summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LibertyContent.php53
-rw-r--r--bit_setup_inc.php3
-rw-r--r--templates/edit_content_status_inc.tpl2
-rw-r--r--templates/service_content_body_inc.tpl3
4 files changed, 53 insertions, 8 deletions
diff --git a/LibertyContent.php b/LibertyContent.php
index adf5bc3..91a2235 100644
--- a/LibertyContent.php
+++ b/LibertyContent.php
@@ -3,7 +3,7 @@
* Management of Liberty content
*
* @package liberty
-* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyContent.php,v 1.331 2007/12/05 14:39:35 wjames5 Exp $
+* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyContent.php,v 1.332 2007/12/30 14:59:40 squareing Exp $
* @author spider <spider@steelsun.com>
*/
@@ -189,7 +189,7 @@ class LibertyContent extends LibertyBase {
// Do we need to change the status
if ($gBitSystem->isFeatureActive('liberty_display_status') && ($gBitUser->hasPermission('p_liberty_edit_content_status') || $gBitUser->hasPermission('p_liberty_edit_all_status'))) {
- $allStatus = $this->getContentStatus();
+ $allStatus = $this->getAvailableContentStatuses();
if (!empty($pParamHash['content_status_id'])) {
if (empty($allStatus[$pParamHash['content_status_id']])) {
$this->mError['content_status_id'] = "No such status ID or permission denied.";
@@ -2903,17 +2903,32 @@ class LibertyContent extends LibertyBase {
* getContentStatus
*
* @access public
- * @return an array of content_status_id, content_status_names the current user can use on this content. Subclases may easily override with return LibertyContent::getContentStatus(-100, 0) for example to restrict to only hidden content types.
+ * @return an array of content_status_id, content_status_names the current
+ * user can use on this content. Subclases may easily override with return
+ * LibertyContent::getContentStatus(-100, 0) for example to restrict to
+ * only hidden content types.
*/
- function getContentStatus($pUserMinimum=-100, $pUserMaximum=100) {
+ function getAvailableContentStatuses( $pUserMinimum=-100, $pUserMaximum=100 ) {
global $gBitUser;
- if ($gBitUser->hasPermission('p_liberty_edit_all_status')) {
+ if( $gBitUser->hasPermission( 'p_liberty_edit_all_status' )) {
return( $this->mDb->getAssoc( "SELECT `content_status_id`,`content_status_name` FROM `".BIT_DB_PREFIX."liberty_content_status` ORDER BY `content_status_id`" ) );
} else {
- return( $this->mDb->getAssoc( "SELECT `content_status_id`, `content_status_name` FROM `".BIT_DB_PREFIX."liberty_content_status` WHERE `content_status_id` > ? AND `content_status_id` < ? ORDER BY `content_status_id`", array($pUserMinimum, $pUserMaximum)));
+ return( $this->mDb->getAssoc( "SELECT `content_status_id`, `content_status_name` FROM `".BIT_DB_PREFIX."liberty_content_status` WHERE `content_status_id` > ? AND `content_status_id` < ? ORDER BY `content_status_id`", array( $pUserMinimum, $pUserMaximum )));
}
}
+ /**
+ * getContentStatus will return the content status of the currently loaded content.
+ *
+ * @param array $pContentId Content ID of the content in question
+ * @access public
+ * @return Status ID
+ * @TODO: remove deprecated notice and add some useful code
+ */
+ function getContentStatus( $pContentId = NULL ) {
+ deprecated( 'This function will return the content status of the current content. if you are trying to get available content statuses, use getAvailableContentStatuses() instead.' );
+ }
+
function isDeleted() {
global $gBitSystem;
return( $this->getField( 'content_status_id' ) <= $gBitSystem->getConfig( 'liberty_status_deleted', -999 ) );
@@ -2935,6 +2950,32 @@ class LibertyContent extends LibertyBase {
}
/**
+ * getContentStatusName
+ *
+ * @param array $pStatusId Status ID if not available in $this->mInfo['content_status_id']
+ * @access public
+ * @return The name of the content status based on the status id of the content
+ */
+ function getContentStatusName( $pStatusId = NULL ) {
+ $ret = 'Not a valid content status';
+
+ // check to see where we can get the status information from
+ if( !empty( $this ) && !empty( $this->mInfo['content_status_name'] )) {
+ return( $this->mInfo['content_status_name'] );
+ } elseif( is_null( $pStatusId ) && !empty( $this ) && !empty( $this->mInfo['content_status_id'] )) {
+ $pStatusId = $this->mInfo['content_status_id'];
+ }
+
+ // fetch from db if needed
+ if( !is_null( $pStatusId )) {
+ if( $ret = $this->mDb->getOne( "SELECT `content_status_name` FROM `".BIT_DB_PREFIX."liberty_content_status` WHERE `content_status_id` = ?", array( $pStatusId ))) {
+ }
+ }
+
+ return $ret;
+ }
+
+ /**
* Store Data
*
* @return bool true ( will not currently report a failure )
diff --git a/bit_setup_inc.php b/bit_setup_inc.php
index 2123d28..e2a837e 100644
--- a/bit_setup_inc.php
+++ b/bit_setup_inc.php
@@ -3,7 +3,7 @@
* base package include
*
* @author spider <spider@steelsun.com>
- * @version $Revision: 1.20 $
+ * @version $Revision: 1.21 $
* @package liberty
* @subpackage functions
*/
@@ -21,6 +21,7 @@ $gLibertySystem->registerService( 'liberty', LIBERTY_PKG_NAME, array(
'content_edit_mini_tpl' => 'bitpackage:liberty/service_content_edit_mini_inc.tpl',
'content_edit_tab_tpl' => 'bitpackage:liberty/service_content_edit_tab_inc.tpl',
'content_icon_tpl' => 'bitpackage:liberty/service_content_icon_inc.tpl',
+ 'content_body_tpl' => 'bitpackage:liberty/service_content_body_inc.tpl',
'content_display_function' => 'liberty_content_display',
//'content_load_function' => 'liberty_content_load',
'content_edit_function' => 'liberty_content_edit',
diff --git a/templates/edit_content_status_inc.tpl b/templates/edit_content_status_inc.tpl
index fdb2dc5..95bdfc8 100644
--- a/templates/edit_content_status_inc.tpl
+++ b/templates/edit_content_status_inc.tpl
@@ -2,7 +2,7 @@
<div class="row">
{formlabel label="Status" for="content_status_id"}
{forminput}
- {html_options name="content_status_id" options=$gContent->getContentStatus() selected=$gContent->getField('content_status_id',$smarty.const.BIT_CONTENT_DEFAULT_STATUS)}
+ {html_options name="content_status_id" options=$gContent->getAvailableContentStatuses() selected=$gContent->getField('content_status_id',$smarty.const.BIT_CONTENT_DEFAULT_STATUS)}
{/forminput}
</div>
{/if}
diff --git a/templates/service_content_body_inc.tpl b/templates/service_content_body_inc.tpl
new file mode 100644
index 0000000..d610e21
--- /dev/null
+++ b/templates/service_content_body_inc.tpl
@@ -0,0 +1,3 @@
+{if $gBitSystem->isFeatureActive( 'liberty_display_status' ) && ($gBitUser->hasPermission('p_liberty_edit_content_status') || $gBitUser->hasPermission('p_liberty_edit_all_status')) && $gContent->mInfo.content_status_id != 50}
+ <p class="liberty_status">{biticon iname=dialog-warning iexplain="Warning"} {tr}The status of this content is <strong>{$gContent->getContentStatusName()}</strong>{/tr}.</p>
+{/if}{$gContent->mInfo.content_status_name}