diff options
| author | spiderr <spiderr@bitweaver.org> | 2021-02-13 16:41:30 -0500 |
|---|---|---|
| committer | spiderr <spiderr@bitweaver.org> | 2021-02-13 16:41:30 -0500 |
| commit | 2b1458a54a7e8cc163e5b7dc6acea16ecd390073 (patch) | |
| tree | bb0a2d6d12ec5ea9c4d817f999aaf305881f7d0b | |
| parent | 54874e0f1377c1c68d4136e0914124c41cfcf278 (diff) | |
| parent | 182fda7f646d1cf7d8420065f57ef4a6eb30a5d2 (diff) | |
| download | liberty-2b1458a54a7e8cc163e5b7dc6acea16ecd390073.tar.gz liberty-2b1458a54a7e8cc163e5b7dc6acea16ecd390073.tar.bz2 liberty-2b1458a54a7e8cc163e5b7dc6acea16ecd390073.zip | |
Merge branch 'master' of github.com:bitweaver/liberty
| -rw-r--r-- | includes/classes/LibertyContent.php | 6 | ||||
| -rw-r--r-- | includes/lookup_content_inc.php | 52 | ||||
| -rw-r--r-- | includes/structure_display_inc.php (renamed from includes/display_structure_inc.php) | 2 | ||||
| -rw-r--r-- | includes/structure_edit_inc.php (renamed from includes/edit_structure_inc.php) | 10 | ||||
| -rw-r--r-- | modules/mod_structure_navigation.tpl | 2 | ||||
| -rw-r--r-- | structure_add_content.php (renamed from add_structure_content.php) | 12 | ||||
| -rw-r--r-- | structure_edit.php | 16 | ||||
| -rw-r--r-- | templates/structure_add_content.tpl (renamed from templates/add_structure_content.tpl) | 89 | ||||
| -rw-r--r-- | templates/structure_add_feedback_inc.tpl (renamed from templates/add_structure_feedback_inc.tpl) | 0 | ||||
| -rw-r--r-- | templates/structure_display.tpl (renamed from templates/display_structure.tpl) | 0 | ||||
| -rw-r--r-- | templates/structure_edit.tpl (renamed from templates/edit_structure.tpl) | 4 | ||||
| -rw-r--r-- | templates/structure_edit_content.tpl (renamed from templates/edit_structure_content.tpl) | 0 |
12 files changed, 101 insertions, 92 deletions
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); } 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 ); + } +} -?> diff --git a/includes/display_structure_inc.php b/includes/structure_display_inc.php index 4b3844b..f0d489f 100644 --- a/includes/display_structure_inc.php +++ b/includes/structure_display_inc.php @@ -1,6 +1,6 @@ <?php /** - * display_structure_inc + * structure_display_inc * * @author spider <spider@steelsun.com> * @version $Revision$ diff --git a/includes/edit_structure_inc.php b/includes/structure_edit_inc.php index 2345a6b..05179c6 100644 --- a/includes/edit_structure_inc.php +++ b/includes/structure_edit_inc.php @@ -1,9 +1,8 @@ <?php /** - * edit_structure_inc + * structure_edit_inc * - * @author Christian Fowler> - * @version $Revision$ + * @author Christian Fowler * @package liberty * @subpackage functions */ @@ -12,9 +11,6 @@ // 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'); @@ -38,10 +34,12 @@ if( !@BitBase::verifyId( $_REQUEST["structure_id"] ) ) { $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); 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/add_structure_content.php b/structure_add_content.php index 8c5d30d..cd31231 100644 --- a/add_structure_content.php +++ b/structure_add_content.php @@ -22,7 +22,7 @@ if( !empty( $_REQUEST['modal'] ) ) { } require_once( LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php' ); -require_once( LIBERTY_PKG_INCLUDE_PATH.'edit_structure_inc.php' ); +require_once( LIBERTY_PKG_INCLUDE_PATH.'structure_edit_inc.php' ); if( !empty( $_SERVER['HTTP_REFERER'] ) ) { $urlHash = parse_url( $_SERVER['HTTP_REFERER'] ); @@ -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 { @@ -56,8 +56,12 @@ if( $gBitThemes->isAjaxRequest() ) { } if( !empty( $_REQUEST['done'] ) ) { - bit_redirect( $_SESSION['structure_referer'] ); + 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' )); + $gBitSystem->display( 'bitpackage:liberty/structure_add_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 @@ +<?php +/** + * structure_edit_inc + * + * @author Christian Fowler + * @package liberty + */ + +// 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. + +// wiki books also use structure_edit_inc.php + +require_once( '../kernel/includes/setup_inc.php' ); +include_once( LIBERTY_PKG_INCLUDE_PATH.'structure_edit_inc.php'); diff --git a/templates/add_structure_content.tpl b/templates/structure_add_content.tpl index ea3e213..74f2c42 100644 --- a/templates/add_structure_content.tpl +++ b/templates/structure_add_content.tpl @@ -12,7 +12,7 @@ function addStructure(pContentId) { BitBase.showById( responseHash.content_id+"remove" ); BitBase.fade( responseHash.content_id+"add" ); }; - ajax.connect( "{/literal}{$smarty.const.LIBERTY_PKG_URL}add_structure_content.php{literal}", data, donefn, "GET" ); + ajax.connect( "{/literal}{$smarty.const.LIBERTY_PKG_URL}structure_add_content.php{literal}", data, donefn, "GET" ); return false; } @@ -23,7 +23,7 @@ function addStructure(pContentId) { <div id="structureaddresult"></div> -<div class="edit structurecontent"> +<div class="edit"> <div class="header"> <h1>{$gContent->getTitle()|escape} {tr}Table of Contents{/tr}</h1> @@ -34,8 +34,8 @@ function addStructure(pContentId) { <input type="hidden" name="tab" value="content" /> <div class="row"> - <div class="col-sm-4"> {if $subtree} + <div class="col-sm-4"> <div class="form-group"> {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} </div> - {/if} </div> + {/if} <div class="col-sm-3"> {minifind} @@ -81,54 +81,41 @@ function addStructure(pContentId) { </div> </div> - <div class="form-group"> - {forminput} - <table class="table data"> - <thead> - <tr> - <th></th> - <th>{tr}Title{/tr}</th> - <th>{tr}Type{/tr}</th> - <th>{tr}Author{/tr}</th> - </tr> - </thead> - <tbody> - {section loop=$contentListHash name=cx} - <tr class="item {cycle values="even,odd"}" id="{$contentListHash[cx].content_id}li"> - <td> + <table class="table data"> + {foreach from=$contentListHash item=contentHash} + {assign var=inStructureId value=$gStructure->isInStructure($contentHash.content_id)} + <tr> + <td class="text-center">{if $contentHash.thumbnail_url}<img class="img-responsive" src="{$contentHash.thumbnail_url}" alt="{tr}Thumbnail{/tr}" />{/if}</td> + <td class="item {cycle values="even,odd"}" id="{$contentHash.content_id}li"> - {assign var=inStructureId value=$gStructure->isInStructure($contentListHash[cx].content_id)} - <div class="icon" {if empty($inStructureId)}style="display:none"{/if} id="{$contentListHash[cx].content_id}remove" onclick="removeStructure({$inStructureId})"> - {booticon iname="icon-minus-sign" ipackage="icons" iexplain="Remove"} - </div> - - <div class="icon" {if $inStructureId}style="display:none"{/if} id="{$contentListHash[cx].content_id}add" onclick="addStructure({$contentListHash[cx].content_id})"> - {booticon iname="icon-plus-sign" ipackage="icons" iexplain="Add to structure"} - </div> - - <a target="_new" href="{$contentListHash[cx].display_url}"> - {booticon ipackage="icons" iname="icon-zoom-in" iexplain="View (in new window)"} - </a> - </td> - <td class="title"> - {if $contentListHash[cx].thumbnail_url} - <img class="img-responsive" src="{$contentListHash[cx].thumbnail_url}" alt="{tr}Thumbnail{/tr}" /> - {/if} - {$contentListHash[cx].title} - <span id="{$contentListHash[cx].content_id}feedback"></span> - </td> - <td class="description" id="{$contentListHash[cx].content_id}item"> - {$contentListHash[cx].content_name} - </td> - <td class="author"> - {displayname hash=$contentListHash[cx]} - </td> - </tr> - {/section} - </tbody> - </table> - {/forminput} - </div> + <div class="title"> + {$contentHash.title} + <div class="help-block"> + <a target="_new" href="{$contentHash.display_url}"> + {booticon ipackage="icons" iname="icon-zoom-in" iexplain="View (in new window)"} + </a> +{$contentHash.content_name}</div> + </div> + </td> + <td> + <div class="author"> + {displayname hash=$contentHash} + </div> + </td> + <td> + {if $inStructureId} + <div class="icon" {if empty($inStructureId)}style="display:none"{/if} id="{$contentHash.content_id}remove" onclick="removeStructure({$inStructureId})"> + <button class="btn btn-default btn-xs" title="Remove from structure">{tr}Remove{/tr}</button> + </div> + {else} + <div class="icon" id="{$contentHash.content_id}add" onclick="addStructure({$contentHash.content_id})"> + <button class="btn btn-default btn-xs" title="Add to structure">{tr}Add{/tr}</button> + </div> + {/if} + </td> + </tr> + {/foreach} + </table> <div class="form-group submit"> <input type="submit" class="btn btn-default" onclick="submitStructure(this.form);return false;" name="create" value="{tr}Add Content{/tr}" /> diff --git a/templates/add_structure_feedback_inc.tpl b/templates/structure_add_feedback_inc.tpl index 65bab36..65bab36 100644 --- a/templates/add_structure_feedback_inc.tpl +++ b/templates/structure_add_feedback_inc.tpl diff --git a/templates/display_structure.tpl b/templates/structure_display.tpl index 021bf77..021bf77 100644 --- a/templates/display_structure.tpl +++ b/templates/structure_display.tpl diff --git a/templates/edit_structure.tpl b/templates/structure_edit.tpl index bdfce1c..40a6951 100644 --- a/templates/edit_structure.tpl +++ b/templates/structure_edit.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 ) { </script> - <div class="btn btn-primary" onclick="saveStructure('{$gStructure->mInfo.root_structure_id}');">{tr}Save Changes{/tr}</div> <a href="{$smart.const.BIT_ROOT_URL}index.php?structure_id={$gStructure->mInfo.root_structure_id}" class="btn btn-default"">{tr}Back{/tr}</a> <a class="btn btn-default" href="{$smarty.const.LIBERTY_PKG_URL}add_structure_content.php?structure_id={$smarty.request.structure_id}&content_type_guid={$smarty.request.content_type_guid}" title="Add Content to {$gContent->getTitle()}" title="Add Content">Add Content</a> + <div class="btn btn-primary" onclick="saveStructure('{$gStructure->mInfo.root_structure_id}');">{tr}Save Changes{/tr}</div> <a href="{$smart.const.BIT_ROOT_URL}index.php?structure_id={$gStructure->mInfo.root_structure_id}" class="btn btn-default"">{tr}Back{/tr}</a> <a class="btn btn-default" href="{$smarty.const.LIBERTY_PKG_URL}structure_add_content.php?structure_id={$smarty.request.structure_id}&content_type_guid={$smarty.request.content_type_guid}" title="Add Content to {$gContent->getTitle()}" title="Add Content">Add Content</a> <div id="structure-feedback"> </div> diff --git a/templates/edit_structure_content.tpl b/templates/structure_edit_content.tpl index c5deee3..c5deee3 100644 --- a/templates/edit_structure_content.tpl +++ b/templates/structure_edit_content.tpl |
