<?php
/*********************************************************************************
 * SugarCRM is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 * *******************************************************************************/

global $sugar_config;

  $path = 'modules/EcmDocumentTemplates/ModuleFieldsParser/ModuleFieldsParser.php';
  if(file_exists($path)) {
    require_once($path);
    $mfp = new ModuleFieldsParser();  
  }

  if((!isset($focus->footer_text) || $focus->footer_text == '') && (!isset($focus->name) || $focus->name == '') && (!isset($focus->id) || $focus->id == '')) $focus->footer_text = translate('LBL_DEFAULT_FOOTER_TEXT', 'EcmDocumentTemplates');
  if((!isset($focus->header_text) || $focus->header_text == '') && (!isset($focus->name) || $focus->name == '') && (!isset($focus->id) || $focus->id == '')) $focus->header_text = translate('LBL_DEFAULT_HEADER_TEXT', 'EcmDocumentTemplates');

$viewdefs['EcmDocumentTemplates']['EditView'] = array (
  'templateMeta' => array (
      'form' => array (
        'enctype'=>'multipart/form-data',
        'buttons'=>array(
          'SAVE',
          'CANCEL',
        ),
      ),
    'maxColumns' => '2', 
    'widths' => array (
      array('label' => '10', 'field' => '30'),
      array('label' => '10', 'field' => '30'),
    ),
    'includes' => array(
      array('file'=>'include/JSON.js'),
      array('file'=>'include/javascript/quicksearch.js'),
      array('file'=>'modules/EcmDocumentTemplates/formloader.js'),
      array('file'=>'modules/EcmDocumentTemplates/EcmDocumentTemplates.js'),
    ),
  ),                          
  'panels' => array (
    'LBL_INFORMATIONS'=> array(
    array (
      'name',
      'assigned_user_name'
    ),
    array (
      'document_number_format_id',
      'account_name'
    ),
    array (
		array(
			'name' => 'change_all_old_records',	
			'tabIndex' => '1',
			'customCode' => '<input tabindex="1" type="checkbox" id="change_all_old_records" name="change_all_old_records" {if $fields.change_all_old_records.value == 1}checked{/if}>'
		),
		array(
			'name' => 'show_header_on_all_pages',	
			'tabIndex' => '1',
			'customCode' => '<input tabindex="1" type="checkbox" id="show_header_on_all_pages" name="show_header_on_all_pages" {if $fields.show_header_on_all_pages.value == 1}checked{/if}>'
		),
	  //'document_number_letter'
    ),
    array (
      'documents_per',
		array(
			'name' => 'show_footer_on_all_pages',	
			'tabIndex' => '1',
			'customCode' => '<input tabindex="1" type="checkbox" id="show_footer_on_all_pages" name="show_footer_on_all_pages" {if $fields.show_footer_on_all_pages.value == 1}checked{/if}>'
		),
      //'correct_number_letter'
    ),
	array ('place_of_register', 'ecmlanguage'),
    array (
	  '',
      'account_number'    
    ),
    array (
      'footer_account',
      'footer_krs',
    ),
    array (
      'footer_address',
      'footer_regon'
    ),
    array (
      'footer_phone',
      'footer_capital'
    ),
    array (
      'footer_fax',
      'footer_management'
    ),
    array (
      'footer_swift',
      'footer_nip'
    ),
    array (
      'footer_bankname',
      'footer_vatid'
    ),
	),
	'LBL_LOGO' => array(
    array (
      array(
        'name' => 'logo_name',
        'label' => 'LBL_LOGO_PATH',
        'tabIndex' => 'l',
        'customCode' => '<input type="file" id="logo_name" name="logo_name" value="" onChange="{literal} var name=this.value.toLowerCase(); if(name.search(/.jpg/)==-1 && name.search(/.png/)==-1) { this.value=\'\'; }{/literal}" /><br>{$MOD.LBL_LOGO_INFO}',
      ),
      array(
        'label' => 'LBL_LOGO_PREVIEW',
        'customCode' => '{if $fields.logo_id.value != ""}<div id="logoDiv"><input type="hidden" name="old_logo_name" id="old_logo_name" value="{$fields.logo_name.value}" /><img src="index.php?module=EcmDocumentTemplates&action=logo&to_pdf=1&logo={$fields.logo_id.value}" /><br>({$fields.logo_name.value})&nbsp;&nbsp;<a href="javascript:deleteLogo();">{$APP.LBL_DELETE_BUTTON_LABEL}</a></div>{/if}'
      ),
    ),
  ),
  'LBL_TEMPLATE_TEXTS' => array (
//    array(array('label' => 'LBL_HEADER_TEXT','customCode' => $mfp->getFormHTML(true, 'header')),),
    array(array('label' => 'LBL_HEADER_TEXT','tabIndex'=>'f', 'customCode'=>'<textarea id="header_text" name="header_text" rows="5" style="width:100%;">{$fields.header_text.value}</textarea>')),
//    array(array('label' => 'LBL_FOOTER_TEXT','customCode' => $mfp->getFormHTML(true, 'footer')),),
    array(array('label' => 'LBL_FOOTER_TEXT','tabIndex'=>'f', 'customCode'=>'<textarea id="footer_text" name="footer_text" rows="5" style="width:100%;">{$fields.footer_text.value}</textarea>')),
  ),
  'LBL_TEMPLATE_FILES_DEFS' => array(
  	array(
		array('customCode'=>'{$TEMPLATE_FILES}'),
	),
  ),
	),
	
);


?>
