summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Fowler <cfowler2@wcpss.net>2014-08-01 15:06:51 -0400
committerChristian Fowler <cfowler2@wcpss.net>2014-08-01 15:06:51 -0400
commit1609052f169ba177d0c2de5a4694f046f144f43e (patch)
tree3b7cdad950d934ab2a99470a07674ea1e794c98c
parent35fae44dd47c669a8ff93d6468399fcbf334b7ee (diff)
parentc6f2e0073a7f269b45a284c08e923056e721208c (diff)
downloadliberty-1609052f169ba177d0c2de5a4694f046f144f43e.tar.gz
liberty-1609052f169ba177d0c2de5a4694f046f144f43e.tar.bz2
liberty-1609052f169ba177d0c2de5a4694f046f144f43e.zip
Merge branch 'master' of github.com:bitweaver/liberty
-rw-r--r--LibertyStructure.php100
-rw-r--r--comments_inc.php5
-rw-r--r--content_permissions.php2
-rw-r--r--content_role_permissions.php2
-rw-r--r--edit_storage_inc.php1
-rw-r--r--edit_structure_inc.php56
-rw-r--r--modules/mod_structure_toc.php4
-rw-r--r--plugins/data.img.php3
-rw-r--r--plugins/filter.maketoc.php8
-rw-r--r--templates/add_structure_content.tpl56
-rw-r--r--templates/comments.tpl4
-rw-r--r--templates/comments_post_inc.tpl8
-rw-r--r--templates/display_comment.tpl2
-rw-r--r--templates/edit_format.tpl2
-rw-r--r--templates/edit_structure.tpl163
-rw-r--r--templates/edit_structure_alias.tpl45
-rw-r--r--templates/edit_structure_inc.tpl60
-rw-r--r--templates/html_head_inc.tpl2
-rw-r--r--templates/service_content_icon_inc.tpl6
-rwxr-xr-xtemplates/structure_toc.tpl2
-rwxr-xr-xtemplates/structure_toc_endul.tpl2
-rwxr-xr-xtemplates/structure_toc_leaf.tpl14
-rwxr-xr-xtemplates/structure_toc_level.tpl2
-rwxr-xr-xtemplates/structure_toc_startul.tpl2
24 files changed, 302 insertions, 249 deletions
diff --git a/LibertyStructure.php b/LibertyStructure.php
index 4c8885a..a87ae81 100644
--- a/LibertyStructure.php
+++ b/LibertyStructure.php
@@ -424,36 +424,81 @@ class LibertyStructure extends LibertyBase {
* @return TRUE on success, FALSE on failure where $this->mErrors will contain the reason why it failed
*/
function verifyStructure( &$pParamHash ) {
- if( !empty( $pParamHash['structure_string'] ) ) {
- eval( $pParamHash['structure_string'] );
- $pParamHash = array_merge( $pParamHash, $tree );
+ $storeNodes = array();
+ if( !self::getParameter( $pParamHash, 'root_structure_id' ) ) {
+ $pParamHash['root_structure_id'] = $this->getField( 'root_structure_id' );
}
- if( !empty( $pParamHash['structure'] ) && @BitBase::verifyId( $pParamHash['root_structure_id'] ) ) {
- LibertyStructure::embellishStructureHash( $pParamHash['structure'] );
- $structureHash = LibertyStructure::flattenStructureHash( $pParamHash['structure'] );
+ if( !self::verifyId( $pParamHash['root_structure_id'] ) ) {
+ $this->mErrors['verify_structure'] = tra( "Unknown root structure." );
+ } else {
+ if( !empty( $pParamHash['structure_json'] ) ) {
+//vd( $pParamHash['structure_json'] );
+ // {{{ closure here to recursively parse json
+ $parseStructureJson = function($treeHash, $pRootId, $pParentId, $pLevel, $pPos ) use ( &$parseStructureJson, &$storeNodes ) {
+ if( is_numeric( key( $treeHash ) ) ) {
+ $pos = 1;
+ foreach( array_keys( $treeHash ) as $i ) {
+ // Array of nodes came in. Process each at the same level
+ $parseStructureJson( $treeHash[$i], $pRootId, $pParentId, $pLevel, $pos++ );
+ }
+ } else {
+ // Base node with data
+ $storeNode = array();
+ $storeNode['root_structure_id'] = $pRootId;
+ $storeNode['parent_id'] = $pParentId;
+ $storeNode['structure_id'] = $treeHash['structure_id'];
+ $storeNode['content_id'] = $treeHash['content_id'];
+ $storeNode['pos'] = $pPos++;
+ //$storeNode['page_alias']
+ $storeNode['structure_level'] = $pLevel;
+ $storeNodes[$treeHash['structure_id']] = $storeNode;
+ if( !empty( $treeHash['children'] ) ) {
+ // current node has children, recurse down in
+ $parseStructureJson( $treeHash['children'], $pRootId, $treeHash['structure_id'], $pLevel + 1, 1 );
+ }
+ }
+ };
+ // }}}
- // replace the 'tree' in the data array with the root_structure_id
- foreach( $pParamHash['data'] as $structure_id => $node ) {
- if( !@BitBase::verifyId( $pParamHash['data'][$structure_id]['parent_id'] ) ) {
- $pParamHash['data'][$structure_id]['parent_id'] = $pParamHash['root_structure_id'];
+ $parseStructureJson( $pParamHash['structure_json'], $this->mStructureId, $pParamHash['root_structure_id'], 1, 1 );
+ if( !empty( $storeNodes ) ) {
+ $pParamHash['structure_store'] = $storeNodes;
}
+//vd( $storeNodes );
}
- foreach( $structureHash as $node ) {
- if( @BitBase::verifyId( $node['structure_id'] ) ) {
- $pParamHash['structure_store'][$node['structure_id']] = array_merge( $node, $pParamHash['data'][$node['structure_id']] );
- $pParamHash['structure_store'][$node['structure_id']]['root_structure_id'] = $pParamHash['root_structure_id'];
+
+ // deprecated flat tree store, code is unused AFAIK.-- spiderr
+ if( !empty( $pParamHash['structure'] ) ) {
+ // LibertyStructure::embellishStructureHash( $pParamHash['structure'] );
+ // $structureHash = LibertyStructure::flattenStructureHash( $pParamHash['structure'] );
+
+ // replace the 'tree' in the data array with the root_structure_id
+ foreach( $pParamHash['data'] as $structure_id => $node ) {
+ if( !@BitBase::verifyId( $pParamHash['data'][$structure_id]['parent_id'] ) ) {
+ $pParamHash['data'][$structure_id]['parent_id'] = $pParamHash['root_structure_id'];
+ }
+ }
+
+ foreach( $structureHash as $node ) {
+ if( @BitBase::verifyId( $node['structure_id'] ) ) {
+ $pParamHash['structure_store'][$node['structure_id']] = array_merge( $node, $pParamHash['data'][$node['structure_id']] );
+ $pParamHash['structure_store'][$node['structure_id']]['root_structure_id'] = $pParamHash['root_structure_id'];
+ }
}
}
- } else {
+ }
+
+ if( empty( $pParamHash['structure_store'] ) ) {
$this->mErrors['verify_structure'] = tra( "There are no changes to save." );
}
// clear up some memory
- if( !empty( $pParamHash['structure_string'] ) ) { unset( $pParamHash['structure_string'] ); }
+ if( !empty( $pParamHash['structure_json'] ) ) { unset( $pParamHash['structure_json'] ); }
if( !empty( $pParamHash['structure'] ) ) { unset( $pParamHash['structure'] ); }
if( !empty( $pParamHash['data'] ) ) { unset( $pParamHash['data'] ); }
+
return( count( $this->mErrors ) == 0 );
}
@@ -466,9 +511,8 @@ class LibertyStructure extends LibertyBase {
if( $this->verifyStructure( $pParamHash ) ) {
// now that the structure is ready to be stored, we remove the old structure first and then insert the new one.
$this->mDb->StartTrans();
- $query = "DELETE FROM `".BIT_DB_PREFIX."liberty_structures` WHERE `root_structure_id`=? AND `structure_id`<>?";
+ $query = "DELETE FROM `".BIT_DB_PREFIX."liberty_structures` WHERE `root_structure_id`=? AND `structure_id`!=?";
$result = $this->mDb->query( $query, array( (int)$pParamHash['root_structure_id'], (int)$pParamHash['root_structure_id'] ) );
- $query = "";
foreach( $pParamHash['structure_store'] as $node ) {
$this->mDb->associateInsert( BIT_DB_PREFIX."liberty_structures", $node );
}
@@ -929,39 +973,41 @@ class LibertyStructure extends LibertyBase {
* @access public
* @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
*/
- function getToc($pStructureId=NULL,$order='asc',$showdesc=false,$pNumberDepth=true,$numberPrefix='') {
+ function getToc($pStructureId=NULL,$order='asc',$showdesc=false,$pNumberDepth=true,$numberPrefix='',$pCss='') {
if( !@$this->verifyId( $pStructureId ) ) {
$pStructureId = $this->mStructureId;
}
- $structure_tree = $this->buildSubtreeToc( $pStructureId, $order, $numberPrefix, $pNumberDepth );
- return $this->fetchToc( $structure_tree,$showdesc,$pNumberDepth );
+ $structureTree = $this->buildSubtreeToc( $pStructureId, $order, $numberPrefix, $pNumberDepth, $pCss );
+ return '<div class="aciTree" id="structure-'.$this->mStructureId.'">'.$this->fetchToc( $structureTree,$showdesc,$pNumberDepth ).'</div>';
}
/**
* fetchToc
*
- * @param array $structure_tree
+ * @param array $structureTree
* @param array $showdesc
* @param array $numbering
* @access public
* @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
*/
- function fetchToc($structure_tree,$showdesc,$numbering) {
+ function fetchToc($structureTree,$showdesc,$numbering,$pCss='') {
global $gBitSmarty;
$ret='';
- if ($structure_tree != '') {
+ if ($structureTree != '') {
$gBitSmarty->verifyCompileDir();
+ $gBitSmarty->assign_by_ref( 'structureId', $this->mStructureId );
$ret.=$gBitSmarty->fetch( "bitpackage:liberty/structure_toc_startul.tpl");
- foreach($structure_tree as $leaf) {
+ foreach($structureTree as $leaf) {
//echo "<br />";print_r($leaf);echo "<br />";
$gBitSmarty->assign_by_ref('structure_tree',$leaf);
$gBitSmarty->assign('showdesc',$showdesc);
$gBitSmarty->assign('numbering',$numbering);
- $ret.=$gBitSmarty->fetch( "bitpackage:liberty/structure_toc_leaf.tpl");
+ $ret .= $gBitSmarty->fetch( "bitpackage:liberty/structure_toc_leaf.tpl");
if(isset($leaf["sub"]) && is_array($leaf["sub"])) {
// recurse down in - li tags are for w3c standard
- $ret.= '<li>'.$this->fetchToc($leaf["sub"],$showdesc,$numbering).'</li>';
+ $ret .= $this->fetchToc($leaf["sub"],$showdesc,$numbering);
}
+ $ret .= '</li>';
}
$ret.=$gBitSmarty->fetch( "bitpackage:liberty/structure_toc_endul.tpl");
}
diff --git a/comments_inc.php b/comments_inc.php
index f9f6398..08bb969 100644
--- a/comments_inc.php
+++ b/comments_inc.php
@@ -48,11 +48,6 @@ if( !$gBitThemes->isJavascriptEnabled() ) {
$gBitSystem->setConfig( 'comments_ajax', 'n' );
}
-if( $gBitSystem->isFeatureActive( 'comments_ajax' ) && !empty( $gContent ) && is_object( $gContent ) && $gContent->isCommentable() ) {
- $gBitSmarty->assign( 'comments_ajax', TRUE );
- $gBitThemes->loadAjax( 'mochikit', array( 'Iter.js', 'DOM.js', 'Style.js', 'Color.js', 'Position.js', 'Visual.js' ));
-}
-
if( @BitBase::verifyId( $_REQUEST['delete_comment_id'] )) {
$deleteComment = new LibertyComment($_REQUEST['delete_comment_id']);
// make sure we're loaded up before we delete
diff --git a/content_permissions.php b/content_permissions.php
index 1e1c1fe..352bbec 100644
--- a/content_permissions.php
+++ b/content_permissions.php
@@ -111,7 +111,5 @@ if( $gBitThemes->isAjaxRequest() ) {
die;
}
-// enable ajaxed permission updating
-$gBitThemes->loadAjax( 'mochikit' );
$gBitSystem->display( 'bitpackage:liberty/content_permissions.tpl', tra( 'Content Permissions' ), array( 'display_mode' => 'display' ));
?>
diff --git a/content_role_permissions.php b/content_role_permissions.php
index b4a9682..1f42c6e 100644
--- a/content_role_permissions.php
+++ b/content_role_permissions.php
@@ -111,7 +111,5 @@ if( $gBitThemes->isAjaxRequest() ) {
die;
}
-// enable ajaxed permission updating
-$gBitThemes->loadAjax( 'mochikit' );
$gBitSystem->display( 'bitpackage:liberty/content_role_permissions.tpl', tra( 'Content Permissions' ), array( 'display_mode' => 'display' ));
?>
diff --git a/edit_storage_inc.php b/edit_storage_inc.php
index e1cdc9d..00ef71f 100644
--- a/edit_storage_inc.php
+++ b/edit_storage_inc.php
@@ -50,7 +50,6 @@ if( !empty( $_REQUEST['deleteAttachment'] )) {
// make sure js is being loaded
if( $gBitSystem->getConfig( 'liberty_attachment_style' ) == 'ajax' ) {
- $gBitThemes->loadAjax( 'mochikit', array( 'Iter.js', 'DOM.js' ) );
$gBitThemes->loadJavascript( LIBERTY_PKG_PATH.'scripts/LibertyAttachment.js', TRUE );
}
?>
diff --git a/edit_structure_inc.php b/edit_structure_inc.php
index 1a09035..1ce0eaf 100644
--- a/edit_structure_inc.php
+++ b/edit_structure_inc.php
@@ -17,27 +17,6 @@
*/
require_once( '../kernel/setup_inc.php' );
include_once( LIBERTY_PKG_PATH.'LibertyStructure.php');
-$feedback = array();
-$gBitSmarty->assign_by_ref( 'feedback', $feedback );
-
-// mochikit can interfere sometimes, so we need a way to disable it.
-if( empty( $noAjaxContent )) {
- $gBitThemes->loadAjax(
- 'mochikit', array(
- 'Iter.js',
- 'DOM.js',
- 'Format.js',
- 'Style.js',
- 'Signal.js',
- 'Logging.js',
- 'ThickBox.js',
- 'Controls.js',
- 'Color.js',
- 'Position.js',
- 'Visual.js'
- )
- );
-}
if( !@BitBase::verifyId( $_REQUEST["structure_id"] ) ) {
$gBitSystem->fatalError( tra( "No structure indicated" ));
@@ -59,8 +38,12 @@ if( !@BitBase::verifyId( $_REQUEST["structure_id"] ) ) {
$rootStructure->loadNavigation();
$rootStructure->loadPath();
}
- $gContent->verifyUpdatePermission();
+ if( empty( $gContent ) ) {
+ $gContent = LibertyContent::getLibertyObject( $gStructure->getField( 'content_id' ) );
+ $gContent->verifyUpdatePermission();
+ }
$gBitSmarty->assign_by_ref( 'gStructure', $gStructure );
+ $gBitSmarty->assign( 'editingStructure', TRUE );
$gBitSmarty->assign('structureInfo', $gStructure->mInfo);
// Store the actively stored structure name
@@ -68,13 +51,19 @@ if( !@BitBase::verifyId( $_REQUEST["structure_id"] ) ) {
$gBitUser->storePreference( 'edit_structure_id', $rootStructure->mStructureId );
if( ( isset( $_REQUEST["action"] ) && ( $_REQUEST["action"] == 'remove' ) ) || !empty( $_REQUEST["confirm"] ) ) {
- if( $_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 ) ) {
- header( "Location: ".$_SERVER['SCRIPT_NAME'].'?structure_id='.$gStructure->mInfo["parent_id"] );
- die;
+ if( $gBitThemes->isAjaxRequest() ) {
+ $feedback['success'] = tra( "removed from" ).' '.$gContent->getContentTypeName();
+ } else {
+ bit_redirect( $_SERVER['SCRIPT_NAME'].'?structure_id='.$gStructure->mInfo["parent_id"] );
+ }
} else {
- error_log( "Error removing structure: " . vc($gStructure->mErrors ) );
+ $feedback['error'] = $gStructure->mErrors;
}
+ $gBitSmarty->assign_by_ref('feedback', $feedback);
} elseif( $_REQUEST["action"] == 'remove' ) {
$gBitSystem->setBrowserTitle( tra('Confirm removal of ').$gContent->getTitle() );
$formHash['action'] = 'remove';
@@ -97,19 +86,14 @@ if( !@BitBase::verifyId( $_REQUEST["structure_id"] ) ) {
} elseif ($_REQUEST["move_node"] == '4') {
$gStructure->moveNodeEast();
}
- header( "Location: ".$_SERVER['SCRIPT_NAME'].'?structure_id='.$gStructure->mInfo["structure_id"] );
- die;
+ 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"])) {
-// if (isset($_REQUEST["pageAlias"])) {
-// $gStructure->set_page_alias($_REQUEST["structure_id"], $_REQUEST["pageAlias"]);
-// }
-
+ } elseif (isset($_REQUEST["create"]) || (isset( $_REQUEST["action"] ) && $_REQUEST["action"] == 'add') ) {
$structureHash['root_structure_id'] = $rootStructure->mStructureId;
$structureHash['parent_id'] = $_REQUEST['structure_id'];
@@ -132,9 +116,11 @@ if( !@BitBase::verifyId( $_REQUEST["structure_id"] ) ) {
}
}
- $rootTree = $rootStructure->getSubTree( $rootStructure->mStructureId, NULL, array('thumbnail_size'=>'small') );
- $gBitSmarty->assign('subtree', $rootTree);
+ $structureTocId = $rootStructure->mStructureId;
+ $gBitSmarty->assign( 'structureToc', $rootStructure->getToc() );
+ $gBitSmarty->assign( 'structureTocId', $structureTocId );
$gBitSmarty->assign_by_ref('feedback', $feedback);
}
+ $gBitSmarty->assign( 'editingStructure', FALSE );
?>
diff --git a/modules/mod_structure_toc.php b/modules/mod_structure_toc.php
index 19f529a..34ce8ef 100644
--- a/modules/mod_structure_toc.php
+++ b/modules/mod_structure_toc.php
@@ -9,7 +9,7 @@
/**
* Initial Setup
*/
-global $gStructure, $gContent, $moduleParams;
+global $gStructure, $gContent, $moduleParams, $gBitSmarty;
require_once( LIBERTY_PKG_PATH.'LibertyStructure.php' );
extract( $moduleParams );
@@ -36,5 +36,7 @@ if( is_object( $gStructure ) && $gStructure->isValid() && $gStructure->hasViewPe
}
if( is_object( $struct ) && count( $struct->isValid() ) ) {
+ $_template->tpl_vars['moduleTitle'] = new Smarty_variable( $moduleParams['title'] );
+ $toc = $struct->getToc( $struct->mInfo['root_structure_id'], 'asc', FALSE, 2 );
$_template->tpl_vars['modStructureTOC'] = new Smarty_variable( $struct->getToc( $struct->mInfo['root_structure_id'], 'asc', FALSE, 2 ) );
}
diff --git a/plugins/data.img.php b/plugins/data.img.php
index 9b49436..79fb3c9 100644
--- a/plugins/data.img.php
+++ b/plugins/data.img.php
@@ -72,6 +72,9 @@ function data_img( $pData, $pParams ) {
// remove values from the hash that they don't get used in the div as well
$pParams[$key] = NULL;
break;
+ case 'style':
+ $img_style .= ';'.$value;
+ break;
}
}
}
diff --git a/plugins/filter.maketoc.php b/plugins/filter.maketoc.php
index ae9b7b4..0817143 100644
--- a/plugins/filter.maketoc.php
+++ b/plugins/filter.maketoc.php
@@ -238,12 +238,14 @@ function maketoc_create_list( $pTocHash, $pParams ) {
}
}
- $class = 'class="maketoc"';
+ $class = 'maketoc';
if( !empty( $pParams['class'] ) ) {
- $class = 'class="'.$pParams['class'].'"';
+ $class .= ' '.$pParams['class'];
+ } else {
+ $class .= ' well width33p pull-right';
}
- $list = "<div $class $width><h3>" .( !empty( $pParams['title'] ) ? $pParams['title'] : tra( 'Page Contents' ) ).'</h3>'.$list.$toplink.'</div>';
+ $list = "<nav class='$class' $width><h3>" .( !empty( $pParams['title'] ) ? $pParams['title'] : tra( 'Page Contents' ) ).'</h3>'.$list.$toplink.'</nav>';
return $list;
}
diff --git a/templates/add_structure_content.tpl b/templates/add_structure_content.tpl
index db90560..1d047f7 100644
--- a/templates/add_structure_content.tpl
+++ b/templates/add_structure_content.tpl
@@ -1,10 +1,7 @@
{literal}
-<script type="text/javascript">/* <![CDATA[ */
-function submitStructure(pForm,pContentId,pMode) {
- var req = getXMLHttpRequest();
- req.open("POST", {/literal}'{$smarty.const.LIBERTY_PKG_URL}add_structure_content.php'{literal}, true);
- var data = queryString(pForm)+"&content[]="+pContentId+"&ajax_xml=1";
-
+<script type="text/javascript">
+function addStructure(pContentId) {
+ var data = $("#structureaddform").serialize()+"&content[]="+pContentId+"&ajax_xml=1&action=add";
var ajax = new BitBase.SimpleAjax();
var donefn = function (r) {
var responseHash = BitBase.evalJSON( r.responseText );
@@ -15,13 +12,11 @@ function submitStructure(pForm,pContentId,pMode) {
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" );
-
return false;
}
-/* ]]> */</script>
+</script>
{/literal}
{strip}
@@ -31,18 +26,20 @@ function submitStructure(pForm,pContentId,pMode) {
<div class="edit structurecontent">
<div class="header">
- <h1>{tr}Structure Content{/tr}</h1>
+ <h1>{$gContent->getTitle()|escape} {tr}Table of Contents{/tr}</h1>
</div>
{form legend="Add Content" id="structureaddform"}
<input type="hidden" name="structure_id" value="{$structureInfo.structure_id}" />
<input type="hidden" name="tab" value="content" />
+ <div class="row">
+ <div class="col-sm-4">
{if $subtree}
<div class="form-group">
{formlabel label="After page" for="after_ref_id"}
{forminput}
- <select name="after_ref_id" id="after_ref_id">
+ <select class="form-control" name="after_ref_id" id="after_ref_id">
{section name=iy loop=$subtree}
<option value="{$subtree[iy].structure_id}" {if $insert_after eq $subtree[iy].structure_id}selected="selected"{/if}>{$subtree[iy].pos} - {$subtree[iy].title|escape}</option>
{/section}
@@ -51,31 +48,40 @@ function submitStructure(pForm,pContentId,pMode) {
{/forminput}
</div>
{/if}
-
+ </div>
+ <div class="col-sm-3">
{minifind}
{* disable until it can be sorted }
<div class="form-group">
{formlabel label="Search" for="lib-content"}
{forminput}
- <input autocomplete="off" id="contact_name" name="contact[name]" size="30" type="text" value="" />
+ <input class="form-control" autocomplete="off" id="contact_name" name="contact[name]" type="text" value="" />
<div class="auto_complete" id="contact_name_auto_complete"></div>
<script type="text/javascript">new Ajax.Autocompleter('contact_name', 'contact_name_auto_complete', '/presentations/foo.php', {ldelim}{rdelim})</script>
{formhelp note=""}
{/forminput}
</div>
{ *}
+ </div>
+ <div class="col-sm-3">
+ <div class="form-group">
+ {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}
- <div class="form-group">
- {formlabel label="Content type" for="content_type_guid"}
- {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}
+ {html_options class="form-control" multiple="multiple" id="lib-content" size="12" name="content[]" values=$contentList options=$contentList}
+ {/forminput *}
+ </div>
+ </div>
+ <div class="col-sm-1">
+ <a class="btn btn-primary" href="{$smarty.const.BIT_ROOT_URL}index.php?structure_id={$gStructure->mStructureId}">Done</a>
+ </div>
+ </div>
+ <div class="form-group">
{forminput}
<table class="table data">
<thead>
@@ -91,12 +97,12 @@ function submitStructure(pForm,pContentId,pMode) {
<tr class="item {cycle values="even,odd"}" id="{$contentListHash[cx].content_id}li">
<td>
- {assign var=inStructure value=$gStructure->isInStructure($contentListHash[cx].content_id)}
- <div class="icon" {if empty($inStructure)}style="display:none"{/if} id="{$contentListHash[cx].content_id}remove" onclick="submitStructure(document.getElementById('structureaddform'),{$contentListHash[cx].content_id},'remove')">
+ {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 $inStructure}style="display:none"{/if} id="{$contentListHash[cx].content_id}add" onclick="submitStructure(document.getElementById('structureaddform'),{$contentListHash[cx].content_id},'add')">
+ <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>
diff --git a/templates/comments.tpl b/templates/comments.tpl
index a9d8dbf..92f1605 100644
--- a/templates/comments.tpl
+++ b/templates/comments.tpl
@@ -8,13 +8,13 @@
{/if}
<div class="body"{if !( $post_comment_request || $post_comment_preview )} id="editcomments"{/if}>
- <div id="edit_comments" {if $comments_ajax}style="display:none"{/if}>
+ <div id="edit_comments" {if $gBitSystem->isFeatureActive('comments_ajax')}style="display:none"{/if}>
{include file="bitpackage:liberty/comments_post_inc.tpl" post_title="Post Comment"}
</div>
{include file="bitpackage:liberty/comments_display_option_bar.tpl"}
- {if $comments_ajax && $gBitUser->hasPermission( 'p_liberty_post_comments' )}
+ {if $gBitSystem->isFeatureActive('comments_ajax') && $gBitUser->hasPermission( 'p_liberty_post_comments' )}
<div class="form-group">
<input type="submit" class="btn btn-default" name="post_comment_request" value="{tr}Add Comment{/tr}" onclick="LibertyComment.attachForm('comment_{$gContent->mContentId}', '{$gContent->mContentId}', {if $gContent->mContentId}{$gContent->mContentId}{elseif $commentsParentId}{$commentsParentId}{else}null{/if})"/>
</div>
diff --git a/templates/comments_post_inc.tpl b/templates/comments_post_inc.tpl
index feaa70d..8452276 100644
--- a/templates/comments_post_inc.tpl
+++ b/templates/comments_post_inc.tpl
@@ -12,7 +12,7 @@
{formfeedback hash=$formfeedback}
- {if $post_comment_request || $smarty.request.post_comment_preview || $comments_ajax}
+ {if $post_comment_request || $smarty.request.post_comment_preview || $gBitSystem->isFeatureActive('comments_ajax')}
{legend legend=$post_title}
<input type="hidden" name="post_comment_reply_id" value="{$post_comment_reply_id}" />
<input type="hidden" name="post_comment_id" value="{$post_comment_id}" />
@@ -76,9 +76,9 @@
{/if}
<div class="form-group submit">
- <input type="submit" class="btn btn-default" name="post_comment_preview" value="{tr}Preview{/tr}" {if $comments_ajax}onclick="LibertyComment.previewComment(); return false;"{/if}/>&nbsp;
- <input type="submit" class="btn btn-default" name="post_comment_submit" value="{tr}Post{/tr}" {if $comments_ajax}onclick="LibertyComment.postComment(); return false;"{/if}/>&nbsp;
- <input type="submit" class="btn btn-default" name="post_comment_cancel" value="{tr}Cancel{/tr}" {if $comments_ajax}onclick="LibertyComment.cancelComment(true); return false;"{/if}/>
+ <input type="submit" class="btn btn-default" name="post_comment_preview" value="{tr}Preview{/tr}" {if $gBitSystem->isFeatureActive('comments_ajax')}onclick="LibertyComment.previewComment(); return false;"{/if}/>&nbsp;
+ <input type="submit" class="btn btn-default" name="post_comment_submit" value="{tr}Post{/tr}" {if $gBitSystem->isFeatureActive('comments_ajax')}onclick="LibertyComment.postComment(); return false;"{/if}/>&nbsp;
+ <input type="submit" class="btn btn-default" name="post_comment_cancel" value="{tr}Cancel{/tr}" {if $gBitSystem->isFeatureActive('comments_ajax')}onclick="LibertyComment.cancelComment(true); return false;"{/if}/>
</div>
{/legend}
{elseif $gBitUser->hasPermission( 'p_liberty_post_comments' )}
diff --git a/templates/display_comment.tpl b/templates/display_comment.tpl
index 699d08f..70c554c 100644
--- a/templates/display_comment.tpl
+++ b/templates/display_comment.tpl
@@ -7,7 +7,7 @@
<div class="post" id="comment_{$comment.content_id}">
<div class="floaticon">
{if $gBitUser->hasPermission( 'p_liberty_post_comments' )}
- {if $comments_ajax }
+ {if $gBitSystem->isFeatureActive('comments_ajax') }
<a href="javascript:void(0);" onclick="LibertyComment.attachForm('comment_{$comment.content_id}', '{$comment.content_id}', '{$comment.root_id}')">{booticon iname="icon-comment-alt" ipackage="icons" iexplain="Reply to this comment"}</a>
{else}
<a href="#">{booticon iname="icon-comment-alt" class="icon" onclick="window.location='`$comments_return_url`&amp;post_comment_reply_id=`$comment.content_id`&amp;post_comment_request=1#editcomments';" iexplain="Reply to this comment" }</a>
diff --git a/templates/edit_format.tpl b/templates/edit_format.tpl
index 99b2152..1f9922c 100644
--- a/templates/edit_format.tpl
+++ b/templates/edit_format.tpl
@@ -1,6 +1,6 @@
{strip}
{* comment or content @TODO pass in as a var in includes *}
-{if ( $post_comment_request || $post_comment_preview || $comments_ajax ) && $gComment}
+{if ( $post_comment_request || $post_comment_preview || $gBitSystem->isFeatureActive('comments_ajax') ) && $gComment}
{assign var=contentObject value=$gComment}
{else}
{assign var=contentObject value=$gContent}
diff --git a/templates/edit_structure.tpl b/templates/edit_structure.tpl
index 8e7521a..4c29aa1 100644
--- a/templates/edit_structure.tpl
+++ b/templates/edit_structure.tpl
@@ -6,32 +6,149 @@
{assign var=structureName value="Structure"}
{/if}
-{if $gBitThemes->isAjaxLib('mochikit')}
+<script type="text/javascript" src="{$smarty.const.UTIL_PKG_URL}javascript/jquery-acisortable/jquery.aciPlugin.min.js"></script>
+<script type="text/javascript" src="{$smarty.const.UTIL_PKG_URL}javascript/jquery-acisortable/jquery.aciSortable.js"></script>
- <div class="form-group">
- <div class="formlabel">
- {$gContent->getContentTypeName()} {tr}Structure{/tr}
- <br/>
- <a href="{$smarty.const.LIBERTY_PKG_URL}add_structure_content.php?structure_id={$smarty.request.structure_id}&amp;content_type_guid={$smarty.request.content_type_guid}" title="Add Content to {$gContent->getTitle()}" title="Add Content">Add Content</a>
- </div>
- {forminput}
- {include file="bitpackage:liberty/edit_structure_inc.tpl"}
- {/forminput}
- </div>
+{$structureToc}
-{else}
+<script type="text/javascript">
+$.fn.aciSortable.defaults.container = 'ol';
+$('#structure-{$structureTocId}').aciSortable( {literal}{
+ child: 50,
+ draggable: true,
+ childHolder: '<ol class="structure-toc"></ol>',
+ childHolderSelector: '.structure-toc',
+ exclude: '.exclude',
+ handle: '.structure-sort-handle',
+ helper: '<div class="structure-sort-helper"></div>',
+ helperSelector: '.structure-sort-helper',
+ start: function(item, placeholder, helper) {
+ // show item inside helper
+ helper.css({
+ opacity: 0.8
+ }).html(item.html());
+ // do not fadeIn helper if the item is from other sortable
+ if (this.hasItem(item)) {
+ helper.fadeIn();
+ }
+ item.slideUp();
+ },
+ end: function(item, hover, placeholder, helper) {
+ if (placeholder.parent().length) {
+ // add item after placeholder
+ placeholder.after(item).detach();
+ }
+ item.slideDown();
+ var top = $(window).scrollTop();
+ var left = $(window).scrollLeft();
+ var rect = item.get(0).getBoundingClientRect();
+ // animate helper to item position
+ helper.animate({
+ top: rect.top + top,
+ left: rect.left + left,
+ opacity: 0
+ },
+ {
+ complete: function() {
+ // when completed detach the helper
+ helper.detach();
+ }
+ });
+ }
+}{/literal} );
- {jstabs}
- {jstab title="`$structureName` Organization"}
- {include file="bitpackage:liberty/edit_structure_inc.tpl"}
- {/jstab}
- {if !$gBitSystem->isFeatureActive( 'wikibook_hide_add_content' )}
- {jstab title="`$structureName` Content"}
- {include file="bitpackage:liberty/edit_structure_content.tpl"}
- {/jstab}
- {/if}
- {/jstabs}
+{literal}
+// Changes XML to JSON
+function structureTocToJson(xml) {
+ if (xml.nodeName == 'LI') { // element
+ if( xml.attributes.length == 0 ) {
+ // do children
+ if (xml.hasChildNodes()) {
+ for(var i = 0; i < xml.childNodes.length; i++) {
+ var childNode = xml.childNodes.item(i);
+console.log( childNode );
+ return structureTocToJson(childNode);
+ }
+ }
+ } else {
+ var obj = {};
-{/if}
+ // do attributes
+ if (xml.attributes.length > 0) {
+ for (var j = 0; j < xml.attributes.length; j++) {
+ var attribute = xml.attributes.item(j);
+ if( attribute.nodeName == "structure_id" || attribute.nodeName == "content_id" ) {
+ obj[attribute.nodeName] = attribute.value;
+ }
+ }
+ }
+ // do children
+ if (xml.hasChildNodes()) {
+ var children = null;
+ childObjects = [];
+ for(var i = 0; i < xml.childNodes.length; i++) {
+ var childNode = xml.childNodes.item(i);
+ if( childNode.nodeName == "OL" ) {
+ children = structureTocToJson(childNode);
+ if( children ) {
+ obj["children"] = children;
+ }
+ }
+ }
+ }
+ return obj;
+ }
+ } else if( xml.nodeName == 'OL' ) {
+ var obj = [];
+ // do children
+ if (xml.hasChildNodes()) {
+ for(var i = 0; i < xml.childNodes.length; i++) {
+ var childNode = xml.childNodes.item(i);
+ if( childNode.nodeName == "LI" ) {
+ var children = structureTocToJson(childNode);
+ if( children ) {
+ obj.push(children);
+ }
+ }
+ }
+ }
+ return obj;
+ }
+ return null;
+
+};
+
+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}
+ type: 'POST',
+ context: document.body,
+ data: { 'structure_json': structureTocToJson(document.getElementById('structure-branch-'+pStructureId)) }
+ })
+ .done(function( response ) {
+ $("#structure-feedback").html( response );
+ });
+}
+
+var undoHash = [];
+
+function deleteStructureNode( pStructureId, pStructureText ) {
+ if( confirm( "Are you sure you want to delete the following item, and all of its children? This cannot be undone."+"\n\nDELETE: "+pStructureText) ) {
+ var eleId = '#structure-node-'+pStructureId;
+ $(eleId).detach();
+ // One day undoHash could be popped for undo
+ undoHash.push( $(eleId) );
+ }
+}
+{/literal}
+
+</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}&amp;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>
+
+{*<pre id="pre-tree"></pre>*}
{/strip}
diff --git a/templates/edit_structure_alias.tpl b/templates/edit_structure_alias.tpl
deleted file mode 100644
index e7b67e3..0000000
--- a/templates/edit_structure_alias.tpl
+++ /dev/null
@@ -1,45 +0,0 @@
-{strip}
-<div>
- {form legend="Update Page Alias"}
- <input type="hidden" name="structure_id" value="{$structureInfo.structure_id}" />
- <input type="hidden" name="tab" value="alias" />
-
- <div class="form-group">
- {formlabel label="Page Alias" for="pageAlias"}
- {forminput}
- <input type="text" name="pageAlias" id="pageAlias" value="{$structureInfo.page_alias}" size="30" maxlength="240"/>
- {formhelp note=""}
- {/forminput}
- </div>
-
- <div class="form-group submit">
- <input type="submit" class="btn btn-default" name="create" value="{tr}Update{/tr}"/>
- </div>
- {/form}
-</div>
-
-<div class="structuretoc">
- <ul class="toc">
- <li>
- {section name=ix loop=$subtree}
- {if $subtree[ix].pos eq ''}
- {if $structureInfo.structure_id eq $subtree[ix].structure_id}<div class="highlight">{/if}
- <a href="{$smarty.server.SCRIPT_NAME}?structure_id={$subtree[ix].structure_id}&amp;tab=alias">{$subtree[ix].title|escape}</a>
- {if $structureInfo.structure_id eq $subtree[ix].structure_id}</div>{/if}
- {else}
- {if $subtree[ix].first}<ul>{else}</li>{/if}
- {if $subtree[ix].last}</ul>{else}
- <li>
- {if $structureInfo.structure_id eq $subtree[ix].structure_id}<div class="highlight">{/if}
- <strong>{$subtree[ix].pos}</strong>
- <a href="{$smarty.server.SCRIPT_NAME}?structure_id={$subtree[ix].structure_id}&amp;tab=alias">{$subtree[ix].title|escape}</a>
- {if $structureInfo.structure_id eq $subtree[ix].structure_id}</div>{/if}
- {/if}
- {/if}
- {/section}
- </li>
- </ul><!-- end outermost .toc -->
-</div>
-<div class="clear"></div>
-
-{/strip}
diff --git a/templates/edit_structure_inc.tpl b/templates/edit_structure_inc.tpl
deleted file mode 100644
index fc8169c..0000000
--- a/templates/edit_structure_inc.tpl
+++ /dev/null
@@ -1,60 +0,0 @@
-{strip}
-<div class="DynamicTree">
- <div class="tree-wrapper1">
- {section name=ix loop=$subtree}
- {if $subtree[ix].pos eq ''}
- <h2>{$subtree[ix].title|escape} {if $subtree[ix].page_alias}({/if}{$subtree[ix].page_alias}{if $subtree[ix].page_alias}){/if}</h2>
- {/if}
- {/section}
-
- <div class="tree-wrapper2" id="tree">
- {section name=ix loop=$subtree}
- {if $subtree[ix].pos ne ''}
- {if $subtree[ix].first}{else}</div>{/if}
- {if $subtree[ix].last}{else}
- <div class="{if $subtree[ix].has_children}folder{else}doc{/if}">
- <a href="{$smarty.const.WIKI_PKG_URL}index.php?structure_id={$subtree[ix].structure_id}" target="{$subtree[ix].content_id}" title="{$subtree[ix].structure_id}">{$subtree[ix].title|escape}{if $subtree[ix].page_alias} ({$subtree[ix].page_alias}){/if}</a>
- {/if}
- {/if}
- {/section}
- </div>
- </div>
-
- <ul class="list-inline">
- <li><a id="tree-moveUp" href="javascript:void(0)">{booticon iname="icon-arrow-up" ipackage="icons" iexplain="Up"}</a></li>
- <li><a id="tree-moveDown" href="javascript:void(0)">{booticon iname="icon-arrow-down" ipackage="icons" iexplain="Down"}</a></li>
- <li><a id="tree-moveLeft" href="javascript:void(0)">{booticon iname="icon-arrow-left" ipackage="icons" iexplain="Left"}</a></li>
- <li><a id="tree-moveRight" href="javascript:void(0)">{booticon iname="icon-arrow-right" ipackage="icons" iexplain="Right"}</a></li>
- {if !$no_delete}
- <li><a id="tree-remove" href="javascript:void(0)">{booticon iname="icon-trash" ipackage="icons" iexplain="Remove"}</a></li>
- {else}
- <input id="tree-remove" type="hidden" value="dummy">
- {/if}
- <li><a id="tree-convert" href="javascript:void(0)">{booticon ipackage=liberty iname="icon-folder-close" iexplain="Folder"} &larr; &rarr; {booticon iname="icon-file-alt" iexplain="Document"}</a></li>
- <li><small id="tree-tooltip"></small></li>
- </ul>
-</div>
-
-{form id="tree-store"}
- <input type="hidden" name="structure_string" id="structure_string" value="" />
- <input type="hidden" name="structure_id" value="{$gStructure->mInfo.structure_id}" />
- <input type="hidden" name="root_structure_id" value="{$gStructure->mInfo.root_structure_id}" />
- <div class="form-group submit">
- <noscript>
- <p class="warning">{tr}The Structure organisation system only works with javascript turned on{/tr}</p>
- </noscript>
- <input type="submit" class="btn btn-default" name="submit_structure" value="Save Changes" />
- </div>
- {formhelp note="To nest items, you first need to convert a page to a folder and then insert at least one item into the new folder before saving."}
- {if !$no_delete}
- {formhelp note="You can only delete a folder when it is empty."}
- {/if}
-{/form}
-{/strip}
-
-<script type="text/javascript">//<![CDATA[
- var tree = new DynamicTreeBuilder("tree");
- tree.init();
- DynamicTreePlugins.call(tree);
-//]]></script>
-<script type="text/javascript" src="{$smarty.const.UTIL_PKG_URL}javascript/libs/mygosu/actions.js"></script>
diff --git a/templates/html_head_inc.tpl b/templates/html_head_inc.tpl
index 9b45694..ace495e 100644
--- a/templates/html_head_inc.tpl
+++ b/templates/html_head_inc.tpl
@@ -15,7 +15,7 @@
{* perhaps we can remove this as well at some point and load it using
$gBitThemes->loadJavascript(); *}
-{if $comments_ajax}
+{if $gBitSystem->isFeatureActive('comments_ajax')}
<script src="{$smarty.const.LIBERTY_PKG_URL}scripts/LibertyComment.js" type="text/javascript"></script>
<script type="text/javascript">
LibertyComment.ROOT_ID = {if $gContent->mContentId}{$gContent->mContentId}{elseif $commentsParentId}{$commentsParentId}{else}null{/if}; {* this is the content id - would be better as part of something in kernel but here it is until that day *}
diff --git a/templates/service_content_icon_inc.tpl b/templates/service_content_icon_inc.tpl
index 574c773..bb402f1 100644
--- a/templates/service_content_icon_inc.tpl
+++ b/templates/service_content_icon_inc.tpl
@@ -15,10 +15,10 @@
{if $gContent->hasUserPermissions()}
{assign var=iconClass value="highlight"}
{/if}
- {if $role_model }
- {smartlink ipackage=liberty ifile="content_role_permissions.php" ititle="Assign Permissions" booticon="icon-key" class=$iconClass ipackage=liberty ifile="content_permissions.php" content_id="$serviceHash.content_id"}
+ {if $smarty.const.ROLE_MODEL }
+ {smartlink ipackage=liberty ifile="content_role_permissions.php" ititle="Assign Permissions" booticon="icon-key" class=$iconClass ipackage=liberty ifile="content_permissions.php" content_id=$serviceHash.content_id}
{else}
- {smartlink ipackage=liberty ifile="content_permissions.php" ititle="Assign Permissions" booticon="icon-key" class=$iconClass ipackage=liberty ifile="content_permissions.php" content_id="$serviceHash.content_id"}
+ {smartlink ipackage=liberty ifile="content_permissions.php" ititle="Assign Permissions" booticon="icon-key" class=$iconClass ipackage=liberty ifile="content_permissions.php" content_id=$serviceHash.content_id}
{/if}
{/if}
{/if}
diff --git a/templates/structure_toc.tpl b/templates/structure_toc.tpl
index cd7c434..800580b 100755
--- a/templates/structure_toc.tpl
+++ b/templates/structure_toc.tpl
@@ -1 +1 @@
-<ul class="toc">{section name=sitem loop=$structure_tree}{include file="structures_toc_level.tpl" that=$structure_tree[sitem]}{/section}</ul>
+<ol class="structure-toc" id="structure-branch">{section name=sitem loop=$structure_tree}{include file="bitpackage:liberty/structure_toc_level.tpl" that=$structure_tree[sitem]}{/section}</ul>
diff --git a/templates/structure_toc_endul.tpl b/templates/structure_toc_endul.tpl
index 3d3a44c..8de35c6 100755
--- a/templates/structure_toc_endul.tpl
+++ b/templates/structure_toc_endul.tpl
@@ -1 +1 @@
-</ul>
+</ol>
diff --git a/templates/structure_toc_leaf.tpl b/templates/structure_toc_leaf.tpl
index 271edaa..45c63e4 100755
--- a/templates/structure_toc_leaf.tpl
+++ b/templates/structure_toc_leaf.tpl
@@ -1,4 +1,10 @@
-<li {if $structure_tree.structure_id==$smarty.request.structure_id}class="highlight"{/if}>
- {if $numbering && $structure_tree.prefix}<span class="numbering">{$structure_tree.prefix}</span>{/if}
- <a href="{$structure_tree.display_url|default:"`$smarty.const.WIKI_PKG_URL`index.php?structure_id=`$structure_tree.structure_id`"}">{$structure_tree.title|escape}</a>
-</li>
+{strip}
+<li {if $editingStructure}id="structure-node-{$structure_tree.structure_id}" content_id="{$structure_tree.content_id}" structure_id="{$structure_tree.structure_id}"{/if} {if $structure_tree.structure_id==$smarty.request.structure_id}class="highlight"{/if}>
+ {if $editingStructure}
+ <div class="inline-block">
+ <div class="btn btn-default btn-xs" onclick="deleteStructureNode('{$structure_tree.structure_id}','{$structure_tree.title|escape:javascript}')">{booticon iname="icon-trash" class="icon"}</div>
+ <span class="inline-block" style="padding:5px;">{booticon iname="icon-move" class="structure-sort-handle"}</span>
+ </div>
+ {/if}
+ <a href="{$structure_tree.display_url|default:"`$smarty.const.WIKI_PKG_URL`index.php?structure_id=`$structure_tree.structure_id`"}">{$structure_tree.title|escape}</a>
+{/strip}
diff --git a/templates/structure_toc_level.tpl b/templates/structure_toc_level.tpl
index 6c369f3..697d2dc 100755
--- a/templates/structure_toc_level.tpl
+++ b/templates/structure_toc_level.tpl
@@ -1 +1 @@
-<li {if $that.structure_id==$smarty.request.structure_id}class="highlight"{/if}><a href="{$smarty.const.WIKI_PKG_URL}index.php?structure_id={$that.structure_id}">{$that.title|escape}</a></li>{if $that.sub}<li><ul>{section name=xitem loop=$that.sub}{include file="structures_toc_level.tpl" that=$that.sub[xitem]}{/section}</ul></li>{/if}
+<li id="structure-node-{$that.structure_id}" content_id="{$that.content_id}" structure_id="{$that.structure_id}">{if $that.structure_id==$smarty.request.structure_id}class="highlight"{/if}><a href="{$smarty.const.WIKI_PKG_URL}index.php?structure_id={$that.structure_id}">{$that.title|escape}</a></li>{if $that.sub}<li><ul id="structure-branch-{$that.structure_id}">{section name=xitem loop=$that.sub}{include file="bitpackage:liberty/structure_toc_level.tpl" that=$that.sub[xitem]}{/section}</ul></li>{/if}
diff --git a/templates/structure_toc_startul.tpl b/templates/structure_toc_startul.tpl
index be10942..cb6eeee 100755
--- a/templates/structure_toc_startul.tpl
+++ b/templates/structure_toc_startul.tpl
@@ -1 +1 @@
-<ul class="toc">
+<ol class="structure-toc" id="structure-branch-{$structureId}" structure_id="{$structureId}">