summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xedit_component.php6
-rwxr-xr-xtemplates/assembly_icons_inc.tpl3
-rwxr-xr-xtemplates/edit_component.tpl24
-rwxr-xr-xtemplates/view_component.tpl34
-rw-r--r--templates/view_movement.tpl11
-rwxr-xr-xview_component.php6
6 files changed, 57 insertions, 27 deletions
diff --git a/edit_component.php b/edit_component.php
index f75be10..ef2cc8f 100755
--- a/edit_component.php
+++ b/edit_component.php
@@ -81,6 +81,12 @@ if( !$gContent->isValid() && !empty( $_REQUEST['title'] ) ) {
$gContent->loadXrefInfo();
$gBitSmarty->assign( 'gXrefInfo', $gContent->mXrefInfo );
+$isKitlocker = $gContent->mContentId ? (bool)$gBitDb->getOne(
+ "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."liberty_xref` WHERE `content_id`=? AND `item`='KLID'",
+ [ $gContent->mContentId ]
+) : false;
+$gBitSmarty->assign( 'isKitlocker', $isKitlocker );
+
$gContent->invokeServices( 'content_edit_function' );
$gBitSystem->display( 'bitpackage:stock/edit_component.tpl', KernelTools::tra('Edit Component: ').$gContent->getTitle(), [ 'display_mode' => 'edit' ] );
diff --git a/templates/assembly_icons_inc.tpl b/templates/assembly_icons_inc.tpl
index e1dd64e..e69de29 100755
--- a/templates/assembly_icons_inc.tpl
+++ b/templates/assembly_icons_inc.tpl
@@ -1,3 +0,0 @@
-{if $gContent->hasUpdatePermission()}
- <a title="{tr}Add Component{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_component.php?content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="list-add" iexplain="Add Component"}</a>
-{/if}
diff --git a/templates/edit_component.tpl b/templates/edit_component.tpl
index a3c15c2..9bf6bcc 100755
--- a/templates/edit_component.tpl
+++ b/templates/edit_component.tpl
@@ -25,16 +25,28 @@
{/forminput}
</div>
- {include file="bitpackage:liberty/edit_services_inc.tpl" serviceFile="content_edit_mini_tpl"}
-
{if $gXrefInfo->mGroups}
{jstabs}
+ {assign var=klGroup value=null}
+ {assign var=sgGroup value=null}
{foreach $gXrefInfo->mGroups as $xrefGroup}
- {include file=$gContent->getXrefListTemplate($xrefGroup->mTemplate)
- xrefGroup=$xrefGroup
- allow_add=true
- allow_edit=true}
+ {if $xrefGroup->mXGroup eq 'kitlocker'}
+ {assign var=klGroup value=$xrefGroup}
+ {elseif $xrefGroup->mXGroup eq 'stgrp'}
+ {assign var=sgGroup value=$xrefGroup}
+ {else}
+ {include file=$gContent->getXrefListTemplate($xrefGroup->mTemplate)
+ xrefGroup=$xrefGroup allow_add=true allow_edit=true}
+ {/if}
{/foreach}
+ {if $isKitlocker && $klGroup}
+ {include file=$gContent->getXrefListTemplate($klGroup->mTemplate)
+ xrefGroup=$klGroup allow_add=true allow_edit=true}
+ {/if}
+ {if $isKitlocker && $sgGroup}
+ {include file=$gContent->getXrefListTemplate($sgGroup->mTemplate)
+ xrefGroup=$sgGroup allow_add=true allow_edit=true}
+ {/if}
{/jstabs}
{/if}
diff --git a/templates/view_component.tpl b/templates/view_component.tpl
index 37b42ef..770005a 100755
--- a/templates/view_component.tpl
+++ b/templates/view_component.tpl
@@ -4,34 +4,46 @@
{/if}
<div class="display stock">
- {if empty($liberty_preview)}
+ {formfeedback hash=$feedback}
+ <div class="header">
+ {if empty($liberty_preview)}
<div class="floaticon">
- {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='icon' serviceHash=$gContent->mInfo}
{if $gContent->hasUpdatePermission()}
<a title="{tr}Edit{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_component.php?content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="edit" iexplain="Edit Component"}</a>
<a title="{tr}Delete{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_component.php?content_id={$gContent->mContentId}&amp;delete=1">{biticon ipackage="icons" iname="user-trash" iexplain="Delete Component"}</a>
{/if}
</div>
- {/if}
-
- {formfeedback hash=$feedback}
- <div class="header">
+ {/if}
<h1>{$gContent->getTitle()|escape}</h1>
</div>
<div class="body">
- {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='body' serviceHash=$gContent->mInfo}
{if $gContent->mInfo.data ne ''}
<p class="description">{$gContent->mInfo.parsed_data}</p>
{/if}
{jstabs}
{if $gXrefInfo->mGroups}
+ {assign var=klGroup value=null}
+ {assign var=sgGroup value=null}
{foreach $gXrefInfo->mGroups as $xrefGroup}
- {include file=$gContent->getXrefListTemplate($xrefGroup->mTemplate)
- xrefGroup=$xrefGroup
- allow_edit=false}
+ {if $xrefGroup->mXGroup eq 'kitlocker'}
+ {assign var=klGroup value=$xrefGroup}
+ {elseif $xrefGroup->mXGroup eq 'stgrp'}
+ {assign var=sgGroup value=$xrefGroup}
+ {else}
+ {include file=$gContent->getXrefListTemplate($xrefGroup->mTemplate)
+ xrefGroup=$xrefGroup allow_edit=false}
+ {/if}
{/foreach}
+ {if $isKitlocker && $klGroup}
+ {include file=$gContent->getXrefListTemplate($klGroup->mTemplate)
+ xrefGroup=$klGroup allow_edit=false}
+ {/if}
+ {if $isKitlocker && $sgGroup}
+ {include file=$gContent->getXrefListTemplate($sgGroup->mTemplate)
+ xrefGroup=$sgGroup allow_edit=false}
+ {/if}
{/if}
{jstab title="{tr}Stock{/tr}"}
@@ -60,8 +72,6 @@
{/jstabs}
</div><!-- end .body -->
- {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='view' serviceHash=$gContent->mInfo}
-
{if $gGallery && $gGallery->isCommentable()}
{include file="bitpackage:liberty/comments.tpl"}
{/if}
diff --git a/templates/view_movement.tpl b/templates/view_movement.tpl
index f3d157f..f038cb6 100644
--- a/templates/view_movement.tpl
+++ b/templates/view_movement.tpl
@@ -1,12 +1,11 @@
{strip}
<div class="display stock">
- <div class="floaticon">
- {if $gBitUser->hasPermission('p_stock_create')}
- <a title="{tr}Edit{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_movement.php?content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="edit" iexplain="Edit Movement"}</a>
- {/if}
- </div>
-
<div class="header">
+ <div class="floaticon">
+ {if $gBitUser->hasPermission('p_stock_create')}
+ <a title="{tr}Edit{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_movement.php?content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="edit" iexplain="Edit Movement"}</a>
+ {/if}
+ </div>
<h1>{$gContent->getTitle()|escape}</h1>
</div>
diff --git a/view_component.php b/view_component.php
index 2940441..f82a5c2 100755
--- a/view_component.php
+++ b/view_component.php
@@ -37,6 +37,12 @@ $gContent->addHit();
$gContent->loadXrefInfo();
$gBitSmarty->assign( 'gXrefInfo', $gContent->mXrefInfo );
+$isKitlocker = (bool)$gBitDb->getOne(
+ "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."liberty_xref` WHERE `content_id`=? AND `item`='KLID'",
+ [ $gContent->mContentId ]
+);
+$gBitSmarty->assign( 'isKitlocker', $isKitlocker );
+
// Stock levels for this component, calculated from movement xrefs
if( $gContent->isValid() ) {
$X = BIT_DB_PREFIX;