diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-05-26 18:28:11 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-05-26 18:28:11 +0100 |
| commit | e373f82ced189ff5814e6591394b432933821dfc (patch) | |
| tree | baa727ed82aceddc8c5f5e1c28b5b34678ef6902 | |
| parent | a3fd549a3824e906b479032d78653562ae5a8db1 (diff) | |
| download | stock-e373f82ced189ff5814e6591394b432933821dfc.tar.gz stock-e373f82ced189ff5814e6591394b432933821dfc.tar.bz2 stock-e373f82ced189ff5814e6591394b432933821dfc.zip | |
Strip per-assembly settings that belong at package level
Remove Gallery Pagination (layout is template-specific), Public Assembly,
Allow Comments, Protection Level service, and Assembly Memberships from
edit_assembly.tpl. Remove corresponding storePreference calls, gallery
tree generation, pagination types assign, and onload script from edit.php.
Hidden field renamed gallery_id → content_id.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rwxr-xr-x | edit.php | 42 | ||||
| -rwxr-xr-x | templates/edit_assembly.tpl | 79 |
2 files changed, 6 insertions, 115 deletions
@@ -24,28 +24,9 @@ if( $gContent->isValid() ){ $gContent->verifyCreatePermission(); } -$gBitSmarty->assign( 'galleryPaginationTypes', $gContent::getAllLayouts() ); - if( !empty( $_REQUEST['savegallery'] ) ) { - // When creating a sub-assembly, inherit protector role from the first parent if not explicitly set - if( !$gContent->isValid() && !empty( $_REQUEST['gallery_additions'] ) && ( !isset( $_REQUEST['protector']['role_id'] ) || $_REQUEST['protector']['role_id'] == -1 ) ) { - $parentAssemblyId = reset( $_REQUEST['gallery_additions'] ); - if( $parentContentId = $gContent->mDb->GetOne( "SELECT `content_id` FROM `".BIT_DB_PREFIX."stock_assembly` WHERE `assembly_id`=?", [ $parentAssemblyId ] ) ) { - if( ( $parentRole = $gContent->mDb->GetOne( "SELECT `role_id` FROM `".BIT_DB_PREFIX."liberty_content_role_map` WHERE `content_id`=?", [ $parentContentId ] ) ) !== false ) { - $_REQUEST['protector']['role_id'] = $parentRole; - } - } - } if( $gContent->store( $_REQUEST ) ) { - $gContent->storePreference( 'is_public', !empty( $_REQUEST['is_public'] ) ? $_REQUEST['is_public'] : null ); - $gContent->storePreference( 'allow_comments', !empty( $_REQUEST['allow_comments'] ) ? $_REQUEST['allow_comments'] : null ); - $gContent->storePreference( 'assembly_pagination', !empty( $_REQUEST['assembly_pagination'] ) ? $_REQUEST['assembly_pagination'] : null ); - $gContent->storePreference( 'total_per_page', !empty( $_REQUEST['total_per_page'] ) ? (int)$_REQUEST['total_per_page'] : null ); - // make sure var is fully stuffed with current data $gContent->load(); - // set the mappings, or if nothing checked, nuke them all - $gContent->addToAssemblies( !empty( $_REQUEST['gallery_additions'] ) ? $_REQUEST['gallery_additions'] : null ); - header("location: ".$gContent->getDisplayUrl() ); die(); } @@ -86,29 +67,6 @@ if( !empty( $_REQUEST['savegallery'] ) ) { $errors = !empty($gContent->mErrors) ? $gContent->mErrors : []; $gBitSmarty->assign('errors', $errors); -$gBitSystem->setOnloadScript( 'updateGalleryPagination();' ); - -$gallery = $gContent->getParentAssemblies(); -$gBitSmarty->assign( 'parentGalleries', $gallery ); -$getHash = [ - 'user_id' => $gBitUser->mUserId, -// 'max_records' => -1, -// 'no_thumbnails' => true, -// 'sort_mode' => 'title_asc', -// 'show_empty' => true, -]; -if( $gContent->mContentId ) { - $getHash['contain_item'] = $gContent->mContentId; -} -// modify listHash according to global preferences -if( $gBitSystem->isFeatureActive( 'stock_show_all_to_admins' ) && $gBitUser->hasPermission( 'p_stock_admin' ) ) { - unset( $getHash['user_id'] ); -} elseif( $gBitSystem->isFeatureActive( 'stock_show_public_on_upload' ) ) { -// $getHash['show_public'] = true; -} -$galleryTree = $gContent->generateList( $getHash, [ 'name' => "assembly_id", 'id' => "gallerylist", 'item_attributes' => [ 'class'=>'listingtitle'], 'radio_checkbox' => true, ] ); -$gBitSmarty->assign( 'galleryTree', $galleryTree ); - $gContent->mInfo['stockassembly_types'] = $gContent->getXrefGroupList(); $gContent->invokeServices( 'content_edit_function' ); diff --git a/templates/edit_assembly.tpl b/templates/edit_assembly.tpl index 08046d7..8ace0d9 100755 --- a/templates/edit_assembly.tpl +++ b/templates/edit_assembly.tpl @@ -1,21 +1,3 @@ -{literal} -<script>//<![CDATA[ -function updateGalleryPagination() { - var paginationIds = ['fixed_grid','auto_flow','position_number','simple_list']; - paginationIds.forEach(function(id) { - var div = document.getElementById(id+'-pagination'); - div.style.display = 'none'; - div.querySelectorAll('input, select').forEach(function(el) { el.disabled = true; }); - }); - var input = document.getElementById('editGalleryForm').gallery_pagination; - var select = input.options[input.selectedIndex].value; - var activeDiv = document.getElementById(select+'-pagination'); - activeDiv.style.display = 'block'; - activeDiv.querySelectorAll('input, select').forEach(function(el) { el.disabled = false; }); -} -document.addEventListener('DOMContentLoaded', updateGalleryPagination); -//]]></script> -{/literal} {strip} <div class="edit stock"> <div class="header"> @@ -29,63 +11,25 @@ document.addEventListener('DOMContentLoaded', updateGalleryPagination); </div> <div class="body"> - {form id="editGalleryForm" ipackage="stock" ifile="edit.php"} + {form id="editAssemblyForm" ipackage="stock" ifile="edit.php"} {formfeedback error=$errors warning=$stockWarnings success=$stockSuccess} - <input type="hidden" name="gallery_id" value="{$galleryId|escape}"/> + <input type="hidden" name="content_id" value="{$gContent->mContentId|escape}"/> <div class="form-group"> - {formlabel label="Title" for="gallery-title" mandatory="y"} + {formlabel label="Title" for="assembly-title" mandatory="y"} {forminput} - <input type="text" name="title" id="gallery-title" value="{$gContent->getTitle()|escape}" maxlength="160" size="50"/> + <input type="text" name="title" id="assembly-title" value="{$gContent->getTitle()|escape}" maxlength="160" size="50"/> {/forminput} </div> <div class="form-group"> - {formlabel label="Description" for="gallery-desc"} + {formlabel label="Description" for="assembly-desc"} {forminput} - <textarea name="edit" id="gallery-desc" rows="4" cols="50">{$gContent->mInfo.data|default:''|escape}</textarea> + <textarea name="edit" id="assembly-desc" rows="4" cols="50">{$gContent->mInfo.data|default:''|escape}</textarea> {/forminput} </div> - {if $gBitUser->hasPermission('p_stock_create_public_gal')} - <div class="form-group"> - {forminput label="checkbox"} - <input type="checkbox" name="is_public" id="is_public" value="y" {if $gContent->getPreference('is_public') eq 'y'}checked="checked"{/if} />{tr}Public Assembly{/tr} - {formhelp note="Allow other users to add components to this assembly."} - {/forminput} - </div> - {/if} - - <div class="form-group"> - {formlabel label="Gallery Pagination" for="gallery-pagination"} - {forminput} - {html_options name="gallery_pagination" id="gallery-pagination" options=$galleryPaginationTypes selected=$gContent->getPreference('gallery_pagination',$gBitSystem->getConfig('default_gallery_pagination',$smarty.const.STOCK_PAGINATION_FIXED_GRID)) onchange="updateGalleryPagination();"} - <div id="fixed_grid-pagination"> - <input type="text" id="gallery-rows-per-page" name="rows_per_page" size="2" maxlength="2" value="{$gContent->mInfo.rows_per_page|default:$gBitSystem->getConfig('stock_gallery_default_rows_per_page')}"/> {tr}Rows per page{/tr}<br/> - <input type="text" id="gallery-cols-per-page" name="cols_per_page" size="2" maxlength="2" value="{$gContent->mInfo.cols_per_page|default:$gBitSystem->getConfig('stock_gallery_default_cols_per_page')}"/> {tr}Columns per page{/tr} - </div> - <div id="auto_flow-pagination"> - <input type="text" id="gallery-total-per-page" name="total_per_page" size="3" maxlength="3" value="{$gContent->getPreference('total_per_page', $gContent->mInfo.rows_per_page|default:20)}"/> {tr}Total components per page{/tr} - </div> - <div id="position_number-pagination"> - {formhelp note="Components are ordered by package group (the integer part of the position number) and position within the package (the decimal part). Use the Component Order page to assign positions."} - </div> - <div id="simple_list-pagination"> - <input type="text" id="gallery-total-per-page-list" name="total_per_page" size="3" maxlength="3" value="{$gContent->getPreference('total_per_page', $gContent->mInfo.rows_per_page|default:20)}"/> {tr}Total lines per page{/tr} - </div> - {/forminput} - </div> - - <div class="form-group"> - {forminput label="checkbox"} - <input type="checkbox" name="allow_comments" id="allow_comments" value="y" {if !$gContent->isValid() || $gContent->getPreference('allow_comments') eq 'y'}checked="checked"{/if} />{tr}Allow Comments{/tr} - {formhelp note="Allow posting comments on components in this assembly."} - {/forminput} - </div> - - {include file="bitpackage:liberty/edit_services_inc.tpl" serviceFile="content_edit_mini_tpl"} - {if $gContent->mInfo.stockassembly_types} {jstabs} {section name=xrefGroup loop=$gContent->mInfo.stockassembly_types} @@ -98,17 +42,6 @@ document.addEventListener('DOMContentLoaded', updateGalleryPagination); {/jstabs} {/if} - {if $galleryTree} - {legend legend="Assembly Memberships"} - <p>{tr}If you would like this assembly to be a sub-assembly, check the parent assembly below.{/tr}</p> - <div class="form-group"> - <div class="gallerytree"> - {$galleryTree} - </div> - </div> - {/legend} - {/if} - <div class="form-group submit"> {if $gContent->isValid()} <input type="submit" class="btn btn-default" name="cancelgallery" value="{tr}Cancel{/tr}"/> |
