From 2034d4e8b5866c7c2148aecda5933f57253f4a21 Mon Sep 17 00:00:00 2001 From: Max Kremmel Date: Wed, 25 Jan 2006 19:19:35 +0000 Subject: rename assign_content files --- assign_content.php | 112 +++++++++++++++++++++++++++++++++++ assign_non_members.php | 112 ----------------------------------- templates/assign_content.tpl | 123 +++++++++++++++++++++++++++++++++++++++ templates/assign_non_members.tpl | 122 -------------------------------------- templates/menu_pigeonholes.tpl | 2 +- 5 files changed, 236 insertions(+), 235 deletions(-) create mode 100644 assign_content.php delete mode 100644 assign_non_members.php create mode 100644 templates/assign_content.tpl delete mode 100644 templates/assign_non_members.tpl diff --git a/assign_content.php b/assign_content.php new file mode 100644 index 0000000..9ab5a77 --- /dev/null +++ b/assign_content.php @@ -0,0 +1,112 @@ +verifyPackage( 'pigeonholes' ); +$gBitSystem->verifyPermission( 'bit_p_insert_pigeonhole_member' ); + +include_once( PIGEONHOLES_PKG_PATH.'lookup_pigeonholes_inc.php' ); + +$feedback = ''; +$gBitSmarty->assign_by_ref( 'feedback', $feedback ); + +$contentTypes = array( '' => tra( 'All Content' ) ); +foreach( $gLibertySystem->mContentTypes as $cType ) { + $contentTypes[$cType['content_type_guid']] = $cType['content_description']; +} +$gBitSmarty->assign( 'contentTypes', $contentTypes ); +$gBitSmarty->assign( 'contentSelect', $contentSelect = !isset( $_REQUEST['content_type'] ) ? NULL : $_REQUEST['content_type'] ); + +$listHash = array( + 'find' => ( empty( $_REQUEST['find_objects'] ) ? NULL : $_REQUEST['find_objects'] ), + 'sort_mode' => ( empty( $_REQUEST['sort_mode'] ) ? NULL : $_REQUEST['sort_mode'] ), + 'max_records' => ( @BitBase::verifyId( $_REQUEST['max_records'] ) ) ? $_REQUEST['max_records'] : 10, + 'include_members' => ( ( !empty( $_REQUEST['include'] ) && $_REQUEST['include'] == 'members' ) ? TRUE : FALSE ), + 'content_type' => $contentSelect, +); +$assignableContent = $gContent->getAssignableContent( $listHash ); + +if( !empty( $_REQUEST['insert_content'] ) && isset( $_REQUEST['pigeonhole'] ) ) { + // here we need to limit all killing to the selected structure + $deletableParentIds = array(); + if( empty( $gStructure ) && @BitBase::verifyId( $_REQUEST['root_structure_id'] ) ) { + $gStructure = new LibertyStructure(); + $struct = $gStructure->getStructure( $_REQUEST['root_structure_id'] ); + foreach( $struct as $node ) { + $deletableParentIds[] = $node['content_id']; + } + } + + // make an array that can be stored + foreach( $assignableContent as $item ) { + if( !empty( $_REQUEST['pigeonhole'][$item['content_id']] ) ) { + foreach( $_REQUEST['pigeonhole'][$item['content_id']] as $parent_id ) { + $memberHash[$parent_id][] = array( + 'parent_id' => $parent_id, + 'content_id' => $item['content_id'], + ); + } + } + + if( !empty( $_REQUEST['include'] ) && $_REQUEST['include'] == 'members' ) { + if( !empty( $item['content_id'] ) && !$gContent->expungePigeonholeMember( array( 'member_id' => $item['content_id'], 'deletables' => $deletableParentIds ) ) ) { + $feedback['error'] = 'The content could not be deleted before insertion.'; + } + } + } + + if( empty( $feedback['error'] ) ) { + foreach( $memberHash as $memberStore ) { + if( $gContent->insertPigeonholeMember( $memberStore ) ) { + $feedback['success'] = 'The content was successfully inserted into the respective categories.'; + } else { + $feedback['error'] = 'The content could not be inserted into the categories.'; + } + } + } + + // we need to reload the assignableContent, since settings have changed + // reuse previous listhash since display settings aren't changed + $assignableContent = $gContent->getAssignableContent( $listHash ); +} + +$listHash = array( + 'load_only_root' => TRUE, + 'max_records' => -1, +); +$pigeonRootData = $gContent->getList( $listHash ); +$pigeonRoots[0] = 'All'; +foreach( $pigeonRootData as $root ) { + $pigeonRoots[$root['root_structure_id']] = $root['title']; +} +$gBitSmarty->assign( 'pigeonRoots', !empty( $pigeonRoots ) ? $pigeonRoots : NULL ); + +$listHash = array( + 'root_structure_id' => ( !empty( $_REQUEST['root_structure_id'] ) ? $_REQUEST['root_structure_id'] : NULL ), + 'force_extras' => TRUE, + 'max_records' => -1, +); +$pigeonList = $gContent->getList( $listHash ); +$gBitSmarty->assign( 'pigeonList', $pigeonList ); +$gBitSmarty->assign( 'assignableContent', $assignableContent ); +$gBitSmarty->assign( 'contentCount', count( $assignableContent ) ); + +// Display the template +$gBitSystem->display( 'bitpackage:pigeonholes/assign_content.tpl', tra( 'Assign Content to Categories' ) ); +?> diff --git a/assign_non_members.php b/assign_non_members.php deleted file mode 100644 index bd85307..0000000 --- a/assign_non_members.php +++ /dev/null @@ -1,112 +0,0 @@ -verifyPackage( 'pigeonholes' ); -$gBitSystem->verifyPermission( 'bit_p_insert_pigeonhole_member' ); - -include_once( PIGEONHOLES_PKG_PATH.'lookup_pigeonholes_inc.php' ); - -$feedback = ''; -$gBitSmarty->assign_by_ref( 'feedback', $feedback ); - -$contentTypes = array( '' => tra( 'All Content' ) ); -foreach( $gLibertySystem->mContentTypes as $cType ) { - $contentTypes[$cType['content_type_guid']] = $cType['content_description']; -} -$gBitSmarty->assign( 'contentTypes', $contentTypes ); -$gBitSmarty->assign( 'contentSelect', $contentSelect = !isset( $_REQUEST['content_type'] ) ? NULL : $_REQUEST['content_type'] ); - -$listHash = array( - 'find' => ( empty( $_REQUEST['find_objects'] ) ? NULL : $_REQUEST['find_objects'] ), - 'sort_mode' => ( empty( $_REQUEST['sort_mode'] ) ? NULL : $_REQUEST['sort_mode'] ), - 'max_records' => ( @BitBase::verifyId( $_REQUEST['max_records'] ) ) ? $_REQUEST['max_records'] : 10, - 'include_members' => ( ( !empty( $_REQUEST['include'] ) && $_REQUEST['include'] == 'members' ) ? TRUE : FALSE ), - 'content_type' => $contentSelect, -); -$assignableContent = $gContent->getAssignableContent( $listHash ); - -if( !empty( $_REQUEST['insert_content'] ) && isset( $_REQUEST['pigeonhole'] ) ) { - // here we need to limit all killing to the selected structure - $deletableParentIds = array(); - if( empty( $gStructure ) && @BitBase::verifyId( $_REQUEST['root_structure_id'] ) ) { - $gStructure = new LibertyStructure(); - $struct = $gStructure->getStructure( $_REQUEST['root_structure_id'] ); - foreach( $struct as $node ) { - $deletableParentIds[] = $node['content_id']; - } - } - - // make an array that can be stored - foreach( $assignableContent as $item ) { - if( !empty( $_REQUEST['pigeonhole'][$item['content_id']] ) ) { - foreach( $_REQUEST['pigeonhole'][$item['content_id']] as $parent_id ) { - $memberHash[$parent_id][] = array( - 'parent_id' => $parent_id, - 'content_id' => $item['content_id'], - ); - } - } - - if( !empty( $_REQUEST['include'] ) && $_REQUEST['include'] == 'members' ) { - if( !empty( $item['content_id'] ) && !$gContent->expungePigeonholeMember( array( 'member_id' => $item['content_id'], 'deletables' => $deletableParentIds ) ) ) { - $feedback['error'] = 'The content could not be deleted before insertion.'; - } - } - } - - if( empty( $feedback['error'] ) ) { - foreach( $memberHash as $memberStore ) { - if( $gContent->insertPigeonholeMember( $memberStore ) ) { - $feedback['success'] = 'The content was successfully inserted into the respective categories.'; - } else { - $feedback['error'] = 'The content could not be inserted into the categories.'; - } - } - } - - // we need to reload the assignableContent, since settings have changed - // reuse previous listhash since display settings aren't changed - $assignableContent = $gContent->getAssignableContent( $listHash ); -} - -$listHash = array( - 'load_only_root' => TRUE, - 'max_records' => -1, -); -$pigeonRootData = $gContent->getList( $listHash ); -$pigeonRoots[0] = 'All'; -foreach( $pigeonRootData as $root ) { - $pigeonRoots[$root['root_structure_id']] = $root['title']; -} -$gBitSmarty->assign( 'pigeonRoots', !empty( $pigeonRoots ) ? $pigeonRoots : NULL ); - -$listHash = array( - 'root_structure_id' => ( !empty( $_REQUEST['root_structure_id'] ) ? $_REQUEST['root_structure_id'] : NULL ), - 'force_extras' => TRUE, - 'max_records' => -1, -); -$pigeonList = $gContent->getList( $listHash ); -$gBitSmarty->assign( 'pigeonList', $pigeonList ); -$gBitSmarty->assign( 'assignableContent', $assignableContent ); -$gBitSmarty->assign( 'contentCount', count( $assignableContent ) ); - -// Display the template -$gBitSystem->display( 'bitpackage:pigeonholes/assign_non_members.tpl', tra( 'Assign Content to Categories' ) ); -?> diff --git a/templates/assign_content.tpl b/templates/assign_content.tpl new file mode 100644 index 0000000..c474209 --- /dev/null +++ b/templates/assign_content.tpl @@ -0,0 +1,123 @@ +{strip} +
+
+

{tr}Assign Content to Categories{/tr}

+
+ +
+ {if !$pigeonList} + {formfeedback warning="No categories have been set up yet. You need to create some before you can assign content to them."} + {else} + {form legend="Assign Content"} + +
+ {formlabel label="Restrict listing" for="content_type"} + + {forminput} + {tr}Records{/tr} + {/forminput} + + {forminput} + + {/forminput} + + {forminput} + {html_options values=$contentTypes options=$contentTypes name=content_type id=content_type selected=$contentSelect} + {/forminput} + + {forminput} +   + {formhelp note="You can restrict the content listing to a given content type or apply a filter."} + {/forminput} +
+ +
+ {formlabel label="Category" for="root_structure_id"} + {forminput} + {html_options values=$pigeonRoots options=$pigeonRoots name=root_structure_id id=root_structure_id selected=$smarty.request.root_structure_id} + {formhelp note="Pick category you want to use to insert content into."} + {/forminput} +
+ +
+ +
+ {/form} + + {formfeedback hash=$feedback} + + {form} + + + + + + + + {if $gBitSystem->isFeatureActive( 'custom_member_sorting' ) && $smarty.request.include eq 'members'} + {formfeedback warning="Using this insertion method will reset any custom sorting you have done so far."} + {/if} + + + + + + + {if $assignableContent} + {foreach from=$pigeonList item=pigeon} + + {/foreach} + {/if} + + + {foreach from=$assignableContent item=item} + + + + {foreach from=$pigeonList item=pigeon} + + {/foreach} + + {foreachelse} + + + + {/foreach} +
{tr}Available Content{/tr} [ {$contentCount} ]
{smartlink ititle="Title" isort=title idefault=1 max_rows=$smarty.request.max_rows content_type=$contentSelect find_objects=$find_objects include=$smarty.request.include page=$page}{smartlink ititle="Content Type" isort=content_type_guid max_rows=$smarty.request.max_rows content_type=$contentSelect find_objects=$find_objects include=$smarty.request.include page=$page}{counter}
{$item.title}{assign var=content_type_guid value=`$item.content_type_guid`}{$contentTypes.$content_type_guid} + +
{tr}No Content can be found with your selection criteria{/tr}
+ + {if $assignableContent} +
+ +
+ {/if} + {/form} + + {if $assignableContent} + {foreach from=$pigeonList item=pigeon} +
+
{counter name=dogEatsPigeon}
+
{$pigeon.display_path}
{$pigeon.data|escape}
+
+ {/foreach} + {/if} + {/if} +
+
+{/strip} + diff --git a/templates/assign_non_members.tpl b/templates/assign_non_members.tpl deleted file mode 100644 index a8a5540..0000000 --- a/templates/assign_non_members.tpl +++ /dev/null @@ -1,122 +0,0 @@ -{strip} -
-
-

{tr}Assign Content to Categories{/tr}

-
- -
- {if !$pigeonList} - {formfeedback warning="No categories have been set up yet. You need to create some before you can assign content to them."} - {else} - {form legend="Assign Content"} - -
- {formlabel label="Restrict listing" for="content_type"} - - {forminput} - {tr}Records{/tr} - {/forminput} - - {forminput} - - {/forminput} - - {forminput} - {html_options values=$contentTypes options=$contentTypes name=content_type id=content_type selected=$contentSelect} - {/forminput} - - {forminput} -   - {formhelp note="You can restrict the content listing to a given content type or apply a filter."} - {/forminput} -
- -
- {formlabel label="Category" for="root_structure_id"} - {forminput} - {html_options values=$pigeonRoots options=$pigeonRoots name=root_structure_id id=root_structure_id selected=$smarty.request.root_structure_id} - {formhelp note="Pick category you want to use to insert content into."} - {/forminput} -
- -
- -
- {/form} - - {formfeedback hash=$feedback} - - {form} - - - - - - - - {if $gBitSystem->isFeatureActive( 'custom_member_sorting' ) && $smarty.request.include eq 'members'} - {formfeedback warning="Using this insertion method will reset any custom sorting you have done so far."} - {/if} - - - - - - - {if $assignableContent} - {foreach from=$pigeonList item=pigeon} - - {/foreach} - {/if} - - - {foreach from=$assignableContent item=item} - - - - {foreach from=$pigeonList item=pigeon} - - {/foreach} - - {foreachelse} - - - - {/foreach} -
{tr}Available Content{/tr} [ {$contentCount} ]
{smartlink ititle="Title" isort=title idefault=1 max_rows=$smarty.request.max_rows content_type=$contentSelect find_objects=$find_objects include=$smarty.request.include page=$page}{smartlink ititle="Content Type" isort=content_type_guid max_rows=$smarty.request.max_rows content_type=$contentSelect find_objects=$find_objects include=$smarty.request.include page=$page}{counter}
{$item.title}{assign var=content_type_guid value=`$item.content_type_guid`}{$contentTypes.$content_type_guid} - -
{tr}No Content can be found with your selection criteria{/tr}
- - {if $assignableContent} -
- -
- {/if} - {/form} - - {if $assignableContent} - {foreach from=$pigeonList item=pigeon} -
-
{counter name=dogEatsPigeon}
-
{$pigeon.display_path}
{$pigeon.data|escape}
-
- {/foreach} - {/if} - {/if} -
-
-{/strip} - diff --git a/templates/menu_pigeonholes.tpl b/templates/menu_pigeonholes.tpl index 59c359a..a2708d5 100644 --- a/templates/menu_pigeonholes.tpl +++ b/templates/menu_pigeonholes.tpl @@ -20,7 +20,7 @@ {/if} {if $gBitUser->hasPermission( 'bit_p_insert_pigeonholes' )} -
  • {biticon ipackage=liberty iname=assign iexplain="Assign Content" iforce="icon"} {tr}Assign Content{/tr}
  • +
  • {biticon ipackage=liberty iname=assign iexplain="Assign Content" iforce="icon"} {tr}Assign Content{/tr}
  • {/if} {/strip} -- cgit v1.3