summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Fowler <spider@viovio.com>2007-05-20 19:45:06 +0000
committerChristian Fowler <spider@viovio.com>2007-05-20 19:45:06 +0000
commitcd1794b35e8d6e8296875e8d2376718e26e5109f (patch)
tree6b9d83286bbfb1716c4e3a565a40a9d562ca1979
parentbb3dff73c48c59a98ee1bf334012ac36a6ce597f (diff)
downloadliberty-cd1794b35e8d6e8296875e8d2376718e26e5109f.tar.gz
liberty-cd1794b35e8d6e8296875e8d2376718e26e5109f.tar.bz2
liberty-cd1794b35e8d6e8296875e8d2376718e26e5109f.zip
migrate to new ajax-ified structure editing. work in progress, currently uses ThickBox, will likely remove. checkout beware\!
-rw-r--r--add_structure_content.php29
-rw-r--r--edit_structure_inc.php16
-rw-r--r--modules/mod_structure_toc.php4
-rw-r--r--templates/add_structure_content.tpl58
-rw-r--r--templates/add_structure_feedback_inc.tpl1
-rw-r--r--templates/edit_structure.tpl51
6 files changed, 149 insertions, 10 deletions
diff --git a/add_structure_content.php b/add_structure_content.php
new file mode 100644
index 0000000..d4e2004
--- /dev/null
+++ b/add_structure_content.php
@@ -0,0 +1,29 @@
+<?php
+
+$gLiteweightScan = TRUE;
+require_once( '../bit_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_PATH.'lookup_content_inc.php' );
+require_once( LIBERTY_PKG_PATH.'edit_structure_inc.php' );
+
+error_log( print_r( $_REQUEST, TRUE ) );
+
+if( $gBitSystem->isAjaxRequest() ) {
+ header( 'Content-Type: text/html; charset=utf-8' );
+ print $gBitSmarty->fetch( "bitpackage:liberty/add_structure_feedback_inc.tpl" );
+ exit;
+} else {
+ if( !$gBitSystem->loadAjax( 'mochikit', array( 'Iter.js', 'DOM.js', 'Format.js', 'Style.js', 'Signal.js', 'Logging.js', 'ThickBox.js' ) ) ) {
+ // do something....
+ }
+ $gBitSystem->display( 'bitpackage:liberty/add_structure_content.tpl', "Add Content" );
+}
+
+?>
diff --git a/edit_structure_inc.php b/edit_structure_inc.php
index 3f398d3..13c8dde 100644
--- a/edit_structure_inc.php
+++ b/edit_structure_inc.php
@@ -3,7 +3,7 @@
* edit_structure_inc
*
* @author Christian Fowler>
- * @version $Revision: 1.19 $
+ * @version $Revision: 1.20 $
* @package liberty
* @subpackage functions
*/
@@ -19,6 +19,8 @@ require_once( '../bit_setup_inc.php' );
include_once( LIBERTY_PKG_PATH.'LibertyStructure.php');
$gBitSmarty->assign_by_ref( 'feedback', $feedback = array() );
+$gBitSystem->loadAjax( 'mochikit', array( 'Iter.js', 'DOM.js', 'Format.js', 'Style.js', 'Signal.js', 'Logging.js', 'ThickBox.js', 'Controls.js' ) );
+
if( !@BitBase::verifyId( $_REQUEST["structure_id"] ) ) {
$gBitSystem->fatalError( tra( "No structure indicated" ));
} else {
@@ -123,13 +125,19 @@ if( !@BitBase::verifyId( $_REQUEST["structure_id"] ) ) {
} elseif(!empty($_REQUEST['content'])) {
foreach ($_REQUEST['content'] as $conId ) {
$structureHash['content_id'] = $conId;
- $new_structure_id = $gStructure->storeNode( $structureHash );
- $structureHash['after_ref_id'] = $new_structure_id;
+ if( $new_structure_id = $gStructure->storeNode( $structureHash ) ) {
+ $structureHash['after_ref_id'] = $new_structure_id;
+ $feedback['success'] = tra( "Items added." );
+ } else {
+ $feedback['failure'] = $gStructure->mErrors;
+ }
}
}
}
- $gBitSmarty->assign('subtree', $rootTree = $rootStructure->getSubTree( $rootStructure->mStructureId ));
+ $rootTree = $rootStructure->getSubTree( $rootStructure->mStructureId );
+ $gBitSmarty->assign('subtree', $rootTree);
+ $gBitSmarty->assign_by_ref('feedback', $feedback);
}
?>
diff --git a/modules/mod_structure_toc.php b/modules/mod_structure_toc.php
index 3f36042..f109a62 100644
--- a/modules/mod_structure_toc.php
+++ b/modules/mod_structure_toc.php
@@ -1,5 +1,5 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_liberty/modules/mod_structure_toc.php,v 1.4 2006/12/23 18:55:44 squareing Exp $
+// $Header: /cvsroot/bitweaver/_bit_liberty/modules/mod_structure_toc.php,v 1.5 2007/05/20 19:45:06 spiderr Exp $
/**
* Params:
* @package liberty
@@ -11,7 +11,9 @@ if( is_object( $gContent ) && ( empty( $gStructure ) || !$gStructure->isValid()
$structures = $gContent->getStructures();
// We take the first structure. not good, but works for now - spiderr
if( !empty( $structures[0] ) ) {
+ require_once( LIBERTY_PKG_PATH.'LibertyStructure.php' );
$struct = new LibertyStructure( $structures[0]['structure_id'] );
+ $struct->load();
}
} else {
$struct = &$gStructure;
diff --git a/templates/add_structure_content.tpl b/templates/add_structure_content.tpl
new file mode 100644
index 0000000..d032e4f
--- /dev/null
+++ b/templates/add_structure_content.tpl
@@ -0,0 +1,58 @@
+
+{strip}
+
+<div id="structureaddresult"></div>
+
+<div class="structurecontent">
+ {form legend="Add Content" id="structureaddform"}
+ <input type="hidden" name="structure_id" value="{$structureInfo.structure_id}" />
+ <input type="hidden" name="tab" value="content" />
+
+ {if $subtree}
+ <div class="row">
+ {formlabel label="After page" for="after_ref_id"}
+ {forminput}
+ <select 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} {$insert_after} {$subtree[iy].structure_id}</option>
+ {/section}
+ </select>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+ {/if}
+
+ <div class="row">
+ {formlabel label="Search" for="lib-content"}
+ {forminput}
+ <input type="text" name="find_objects" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {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}
+ </div>
+
+ <div id=foosubmit onclick="submitStructureAdd($('structureaddform'));">foo submit</div>
+
+ <div class="row submit">
+ <input type="submit" onclick="submitStructureAdd(this.form);return false;" name="create" value="{tr}Add Content{/tr}" />
+ </div>
+ {/form}
+</div>
+
+<div class="structuretoc">
+ <ul class="toc">
+ <li>
+ </li>
+ </ul><!-- end outermost .toc -->
+</div>
+<div class="clear"></div>
+{/strip}
diff --git a/templates/add_structure_feedback_inc.tpl b/templates/add_structure_feedback_inc.tpl
new file mode 100644
index 0000000..5534b67
--- /dev/null
+++ b/templates/add_structure_feedback_inc.tpl
@@ -0,0 +1 @@
+{formfeedback hash=$feedback}
diff --git a/templates/edit_structure.tpl b/templates/edit_structure.tpl
index 3a1aaa8..a2b14fe 100644
--- a/templates/edit_structure.tpl
+++ b/templates/edit_structure.tpl
@@ -3,6 +3,49 @@
{if !$structureName}
{assign var=structureName value="Structure"}
{/if}
+
+{literal}
+
+{*
+<input autocomplete="off" id="contact_name" name="contact[name]" size="30" 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', {})</script>
+*}
+
+{/literal}
+
+{if $gBitSystem->mAjax=='mochikit'}
+{literal}
+<script type="text/javascript">//<![CDATA[
+function submitStructureAdd(pForm) {
+ var req = getXMLHttpRequest();
+ req.open("POST", {/literal}'{$smarty.const.LIBERTY_PKG_URL}add_structure_content.php'{literal}, true);
+ req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ var data = queryString(pForm)+"&ajax_xml=1";
+ var d = sendXMLHttpRequest(req, data);
+ d.addBoth( structureAddResult );
+ return false;
+}
+
+var structureAddResult = function (response) {
+ $("structureaddresult").innerHTML = response.responseText;
+};
+
+//]]></script>
+{/literal}
+
+<div class="row">
+ <div class="formlabel">
+ {$gContent->getContentTypeDescription()} {tr}Structure{/tr}
+ </div>
+ {forminput}
+<a href="{$smarty.const.LIBERTY_PKG_URL}add_structure_content.php?structure_id={$smarty.request.structure_id}&amp;height=600&amp;width=600&amp;modal=true" title="Add Content to {$gContent->getTitle()}" class="thickbox" title="Add Content">Add Content</a>
+ {include file="bitpackage:liberty/edit_structure_inc.tpl"}
+ {/forminput}
+</div>
+
+{else}
+
{jstabs}
{jstab title="`$structureName` Organization"}
{include file="bitpackage:liberty/edit_structure_inc.tpl"}
@@ -12,10 +55,8 @@
{include file="bitpackage:liberty/edit_structure_content.tpl"}
{/jstab}
{/if}
-{* removing alias stuff until we know what to do with it - XING
- {jstab title="Update Alias"}
- {include file="bitpackage:liberty/edit_structure_alias.tpl"}
- {/jstab}
-*}
{/jstabs}
+
+{/if}
+
{/strip}