vtenext/Smarty/templates/modules/PDFMaker/EditPDFTemplate.tpl
2021-04-28 20:10:26 +02:00

1213 lines
48 KiB
Smarty

{*
/*************************************
* SPDX-FileCopyrightText: 2009-2020 Vtenext S.r.l. <info@vtenext.com>
* SPDX-License-Identifier: AGPL-3.0-only
************************************/
*}
<script type="text/javascript" src="include/js/smoothscroll.js"></script>
{include file='Buttons_List.tpl'}
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
{if $EMODE eq 'edit'}
{if $DUPLICATE_FILENAME eq ""}
<h4><strong>{$MOD.LBL_EDIT} &quot;{$FILENAME}&quot;</strong></h4>
{else}
<h4><strong>{$MOD.LBL_DUPLICATE} &quot;{$DUPLICATE_FILENAME}&quot;</strong></h4>
{/if}
{else}
<h4><strong>&nbsp;&nbsp;<b>{$MOD.LBL_NEW_TEMPLATE}</b></strong></h4>
{/if}
<form name="PDFMakerEdit" action="index.php?module=PDFMaker&action=SavePDFTemplate" method="post" enctype="multipart/form-data" onsubmit="VteJS_DialogBox.block();">
<input type="hidden" name="return_module" value="PDFMaker">
<input type="hidden" name="parenttab" value="{$PARENTTAB}">
<input type="hidden" name="templateid" value="{$SAVETEMPLATEID}">
<input type="hidden" name="action" value="SavePDFTemplate">
<input type="hidden" name="redirect" value="true">
{if $DISPLAY_PRODUCT_DIV eq 'none'}
{assign var=DISPLAY_NO_PRODUCT_DIV value='block'}
{assign var=DISPLAY_PRODUCT_TPL_ROW value='none'}
{else}
{assign var=DISPLAY_NO_PRODUCT_DIV value='none'}
{assign var=DISPLAY_PRODUCT_TPL_ROW value='table-row'}
{/if}
<div class="row">
<div class="col-sm-12 col-header">
<table class="vte-tabs" width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td style="width:15%;" class="dvtSelectedCell" id="properties_tab" onclick="showHideTab('properties');" width="75" align="center" nowrap="nowrap"><b>{$MOD.LBL_PROPERTIES_TAB}</b></td>
<td class="dvtUnSelectedCell" id="company_tab" onclick="showHideTab('company');" align="center" nowrap="nowrap"><b>{$MOD.LBL_OTHER_INFO}</b></td>
<td class="dvtUnSelectedCell" id="labels_tab" onclick="showHideTab('labels');" align="center" nowrap="nowrap"><b>{$MOD.LBL_LABELS}</b></td>
<td class="dvtUnSelectedCell" id="products_tab" onclick="showHideTab('products');" align="center" nowrap="nowrap"><b>{$MOD.LBL_ARTICLE}</b></td>
<td class="dvtUnSelectedCell" id="settings_tab" onclick="showHideTab('settings');" align="center" nowrap="nowrap"><b>{$MOD.LBL_SETTINGS_TAB}</b></td>
<td class="dvtTabCache" style="width:30%;" nowrap="nowrap">&nbsp;</td>
</tr>
</table>
</div>
</div>
<div class="row">
<div class="col-sm-12">
{*********************************************PROPERTIES DIV*************************************************}
<div class="vte-card" id="properties_div" style="diplay:block;">
<table class="vtetable vtetable-props">
{* pdf module name and description *}
<tr>
<td class="cellLabel"><font color="red">*</font>{$MOD.LBL_PDF_NAME}:</td>
<td class="cellText">
<div class="dvtCellInfoM">
<input name="filename" id="filename" type="text" value="{$FILENAME}" class="detailedViewTextBox">
</div>
</td>
</tr>
<tr>
<td class="cellLabel">{$MOD.LBL_DESCRIPTION}:</td>
<td class="cellText">
<div class="dvtCellInfo">
<input name="description" type="text" value="{$DESCRIPTION}" class="detailedViewTextBox">
</div>
</td>
</tr>
{* pdf source module and its available fields *}
<tr>
<td class="cellLabel">{if $TEMPLATEID eq ""}<font color="red">*</font>{/if}{$MOD.LBL_MODULENAMES}:</td>
<td class="cellText">
<select name="modulename" id="modulename" class="detailedViewTextBox input-inline" onChange="change_modulesorce(this,'modulefields');" style="width:auto;">
{if $TEMPLATEID neq "" || $SELECTMODULE neq ""}
{html_options options=$MODULENAMES selected=$SELECTMODULE}
{else}
{html_options options=$MODULENAMES}
{/if}
</select>
&nbsp;&nbsp;
<select name="modulefields" id="modulefields" class="detailedViewTextBox input-inline" style="width:auto;">
{if $TEMPLATEID eq "" && $SELECTMODULE eq ""}
<option value="">{$MOD.LBL_SELECT_MODULE_FIELD}</option>
{else}
{html_options options=$SELECT_MODULE_FIELD}
{/if}
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('modulefields');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
{* related modules and its fields *}
<tr id="body_variables">
<td class="cellLabel">{$MOD.LBL_RELATED_MODULES}:</td>
<td class="cellText">
<select name="relatedmodulesorce" id="relatedmodulesorce" class="detailedViewTextBox input-inline" onChange="change_relatedmodule(this,'relatedmodulefields');">
<option value="none">{$MOD.LBL_SELECT_MODULE}</option>
{html_options options=$RELATED_MODULES}
</select>
&nbsp;&nbsp;
<select name="relatedmodulefields" id="relatedmodulefields" class="detailedViewTextBox input-inline">
<option>{$MOD.LBL_SELECT_MODULE_FIELD}</option>
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('relatedmodulefields');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
{* related bloc tpl *}
<tr id="related_block_tpl_row" {if $TEMPLATEID eq "" && $SELECTMODULE eq ""}style="display:none;"{/if}>
<td class="cellLabel">{$MOD.LBL_RELATED_BLOCK_TPL}:</td>
<td class="cellText">
<button type="button" class="crmbutton create" onclick="EditRelatedBlock();">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
{* product bloc tpl *}
<tr id="product_bloc_tpl_row" style="display:{$DISPLAY_PRODUCT_TPL_ROW};">
<td class="cellLabel">{$MOD.LBL_PRODUCT_BLOC_TPL}:</td>
<td class="cellText">
<select name="productbloctpl" id="productbloctpl" class="detailedViewTextBox input-inline">
{html_options options=$PRODUCT_BLOC_TPL}
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('productbloctpl');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
{* pdf header variables*}
<tr id="header_variables" style="display:none">
<td class="cellLabel">{$MOD.LBL_HEADER_VARIABLE}:</td>
<td class="cellText">
<select name="header_var" id="header_var" class="detailedViewTextBox input-inline">
{html_options options=$HEAD_FOOT_VARS selected=""}
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('header_var');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
{* pdf footer variables*}
<tr id="footer_variables" style="display:none">
<td class="cellLabel">{$MOD.LBL_FOOTER_VARIABLE}:</td>
<td class="cellText">
<select name="footer_var" id="footer_var" class="detailedViewTextBox input-inline">
{html_options options=$HEAD_FOOT_VARS selected=""}
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('footer_var');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
</table>
</div>
{*********************************************Labels DIV*************************************************}
<div class="vte-card" id="labels_div" style="display:none;">
<table class="vtetable vtetable-props">
<tr>
<td class="cellLabel">{$MOD.LBL_GLOBAL_LANG}:</td>
<td class="cellText">
<select name="global_lang" id="global_lang" class="detailedViewTextBox input-inline" style="width:80%;">
{html_options options=$GLOBAL_LANG_LABELS}
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('global_lang');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
<tr>
<td class="cellLabel">{$MOD.LBL_MODULE_LANG}:</td>
<td class="cellText">
<select name="module_lang" id="module_lang" class="detailedViewTextBox input-inline" style="width:80%;">
{html_options options=$MODULE_LANG_LABELS}
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('module_lang');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
</table>
</div>
{*********************************************Company and User information DIV*************************************************}
<div class="vte-card" id="company_div" style="display:none;">
<table class="vtetable vtetable-props">
<tr>
<td class="cellLabel">{$MOD.LBL_COMPANY_USER_INFO}:</td>
<td class="cellText">
<select name="acc_info" id="acc_info" class="detailedViewTextBox input-inline">
<optGroup label="{$MOD.LBL_COMPANY_INFO}">
{html_options options=$ACCOUNTINFORMATIONS}
</optGroup>
<optGroup label="{$MOD.LBL_USER_INFO}">
{html_options options=$USERINFORMATIONS}
</optGroup>
<optGroup label="{$MOD.LBL_LOGGED_USER_INFO}">
{html_options options=$LOGGEDUSERINFORMATION}
</optGroup>
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('acc_info');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
<tr>
<td class="cellLabel">{$MOD.TERMS_AND_CONDITIONS}:</td>
<td class="cellText">
<select name="invterandcon" id="invterandcon" class="detailedViewTextBox input-inline">
{html_options options=$INVENTORYTERMSANDCONDITIONS}
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('invterandcon');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
<tr>
<td class="cellLabel">{$MOD.LBL_CURRENT_DATE}:</td>
<td class="cellText">
<select name="dateval" id="dateval" class="detailedViewTextBox input-inline">
{html_options options=$DATE_VARS}
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('dateval');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
{***** BARCODES *****}
<tr>
<td class="cellLabel">{$MOD.LBL_BARCODES}:</td>
<td class="cellText">
<select name="barcodeval" id="barcodeval" class="detailedViewTextBox input-inline">
<optgroup label="{$MOD.LBL_BARCODES_TYPE1}">
<option value="EAN13">EAN13</option>
<option value="ISBN">ISBN</option>
<option value="ISSN">ISSN</option>
</optgroup>
<optgroup label="{$MOD.LBL_BARCODES_TYPE2}">
<option value="UPCA">UPCA</option>
<option value="UPCE">UPCE</option>
<option value="EAN8">EAN8</option>
</optgroup>
<optgroup label="{$MOD.LBL_BARCODES_TYPE3}">
<option value="EAN2">EAN2</option>
<option value="EAN5">EAN5</option>
<option value="EAN13P2">EAN13P2</option>
<option value="ISBNP2">ISBNP2</option>
<option value="ISSNP2">ISSNP2</option>
<option value="UPCAP2">UPCAP2</option>
<option value="UPCEP2">UPCEP2</option>
<option value="EAN8P2">EAN8P2</option>
<option value="EAN13P5">EAN13P5</option>
<option value="ISBNP5">ISBNP5</option>
<option value="ISSNP5">ISSNP5</option>
<option value="UPCAP5">UPCAP5</option>
<option value="UPCEP5">UPCEP5</option>
<option value="EAN8P5">EAN8P5</option>
</optgroup>
<optgroup label="{$MOD.LBL_BARCODES_TYPE4}">
<option value="IMB">IMB</option>
<option value="RM4SCC">RM4SCC</option>
<option value="KIX">KIX</option>
<option value="POSTNET">POSTNET</option>
<option value="PLANET">PLANET</option>
</optgroup>
<optgroup label="{$MOD.LBL_BARCODES_TYPE5}">
<option value="C128A">C128A</option>
<option value="C128B">C128B</option>
<option value="C128C">C128C</option>
<option value="EAN128C">EAN128C</option>
<option value="C39">C39</option>
<option value="C39+">C39+</option>
<option value="C39E">C39E</option>
<option value="C39E+">C39E+</option>
<option value="S25">S25</option>
<option value="S25+">S25+</option>
<option value="I25">I25</option>
<option value="I25+">I25+</option>
<option value="I25B">I25B</option>
<option value="I25B+">I25B+</option>
<option value="C93">C93</option>
<option value="MSI">MSI</option>
<option value="MSI+">MSI+</option>
<option value="CODABAR">CODABAR</option>
<option value="CODE11">CODE11</option>
</optgroup>
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('barcodeval');">{$MOD.LBL_INSERT_BARCODE_TO_TEXT}</button>&nbsp;&nbsp;
<a href="modules/PDFMaker/Barcodes.php" target="_new"><i class="vteicon md-sm">help</i></a>
</td>
</tr>
{************************************ Custom Functions *******************************************}
{if $TYPE eq "professional"}
<tr>
<td class="cellLabel">{$MOD.CUSTOM_FUNCTIONS}:</td>
<td class="cellText">
<select name="customfunction" id="customfunction" class="detailedViewTextBox input-inline">
<option value="functionname|param1">{$MOD.CUSTOM_FUNCTION}</option>
{* crmv@2539m *}
{foreach item=values from=$CUSTOM_FUNCTIONS}
{if $values.params neq ''}
{assign var="value" value=$values.name|cat:"|"|cat:$values.params}
{else}
{assign var="value" value=$values.name}
{/if}
<option value="{$value}">{$values.label|getTranslatedString:'PDFMaker'}</option>
{/foreach}
{* crmv@2539me *}
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('customfunction');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
{/if}
</table>
</div>
{*********************************************Products bloc DIV*************************************************}
<div class="vte-card" id="products_div" style="display:none;">
<div id="product_div" style="display:{$DISPLAY_PRODUCT_DIV};">
<table class="vtetable vtetable-props">
<tr>
<td class="cellLabel" width="200px">{$MOD.LBL_ARTICLE}:</td>
<td class="cellText">
<select name="articelvar" id="articelvar" class="detailedViewTextBox input-inline">
{html_options options=$ARTICLE_STRINGS}
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('articelvar');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
{* insert products & services fields into text *}
<tr>
<td class="cellLabel">*{$MOD.LBL_PRODUCTS_AVLBL}:</td>
<td class="cellText">
<select name="psfields" id="psfields" class="detailedViewTextBox input-inline">
{html_options options=$SELECT_PRODUCT_FIELD}
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('psfields');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
{* products fields *}
<tr>
<td class="cellLabel">*{$MOD.LBL_PRODUCTS_FIELDS}:</td>
<td class="cellText">
<select name="productfields" id="productfields" class="detailedViewTextBox input-inline">
{html_options options=$PRODUCTS_FIELDS}
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('productfields');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
{* services fields *}
<tr>
<td class="cellLabel">*{$MOD.LBL_SERVICES_FIELDS}:</td>
<td class="cellText">
<select name="servicesfields" id="servicesfields" class="detailedViewTextBox input-inline">
{html_options options=$SERVICES_FIELDS}
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('servicesfields');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
{* product bloc tpl which is the same as in main Properties tab*}
<tr>
<td class="cellLabel">{$MOD.LBL_PRODUCT_BLOC_TPL}:</td>
<td class="cellText">
<select name="productbloctpl2" id="productbloctpl2" class="detailedViewTextBox input-inline">
{html_options options=$PRODUCT_BLOC_TPL}
</select>
<button type="button" class="crmbutton create" onclick="InsertIntoTemplate('productbloctpl2');">{$MOD.LBL_INSERT_TO_TEXT}</button>
</td>
</tr>
<tr>
<td colspan="2"><small>{$MOD.LBL_PRODUCT_FIELD_INFO}</small></td>
</tr>
</table>
</div>
<div id="no_product_div" style="padding:15px;text-align:center;display:{$DISPLAY_NO_PRODUCT_DIV};">
<b>{$MOD.LBL_NOPRODUCT_BLOC}</b>
</div>
</div>
{*********************************************Settings DIV*************************************************}
<div class="vte-card" id="settings_div" style="display:none;">
<table class="vtetable vtetable-props">
{* file name settings *}
<tr>
<td class="cellLabel">{$MOD.LBL_FILENAME}:</td>
<td class="cellText">
<span class="dvtCellInfo">
<input type="text" name="nameOfFile" value="{$NAME_OF_FILE}" id="nameOfFile" class="detailedViewTextBox" style="width:50%;"/>
</span>
<select name="filename_fields" id="filename_fields" class="detailedViewTextBox input-inline" onchange="insertFieldIntoFilename(this.value);">
<option value="">{$MOD.LBL_SELECT_MODULE_FIELD}</option>
<optgroup label="{$MOD.LBL_COMMON_FILEINFO}">
{html_options options=$FILENAME_FIELDS}
</optgroup>
{if $TEMPLATEID neq "" || $SELECTMODULE neq ""}
{html_options options=$SELECT_MODULE_FIELD_FILENAME}
{/if}
</select>
</td>
</tr>
{* pdf format settings *}
<tr>
<td class="cellLabel">{$MOD.LBL_PDF_FORMAT}:</td>
<td class="cellText">
<select name="pdf_format" id="pdf_format" class="detailedViewTextBox input-inline">
{html_options options=$FORMATS selected=$SELECT_FORMAT}
</select>
</td>
</tr>
{* pdf orientation settings *}
<tr>
<td class="cellLabel">{$MOD.LBL_PDF_ORIENTATION}:</td>
<td class="cellText">
<select name="pdf_orientation" id="pdf_orientation" class="detailedViewTextBox input-inline">
{html_options options=$ORIENTATIONS selected=$SELECT_ORIENTATION}
</select>
</td>
</tr>
{* encoding *}
{*
<tr>
<td class="cellLabel" title="{$MOD.LBL_ENCODING_TITLE}">{$MOD.LBL_ENCODING}:</td>
<td class="cellText">
<select name="encoding" id="encoding" class="detailedViewTextBox input-inline">
{html_options options=$ENCODINGS selected=$SELECT_ENCODING}
</select>
</td>
</tr>
*}
{* ignored picklist values settings *}
<tr>
<td class="cellLabel" title="{$MOD.LBL_IGNORE_PICKLIST_VALUES_DESC}">{$MOD.LBL_IGNORE_PICKLIST_VALUES}:</td>
<td class="cellText" valign="top" title="{$MOD.LBL_IGNORE_PICKLIST_VALUES_DESC}">
<div class="dvtCellInfo">
<input type="text" name="ignore_picklist_values" value="{$IGNORE_PICKLIST_VALUES}" class="detailedViewTextBox"/>
</div>
</td>
</tr>
{* pdf margin settings *}
{assign var=margin_input_width value='50px'}
{assign var=margin_label_width value='50px'}
<tr>
<td class="cellLabel">{$MOD.LBL_MARGINS}:</td>
<td class="cellText" valign="top">
<table>
<tr>
<td align="right" nowrap><b>{$MOD.LBL_TOP}</b></td>
<td>
<span class="dvtCellInfo">
<input type="text" name="margin_top" id="margin_top" class="detailedViewTextBox" value="{$MARGINS.top}" style="width:{$margin_input_width}" onKeyUp="ControlNumber('margin_top',false);">
</span>
</td>
<td align="right" nowrap><b>{$MOD.LBL_BOTTOM}</b></td>
<td>
<span class="dvtCellInfo">
<input type="text" name="margin_bottom" id="margin_bottom" class="detailedViewTextBox" value="{$MARGINS.bottom}" style="width:{$margin_input_width}" onKeyUp="ControlNumber('margin_bottom',false);">
</span>
</td>
<td align="right" nowrap><b>{$MOD.LBL_LEFT}</b></td>
<td>
<span class="dvtCellInfo">
<input type="text" name="margin_left" id="margin_left" class="detailedViewTextBox" value="{$MARGINS.left}" style="width:{$margin_input_width}" onKeyUp="ControlNumber('margin_left',false);">
</span>
</td>
<td align="right" nowrap><b>{$MOD.LBL_RIGHT}</b></td>
<td>
<span class="dvtCellInfo">
<input type="text" name="margin_right" id="margin_right" class="detailedViewTextBox" value="{$MARGINS.right}" style="width:{$margin_input_width}" onKeyUp="ControlNumber('margin_right',false);">
</span>
</td>
</tr>
</table>
</td>
</tr>
{* decimal settings *}
<tr>
<td class="cellLabel">{$MOD.LBL_DECIMALS}:</td>
<td class="cellText" valign="top">
<table>
<tr>
<td align="right" nowrap><b>{$MOD.LBL_DEC_POINT}</b></td>
<td>
<span class="dvtCellInfo">
<input type="text" maxlength="2" name="dec_point" class="detailedViewTextBox" value="{$DECIMALS.point}" style="width:{$margin_input_width}"/>
</span>
</td>
<td align="right" nowrap><b>{$MOD.LBL_DEC_DECIMALS}</b></td>
<td>
<span class="dvtCellInfo">
<input type="text" maxlength="2" name="dec_decimals" class="detailedViewTextBox" value="{$DECIMALS.decimals}" style="width:{$margin_input_width}"/>
</span>
</td>
<td align="right" nowrap><b>{$MOD.LBL_DEC_THOUSANDS}</b></td>
<td>
<span class="dvtCellInfo">
<input type="text" maxlength="2" name="dec_thousands" class="detailedViewTextBox" value="{$DECIMALS.thousands}" style="width:{$margin_input_width}"/>
</span>
</td>
</tr>
</table>
</td>
</tr>
{* crmv@172422 *}
<tr>
<td class="cellLabel">{$MOD.LBL_COMPLIANCE}:</td>
<td class="cellText" valign="top">
<select name="compliance" id="compliance" class="detailedViewTextBox input-inline">
<option value="" {if $COMPLIANCE eq ''}selected{/if}></option>
<option value="PDFA" {if $COMPLIANCE eq 'PDFA'}selected{/if}>{$MOD.LBL_PDFA}</option>
<option value="PDFX" {if $COMPLIANCE eq 'PDFX'}selected{/if}>{$MOD.LBL_PDFX}</option>
</select>
</td>
</tr>
{* crmv@172422e *}
{* status settings *}
<tr>
<td class="cellLabel">{$APP.LBL_STATUS}:</td>
<td class="cellText" valign="top">
<select name="is_active" id="is_active" class="detailedViewTextBox input-inline" onchange="if(this.value=='1') document.getElementById('is_default').disabled=false; else {ldelim}document.getElementById('is_default').checked=false; document.getElementById('is_default').disabled=true; {rdelim}">
{html_options options=$STATUS selected=$IS_ACTIVE}
</select>
</td>
</tr>
{* is default settings *}
<tr>
<td class="cellLabel">{$MOD.LBL_SETASDEFAULT}:</td>
<td class="cellText" valign="top">
<input type="checkbox" id="is_default" name="is_default" {$IS_DEFAULT_CHECKED}/>
</td>
</tr>
</table>
</div>
</div>
</div>
{************************************** END OF TABS BLOCK *************************************}
<div class="row">
<div class="col-sm-12 col-header text-center">
<button type="submit" class="crmbutton create" onclick="document.PDFMakerEdit.redirect.value='false'; return savePDF();">{$APP.LBL_APPLY_BUTTON_LABEL}</button>&nbsp;&nbsp;
<button type="submit" class="crmbutton save" onclick="return savePDF();">{$APP.LBL_SAVE_BUTTON_LABEL}</button>&nbsp;&nbsp;
{if $smarty.request.applied eq 'true'}
<button type="button" class="crmbutton cancel" onclick="window.location.href='index.php?action=DetailViewPDFTemplate&module=PDFMaker&templateid={$SAVETEMPLATEID}&parenttab=Tools';">{$APP.LBL_CANCEL_BUTTON_LABEL}</button>
{else}
<button type="button" class="crmbutton cancel" onclick="window.history.back()">{$APP.LBL_CANCEL_BUTTON_LABEL}</button>
{/if}
</div>
</div>
<div class="row">
<div class="col-sm-12 col-header">
<table class="vte-tabs" width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td style="width: 15%;" class="dvtSelectedCell" id="body_tab2" onclick="showHideTab2('body');" width="75" align="center" nowrap="nowrap"><b>{$MOD.LBL_BODY}</b></td>
<td class="dvtUnSelectedCell" id="header_tab2" onclick="showHideTab2('header');" align="center" nowrap="nowrap"><b>{$MOD.LBL_HEADER_TAB}</b></td>
<td class="dvtUnSelectedCell" id="footer_tab2" onclick="showHideTab2('footer');" align="center" nowrap="nowrap"><b>{$MOD.LBL_FOOTER_TAB}</b></td>
<td style="width: 50%;" nowrap="nowrap">&nbsp;</td>
</tr>
</table>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<script type="text/javascript" src="include/ckeditor/ckeditor.js"></script>
{*********************************************BODY DIV*************************************************}
<div id="body_div2" class="vte-card cellInfo">
<textarea name="body" id="body" style="width:100%;height:700px">{$BODY}</textarea>
</div>
<script type="text/javascript">
{*//crmv@35764*}
var current_language_arr = "{$AUTHENTICATED_USER_LANGUAGE}".split("_"); // crmv@181170
var curr_lang = current_language_arr[0];
{* crmv@181170 *}
{if file_exists("kcfinder/browse.php")}
{literal}
CKEDITOR.replace('body', { customConfig: '../../modules/PDFMaker/fck_config_kcfinder.js', language: curr_lang });
{/literal}
{else}
{literal}
CKEDITOR.replace('body', { customConfig: '../../modules/PDFMaker/fck_config.js', language: curr_lang });
{/literal}
{/if}
{* crmv@181170e *}
{*//crmv@35764 e*}
</script>
{*********************************************Header DIV*************************************************}
<div style="display:none;" id="header_div2" class="vte-card cellInfo">
<textarea name="header_body" id="header_body" style="width:100%;height:200px" class="small">{$HEADER}</textarea>
</div>
<script type="text/javascript">
{*//crmv@35764*}
var current_language_arr = "{$AUTHENTICATED_USER_LANGUAGE}".split("_"); // crmv@181170
var curr_lang = current_language_arr[0];
{literal} CKEDITOR.replace( 'header_body',{customConfig:'../../modules/PDFMaker/fck_config.js',language : curr_lang} ); {/literal}
{*//crmv@35764 e*}
</script>
{*********************************************Footer DIV*************************************************}
<div style="display:none;" id="footer_div2" class="vte-card cellInfo">
<textarea name="footer_body" id="footer_body" style="width:100%;height:200px" class="small">{$FOOTER}</textarea>
</div>
<script type="text/javascript">
{*//crmv@35764*}
var current_language_arr = "{$AUTHENTICATED_USER_LANGUAGE}".split("_"); // crmv@181170
var curr_lang = current_language_arr[0];
{literal} CKEDITOR.replace( 'footer_body',{customConfig:'../../modules/PDFMaker/fck_config.js',language : curr_lang} ); {/literal}
{*//crmv@35764 e*}
</script>
<script type="text/javascript" src="modules/PDFMaker/fck_config.js"></script>
</div>
</div>
<div class="row">
<div class="col-sm-12 col-header text-center">
<button type="submit" class="crmbutton create" onclick="document.PDFMakerEdit.redirect.value='false'; return savePDF();">{$APP.LBL_APPLY_BUTTON_LABEL}</button>&nbsp;&nbsp;
<button type="submit" class="crmbutton save" onclick="return savePDF();">{$APP.LBL_SAVE_BUTTON_LABEL}</button>&nbsp;&nbsp;
{if $smarty.request.applied eq 'true'}
<button type="button" class="crmbutton cancel" onclick="window.location.href='index.php?action=DetailViewPDFTemplate&module=PDFMaker&templateid={$SAVETEMPLATEID}&parenttab=Tools';">{$APP.LBL_CANCEL_BUTTON_LABEL}</button>
{else}
<button type="button" class="crmbutton cancel" onclick="window.history.back()">{$APP.LBL_CANCEL_BUTTON_LABEL}</button>
{/if}
</div>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript">
var selectedTab='properties';
var selectedTab2='body';
function check4null(form)
{ldelim}
var isError = false;
var errorMessage = "";
// Here we decide whether to submit the form.
if (trim(form.templatename.value) =='') {ldelim}
isError = true;
errorMessage += "\n template name";
form.templatename.focus();
{rdelim}
if (trim(form.foldername.value) =='') {ldelim}
isError = true;
errorMessage += "\n folder name";
form.foldername.focus();
{rdelim}
if (trim(form.subject.value) =='') {ldelim}
isError = true;
errorMessage += "\n subject";
form.subject.focus();
{rdelim}
// Here we decide whether to submit the form.
if (isError == true) {ldelim}
alert("{$MOD.LBL_MISSING_FIELDS}" + errorMessage);
return false;
{rdelim}
return true;
{rdelim}
var module_blocks = new Array();
{foreach item=moduleblocks key=blockname from=$MODULE_BLOCKS}
module_blocks["{$blockname}"] = new Array({$moduleblocks});
{/foreach}
var module_fields = new Array();
{foreach item=modulefields key=modulename from=$MODULE_FIELDS}
module_fields["{$modulename}"] = new Array({$modulefields});
{/foreach}
var selected_module='{$SELECTMODULE}';
//crmv@48404
var inventory_modules = new Array();
{foreach item=modulename key=k from=$INVENTORY_MODULES}
inventory_modules['{$modulename}'] = '{$modulename}';
{/foreach}
function isInventorymodule(module){ldelim}
console.log(module);
console.log(typeof inventory_modules[module]);
if (typeof inventory_modules[module] != 'undefined' && inventory_modules[module] != ''){ldelim}
return true;
{rdelim}
return false;
{rdelim}
//crmv@48404 e
function change_modulesorce(first,second_name)
{ldelim}
if(selected_module!='')
{ldelim}
question = confirm("{$MOD.LBL_CHANGE_MODULE_QUESTION}");
if(question)
{ldelim}
var oEditor = CKEDITOR.instances.body;
oEditor.setData("");
oEditor = CKEDITOR.instances.header_body;
oEditor.setData("");
oEditor = CKEDITOR.instances.footer_body;
oEditor.setData("");
document.getElementById('nameOfFile').value='';
{rdelim}
else
{ldelim}
first.value=selected_module;
return;
{rdelim}
{rdelim}
selected_module=first.value;
if (selected_module != "")
{ldelim}
document.getElementById('related_block_tpl_row').style.display='table-row';
{rdelim}
else
{ldelim}
document.getElementById('related_block_tpl_row').style.display='none';
{rdelim}
var module = fillModuleFields(first,second_name);
fillModuleFields(first,'filename_fields');
var product_div = document.getElementById("product_div");
try {ldelim}
if (selectedTab2 == "body" && isInventorymodule(module)) //crmv@48404
{ldelim}
document.getElementById('no_product_div').style.display='none';
product_div.style.display = 'block';
document.getElementById('product_bloc_tpl_row').style.display='table-row';
{rdelim}
else
{ldelim}
document.getElementById('product_bloc_tpl_row').style.display='none';
product_div.style.display = 'none';
document.getElementById('no_product_div').style.display='block';
{rdelim}
{rdelim}catch(err){ldelim}
document.getElementById('product_bloc_tpl_row').style.display='block';
{rdelim}
change_relatedmodulesorce(first,'relatedmodulesorce');
fill_module_lang_array(first.value);
{rdelim}
function fillModuleFields(first,second_name)
{ldelim}
second = document.getElementById(second_name);
optionTest = true;
lgth = second.options.length - 1;
second.options[lgth] = null;
if (second.options[lgth]) optionTest = false;
if (!optionTest) return;
var box = first;
var module = box.options[box.selectedIndex].value;
if (!module) return;
var box2 = second;
//box2.options.length = 0;
var optgroups = box2.childNodes;
for(i = optgroups.length - 1 ; i >= 0 ; i--)
{ldelim}
box2.removeChild(optgroups[i]);
{rdelim}
var blocks = module_blocks[module];
var blocks_length = blocks.length;
if(second_name=='filename_fields')
{ldelim}
objOption=document.createElement("option");
objOption.innerHTML = '{$MOD.LBL_SELECT_MODULE_FIELD}';
objOption.value = '';
box2.appendChild(objOption);
optGroup = document.createElement('optgroup');
optGroup.label = '{$MOD.LBL_COMMON_FILEINFO}';
box2.appendChild(optGroup);
{foreach item=field key=field_val from=$FILENAME_FIELDS}
objOption=document.createElement("option");
objOption.innerHTML = '{$field}';
objOption.value = '{$field_val}';
optGroup.appendChild(objOption);
{/foreach}
if(isInventorymodule(module)) //crmv@48404
blocks_length-=2;
{rdelim}
for(b=0;b<blocks_length;b+=2)
{ldelim}
optGroup = document.createElement('optgroup');
optGroup.label = blocks[b];
box2.appendChild(optGroup);
var list = module_fields[module+'|'+ blocks[b+1]];
for(i=0;i<list.length;i+=2)
{ldelim}
//<optgroup label="Addresse" class=\"select\" style=\"border:none\">
objOption=document.createElement("option");
objOption.innerHTML = list[i];
objOption.value = list[i+1];
optGroup.appendChild(objOption);
{rdelim}
{rdelim}
return module;
{rdelim}
var all_related_modules = new Array();
{foreach item=related_modules key=relatedmodulename from=$ALL_RELATED_MODULES}
all_related_modules["{$relatedmodulename}"] = new Array('{$MOD.LBL_SELECT_MODULE}','none'{foreach item=module1 from=$related_modules} ,'{$module1|getTranslatedString:$module1}','{$module1}'{/foreach}); {* crmv@33640 *}
{/foreach}
function change_relatedmodulesorce(first,second_name)
{ldelim}
second = document.getElementById(second_name);
optionTest = true;
lgth = second.options.length - 1;
second.options[lgth] = null;
if (second.options[lgth]) optionTest = false;
if (!optionTest) return;
var box = first;
var number = box.options[box.selectedIndex].value;
if (!number) return;
var box2 = second;
//box2.options.length = 0;
var optgroups = box2.childNodes;
for(i = optgroups.length - 1 ; i >= 0 ; i--)
{ldelim}
box2.removeChild(optgroups[i]);
{rdelim}
var list = all_related_modules[number];
for(i=0;i<list.length;i+=2)
{ldelim}
objOption=document.createElement("option");
objOption.innerHTML = list[i];
objOption.value = list[i+1];
box2.appendChild(objOption);
{rdelim}
clearRelatedModuleFields();
{rdelim}
function clearRelatedModuleFields()
{ldelim}
second = document.getElementById("relatedmodulefields");
lgth = second.options.length - 1;
second.options[lgth] = null;
if (second.options[lgth]) optionTest = false;
if (!optionTest) return;
var box2 = second;
var optgroups = box2.childNodes;
for(i = optgroups.length - 1 ; i >= 0 ; i--)
{ldelim}
box2.removeChild(optgroups[i]);
{rdelim}
objOption=document.createElement("option");
objOption.innerHTML = "{$MOD.LBL_SELECT_MODULE_FIELD}";
objOption.value = "";
box2.appendChild(objOption);
{rdelim}
var related_module_fields = new Array();
{foreach item=relatedmodulefields key=relatedmodulename from=$RELATED_MODULE_FIELDS}
related_module_fields["{$relatedmodulename}"] = new Array({$relatedmodulefields});
{/foreach}
function change_relatedmodule(first,second_name)
{ldelim}
second = document.getElementById(second_name);
optionTest = true;
lgth = second.options.length - 1;
second.options[lgth] = null;
if (second.options[lgth]) optionTest = false;
if (!optionTest) return;
var box = first;
var number = box.options[box.selectedIndex].value;
if (!number) return;
var box2 = second;
//box2.options.length = 0;
var optgroups = box2.childNodes;
for(i = optgroups.length - 1 ; i >= 0 ; i--)
{ldelim}
box2.removeChild(optgroups[i]);
{rdelim}
if (number == "none")
{ldelim}
objOption=document.createElement("option");
objOption.innerHTML = "{$MOD.LBL_SELECT_MODULE_FIELD}";
objOption.value = "";
box2.appendChild(objOption);
{rdelim}
else
{ldelim}
var blocks = module_blocks[number];
for(b=0;b<blocks.length;b+=2)
{ldelim}
var list = related_module_fields[number+'|'+ blocks[b+1]];
if (list.length > 0)
{ldelim}
optGroup = document.createElement('optgroup');
optGroup.label = blocks[b];
box2.appendChild(optGroup);
for(i=0;i<list.length;i+=2)
{ldelim}
objOption=document.createElement("option");
objOption.innerHTML = list[i];
objOption.value = list[i+1];
optGroup.appendChild(objOption);
{rdelim}
{rdelim}
{rdelim}
{rdelim}
{rdelim}
function InsertIntoTemplate(element)
{ldelim}
selectField = document.getElementById(element).value;
if (selectedTab2 == "body")
var oEditor = CKEDITOR.instances.body;
else if (selectedTab2 == "header")
var oEditor = CKEDITOR.instances.header_body;
else if (selectedTab2 == "footer")
var oEditor = CKEDITOR.instances.footer_body;
if(element!='header_var' && element!='footer_var' && element!='hmodulefields' && element!='fmodulefields' && element!='dateval')
{ldelim}
if (selectField != '')
{ldelim}
if (selectField == 'ORGANIZATION_STAMP_SIGNATURE')
{ldelim}
insert_value = '{$COMPANY_STAMP_SIGNATURE}';
{rdelim}
{* crmv@25963
else if (selectField == 'COMPANY_LOGO')
{ldelim}
insert_value = '{$COMPANYLOGO}';
{rdelim}
crmv@25963e *}
else if (selectField == 'ORGANIZATION_HEADER_SIGNATURE')
{ldelim}
insert_value = '{$COMPANY_HEADER_SIGNATURE}';
{rdelim}
else
{ldelim}
if (element == "articelvar")
insert_value = '#'+selectField+'#';
else if (element == "relatedmodulefields")
insert_value = '$R_'+selectField+'$';
else if(element == "productbloctpl" || element == "productbloctpl2")
insert_value = selectField;
else if(element == "global_lang")
insert_value = '%G_'+selectField+'%';
else if(element == "module_lang")
insert_value = '%M_'+selectField+'%';
else if(element == "barcodeval")
insert_value = '[BARCODE|'+selectField+'=YOURCODE|BARCODE]';
else if(element == "customfunction")
insert_value = '[CUSTOMFUNCTION|'+selectField+'|CUSTOMFUNCTION]';
else
insert_value = '$'+selectField+'$';
{rdelim}
oEditor.insertHtml(insert_value);
{rdelim}
{rdelim}
else
{ldelim}
if (selectField != '')
{ldelim}
if(element=='hmodulefields' || element=='fmodulefields' )
oEditor.insertHtml('$'+selectField+'$');
else
oEditor.insertHtml(selectField);
{rdelim}
{rdelim}
{rdelim}
function savePDF()
{ldelim}
var pdf_name = document.getElementById("filename").value;
var error = 0;
if (pdf_name == "")
{ldelim}
alert(sprintf(alert_arr.CANNOT_BE_EMPTY, "{$MOD.LBL_PDF_NAME}"));
error++;
{rdelim}
var pdf_module = document.getElementById("modulename").value;
if (pdf_module == "")
{ldelim}
alert("{$MOD.LBL_MODULE_ERROR}");
error++;
{rdelim}
{* crmv@181170 *}
{if isFreeVersion()}
{Users::m_de_cryption_get(8)}
{/if}
{* crmv@181170e *}
if (!ControlNumber('margin_top',true) || !ControlNumber('margin_bottom',true) || !ControlNumber('margin_left',true) || !ControlNumber('margin_right',true))
{ldelim}
error++;
{rdelim}
if (error > 0)
return false;
else
return true;
{rdelim}
function ControlNumber(elid,final)
{ldelim}
var control_number = document.getElementById(elid).value;
{literal}
var re = new Array();
re[1] = new RegExp("^([0-9])");
re[2] = new RegExp("^[0-9]{1}[.]$");
re[3] = new RegExp("^[0-9]{1}[.][0-9]{1}$");
{/literal}
if (control_number.length > 3 || !re[control_number.length].test(control_number) || (final == true && control_number.length == 2))
{ldelim}
alert("{$MOD.LBL_MARGIN_ERROR}");
document.getElementById(elid).focus();
return false;
{rdelim}
else
{ldelim}
return true;
{rdelim}
{rdelim}
function refreshPosition(type)
{ldelim}
var i;
selectbox = document.getElementById(type + "_position");
selectbox_value = selectbox.value;
for(i=selectbox.options.length-1;i>=0;i--)
{ldelim}
selectbox.remove(i);
{rdelim}
el1 = document.getElementById(type + "_function_left").value;
el2 = document.getElementById(type + "_function_center").value;
el3 = document.getElementById(type + "_function_right").value;
selectbox.options[selectbox.options.length] = new Option("{$MOD.LBL_EMPTY_IMAGE}", "empty");
if (el1 == "hf_function_1") selectbox.options[selectbox.options.length] = new Option("{$MOD.LBL_LEFT}", "left");
if (el2 == "hf_function_1") selectbox.options[selectbox.options.length] = new Option("{$MOD.LBL_CENTER}", "center");
if (el3 == "hf_function_1") selectbox.options[selectbox.options.length] = new Option("{$MOD.LBL_RIGHT}", "right");
selectbox.value = selectbox_value;
{rdelim}
function showHideTab(tabname)
{ldelim}
document.getElementById(selectedTab+'_tab').className="dvtUnSelectedCell";
document.getElementById(tabname+'_tab').className='dvtSelectedCell';
document.getElementById(selectedTab+'_div').style.display='none';
document.getElementById(tabname+'_div').style.display='block';
var formerTab=selectedTab;
selectedTab=tabname;
{rdelim}
function showHideTab2(tabname)
{ldelim}
document.getElementById(selectedTab2+'_tab2').className="dvtUnSelectedCell";
document.getElementById(tabname+'_tab2').className='dvtSelectedCell';
document.getElementById(selectedTab2+'_variables').style.display='none';
document.getElementById(tabname+'_variables').style.display='';
document.getElementById(selectedTab2+'_div2').style.display='none';
document.getElementById(tabname+'_div2').style.display='block';
box = document.getElementById('modulename')
var module = box.options[box.selectedIndex].value;
if (tabname == "body" && isInventorymodule(module)) //crmv@48404
{ldelim}
document.getElementById('no_product_div').style.display='none';
document.getElementById('product_div').style.display = '';
document.getElementById('product_bloc_tpl_row').style.display='';
{rdelim}
else
{ldelim}
document.getElementById('product_bloc_tpl_row').style.display='none';
document.getElementById('product_div').style.display = 'none';
document.getElementById('no_product_div').style.display='';
{rdelim}
var formerTab=selectedTab2;
selectedTab2=tabname;
{rdelim}
{literal}
// crmv@192033
function fill_module_lang_array(module) {
jQuery.ajax({
url: 'index.php',
method: 'post',
data: 'module=PDFMaker&action=PDFMakerAjax&file=AjaxRequestHandle&langmod='+module,
success: function(result) {
var module_lang = document.getElementById('module_lang');
module_lang.length=0;
var map = result.split('|@|');
var keys = map[0].split('||');
var values = map[1].split('||');
for(var i=0;i<values.length;i++) {
var item = document.createElement('option');
item.text = values[i];
item.value = keys[i];
try {
module_lang.add(item,null);
} catch(ex) {
module_lang.add(item);
}
}
}
});
}
// crmv@192033e
function insertFieldIntoFilename(val)
{
if(val!='')
document.getElementById('nameOfFile').value+='$'+val+'$';
}
function EditRelatedBlock()
{
var pdf_module = document.getElementById("modulename").value;
var popup_url = 'index.php?module=PDFMaker&action=PDFMakerAjax&file=ListRelatedBlocks&pdfmodule='+pdf_module;
openPopup(popup_url,"Editblock","width=790px,height=630px,scrollbars=yes",'','','','','nospinner'); //crmv@25443
}
{/literal}
</script>