summaryrefslogtreecommitdiff
path: root/list_content.php
diff options
context:
space:
mode:
authorwjames5 <will@tekimaki.com>2006-09-06 16:25:19 +0000
committerwjames5 <will@tekimaki.com>2006-09-06 16:25:19 +0000
commit0506a4faddfa4ff88b1134a916497dead12aebf0 (patch)
treeb2907b23b7d265b0c7faebd9bea16433bfa20089 /list_content.php
parent5bfd2f54b29ea31754379b1a61a60506dadf18e3 (diff)
downloadliberty-0506a4faddfa4ff88b1134a916497dead12aebf0.tar.gz
liberty-0506a4faddfa4ff88b1134a916497dead12aebf0.tar.bz2
liberty-0506a4faddfa4ff88b1134a916497dead12aebf0.zip
adds additional param options, including json output
Diffstat (limited to 'list_content.php')
-rw-r--r--list_content.php39
1 files changed, 30 insertions, 9 deletions
diff --git a/list_content.php b/list_content.php
index bd210ff..99e26af 100644
--- a/list_content.php
+++ b/list_content.php
@@ -3,7 +3,7 @@
* list_content
*
* @author spider <spider@steelsun.com>
- * @version $Revision: 1.18 $
+ * @version $Revision: 1.19 $
* @package liberty
* @subpackage functions
*/
@@ -19,7 +19,7 @@ if( !empty( $_REQUEST['sort_mode'] ) ) {
$gBitSmarty->assign( 'sort_mode', $content_sort_mode );
}
-$max_content = $gBitSystem->getConfig( 'max_records' );
+$max_content = ( !empty( $_REQUEST['max_records'] ) )?$_REQUEST['max_records']:$gBitSystem->getConfig( 'max_records' );
$gBitSmarty->assign( 'user_id', @BitBase::verifyId( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : NULL );
// now that we have all the offsets, we can get the content list
@@ -31,14 +31,35 @@ $gBitSmarty->assign( 'contentList', $contentList['data'] );
$contentList['listInfo']['parameters']['content_type_guid'] = $contentSelect;
$gBitSmarty->assign( 'listInfo', $contentList['listInfo'] );
+//depricate 'ajax_xml', use 'output'
+//@todo clean out from other packages
if( !empty( $_REQUEST['ajax_xml'] ) ) {
- require_once( UTIL_PKG_PATH.'javascript/libs/suggest/suggest_lib.php' );
- foreach( array_keys( $contentList['data'] ) as $row ) {
- $xmlList[$contentList['data'][$row]['content_id']] = $contentList['data'][$row]['title'];
- }
- $xml = SuggestLib::exportXml( $xmlList, $_REQUEST['id'] );
- header( "Content-Type: text/xml\n\n" );
- print $xml;
+ $_REQUEST['output'] = 'ajax';
+}
+
+if ( !empty( $_REQUEST['output'] ) ){
+ switch ($_REQUEST['output']){
+ case 'json':
+ $gBitSmarty->assign_by_ref('listcontent', $contentList['data']);
+ header("content-type:text/javascript");
+ $gBitSmarty->display( 'bitpackage:liberty/list_content_json.tpl' );
+ break;
+ case 'ajax':
+ /*@todo the results structure of this are limited and
+ * seem specific to some package use. It also requires
+ * an extra value 'id' which also seems very specific.
+ * Recommend that this be standardized, but
+ * a package dependency somewhere is likely an issue
+ */
+ require_once( UTIL_PKG_PATH.'javascript/libs/suggest/suggest_lib.php' );
+ foreach( array_keys( $contentList['data'] ) as $row ) {
+ $xmlList[$contentList['data'][$row]['content_id']] = $contentList['data'][$row]['title'];
+ }
+ $xml = SuggestLib::exportXml( $xmlList, $_REQUEST['id'] );
+ header( "Content-Type: text/xml\n\n" );
+ print $xml;
+ break;
+ }
} else {
$gBitSystem->setBrowserTitle( 'List Content' );
$gBitSystem->display( 'bitpackage:liberty/list_content.tpl' );