summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Pigeonholes.php30
-rw-r--r--admin/admin_pigeonholes_inc.php4
-rw-r--r--assign_content.php6
-rw-r--r--list.php3
-rw-r--r--templates/assign_content.tpl6
-rw-r--r--templates/edit_pigeonholes.tpl12
-rw-r--r--templates/list.tpl4
-rw-r--r--templates/section_inc.tpl6
-rw-r--r--templates/service_view_members_inc.tpl11
-rw-r--r--templates/view_table_inc.tpl6
-rw-r--r--view.php5
11 files changed, 56 insertions, 37 deletions
diff --git a/Pigeonholes.php b/Pigeonholes.php
index 4eb5bb4..ae40948 100644
--- a/Pigeonholes.php
+++ b/Pigeonholes.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.85 2007/04/05 22:16:33 nickpalmer Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.86 2007/06/10 12:35:50 nickpalmer Exp $
*
* +----------------------------------------------------------------------+
* | Copyright ( c ) 2004, bitweaver.org
@@ -17,14 +17,14 @@
* Pigeonholes class
*
* @author xing <xing@synapse.plus.com>
- * @version $Revision: 1.85 $
+ * @version $Revision: 1.86 $
* @package pigeonholes
*/
/**
* required setup
*/
-require_once( LIBERTY_PKG_PATH.'LibertyContent.php' );
+require_once( LIBERTY_PKG_PATH.'LibertyAttachable.php' );
require_once( LIBERTY_PKG_PATH.'LibertyStructure.php' );
/**
@@ -32,7 +32,7 @@ require_once( LIBERTY_PKG_PATH.'LibertyStructure.php' );
*
* @package pigeonholes
*/
-class Pigeonholes extends LibertyContent {
+class Pigeonholes extends LibertyAttachable {
/**
* initiate class
* @param $pContentId content id of the pigeonhole - use either one of the ids.
@@ -41,7 +41,7 @@ class Pigeonholes extends LibertyContent {
* @access public
**/
function Pigeonholes( $pStructureId=NULL, $pContentId=NULL ) {
- LibertyContent::LibertyContent();
+ LibertyAttachable::LibertyAttachable();
$this->registerContentType( PIGEONHOLES_CONTENT_TYPE_GUID, array(
'content_type_guid' => PIGEONHOLES_CONTENT_TYPE_GUID,
'content_description' => 'Pigeonhole',
@@ -66,7 +66,8 @@ class Pigeonholes extends LibertyContent {
global $gBitSystem;
$lookupColumn = ( @BitBase::verifyId( $this->mContentId ) ? 'lc.`content_id`' : 'ls.`structure_id`' );
$lookupId = ( @BitBase::verifyId( $this->mContentId ) ? $this->mContentId : $this->mStructureId );
- $query = "SELECT pig.*, ls.`root_structure_id`, ls.`parent_id`, lc.`title`, lc.`data`, lc.`user_id`, lc.`content_type_guid`,
+ $query = "SELECT pig.*, ls.`root_structure_id`, ls.`parent_id`, lc.`title`, lc.`data`,
+ lc.`user_id`, lc.`content_type_guid`, lc.`format_guid`,
uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,
uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name
FROM `".BIT_DB_PREFIX."pigeonholes` pig
@@ -87,6 +88,9 @@ class Pigeonholes extends LibertyContent {
$this->mInfo['editor'] = ( isset( $row['modifier_real_name'] ) ? $row['modifier_real_name'] : $row['modifier_user'] );
$this->mInfo['display_link'] = $this->getDisplayLink();
$this->mInfo['display_url'] = $this->getDisplayUrl();
+ if (!empty($row['data'])) {
+ $this->mInfo['parsed_data'] = $this->parseData($row['data'],$row['format_guid']);
+ }
}
// if the content for the pigeonhole is requested, get it
@@ -452,7 +456,7 @@ class Pigeonholes extends LibertyContent {
$order .= " ORDER BY ls.`root_structure_id`, ls.`structure_id` ASC";
}
- $query = "SELECT pig.*, ls.`root_structure_id`, ls.`parent_id`, lc.`title`, lc.`data`, lc.`user_id`, lc.`content_type_guid`,
+ $query = "SELECT pig.*, ls.`root_structure_id`, ls.`parent_id`, lc.`title`, lc.`data`, lc.`user_id`, lc.`content_type_guid`, lc.`format_guid`,
uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,
uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name $select
FROM `".BIT_DB_PREFIX."pigeonholes` pig
@@ -470,8 +474,10 @@ class Pigeonholes extends LibertyContent {
$aux['real_name'] = ( isset( $aux['creator_real_name'] ) ? $aux['creator_real_name'] : $aux['creator_user'] );
$aux['display_name'] = BitUser::getTitle( $aux );
$aux['editor'] = ( isset( $aux['modifier_real_name'] ) ? $aux['modifier_real_name'] : $aux['modifier_user'] );
- $aux['display_link'] = Pigeonholes::getDisplayLink( $aux['title'], $aux );
-
+ $aux['display_link'] = Pigeonholes::getDisplayLink( $aux['title'], $aux );
+ if (!empty($pListHash['parse_data']) && !empty($aux['data'])) {
+ $aux['parsed_data'] = $this->parseData($aux['data'], $aux['format_guid']);
+ }
if( !empty( $pListHash['force_extras'] ) || ( !empty( $pListHash['load_extras'] ) && $aux['structure_id'] == @$pListHash['structure_id'] ) ) {
$aux['path'] = $this->getPigeonholePath( $aux['structure_id'] );
$aux['display_path'] = Pigeonholes::getDisplayPath( $aux['path'] );
@@ -566,7 +572,7 @@ class Pigeonholes extends LibertyContent {
* @access public
**/
function store( &$pParamHash ) {
- if( $this->verify( $pParamHash ) && LibertyContent::store( $pParamHash ) ) {
+ if( $this->verify( $pParamHash ) && LibertyAttachable::store( $pParamHash ) ) {
$table = BIT_DB_PREFIX."pigeonholes";
$this->mDb->StartTrans();
@@ -578,7 +584,7 @@ class Pigeonholes extends LibertyContent {
}
$pParamHash['structure_location_id'] = $this->mStructureId;
} else {
- // update the pigeonhole_store and structure_store content_id with the one from LibertyContent::store()
+ // update the pigeonhole_store and structure_store content_id with the one from LibertyAttachable::store()
$pParamHash['structure_store']['content_id'] = $pParamHash['content_id'];
$pParamHash['pigeonhole_store']['content_id'] = $pParamHash['content_id'];
@@ -827,7 +833,7 @@ class Pigeonholes extends LibertyContent {
// remove all entries from content tables
$this->mContentId = $id['content_id'];
- if( LibertyContent::expunge() ) {
+ if( LibertyAttachable::expunge() ) {
$ret = TRUE;
$this->mDb->CompleteTrans();
} else {
diff --git a/admin/admin_pigeonholes_inc.php b/admin/admin_pigeonholes_inc.php
index a6fdfbd..d73aded 100644
--- a/admin/admin_pigeonholes_inc.php
+++ b/admin/admin_pigeonholes_inc.php
@@ -1,5 +1,5 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_pigeonholes/admin/admin_pigeonholes_inc.php,v 1.16 2007/03/05 02:19:54 nickpalmer Exp $
+// $Header: /cvsroot/bitweaver/_bit_pigeonholes/admin/admin_pigeonholes_inc.php,v 1.17 2007/06/10 12:35:51 nickpalmer Exp $
$pigeonholeDisplaySettings = array(
'pigeonholes_display_path' => array(
@@ -16,7 +16,7 @@ $pigeonholeDisplaySettings = array(
),
'pigeonholes_display_subtree' => array(
'label' => 'Display Subtree',
- 'note' => 'When viewing the kategory list, you can display the subcategories as well.',
+ 'note' => 'When viewing the category list, you can display the subcategories as well.',
),
'pigeonholes_themes' => array(
'label' => 'Theme selection',
diff --git a/assign_content.php b/assign_content.php
index 5eccbe0..ba94971 100644
--- a/assign_content.php
+++ b/assign_content.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_pigeonholes/assign_content.php,v 1.11 2007/04/05 22:16:33 nickpalmer Exp $
+ * $Header: /cvsroot/bitweaver/_bit_pigeonholes/assign_content.php,v 1.12 2007/06/10 12:35:51 nickpalmer Exp $
*
* Copyright ( c ) 2004 bitweaver.org
* Copyright ( c ) 2003 tikwiki.org
@@ -8,7 +8,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: assign_content.php,v 1.11 2007/04/05 22:16:33 nickpalmer Exp $
+ * $Id: assign_content.php,v 1.12 2007/06/10 12:35:51 nickpalmer Exp $
* @package pigeonholes
* @subpackage functions
*/
@@ -107,6 +107,7 @@ $gBitSmarty->assign_by_ref( 'listInfo', $listHash['listInfo'] );
$listHash = array(
'load_only_root' => TRUE,
'max_records' => -1,
+ 'parse_data' => TRUE,
);
$pigeonRootData = $gContent->getList( $listHash );
$pigeonRoots[0] = 'All';
@@ -120,6 +121,7 @@ $listHash = array(
'force_extras' => TRUE,
'max_records' => -1,
'sort_mode' => 'ls.`parent_id_asc`',
+ 'parse_data' => TRUE,
);
if ($gBitSystem->isFeatureActive('pigeonholes_allow_forbid_insertion')) {
diff --git a/list.php b/list.php
index eb65de6..58ae94c 100644
--- a/list.php
+++ b/list.php
@@ -3,7 +3,7 @@
* $Header
*
* @author xing <xing@synapse.plus.com>
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.11 $
* @package pigeonholes
* @subpackage functions
*/
@@ -21,6 +21,7 @@ include_once( PIGEONHOLES_PKG_PATH.'lookup_pigeonholes_inc.php' );
$listHash = &$_REQUEST;
$listHash['load_only_root'] = TRUE;
$listHash['sort_mode'] = !empty( $listHash['sort_mode'] ) ? $listHash['sort_mode'] : 'title_asc';
+$listHash['parse_data'] = TRUE;
$pigeonList = $gContent->getList( $listHash );
// set up structure related stuff
diff --git a/templates/assign_content.tpl b/templates/assign_content.tpl
index d551a48..74f398c 100644
--- a/templates/assign_content.tpl
+++ b/templates/assign_content.tpl
@@ -154,7 +154,11 @@
{foreach from=$pigeonList item=pigeon}
<dl>
<dt>{counter name=dogEatsPigeon}</dt>
- <dd>{$pigeon.display_path}<br /><small>{$pigeon.data|escape}</small></dd>
+ <dd>{$pigeon.display_path}
+ {if !empty($pigeon.parsed_data) && $gBitSystem->isFeatureActive('pigeonholes_display_description')}
+ <br /><small>{$pigeon.parsed_data}</small>
+ {/if}
+ </dd>
</dl>
{/foreach}
{/if}
diff --git a/templates/edit_pigeonholes.tpl b/templates/edit_pigeonholes.tpl
index 0b3bf12..18f4229 100644
--- a/templates/edit_pigeonholes.tpl
+++ b/templates/edit_pigeonholes.tpl
@@ -34,13 +34,11 @@
{/forminput}
</div>
- <div class="row">
- {formlabel label="Description" for="pigeonhole-desc"}
- {forminput}
- <textarea id="pigeonhole-desc" name="pigeonhole[edit]" rows="3" cols="50">{$pigeonInfo.data|escape}</textarea>
- {formhelp note="A description of the category. This will be visible when users view this particular category."}
- {/forminput}
- </div>
+ {if $gBitSystem->isFeatureActive('pigeonholes_display_description')}
+ <div class="row">
+ {textarea id="pigeonhole-desc" name="pigeonhole[edit]" note="A description of the category. This will be visible when users view this particular category." label="Description"}{$pigeonInfo.data}{/textarea}
+ </div>
+ {/if}
{if $gBitSystem->isFeatureActive( 'pigeonholes_allow_forbid_insertion') }
<div class="row">
diff --git a/templates/list.tpl b/templates/list.tpl
index 2091dd3..b5ec031 100644
--- a/templates/list.tpl
+++ b/templates/list.tpl
@@ -36,7 +36,9 @@
</div>
{/if}
<h2>{$item.display_link}</h2>
- {$item.data|escape}
+ {if $gBitSystem->isFeatureActive('pigeonholes_display_description')}
+ {$item.parsed_data}
+ {/if}
{if $gBitSystem->isFeatureActive( 'pigeonholes_display_subtree' ) && count($item.subtree) > 1}
{include file="bitpackage:pigeonholes/view_structure_inc.tpl" subtree=$item.subtree no_details=true}
{/if}
diff --git a/templates/section_inc.tpl b/templates/section_inc.tpl
index 74b8e9c..0c99a9a 100644
--- a/templates/section_inc.tpl
+++ b/templates/section_inc.tpl
@@ -14,7 +14,9 @@
{if $pigeonItem.structure_id eq $subtree[ix].structure_id}
{if $pigeonItem.members}
- {$pigeonItem.data|escape}
+ {if $gBitSystem->isFeatureActive('pigeonholes_display_description')}
+ {$pigeonItem.parsed_data}
+ {/if}
<ul style="display:{if $gContent->mStructureId eq $subtree[ix].structure_id or $smarty.request.expand_all}block{else}none{/if}; padding:2em;" class="data">
{foreach from=$pigeonItem.members item=pigeonMember}
{assign var=ctg1 value=$pigeonMember.content_type_guid}
@@ -84,7 +86,7 @@
{if !$no_details}
{foreach from=$pigeonList item=pigeonItem}
{if $pigeonItem.structure_id eq $subtree[ix].structure_id}
- <br />{$pigeonItem.data|escape} <small> [ {tr}{$pigeonItem.members_count|default:0} Item(s){/tr} ] </small>
+ <br />{$pigeonItem.parsed_data} <small> [ {tr}{$pigeonItem.members_count|default:0} Item(s){/tr} ] </small>
{/if}
{/foreach}
{/if}
diff --git a/templates/service_view_members_inc.tpl b/templates/service_view_members_inc.tpl
index 31ff57e..b720221 100644
--- a/templates/service_view_members_inc.tpl
+++ b/templates/service_view_members_inc.tpl
@@ -5,10 +5,11 @@
<h2>{tr}Categories{/tr}</h2>
{foreach from=$pigeonData item=pigeonItem}
{$pigeonItem.display_path}
- {if $pigeonItem.data and $gBitSystem->isFeatureActive( 'pigeonholes_display_description' )}
- : {$pigeonItem.data|escape}
+ {if $gBitSystem->isFeatureActive( 'pigeonholes_display_description' )}
+ : {$pigeonItem.parsed_data} <br />
+ {else}
+ &nbsp; &bull; &nbsp;
{/if}
- &nbsp; &bull; &nbsp;
{/foreach}
{else}
<h2>{tr}Related Items{/tr}</h2>
@@ -16,8 +17,8 @@
<h3>{$pigeonItem.display_path}</h3>
<p>
- {if $pigeonItem.data and $gBitSystem->isFeatureActive( 'pigeonholes_display_description' )}
- {$pigeonItem.data|escape}<br />
+ {if $pigeonItem.parsed_data and $gBitSystem->isFeatureActive( 'pigeonholes_display_description' )}
+ {$pigeonItem.parsed_data}<br />
{/if}
{* reset vars *}
diff --git a/templates/view_table_inc.tpl b/templates/view_table_inc.tpl
index 9106e1d..4f47043 100644
--- a/templates/view_table_inc.tpl
+++ b/templates/view_table_inc.tpl
@@ -4,8 +4,10 @@
<a name="members"></a>
<h2>{$gContent->getTitle()}</h2>
<p>
- {$pigeonItem.data|escape}
- <br />
+ {if !empty($pigeonItem.parsed_data) && $gBitSystem->isFeatureActive('pigeonholes_display_description')}
+ {$pigeonItem.parsed_data}
+ <br />
+ {/if}
<small>{tr}This category contains {$pigeonItem.members_count} item(s){/tr}</small>
</p>
{* calculate column width *}
diff --git a/view.php b/view.php
index 403a2fe..b3e0e02 100644
--- a/view.php
+++ b/view.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_pigeonholes/view.php,v 1.17 2007/04/23 09:36:31 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_pigeonholes/view.php,v 1.18 2007/06/10 12:35:51 nickpalmer Exp $
*
* Copyright ( c ) 2004 bitweaver.org
* Copyright ( c ) 2003 tikwiki.org
@@ -8,7 +8,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: view.php,v 1.17 2007/04/23 09:36:31 squareing Exp $
+ * $Id: view.php,v 1.18 2007/06/10 12:35:51 nickpalmer Exp $
* @package pigeonholes
* @subpackage functions
*/
@@ -63,6 +63,7 @@ if( $gContent->checkPathPermissions( $gContent->getField( 'path' ) ) ) {
'root_structure_id' => $gContent->mInfo['root_structure_id'],
'structure_id' => $gContent->mInfo['structure_id'],
'load_extras' => TRUE,
+ 'parse_data' => TRUE,
'max_records' => -1,
);
$pigeonList = $gContent->getList( $listHash );