Diff
Property changes: makaanga/0.x/htdocs
Modified: svn:mergeinfo
/trunk/htdocs:4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949
+ /branches/HAT-1.0/htdocs:2984-3026
/trunk/htdocs:4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949,4954,4957,4960-4965
Property changes: makaanga/0.x/htdocs/LICENCE
Modified: svn:mergeinfo
/trunk/htdocs/LICENCE:2-2548,4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949
+ /branches/HAT-1.0/htdocs/LICENCE:2984-3026
/trunk/htdocs/LICENCE:2-2548,4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949,4954,4957,4960-4965
Property changes: makaanga/0.x/htdocs/NOTICE
Modified: svn:mergeinfo
/trunk/htdocs/NOTICE:2-609,4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949
+ /branches/HAT-1.0/htdocs/NOTICE:2984-3026
/trunk/htdocs/NOTICE:2-609,4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949,4954,4957,4960-4965
Property changes: makaanga/0.x/htdocs/index.php
Modified: svn:mergeinfo
/trunk/htdocs/index.php:2-284,4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949
+ /branches/HAT-1.0/htdocs/index.php:2984-3026
/trunk/htdocs/index.php:2-284,4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949,4954,4957,4960-4965
Property changes: makaanga/0.x/htdocs/system
Modified: svn:mergeinfo
/trunk/htdocs/system:2-7,4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949
+ /branches/HAT-1.0/htdocs/system:2984-3026
/trunk/htdocs/system:2-7,4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949,4954,4957,4960-4965
Modified: makaanga/0.x/htdocs/system/classes/block.php (4979 => 4980)
--- makaanga/0.x/htdocs/system/classes/block.php 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/classes/block.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -312,6 +312,35 @@
return false;
}
+ /**
+ * Add this block to a particular area in the theme
+ *
+ * @param string $area The name of the area to add to
+ * @param integer $order The position of the block within the area
+ * @param string $scope The scope id into which to add this block
+ */
+ public function add_to_area( $area, $order = null, $scope = null )
+ {
+ if(is_null($scope)) {
+ $scope = '';
+ }
+ if(is_null($order) || ! is_int($order)) {
+ $order = DB::get_value('SELECT max(display_order) + 1 FROM {blocks_areas} WHERE area = :area AND scope_id = :scope', array('area'=>$area, 'scope'=>$scope));
+ if(is_null($order)) {
+ $order = 1;
+ }
+ }
+ else {
+ DB::query('UPDATE {blocks_areas} SET display_order = display_order + 1 WHERE area = :area AND scope_id = :scope AND display_order >= :order', array('area'=>$area, 'scope'=>$scope, 'order'=>$order));
+ }
+
+ // If the block isn't saved in the database, insert it.
+ if(!$this->id) {
+ $this->insert();
+ }
+
+ $result = DB::query( 'INSERT INTO {blocks_areas} (block_id, area, scope_id, display_order) VALUES (:block_id, :area, :scope_id, :display_order)', array( 'block_id'=>$this->id, 'area'=>$area, 'scope_id'=>$scope, 'display_order'=>$order ) );
+ }
}
Modified: makaanga/0.x/htdocs/system/classes/databaseconnection.php (4979 => 4980)
--- makaanga/0.x/htdocs/system/classes/databaseconnection.php 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/classes/databaseconnection.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -44,6 +44,7 @@
'scopes',
'sessions',
'terms',
+ 'terminfo',
'tokens',
'userinfo',
'users',
Modified: makaanga/0.x/htdocs/system/classes/format.php (4979 => 4980)
--- makaanga/0.x/htdocs/system/classes/format.php 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/classes/format.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -260,9 +260,10 @@
* @param array $array An array of tag names
* @param string $between Text to put between each element
* @param string $between_last Text to put between the next to last element and the last element
+ * @param boolean $sort_alphabetical Should the tags be sorted alphabetically by `term` first?
* @return string HTML links with specified separators.
*/
- public static function tag_and_list( $terms, $between = ', ', $between_last = null )
+ public static function tag_and_list( $terms, $between = ', ', $between_last = null, $sort_alphabetical = false )
{
$array = array();
if ( !$terms instanceof Terms ) {
@@ -272,6 +273,10 @@
foreach ( $terms as $term ) {
$array[$term->term] = $term->term_display;
}
+
+ if ( $sort_alphabetical ) {
+ ksort( $array );
+ }
if ( $between_last === null ) {
$between_last = _t( ' and ' );
Modified: makaanga/0.x/htdocs/system/classes/formui.php (4979 => 4980)
--- makaanga/0.x/htdocs/system/classes/formui.php 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/classes/formui.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -820,9 +820,11 @@
*/
public static function validate_email( $text, $control, $form, $warning = null )
{
- if ( !preg_match( "@^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*\@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$@i", $text ) ) {
- $warning = empty( $warning ) ? _t( 'Value must be a valid Email Address.' ) : $warning;
- return array( $warning );
+ if ( ! empty( $text ) ) {
+ if ( !preg_match( "@^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*\@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$@i", $text ) ) {
+ $warning = empty( $warning ) ? _t( 'Value must be a valid Email Address.' ) : $warning;
+ return array( $warning );
+ }
}
return array();
}
Modified: makaanga/0.x/htdocs/system/classes/pluggable.php (4979 => 4980)
--- makaanga/0.x/htdocs/system/classes/pluggable.php 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/classes/pluggable.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -289,6 +289,33 @@
return $file;
}
+ /**
+ * Provide a method to return the version number from a pluggable's info
+ * @return string The version of the pluggable
+ **/
+ public abstract function get_version();
+
+ /**
+ * Execute the upgrade action on any pluggable that has a version number change
+ * Update the version number of the pluggable in the database to what is installed
+ */
+ public function upgrade()
+ {
+ $pluggable_class = get_class($this);
+ $versions = Options::get( 'pluggable_versions' );
+ if(isset($versions[$pluggable_class])) {
+ $old_version = $versions[$pluggable_class];
+ if($old_version != $this->get_version()) {
+ Plugins::act_id('upgrade', $this->plugin_id(), $old_version);
+ $versions[$pluggable_class] = $this->get_version();
+ Options::set( 'pluggable_versions', $versions );
+ }
+ }
+ else {
+ $versions[$pluggable_class] = $this->get_version();
+ Options::set( 'pluggable_versions', $versions );
+ }
+ }
}
?>
Modified: makaanga/0.x/htdocs/system/classes/plugin.php (4979 => 4980)
--- makaanga/0.x/htdocs/system/classes/plugin.php 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/classes/plugin.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -82,6 +82,14 @@
}
}
+ /**
+ * Provide a method to return the version number from the plugin xml
+ * @return string The plugin version from XML
+ **/
+ public function get_version()
+ {
+ return (string)$this->info->version;
+ }
}
?>
Modified: makaanga/0.x/htdocs/system/classes/plugins.php (4979 => 4980)
--- makaanga/0.x/htdocs/system/classes/plugins.php 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/classes/plugins.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -436,6 +436,7 @@
if ( $activate ) {
self::$plugins[$plugin->plugin_id] = $plugin;
$plugin->load();
+ $plugin->upgrade();
}
return $plugin;
}
@@ -488,6 +489,11 @@
if ( $ok ) {
$activated[$class] = $short_file;
Options::set( 'active_plugins', $activated );
+ $versions = Options::get( 'pluggable_versions' );
+ if(!isset($versions[$class])) {
+ $versions[$class] = $plugin->get_version();
+ Options::set( 'pluggable_versions', $versions );
+ }
if ( method_exists( $plugin, 'action_plugin_activation' ) ) {
$plugin->action_plugin_activation( $file ); // For the plugin to install itself
Modified: makaanga/0.x/htdocs/system/classes/post.php (4979 => 4980)
--- makaanga/0.x/htdocs/system/classes/post.php 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/classes/post.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -973,6 +973,7 @@
->id = 'comment_email';
$form->cf_email->tabindex = 2;
if ( Options::get( 'comments_require_id' ) == 1 ) {
+ $form->cf_email->add_validator( 'validate_required', _t( 'The Email field value must be a valid email address' ) );
$form->cf_email->caption = _t( 'Email <span class="required">*Required</span>' );
}
$form->cf_email->value = $commenter_email;
Modified: makaanga/0.x/htdocs/system/classes/term.php (4979 => 4980)
--- makaanga/0.x/htdocs/system/classes/term.php 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/classes/term.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -16,6 +16,8 @@
class Term extends QueryRecord
{
+ protected $inforecords = null;
+
/**
* Return the defined database columns for a Term.
* @return array Array of columns in the Term table
@@ -137,6 +139,9 @@
// We've inserted the term, reset newfields
$this->newfields = array();
+ // Commit the info records
+ $this->info->commit( $this->fields['id'] );
+
EventLog::log( _t( 'New term %1$s: %2$s', array( $this->id, $this->term_display ) ), 'info', 'content', 'habari' );
// Let plugins act after we write to the database
@@ -169,6 +174,8 @@
$result = parent::updateRecord( '{terms}', array( 'id' => $this->id ) );
$this->fields = array_merge( $this->fields, $this->newfields );
+ $this->info->commit();
+
// Let plugins act after we write to the database
Plugins::act( 'term_update_after', $this );
@@ -188,6 +195,9 @@
}
Plugins::act( 'term_delete_before', $this );
+ // Delete all info records associated with this comment
+ $this->info->delete_all();
+
DB::query( 'DELETE FROM {object_terms} WHERE term_id = :id', array( 'id' => $this->id ) );
$result = parent::deleteRecord( '{terms}', array( 'id'=>$this->id ) );
@@ -438,6 +448,8 @@
break;
case 'id':
return (int)parent::__get( $name );
+ case 'info':
+ return $this->get_info();
default:
$out = parent::__get( $name );
break;
@@ -446,6 +458,24 @@
}
/**
+ * Gets the info object for this term, which contains data from the terminfo table
+ * related to this term.
+ * @return TermInfo object
+ */
+ protected function get_info()
+ {
+ if ( ! $this->inforecords ) {
+ if ( 0 == $this->id ) {
+ $this->inforecords = new TermInfo();
+ }
+ else {
+ $this->inforecords = new TermInfo( $this->id );
+ }
+ }
+ return $this->inforecords;
+ }
+
+ /**
* Get a count of how many times the tag has been used in a post
* @param string $object_type The type of object to count
* @return integer The number of times the tag has been used
Copied: makaanga/0.x/htdocs/system/classes/terminfo.php (from rev 4957, trunk/htdocs/system/classes/terminfo.php) (0 => 4980)
--- makaanga/0.x/htdocs/system/classes/terminfo.php (rev 0)
+++ makaanga/0.x/htdocs/system/classes/terminfo.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -0,0 +1,20 @@
+<?php
+/**
+ * @package Habari
+ *
+ */
+
+/**
+ * Term metadata
+ */
+class TermInfo extends InfoRecords
+{
+
+ function __construct ( $term_id = null )
+ {
+ parent::__construct( DB::table( 'terminfo' ), 'term_id', $term_id ); // call parent with appropriate parameters
+ }
+
+}
+
+?>
Modified: makaanga/0.x/htdocs/system/classes/theme.php (4979 => 4980)
--- makaanga/0.x/htdocs/system/classes/theme.php 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/classes/theme.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -87,30 +87,18 @@
public function info()
{
- $xml_file = dirname( $this->getfile ) . '/theme.xml';
+ $xml_file = $this->theme_dir . '/theme.xml';
+ if(!file_exists($xml_file)) {
+ return new SimpleXMLElement('<?xml version="1.0" encoding="utf-8" ?>
+<pluggable type="theme">
+ <name>Unknown Theme</name>
+ <version>1.0</version>
+</pluggable>
+');
+ }
if ( $xml_content = file_get_contents( $xml_file ) ) {
- $theme_data = new SimpleXMLElement( $xml_file );
+ $theme_data = new SimpleXMLElement( $xml_content );
return $theme_data;
- // Is it a valid theme xml file?
- if ( isset( $theme_data->theme ) ) {
- $valid_named_elements = array(
- 'name',
- 'version',
- 'template_engine',
- 'theme_dir',
- 'class'
- );
- // Assigns based on wether or not it's a valid named element.
- foreach ( $theme_data->theme->children() as $key => $value ) {
- $key = strtolower( $key );
- if ( in_array( $key, $valid_named_elements ) ) {
- $this->$key = $value;
- }
- else {
- $this->config_vars[$key] = $value;
- }
- }
- }
}
}
@@ -1067,7 +1055,7 @@
public function get_blocks( $area, $scope, $theme )
{
$blocks = DB::get_results( 'SELECT b.* FROM {blocks} b INNER JOIN {blocks_areas} ba ON ba.block_id = b.id WHERE ba.area = ? AND ba.scope_id = ? ORDER BY ba.display_order ASC', array( $area, $scope ), 'Block' );
- Plugins::act( 'get_blocks', $blocks );
+ $blocks = Plugins::filter( 'get_blocks', $blocks, $area, $scope, $theme );
return $blocks;
}
@@ -1340,5 +1328,14 @@
}
+ /**
+ * Provide a method to return the version number from the theme xml
+ * @return string The theme version from XML
+ **/
+ public function get_version()
+ {
+ return (string)$this->info()->version;
+ }
+
}
?>
Modified: makaanga/0.x/htdocs/system/classes/themes.php (4979 => 4980)
--- makaanga/0.x/htdocs/system/classes/themes.php 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/classes/themes.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -171,6 +171,15 @@
Options::set( 'theme_name', $theme_name );
Options::set( 'theme_dir', $theme_dir );
$new_active_theme = Themes::create();
+
+ // Set version of theme if it wasn't installed before
+ $versions = Options::get( 'pluggable_versions' );
+ if(!isset($versions[get_class($new_active_theme)])) {
+ $versions[get_class($new_active_theme)] = $new_active_theme->get_version();
+ Options::set( 'pluggable_versions', $versions );
+ }
+
+ // Run activation hooks for theme activation
Plugins::act_id( 'theme_activated', $new_active_theme->plugin_id(), $theme_name, $new_active_theme ); // For the theme itself to react to its activation
Plugins::act( 'theme_activated_any', $theme_name, $new_active_theme ); // For any plugin to react to its activation
EventLog::log( _t( 'Activated Theme: %s', array( $theme_name ) ), 'notice', 'theme', 'habari' );
@@ -276,6 +285,7 @@
}
$created_theme = new $classname( $themedata );
+ $created_theme->upgrade();
Plugins::act_id( 'init_theme', $created_theme->plugin_id(), $created_theme );
Plugins::act( 'init_theme_any', $created_theme );
return $created_theme;
Modified: makaanga/0.x/htdocs/system/classes/version.php (4979 => 4980)
--- makaanga/0.x/htdocs/system/classes/version.php 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/classes/version.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -14,8 +14,8 @@
{
// DB and API versions are aligned with the SVN revision
// number in which they last changed.
- const DB_VERSION = 4785;
- const API_VERSION = 4875;
+ const DB_VERSION = 4955;
+ const API_VERSION = 4955;
const HABARI_VERSION = '0.7';
Property changes: makaanga/0.x/htdocs/system/plugins/coreblocks
Modified: svn:mergeinfo
/trunk/htdocs/system/coreblocks:2-7
/trunk/htdocs/system/plugins/coreblocks:4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949
+ /branches/HAT-1.0/htdocs/system/coreblocks:2984-3026
/trunk/htdocs/system/coreblocks:2-7
/trunk/htdocs/system/plugins/coreblocks:4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949,4954,4957,4960-4965
Modified: makaanga/0.x/htdocs/system/schema/mysql/schema.sql (4979 => 4980)
--- makaanga/0.x/htdocs/system/schema/mysql/schema.sql 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/schema/mysql/schema.sql 2011-03-06 21:58:27 UTC (rev 4980)
@@ -201,6 +201,14 @@
UNIQUE KEY ix_term (vocabulary_id, term)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+CREATE TABLE {$prefix}terminfo (
+ term_id INT UNSIGNED NOT NULL,
+ name VARCHAR(255) NOT NULL,
+ type SMALLINT UNSIGNED NOT NULL DEFAULT 0,
+ value TEXT NULL,
+ PRIMARY KEY (term_id,name)
+) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
CREATE TABLE {$prefix}vocabularies (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
Modified: makaanga/0.x/htdocs/system/schema/pgsql/schema.sql (4979 => 4980)
--- makaanga/0.x/htdocs/system/schema/pgsql/schema.sql 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/schema/pgsql/schema.sql 2011-03-06 21:58:27 UTC (rev 4980)
@@ -206,6 +206,14 @@
UNIQUE (vocabulary_id,term)
);
+CREATE TABLE {$prefix}terminfo (
+ term_id BIGINT NOT NULL,
+ name VARCHAR(255) NOT NULL,
+ type INTEGER NOT NULL DEFAULT 0,
+ value TEXT NULL,
+ PRIMARY KEY (term_id,name)
+);
+
CREATE SEQUENCE {$prefix}vocabularies_pkey_seq;
CREATE TABLE {$prefix}vocabularies (
id INTEGER NOT NULL DEFAULT nextval('{$prefix}vocabularies_pkey_seq'),
Modified: makaanga/0.x/htdocs/system/schema/sqlite/schema.sql (4979 => 4980)
--- makaanga/0.x/htdocs/system/schema/sqlite/schema.sql 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/schema/sqlite/schema.sql 2011-03-06 21:58:27 UTC (rev 4980)
@@ -176,6 +176,14 @@
CREATE UNIQUE INDEX IF NOT EXISTS ix_mptt ON {$prefix}terms(vocabulary_id, mptt_right, mptt_left);
CREATE UNIQUE INDEX IF NOT EXISTS ix_term ON {$prefix}terms(vocabulary_id, term);
+CREATE TABLE {$prefix}terminfo (
+ term_id INTEGER NOT NULL,
+ name VARCHAR(255) NOT NULL,
+ type SMALLINTEGER NOT NULL DEFAULT 0,
+ value TEXT NULL,
+ PRIMARY KEY (term_id, name)
+);
+
CREATE TABLE {$prefix}vocabularies (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
name VARCHAR(255) NOT NULL,
Copied: makaanga/0.x/htdocs/system/themes/k2/block.k2_menu.php (from rev 4964, trunk/htdocs/system/themes/k2/block.k2_menu.php) (0 => 4980)
--- makaanga/0.x/htdocs/system/themes/k2/block.k2_menu.php (rev 0)
+++ makaanga/0.x/htdocs/system/themes/k2/block.k2_menu.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -0,0 +1,5 @@
+<ul class="menu">
+<?php foreach($content->menus as $menu) : ?>
+<li class="<?php echo $menu['cssclass']; ?> block-<?php echo Utils::slugify($menu['caption']); ?>"><a href="<?php echo $menu['link']; ?>"><?php echo $menu['caption']; ?></a></li>
+<?php endforeach; ?>
+</ul>
Modified: makaanga/0.x/htdocs/system/themes/k2/header.php (4979 => 4980)
--- makaanga/0.x/htdocs/system/themes/k2/header.php 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/themes/k2/header.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -22,16 +22,7 @@
<h1><a href="<?php Site::out_url( 'habari' ); ?>"><?php Options::out( 'title' ); ?></a></h1>
<p class="description"><?php Options::out( 'tagline' ); ?></p>
- <ul class="menu">
- <li <?php if ($request->display_home) { ?>
- class="current_page_item"<?php } ?>><a href="<?php Site::out_url( 'habari' ); ?>" title="<?php Options::out( 'title' ); ?>"><?php echo $home_tab; ?></a></li>
-<?php
-// Menu tabs
-$theme->menu('mainmenu');
-if ( User::identify()->loggedin ) { ?>
- <li class="admintab"><a href="<?php Site::out_url( 'admin' ); ?>" title="<?php _e('Admin area'); ?>"><?php _e('Admin'); ?></a></li>
-<?php } ?>
- </ul>
+ <?php $theme->area('nav'); ?>
</div>
Modified: makaanga/0.x/htdocs/system/themes/k2/theme.php (4979 => 4980)
--- makaanga/0.x/htdocs/system/themes/k2/theme.php 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/themes/k2/theme.php 2011-03-06 21:58:27 UTC (rev 4980)
@@ -12,18 +12,32 @@
*/
class K2 extends Theme
{
+ public function action_theme_activated()
+ {
+ $blocks = $this->get_blocks('nav', '', $this);
+ if(count($blocks) == 0) {
+ $block = new Block(array(
+ 'title' => _t('K2 Menu'),
+ 'type' => 'k2_menu',
+ ));
+
+ $block->add_to_area('nav');
+ Session::notice(_t('Added K2 Menu block to Nav area.'));
+ }
+ }
+
/**
* Execute on theme init to apply these filters to output
*/
public function action_init_theme()
{
-// Apply Format::autop() to comment content...
-Format::apply( 'autop', 'comment_content_out' );
-// Apply Format::tag_and_list() to post tags...
-Format::apply( 'tag_and_list', 'post_tags_out' );
-
-// Remove the comment on the following line to limit post length on the home page to 1 paragraph or 100 characters
-//Format::apply_with_hook_params( 'more', 'post_content_out', _t('more'), 100, 1 );
+ // Apply Format::autop() to comment content...
+ Format::apply( 'autop', 'comment_content_out' );
+ // Apply Format::tag_and_list() to post tags...
+ Format::apply( 'tag_and_list', 'post_tags_out' );
+
+ // Remove the comment on the following line to limit post length on the home page to 1 paragraph or 100 characters
+ //Format::apply_with_hook_params( 'more', 'post_content_out', _t('more'), 100, 1 );
}
/**
@@ -93,21 +107,7 @@
}
}
-
- public function theme_menu_empty($theme, $menu)
- {
- // Should pass menu name on to Posts::get(array('preset'=>$menu))
- if ($menu == 'mainmenu') {
- $pages = Posts::get(array('content_type' => 'page', 'status' => Post::status('published')));
- $out = '';
- foreach( $pages as $page ) {
- $out .= '<li><a href="' . $page->permalink . '" title="' . $page->title . '">' . $page->title . '</a></li>' . "\n";
- }
- return $out;
- }
- }
-
/**
* Customize comment form layout. Needs thorough commenting.
*/
@@ -122,6 +122,34 @@
$form->cf_submit->caption = _t( 'Submit' );
}
+ public function filter_block_list($block_list)
+ {
+ $block_list['k2_menu'] = _t('K2 Menu');
+ return $block_list;
+ }
+
+ public function action_block_content_k2_menu($block, $theme)
+ {
+ $menus = array('home' => array(
+ 'link' => Site::get_url( 'habari' ),
+ 'title' => Options::get( 'title' ),
+ 'caption' => _t('Blog'),
+ 'cssclass' => $theme->request->display_home ? 'current_page_item' : '',
+ ));
+ $pages = Posts::get(array('content_type' => 'page', 'status' => Post::status('published')));
+ foreach($pages as $page) {
+ $menus[] = array(
+ 'link' => $page->permalink,
+ 'title' => $page->title,
+ 'caption' => $page->title,
+ 'cssclass' => (isset($theme->post) && $theme->post->id == $page->id) ? 'current_page_item' : '',
+ );
+ }
+ if ( User::identify()->loggedin ) {
+ $menus['admin'] = array('link' => Site::get_url( 'admin' ), 'title' => _t('Admin area'), 'caption' => _t('Admin'), 'cssclass' => 'admintab');
+ }
+ $block->menus = $menus;
+ }
}
?>
Modified: makaanga/0.x/htdocs/system/themes/k2/theme.xml (4979 => 4980)
--- makaanga/0.x/htdocs/system/themes/k2/theme.xml 2011-03-06 21:25:43 UTC (rev 4979)
+++ makaanga/0.x/htdocs/system/themes/k2/theme.xml 2011-03-06 21:58:27 UTC (rev 4980)
@@ -14,6 +14,9 @@
<copyright>2009</copyright>
<areas>
+ <area name="nav">
+ <description><![CDATA[Primary navigation area]]></description>
+ </area>
<area name="sidebar">
<description><![CDATA[Sidebar]]></description>
</area>
Property changes: makaanga/0.x/htdocs/system/vendor
Modified: svn:mergeinfo
/trunk/htdocs/scripts:2-7
/trunk/htdocs/system/vendor:4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949
+ /branches/HAT-1.0/htdocs/scripts:2984-3026
/trunk/htdocs/scripts:2-7
/trunk/htdocs/system/vendor:4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949,4954,4957,4960-4965
Property changes: makaanga/0.x/htdocs/system/vendor/jquery.js
Modified: svn:mergeinfo
/trunk/htdocs/scripts/jquery-1.3.2.min.js:2-7
/trunk/htdocs/system/vendor/jquery.js:4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949
+ /branches/HAT-1.0/htdocs/scripts/jquery-1.3.2.min.js:2984-3026
/trunk/htdocs/scripts/jquery-1.3.2.min.js:2-7
/trunk/htdocs/system/vendor/jquery.js:4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949,4954,4957,4960-4965
Property changes: makaanga/0.x/htdocs/user
Modified: svn:mergeinfo
/trunk/htdocs/user:2-21,4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949
+ /branches/HAT-1.0/htdocs/user:2984-3026
/trunk/htdocs/user:2-21,4874-4876,4880-4888,4890-4905,4908-4917,4919-4921,4923-4924,4927-4933,4935-4936,4938,4949,4954,4957,4960-4965