From fc66432d43610589602b3c87422fc95aca9e0de6 Mon Sep 17 00:00:00 2001 From: spiderr Date: Thu, 11 Feb 2021 18:19:05 -0500 Subject: add pListHash['join_sql'] to getContentList --- includes/classes/LibertyContent.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/classes/LibertyContent.php b/includes/classes/LibertyContent.php index 4c148df..4fe00b2 100644 --- a/includes/classes/LibertyContent.php +++ b/includes/classes/LibertyContent.php @@ -2522,6 +2522,7 @@ class LibertyContent extends LibertyBase implements BitCacheable { $hashSql = array('select'=>array(), 'join'=>array(),'where'=>array() ); $hashBindVars = array('select'=>array(), 'where'=>array(), 'join'=>array()); + if( !empty( $pListHash['content_type_guid'] ) && is_array( $pListHash['content_type_guid'] )) { foreach( $pListHash['content_type_guid'] as $contentTypeGuid ) { $this->getFilter( $contentTypeGuid, $hashSql, $hashBindVars, $pListHash ); @@ -2536,6 +2537,10 @@ class LibertyContent extends LibertyBase implements BitCacheable { $selectSql = ''; } $joinSql = implode( ' ', $hashSql['join'] ); + if( !empty( $pListHash['join_sql'] ) ) { + $joinSql .= $pListHash['join_sql']; + } + $whereSql = ''; if( empty( $hashBindVars['join'] )) { $bindVars = array(); @@ -2773,7 +2778,6 @@ class LibertyContent extends LibertyBase implements BitCacheable { $pListHash['offset'] = $pListHash['max_records'] * $lastPageNumber; } - if( !empty( $hashBindVars['select'] ) ) { $bindVars = array_merge($hashBindVars['select'], $bindVars); } -- cgit v1.3 From a6c7397fb0ac53a4e92c2a8b724d64619e576362 Mon Sep 17 00:00:00 2001 From: spiderr Date: Thu, 11 Feb 2021 21:58:58 -0500 Subject: confirm non null object from getNewObject --- includes/classes/LibertyBase.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/classes/LibertyBase.php b/includes/classes/LibertyBase.php index 1825827..063f8b8 100644 --- a/includes/classes/LibertyBase.php +++ b/includes/classes/LibertyBase.php @@ -84,9 +84,10 @@ class LibertyBase extends BitBase { } else { if( $typeClass ) { $creator = new $typeClass(); - $ret = $creator->getNewObject( $typeClass, $pContentId, $pLoadFromCache ); - $ret->setCacheableObject( FALSE ); - $ret->clearFromCache(); + if( $ret = $creator->getNewObject( $typeClass, $pContentId, $pLoadFromCache ) ) { + $ret->setCacheableObject( FALSE ); + $ret->clearFromCache(); + } } } } -- cgit v1.3 From 1cd663956c5a0bf55b4f43b34d7ab28fb16a4543 Mon Sep 17 00:00:00 2001 From: spiderr Date: Fri, 12 Feb 2021 13:28:08 -0500 Subject: clean up structure lookup --- includes/lookup_content_inc.php | 52 ++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/includes/lookup_content_inc.php b/includes/lookup_content_inc.php index d9ebaa6..e92a5a1 100644 --- a/includes/lookup_content_inc.php +++ b/includes/lookup_content_inc.php @@ -7,34 +7,34 @@ * @package liberty * @subpackage functions */ - global $gContent; - if( @BitBase::verifyId( $_REQUEST['structure_id'] ) ) { - /** - * required setup - */ - require_once( LIBERTY_PKG_CLASS_PATH.'LibertyStructure.php'); - $_REQUEST['structure_id'] = preg_replace( '/[\D]/', '', $_REQUEST['structure_id'] ); - $gStructure = new LibertyStructure( $_REQUEST['structure_id'] ); - if( $gStructure->load() ) { - $gStructure->loadNavigation(); - $gStructure->loadPath(); - $gBitSmarty->assign( 'structureInfo', $gStructure->mInfo ); - // $_REQUEST['page_id'] = $gStructure->mInfo['page_id']; - if( $viewContent = LibertyBase::getLibertyObject( $gStructure->mInfo['content_id'], $gStructure->mInfo['content_type']['content_type_guid'] ) ) { - $viewContent->setStructure( $_REQUEST['structure_id'] ); - $gBitSmarty->assignByRef( 'pageInfo', $viewContent->mInfo ); - $gContent = &$viewContent; - $gBitSmarty->assignByRef( 'gContent', $gContent ); - } - } - } elseif( @BitBase::verifyId( $_REQUEST['content_id'] ) ) { - $_REQUEST['content_id'] = preg_replace( '/[\D]/', '', $_REQUEST['content_id'] ); - require_once( LIBERTY_PKG_CLASS_PATH.'LibertyBase.php'); - if( $gContent = LibertyBase::getLibertyObject( $_REQUEST['content_id'] ) ) { +global $gContent; + +if( @BitBase::verifyId( $_REQUEST['structure_id'] ) ) { + /** + * required setup + */ + require_once( LIBERTY_PKG_CLASS_PATH.'LibertyStructure.php'); + $_REQUEST['structure_id'] = preg_replace( '/[\D]/', '', $_REQUEST['structure_id'] ); + $gStructure = new LibertyStructure( $_REQUEST['structure_id'] ); + if( $gStructure->load() ) { + $gStructure->loadNavigation(); + $gStructure->loadPath(); + $gBitSmarty->assign( 'structureInfo', $gStructure->mInfo ); +// $_REQUEST['page_id'] = $gStructure->mInfo['page_id']; + if( $viewContent = LibertyBase::getLibertyObject( $gStructure->mInfo['content_id'], $gStructure->mInfo['content_type']['content_type_guid'] ) ) { + $viewContent->setStructure( $_REQUEST['structure_id'] ); + $gBitSmarty->assignByRef( 'pageInfo', $viewContent->mInfo ); + $gContent = &$viewContent; $gBitSmarty->assignByRef( 'gContent', $gContent ); - $gBitSmarty->assignByRef( 'pageInfo', $gContent->mInfo ); } } +} elseif( @BitBase::verifyId( $_REQUEST['content_id'] ) ) { + $_REQUEST['content_id'] = preg_replace( '/[\D]/', '', $_REQUEST['content_id'] ); + require_once( LIBERTY_PKG_CLASS_PATH.'LibertyBase.php'); + if( $gContent = LibertyBase::getLibertyObject( $_REQUEST['content_id'] ) ) { + $gBitSmarty->assignByRef( 'gContent', $gContent ); + $gBitSmarty->assignByRef( 'pageInfo', $gContent->mInfo ); + } +} -?> -- cgit v1.3 From de372b9940218cc4e92fd7f27bb437cd8a76dce5 Mon Sep 17 00:00:00 2001 From: spiderr Date: Fri, 12 Feb 2021 13:28:31 -0500 Subject: rename *_structure_inc.php to structure_*_inc.php --- add_structure_content.php | 63 ------------------ includes/display_structure_inc.php | 22 ------- includes/edit_structure_inc.php | 126 ------------------------------------ includes/structure_display_inc.php | 22 +++++++ includes/structure_edit_inc.php | 124 +++++++++++++++++++++++++++++++++++ structure_add_content.php | 67 +++++++++++++++++++ structure_edit.php | 16 +++++ templates/add_structure_content.tpl | 91 +++++++++++--------------- templates/edit_structure.tpl | 4 +- 9 files changed, 270 insertions(+), 265 deletions(-) delete mode 100644 add_structure_content.php delete mode 100644 includes/display_structure_inc.php delete mode 100644 includes/edit_structure_inc.php create mode 100644 includes/structure_display_inc.php create mode 100644 includes/structure_edit_inc.php create mode 100644 structure_add_content.php create mode 100644 structure_edit.php diff --git a/add_structure_content.php b/add_structure_content.php deleted file mode 100644 index 8c5d30d..0000000 --- a/add_structure_content.php +++ /dev/null @@ -1,63 +0,0 @@ - - * @version $Revision$ - * @package liberty - * @subpackage functions - */ - -/** - * required setup - */ -$gLiteweightScan = TRUE; -require_once( '../kernel/includes/setup_inc.php' ); - -if( !empty( $_REQUEST['modal'] ) ) { - $gBitSystem->mConfig['site_top_bar'] = FALSE; - $gBitSystem->mConfig['site_left_column'] = FALSE; - $gBitSystem->mConfig['site_right_column'] = FALSE; - $gBitSmarty->assign( 'popupPage', '1' ); -} - -require_once( LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php' ); -require_once( LIBERTY_PKG_INCLUDE_PATH.'edit_structure_inc.php' ); - -if( !empty( $_SERVER['HTTP_REFERER'] ) ) { - $urlHash = parse_url( $_SERVER['HTTP_REFERER'] ); - if( $urlHash['path'] != $_SERVER['SCRIPT_NAME'] ) { - $_SESSION['structure_referer'] = $_SERVER['HTTP_REFERER']; - } -} - -if( $gBitThemes->isAjaxRequest() ) { - header( 'Content-Type: text/html; charset=utf-8' ); - print $gBitSmarty->fetch( "bitpackage:liberty/add_structure_feedback_inc.tpl" ); - exit; -} else { - - $_REQUEST['thumbnail_size'] = 'icon'; - include_once( LIBERTY_PKG_INCLUDE_PATH.'get_content_list_inc.php' ); - foreach( $contentList as $cItem ) { - $cList[$contentTypes[$cItem['content_type_guid']]][$cItem['content_id']] = $cItem['title'].' [id: '.$cItem['content_id'].']'; - } - $gBitSmarty->assignByRef( 'contentListHash', $contentList ); - $gBitSmarty->assign( 'contentList', $cList ); - $gBitSmarty->assign( 'contentSelect', $contentSelect ); - $gBitSmarty->assign( 'contentTypes', $contentTypes ); - - $subpages = $gStructure->getStructureNodes($_REQUEST["structure_id"]); - $max = count($subpages); - $gBitSmarty->assignByRef('subpages', $subpages); - if ($max != 0) { - $last_child = $subpages[$max - 1]; - $gBitSmarty->assign('insert_after', $last_child["structure_id"]); - } - - if( !empty( $_REQUEST['done'] ) ) { - bit_redirect( $_SESSION['structure_referer'] ); - } - $gBitSystem->display( 'bitpackage:liberty/add_structure_content.tpl', "Add Content" , array( 'display_mode' => 'display' )); -} - diff --git a/includes/display_structure_inc.php b/includes/display_structure_inc.php deleted file mode 100644 index 4b3844b..0000000 --- a/includes/display_structure_inc.php +++ /dev/null @@ -1,22 +0,0 @@ - - * @version $Revision$ - * @package liberty - * @subpackage functions - */ - -/** - * required setup - */ -global $gContent; -include_once( LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php' ); -if( is_object( $gContent ) && $gContent->isValid() ) { - $gBitSystem->setBrowserTitle( $gStructure->getRootTitle().' : '.$gContent->getTitle() ); - $gBitSystem->setCanonicalLink( $gContent->getDisplayUrl() ); - include $gContent->getRenderFile(); -} else { - $gBitSystem->fatalError( tra( 'Page cannot be found' ), NULL, NULL, HttpStatusCodes::HTTP_GONE ); -} diff --git a/includes/edit_structure_inc.php b/includes/edit_structure_inc.php deleted file mode 100644 index 2345a6b..0000000 --- a/includes/edit_structure_inc.php +++ /dev/null @@ -1,126 +0,0 @@ - - * @version $Revision$ - * @package liberty - * @subpackage functions - */ - -// Copyright (c) 2004, Christian Fowler, et. al. -// All Rights Reserved. See below for details and a complete list of authors. -// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details. - -/** - * required setup - */ -require_once( '../kernel/includes/setup_inc.php' ); -include_once( LIBERTY_PKG_CLASS_PATH.'LibertyStructure.php'); - -if( !@BitBase::verifyId( $_REQUEST["structure_id"] ) ) { - $gBitSystem->fatalError( tra( "No structure indicated" )); -} else { - global $gStructure; - $gStructure = new LibertyStructure( $_REQUEST["structure_id"] ); - $gStructure->load(); - - // order matters for these conditionals - if( empty( $gStructure ) || !$gStructure->isValid() ) { - $gBitSystem->fatalError( tra( 'Invalid structure' )); - } - - if( $gStructure->mInfo['root_structure_id'] == $gStructure->mInfo['structure_id'] ) { - $rootStructure = &$gStructure; - } else { - $rootStructure = new LibertyStructure( $gStructure->mInfo['root_structure_id'] ); - $rootStructure->load(); - $rootStructure->loadNavigation(); - $rootStructure->loadPath(); - } - if( empty( $gContent ) ) { - $gContent = LibertyContent::getLibertyObject( $gStructure->getField( 'content_id' ) ); - $gContent->verifyUpdatePermission(); - } - $gBitSmarty->assignByRef( 'gStructure', $gStructure ); - $gBitSmarty->assign( 'editingStructure', TRUE ); - $gBitSmarty->assign('structureInfo', $gStructure->mInfo); - - // Store the actively stored structure name - $gBitUser->storePreference( 'edit_structure_name', $rootStructure->mInfo['title'] ); - $gBitUser->storePreference( 'edit_structure_id', $rootStructure->mStructureId ); - - if( ( isset( $_REQUEST["action"] ) && ( $_REQUEST["action"] == 'remove' ) ) || !empty( $_REQUEST["confirm"] ) ) { - $gBitUser->verifyTicket(); - if( $_REQUEST["action"] == 'remove' && ($gBitThemes->isAjaxRequest() || !empty( $_REQUEST["confirm"] )) ) { - $gBitUser->verifyTicket(); - if( $gStructure->removeStructureNode( $_REQUEST["structure_id"], false ) ) { - if( $gBitThemes->isAjaxRequest() ) { - $feedback['success'] = tra( "removed from" ).' '.$gContent->getContentTypeName(); - } else { - bit_redirect( $_SERVER['SCRIPT_NAME'].'?structure_id='.$gStructure->mInfo["parent_id"] ); - } - } else { - $feedback['error'] = $gStructure->mErrors; - } - $gBitSmarty->assignByRef('feedback', $feedback); - } elseif( $_REQUEST["action"] == 'remove' ) { - $gBitSystem->setBrowserTitle( tra('Confirm removal of ').$gContent->getTitle() ); - $formHash['action'] = 'remove'; - $formHash['remove'] = TRUE; - $formHash['structure_id'] = $_REQUEST['structure_id']; - $msgHash = array( - 'label' => tra('Remove content from Structure'), - 'confirm_item' => $gContent->getTitle().tra('and any subitems'), - 'warning' => tra('This will remove the content from the structure but will not modify or remove the content itself.'), - ); - $gBitSystem->confirmDialog( $formHash,$msgHash ); - } - } elseif (isset($_REQUEST["move_node"])) { - if ($_REQUEST["move_node"] == '1') { - $gStructure->moveNodeWest(); - } elseif ($_REQUEST["move_node"] == '2') { - $gStructure->moveNodeNorth(); - } elseif ($_REQUEST["move_node"] == '3') { - $gStructure->moveNodeSouth(); - } elseif ($_REQUEST["move_node"] == '4') { - $gStructure->moveNodeEast(); - } - bit_redirect( $_SERVER['SCRIPT_NAME'].'?structure_id='.$gStructure->mInfo["structure_id"] ); - } elseif( !empty( $_REQUEST['submit_structure'] ) ) { - if( $gStructure->storeStructure( $_REQUEST ) ) { - $feedback['success'] = tra( "Your changes were successfully saved." ); - } else { - $feedback['error'] = $gStructure->mErrors; - } - } elseif (isset($_REQUEST["create"]) || (isset( $_REQUEST["action"] ) && $_REQUEST["action"] == 'add') ) { - $structureHash['root_structure_id'] = $rootStructure->mStructureId; - $structureHash['parent_id'] = $_REQUEST['structure_id']; - - $after = null; - if (isset($_REQUEST['after_ref_id'])) { - $structureHash['after_ref_id'] = $_REQUEST['after_ref_id']; - } - if (!(empty($_REQUEST['name']))) { - $gStructure->s_create_page($_REQUEST["structure_id"], $after, $_REQUEST["name"], ''); - } elseif(!empty($_REQUEST['content'])) { - foreach ($_REQUEST['content'] as $conId ) { - $structureHash['content_id'] = $conId; - if( $new_structure_id = $gStructure->storeNode( $structureHash ) ) { - $structureHash['after_ref_id'] = $new_structure_id; - $feedback['success'] = tra( "added to" ).' '.$gContent->getContentTypeName(); - } else { - $feedback['failure'] = $gStructure->mErrors; - } - } - } - } - - $structureTocId = $rootStructure->mStructureId; - $gBitSmarty->assign( 'structureToc', $rootStructure->getToc() ); - $gBitSmarty->assign( 'structureTocId', $structureTocId ); - $gBitSmarty->assignByRef('feedback', $feedback); -} - $gBitSmarty->assign( 'editingStructure', FALSE ); - -?> diff --git a/includes/structure_display_inc.php b/includes/structure_display_inc.php new file mode 100644 index 0000000..f0d489f --- /dev/null +++ b/includes/structure_display_inc.php @@ -0,0 +1,22 @@ + + * @version $Revision$ + * @package liberty + * @subpackage functions + */ + +/** + * required setup + */ +global $gContent; +include_once( LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php' ); +if( is_object( $gContent ) && $gContent->isValid() ) { + $gBitSystem->setBrowserTitle( $gStructure->getRootTitle().' : '.$gContent->getTitle() ); + $gBitSystem->setCanonicalLink( $gContent->getDisplayUrl() ); + include $gContent->getRenderFile(); +} else { + $gBitSystem->fatalError( tra( 'Page cannot be found' ), NULL, NULL, HttpStatusCodes::HTTP_GONE ); +} diff --git a/includes/structure_edit_inc.php b/includes/structure_edit_inc.php new file mode 100644 index 0000000..05179c6 --- /dev/null +++ b/includes/structure_edit_inc.php @@ -0,0 +1,124 @@ +fatalError( tra( "No structure indicated" )); +} else { + global $gStructure; + $gStructure = new LibertyStructure( $_REQUEST["structure_id"] ); + $gStructure->load(); + + // order matters for these conditionals + if( empty( $gStructure ) || !$gStructure->isValid() ) { + $gBitSystem->fatalError( tra( 'Invalid structure' )); + } + + if( $gStructure->mInfo['root_structure_id'] == $gStructure->mInfo['structure_id'] ) { + $rootStructure = &$gStructure; + } else { + $rootStructure = new LibertyStructure( $gStructure->mInfo['root_structure_id'] ); + $rootStructure->load(); + $rootStructure->loadNavigation(); + $rootStructure->loadPath(); + } + + if( empty( $gContent ) ) { + $gContent = LibertyContent::getLibertyObject( $gStructure->getField( 'content_id' ) ); + $gContent->verifyUpdatePermission(); + } + + $gBitSmarty->assignByRef( 'gStructure', $gStructure ); + $gBitSmarty->assign( 'editingStructure', TRUE ); + $gBitSmarty->assign('structureInfo', $gStructure->mInfo); + + // Store the actively stored structure name + $gBitUser->storePreference( 'edit_structure_name', $rootStructure->mInfo['title'] ); + $gBitUser->storePreference( 'edit_structure_id', $rootStructure->mStructureId ); + + if( ( isset( $_REQUEST["action"] ) && ( $_REQUEST["action"] == 'remove' ) ) || !empty( $_REQUEST["confirm"] ) ) { + $gBitUser->verifyTicket(); + if( $_REQUEST["action"] == 'remove' && ($gBitThemes->isAjaxRequest() || !empty( $_REQUEST["confirm"] )) ) { + $gBitUser->verifyTicket(); + if( $gStructure->removeStructureNode( $_REQUEST["structure_id"], false ) ) { + if( $gBitThemes->isAjaxRequest() ) { + $feedback['success'] = tra( "removed from" ).' '.$gContent->getContentTypeName(); + } else { + bit_redirect( $_SERVER['SCRIPT_NAME'].'?structure_id='.$gStructure->mInfo["parent_id"] ); + } + } else { + $feedback['error'] = $gStructure->mErrors; + } + $gBitSmarty->assignByRef('feedback', $feedback); + } elseif( $_REQUEST["action"] == 'remove' ) { + $gBitSystem->setBrowserTitle( tra('Confirm removal of ').$gContent->getTitle() ); + $formHash['action'] = 'remove'; + $formHash['remove'] = TRUE; + $formHash['structure_id'] = $_REQUEST['structure_id']; + $msgHash = array( + 'label' => tra('Remove content from Structure'), + 'confirm_item' => $gContent->getTitle().tra('and any subitems'), + 'warning' => tra('This will remove the content from the structure but will not modify or remove the content itself.'), + ); + $gBitSystem->confirmDialog( $formHash,$msgHash ); + } + } elseif (isset($_REQUEST["move_node"])) { + if ($_REQUEST["move_node"] == '1') { + $gStructure->moveNodeWest(); + } elseif ($_REQUEST["move_node"] == '2') { + $gStructure->moveNodeNorth(); + } elseif ($_REQUEST["move_node"] == '3') { + $gStructure->moveNodeSouth(); + } elseif ($_REQUEST["move_node"] == '4') { + $gStructure->moveNodeEast(); + } + bit_redirect( $_SERVER['SCRIPT_NAME'].'?structure_id='.$gStructure->mInfo["structure_id"] ); + } elseif( !empty( $_REQUEST['submit_structure'] ) ) { + if( $gStructure->storeStructure( $_REQUEST ) ) { + $feedback['success'] = tra( "Your changes were successfully saved." ); + } else { + $feedback['error'] = $gStructure->mErrors; + } + } elseif (isset($_REQUEST["create"]) || (isset( $_REQUEST["action"] ) && $_REQUEST["action"] == 'add') ) { + $structureHash['root_structure_id'] = $rootStructure->mStructureId; + $structureHash['parent_id'] = $_REQUEST['structure_id']; + + $after = null; + if (isset($_REQUEST['after_ref_id'])) { + $structureHash['after_ref_id'] = $_REQUEST['after_ref_id']; + } + if (!(empty($_REQUEST['name']))) { + $gStructure->s_create_page($_REQUEST["structure_id"], $after, $_REQUEST["name"], ''); + } elseif(!empty($_REQUEST['content'])) { + foreach ($_REQUEST['content'] as $conId ) { + $structureHash['content_id'] = $conId; + if( $new_structure_id = $gStructure->storeNode( $structureHash ) ) { + $structureHash['after_ref_id'] = $new_structure_id; + $feedback['success'] = tra( "added to" ).' '.$gContent->getContentTypeName(); + } else { + $feedback['failure'] = $gStructure->mErrors; + } + } + } + } + + $structureTocId = $rootStructure->mStructureId; + $gBitSmarty->assign( 'structureToc', $rootStructure->getToc() ); + $gBitSmarty->assign( 'structureTocId', $structureTocId ); + $gBitSmarty->assignByRef('feedback', $feedback); +} + $gBitSmarty->assign( 'editingStructure', FALSE ); + +?> diff --git a/structure_add_content.php b/structure_add_content.php new file mode 100644 index 0000000..2009a45 --- /dev/null +++ b/structure_add_content.php @@ -0,0 +1,67 @@ + + * @version $Revision$ + * @package liberty + * @subpackage functions + */ + +/** + * required setup + */ +$gLiteweightScan = TRUE; +require_once( '../kernel/includes/setup_inc.php' ); + +if( !empty( $_REQUEST['modal'] ) ) { + $gBitSystem->mConfig['site_top_bar'] = FALSE; + $gBitSystem->mConfig['site_left_column'] = FALSE; + $gBitSystem->mConfig['site_right_column'] = FALSE; + $gBitSmarty->assign( 'popupPage', '1' ); +} + +require_once( LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php' ); +require_once( LIBERTY_PKG_INCLUDE_PATH.'structure_edit_inc.php' ); + +if( !empty( $_SERVER['HTTP_REFERER'] ) ) { + $urlHash = parse_url( $_SERVER['HTTP_REFERER'] ); + if( $urlHash['path'] != $_SERVER['SCRIPT_NAME'] ) { + $_SESSION['structure_referer'] = $_SERVER['HTTP_REFERER']; + } +} + +if( $gBitThemes->isAjaxRequest() ) { + header( 'Content-Type: text/html; charset=utf-8' ); + print $gBitSmarty->fetch( "bitpackage:liberty/add_structure_feedback_inc.tpl" ); + exit; +} else { + + $_REQUEST['thumbnail_size'] = 'icon'; + include_once( LIBERTY_PKG_INCLUDE_PATH.'get_content_list_inc.php' ); + foreach( $contentList as $cItem ) { + $cList[$contentTypes[$cItem['content_type_guid']]][$cItem['content_id']] = $cItem['title'].' [id: '.$cItem['content_id'].']'; + } + $gBitSmarty->assignByRef( 'contentListHash', $contentList ); + $gBitSmarty->assign( 'contentList', $cList ); + $gBitSmarty->assign( 'contentSelect', $contentSelect ); + $gBitSmarty->assign( 'contentTypes', $contentTypes ); + + $subpages = $gStructure->getStructureNodes($_REQUEST["structure_id"]); + $max = count($subpages); + $gBitSmarty->assignByRef('subpages', $subpages); + if ($max != 0) { + $last_child = $subpages[$max - 1]; + $gBitSmarty->assign('insert_after', $last_child["structure_id"]); + } + + if( !empty( $_REQUEST['done'] ) ) { + if( !empty( $_SESSION['structure_referer'] ) ) { + bit_redirect( $_SESSION['structure_referer'] ); + } else { + bit_redirect( $gContent->getDisplayUri() ); + } + } + $gBitSystem->display( 'bitpackage:liberty/add_structure_content.tpl', "Add Content" , array( 'display_mode' => 'display' )); +} + diff --git a/structure_edit.php b/structure_edit.php new file mode 100644 index 0000000..7ae244b --- /dev/null +++ b/structure_edit.php @@ -0,0 +1,16 @@ + -
+

{$gContent->getTitle()|escape} {tr}Table of Contents{/tr}

@@ -34,8 +34,8 @@ function addStructure(pContentId) {
-
{if $subtree} +
{formlabel label="After page" for="after_ref_id"} {forminput} @@ -47,8 +47,8 @@ function addStructure(pContentId) { {formhelp note="Format: Position in tree - Title of Content, insert after, structure_id"} {/forminput}
- {/if}
+ {/if}
{minifind} @@ -81,54 +81,41 @@ function addStructure(pContentId) {
-
- {forminput} - - - - - - - - - - - {section loop=$contentListHash name=cx} - - - - - - - {/section} - -
{tr}Title{/tr}{tr}Type{/tr}{tr}Author{/tr}
- - {assign var=inStructureId value=$gStructure->isInStructure($contentListHash[cx].content_id)} -
- {booticon iname="icon-minus-sign" ipackage="icons" iexplain="Remove"} -
- -
- {booticon iname="icon-plus-sign" ipackage="icons" iexplain="Add to structure"} -
- - - {booticon ipackage="icons" iname="icon-zoom-in" iexplain="View (in new window)"} - -
- {if $contentListHash[cx].thumbnail_url} - {tr}Thumbnail{/tr} - {/if} - {$contentListHash[cx].title} - - - {$contentListHash[cx].content_name} - - {displayname hash=$contentListHash[cx]} -
- {/forminput} -
+ + {foreach from=$contentListHash item=contentHash} + {assign var=inStructureId value=$gStructure->isInStructure($contentHash.content_id)} + + + + + + + {/foreach} +
{if $contentHash.thumbnail_url}{tr}Thumbnail{/tr}{/if} + +
+ {$contentHash.title} + +
+
+
+ {displayname hash=$contentHash} +
+
+ {if $inStructureId} +
+ +
+ {else} +
+ +
+ {/if} +
diff --git a/templates/edit_structure.tpl b/templates/edit_structure.tpl index bdfce1c..40a6951 100644 --- a/templates/edit_structure.tpl +++ b/templates/edit_structure.tpl @@ -121,7 +121,7 @@ console.log( childNode ); function saveStructure( pStructureId ) { // var json = structureTocToJson(document.getElementById('structure-branch-'+pStructureId));$('#pre-tree').html(JSON.stringify(json,null,2)); $.ajax({ - url: {/literal}"{$smarty.const.LIBERTY_PKG_URL}edit_structure_inc.php?tk={$gBitUser->mTicket}&submit_structure=1&structure_id="+pStructureId,{literal} + url: {/literal}"{$smarty.const.LIBERTY_PKG_URL}structure_edit.php?tk={$gBitUser->mTicket}&submit_structure=1&structure_id="+pStructureId,{literal} type: 'POST', context: document.body, data: { 'structure_json': structureTocToJson(document.getElementById('structure-branch-'+pStructureId)) } @@ -145,7 +145,7 @@ function deleteStructureNode( pStructureId, pStructureText ) { -
{tr}Save Changes{/tr}
{tr}Back{/tr} Add Content +
{tr}Save Changes{/tr}
{tr}Back{/tr} Add Content
-- cgit v1.3 From 182fda7f646d1cf7d8420065f57ef4a6eb30a5d2 Mon Sep 17 00:00:00 2001 From: spiderr Date: Fri, 12 Feb 2021 13:46:27 -0500 Subject: rename *_structure to structure_* --- modules/mod_structure_navigation.tpl | 2 +- structure_add_content.php | 4 +- templates/add_structure_content.tpl | 126 ------------------------- templates/add_structure_feedback_inc.tpl | 4 - templates/display_structure.tpl | 49 ---------- templates/edit_structure.tpl | 154 ------------------------------- templates/edit_structure_content.tpl | 72 --------------- templates/structure_add_content.tpl | 126 +++++++++++++++++++++++++ templates/structure_add_feedback_inc.tpl | 4 + templates/structure_display.tpl | 49 ++++++++++ templates/structure_edit.tpl | 154 +++++++++++++++++++++++++++++++ templates/structure_edit_content.tpl | 72 +++++++++++++++ 12 files changed, 408 insertions(+), 408 deletions(-) delete mode 100644 templates/add_structure_content.tpl delete mode 100644 templates/add_structure_feedback_inc.tpl delete mode 100644 templates/display_structure.tpl delete mode 100644 templates/edit_structure.tpl delete mode 100644 templates/edit_structure_content.tpl create mode 100644 templates/structure_add_content.tpl create mode 100644 templates/structure_add_feedback_inc.tpl create mode 100644 templates/structure_display.tpl create mode 100644 templates/structure_edit.tpl create mode 100644 templates/structure_edit_content.tpl diff --git a/modules/mod_structure_navigation.tpl b/modules/mod_structure_navigation.tpl index ec1160b..a983e14 100644 --- a/modules/mod_structure_navigation.tpl +++ b/modules/mod_structure_navigation.tpl @@ -1,5 +1,5 @@ {if $structureInfo} {bitmodule title="$moduleTitle" name="structure_navigation"} - {include file="bitpackage:liberty/display_structure.tpl" wiki_book_show_path='y' wiki_book_show_navigation='y' wikibook_use_icons='y'} + {include file="bitpackage:liberty/structure_display.tpl" wiki_book_show_path='y' wiki_book_show_navigation='y' wikibook_use_icons='y'} {/bitmodule} {/if} diff --git a/structure_add_content.php b/structure_add_content.php index 2009a45..cd31231 100644 --- a/structure_add_content.php +++ b/structure_add_content.php @@ -33,7 +33,7 @@ if( !empty( $_SERVER['HTTP_REFERER'] ) ) { if( $gBitThemes->isAjaxRequest() ) { header( 'Content-Type: text/html; charset=utf-8' ); - print $gBitSmarty->fetch( "bitpackage:liberty/add_structure_feedback_inc.tpl" ); + print $gBitSmarty->fetch( "bitpackage:liberty/structure_add_feedback_inc.tpl" ); exit; } else { @@ -62,6 +62,6 @@ if( $gBitThemes->isAjaxRequest() ) { bit_redirect( $gContent->getDisplayUri() ); } } - $gBitSystem->display( 'bitpackage:liberty/add_structure_content.tpl', "Add Content" , array( 'display_mode' => 'display' )); + $gBitSystem->display( 'bitpackage:liberty/structure_add_content.tpl', "Add Content" , array( 'display_mode' => 'display' )); } diff --git a/templates/add_structure_content.tpl b/templates/add_structure_content.tpl deleted file mode 100644 index 74f2c42..0000000 --- a/templates/add_structure_content.tpl +++ /dev/null @@ -1,126 +0,0 @@ -{literal} - -{/literal} - -{strip} - -
- -
- -
-

{$gContent->getTitle()|escape} {tr}Table of Contents{/tr}

-
- - {form legend="Add Content" id="structureaddform"} - - - -
- {if $subtree} -
-
- {formlabel label="After page" for="after_ref_id"} - {forminput} - - {formhelp note="Format: Position in tree - Title of Content, insert after, structure_id"} - {/forminput} -
-
- {/if} -
- {minifind} - - {* disable until it can be sorted } -
- {formlabel label="Search" for="lib-content"} - {forminput} - -
- - {formhelp note=""} - {/forminput} -
- { *} -
-
-
- {formlabel label="Content Type" for="content_type_guid"} - {forminput} - {html_options class="form-control" onchange="submit();" options=$contentTypes name=content_type_guid selected=$contentSelect} - {/forminput} - - {* forminput} - {html_options class="form-control" multiple="multiple" id="lib-content" size="12" name="content[]" values=$contentList options=$contentList} - {/forminput *} -
-
-
- Done -
-
- - - {foreach from=$contentListHash item=contentHash} - {assign var=inStructureId value=$gStructure->isInStructure($contentHash.content_id)} - - - - - - - {/foreach} -
{if $contentHash.thumbnail_url}{tr}Thumbnail{/tr}{/if} - -
- {$contentHash.title} - -
-
-
- {displayname hash=$contentHash} -
-
- {if $inStructureId} -
- -
- {else} -
- -
- {/if} -
- -
- - -
- {/form} -
-{/strip} diff --git a/templates/add_structure_feedback_inc.tpl b/templates/add_structure_feedback_inc.tpl deleted file mode 100644 index 65bab36..0000000 --- a/templates/add_structure_feedback_inc.tpl +++ /dev/null @@ -1,4 +0,0 @@ -{ldelim} - "content_id":{$smarty.request.content.0}, - "feedback":'{formfeedback hash=$feedback}' -{rdelim} diff --git a/templates/display_structure.tpl b/templates/display_structure.tpl deleted file mode 100644 index 021bf77..0000000 --- a/templates/display_structure.tpl +++ /dev/null @@ -1,49 +0,0 @@ -{strip} -{if $structureInfo.structure_path} -
- {if $gBitSystem->isFeatureActive( 'wiki_book_show_path' )} -
- {section loop=$structureInfo.structure_path name=ix} - {if $structureInfo.structure_path[ix].parent_id} » {/if} - - {if $structureInfo.structure_path[ix].page_alias} - {$structureInfo.structure_path[ix].page_alias|escape} - {else} - {$structureInfo.structure_path[ix].title|escape} - {/if} - - {/section} -
- {/if} - - {if $gBitSystem->isFeatureActive( 'wiki_book_show_navigation' )} - - {/if} -
-
-{/if} {* end structure *} -{/strip} diff --git a/templates/edit_structure.tpl b/templates/edit_structure.tpl deleted file mode 100644 index 40a6951..0000000 --- a/templates/edit_structure.tpl +++ /dev/null @@ -1,154 +0,0 @@ -{strip} - -{formfeedback hash=$feedback} - -{if !$structureName} - {assign var=structureName value="Structure"} -{/if} - - - - -{$structureToc} - - - -
{tr}Save Changes{/tr}
{tr}Back{/tr} Add Content -
-
- -{*
*}
-
-{/strip}
diff --git a/templates/edit_structure_content.tpl b/templates/edit_structure_content.tpl
deleted file mode 100644
index c5deee3..0000000
--- a/templates/edit_structure_content.tpl
+++ /dev/null
@@ -1,72 +0,0 @@
-{strip}
-
-
-

{tr}Structure Content{/tr}

-
- -
- {form legend="Add Content"} - - - - {if $subpages} -
- {formlabel label="After page" for="after_ref_id"} - {forminput} - - {formhelp note=""} - {/forminput} -
- {/if} - -
- {formlabel label="Content" for="lib-content"} - {forminput} - {html_options onchange="submit();" options=$contentTypes name=content_type_guid selected=$contentSelect} - {/forminput} - - {forminput} - {html_options multiple="multiple" id="lib-content" size="12" name="content[]" values=$contentList options=$contentList} - {/forminput} - - {forminput} - - - {formhelp note=""} - {/forminput} -
- -
- -
- {/form} -
- -
-
    -
  • - {section name=ix loop=$subtree} - {if $subtree[ix].pos eq ''} - {if $structureInfo.structure_id eq $subtree[ix].structure_id}
    {/if} - {$subtree[ix].title|escape} - {if $structureInfo.structure_id eq $subtree[ix].structure_id}
    {/if} - {else} - {if $subtree[ix].first}
      {else}{/if} - {if $subtree[ix].last}
    {else} -
  • - {if $structureInfo.structure_id eq $subtree[ix].structure_id}
    {/if} - {$subtree[ix].pos}  - {$subtree[ix].title|escape} - {if $structureInfo.structure_id eq $subtree[ix].structure_id}
    {/if} - {/if} - {/if} - {/section} -
  • -
-
-
-{/strip} diff --git a/templates/structure_add_content.tpl b/templates/structure_add_content.tpl new file mode 100644 index 0000000..74f2c42 --- /dev/null +++ b/templates/structure_add_content.tpl @@ -0,0 +1,126 @@ +{literal} + +{/literal} + +{strip} + +
+ +
+ +
+

{$gContent->getTitle()|escape} {tr}Table of Contents{/tr}

+
+ + {form legend="Add Content" id="structureaddform"} + + + +
+ {if $subtree} +
+
+ {formlabel label="After page" for="after_ref_id"} + {forminput} + + {formhelp note="Format: Position in tree - Title of Content, insert after, structure_id"} + {/forminput} +
+
+ {/if} +
+ {minifind} + + {* disable until it can be sorted } +
+ {formlabel label="Search" for="lib-content"} + {forminput} + +
+ + {formhelp note=""} + {/forminput} +
+ { *} +
+
+
+ {formlabel label="Content Type" for="content_type_guid"} + {forminput} + {html_options class="form-control" onchange="submit();" options=$contentTypes name=content_type_guid selected=$contentSelect} + {/forminput} + + {* forminput} + {html_options class="form-control" multiple="multiple" id="lib-content" size="12" name="content[]" values=$contentList options=$contentList} + {/forminput *} +
+
+
+ Done +
+
+ + + {foreach from=$contentListHash item=contentHash} + {assign var=inStructureId value=$gStructure->isInStructure($contentHash.content_id)} + + + + + + + {/foreach} +
{if $contentHash.thumbnail_url}{tr}Thumbnail{/tr}{/if} + +
+ {$contentHash.title} + +
+
+
+ {displayname hash=$contentHash} +
+
+ {if $inStructureId} +
+ +
+ {else} +
+ +
+ {/if} +
+ +
+ + +
+ {/form} +
+{/strip} diff --git a/templates/structure_add_feedback_inc.tpl b/templates/structure_add_feedback_inc.tpl new file mode 100644 index 0000000..65bab36 --- /dev/null +++ b/templates/structure_add_feedback_inc.tpl @@ -0,0 +1,4 @@ +{ldelim} + "content_id":{$smarty.request.content.0}, + "feedback":'{formfeedback hash=$feedback}' +{rdelim} diff --git a/templates/structure_display.tpl b/templates/structure_display.tpl new file mode 100644 index 0000000..021bf77 --- /dev/null +++ b/templates/structure_display.tpl @@ -0,0 +1,49 @@ +{strip} +{if $structureInfo.structure_path} +
+ {if $gBitSystem->isFeatureActive( 'wiki_book_show_path' )} +
+ {section loop=$structureInfo.structure_path name=ix} + {if $structureInfo.structure_path[ix].parent_id} » {/if} + + {if $structureInfo.structure_path[ix].page_alias} + {$structureInfo.structure_path[ix].page_alias|escape} + {else} + {$structureInfo.structure_path[ix].title|escape} + {/if} + + {/section} +
+ {/if} + + {if $gBitSystem->isFeatureActive( 'wiki_book_show_navigation' )} + + {/if} +
+
+{/if} {* end structure *} +{/strip} diff --git a/templates/structure_edit.tpl b/templates/structure_edit.tpl new file mode 100644 index 0000000..40a6951 --- /dev/null +++ b/templates/structure_edit.tpl @@ -0,0 +1,154 @@ +{strip} + +{formfeedback hash=$feedback} + +{if !$structureName} + {assign var=structureName value="Structure"} +{/if} + + + + +{$structureToc} + + + +
{tr}Save Changes{/tr}
{tr}Back{/tr} Add Content +
+
+ +{*
*}
+
+{/strip}
diff --git a/templates/structure_edit_content.tpl b/templates/structure_edit_content.tpl
new file mode 100644
index 0000000..c5deee3
--- /dev/null
+++ b/templates/structure_edit_content.tpl
@@ -0,0 +1,72 @@
+{strip}
+
+
+

{tr}Structure Content{/tr}

+
+ +
+ {form legend="Add Content"} + + + + {if $subpages} +
+ {formlabel label="After page" for="after_ref_id"} + {forminput} + + {formhelp note=""} + {/forminput} +
+ {/if} + +
+ {formlabel label="Content" for="lib-content"} + {forminput} + {html_options onchange="submit();" options=$contentTypes name=content_type_guid selected=$contentSelect} + {/forminput} + + {forminput} + {html_options multiple="multiple" id="lib-content" size="12" name="content[]" values=$contentList options=$contentList} + {/forminput} + + {forminput} + + + {formhelp note=""} + {/forminput} +
+ +
+ +
+ {/form} +
+ +
+
    +
  • + {section name=ix loop=$subtree} + {if $subtree[ix].pos eq ''} + {if $structureInfo.structure_id eq $subtree[ix].structure_id}
    {/if} + {$subtree[ix].title|escape} + {if $structureInfo.structure_id eq $subtree[ix].structure_id}
    {/if} + {else} + {if $subtree[ix].first}
      {else}{/if} + {if $subtree[ix].last}
    {else} +
  • + {if $structureInfo.structure_id eq $subtree[ix].structure_id}
    {/if} + {$subtree[ix].pos}  + {$subtree[ix].title|escape} + {if $structureInfo.structure_id eq $subtree[ix].structure_id}
    {/if} + {/if} + {/if} + {/section} +
  • +
+
+
+{/strip} -- cgit v1.3