]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/SugarFields/Fields/File/EditView.tpl
Release 6.5.0
[Github/sugarcrm.git] / include / SugarFields / Fields / File / EditView.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM Community Edition is a customer relationship management program developed by
4  * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
5  * 
6  * This program is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  * 
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
16  * details.
17  * 
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  * 
23  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
25  * 
26  * The interactive user interfaces in modified source and object code versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  * 
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the "Powered by
32  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33  * technical reasons, the Appropriate Legal Notices must display the words
34  * "Powered by SugarCRM".
35  ********************************************************************************/
36
37 *}
38 {{if isset($vardef.allowEapm) && $vardef.allowEapm}}
39 <script type="text/javascript" src='{{sugar_getjspath file="cache/include/externalAPI.cache.js"}}'></script>
40 {{/if}}
41 <script type="text/javascript" src='{{sugar_getjspath file="include/SugarFields/Fields/File/SugarFieldFile.js"}}'></script>
42 {{capture name=idName assign=idName}}{{sugarvar key='name'}}{{/capture}}
43 {{if !empty($displayParams.idName)}}
44     {{assign var=idName value=$displayParams.idName}}
45 {{/if}}
46
47 {{if !isset($vardef.noRemove) || !$vardef.noRemove}}
48 {if !empty({{sugarvar key='value' stringFormat=true}}) }
49     {assign var=showRemove value=true}
50 {else}
51     {assign var=showRemove value=false}
52 {/if}
53 {{else}}
54     {assign var=showRemove value=false}
55 {{/if}}
56
57 {{if isset($vardef.noChange) && $vardef.noChange }}
58 {if !empty({{sugarvar key='value' stringFormat=true}}) }
59     {assign var=showRemove value=true}
60     {assign var=noChange value=true}
61 {else}
62     {assign var=noChange value=false}
63 {/if}
64 {{else}}
65     {assign var=noChange value=false}
66 {{/if}}
67
68 <input type="hidden" name="deleteAttachment" value="0">
69 <input type="hidden" name="{{$idName}}" id="{{$idName}}" value="{{sugarvar key='value'}}">
70 {{if isset($vardef.allowEapm) && $vardef.allowEapm}}
71 <input type="hidden" name="{{$vardef.docId}}" id="{{$vardef.docId}}" value="{$fields.{{$vardef.docId}}.value}">
72 <input type="hidden" name="{{$vardef.docUrl}}" id="{{$vardef.docUrl}}" value="{$fields.{{$vardef.docUrl}}.value}">
73 <input type="hidden" name="{{$idName}}_old_doctype" id="{{$idName}}_old_doctype" value="{$fields.{{$vardef.docType}}.value}">
74 {{/if}}
75 <span id="{{$idName}}_old" style="display:{if !$showRemove}none;{/if}">
76   <a href="index.php?entryPoint=download&id={$fields.{{$vardef.fileId}}.value}&type={{$vardef.linkModule}}" class="tabDetailViewDFLink">{{sugarvar key='value'}}</a>
77
78 {{if isset($vardef.allowEapm) && $vardef.allowEapm}}
79 {if isset($fields.{{$vardef.docType}}) && !empty($fields.{{$vardef.docType}}.value) && $fields.{{$vardef.docType}}.value != 'Sugar' && !empty($fields.{{$vardef.docUrl}}.value) }
80 {capture name=imageNameCapture assign=imageName}
81 {$fields.{{$vardef.docType}}.value}_image_inline.png
82 {/capture}
83 <a href="{$fields.{{$vardef.docUrl}}.value}" class="tabDetailViewDFLink" target="_blank">{sugar_getimage name=$imageName alt=$imageName other_attributes='border="0" '}</a>
84 {/if}
85 {{/if}}
86 {if !$noChange}
87 <input type='button' class='button' id='remove_button' value='{$APP.LBL_REMOVE}' onclick='SUGAR.field.file.deleteAttachment("{{$idName}}","{{$vardef.docType}}",this);'>
88 {/if}
89 </span>
90 {if !$noChange}
91 <span id="{{$idName}}_new" style="display:{if $showRemove}none;{/if}">
92 <input type="hidden" name="{{$idName}}_escaped">
93 <input id="{{$idName}}_file" name="{{$idName}}_file" 
94 type="file" title='{{$vardef.help}}' size="{{$displayParams.size|default:30}}"
95 {{if !empty($displayParams.accesskey)}} accesskey='{{$displayParams.accesskey}}' {{/if}} 
96 {{if !empty($vardef.len)}}
97     maxlength='{{$vardef.len}}'
98 {{elseif !empty($displayParams.maxlength)}}
99     maxlength="{{$displayParams.maxlength}}"
100 {{else}}
101     maxlength="255"
102 {{/if}}
103 {{$displayParams.field}}>
104
105 {{if isset($vardef.allowEapm) && $vardef.allowEapm}}
106 <span id="{{$idName}}_externalApiSelector" style="display:none;">
107 <br><h4 id="{{$idName}}_externalApiLabel">
108 <span id="{{$idName}}_more">{sugar_image name="advanced_search" width="8px" height="8px"}</span>
109 <span id="{{$idName}}_less" style="display: none;">{sugar_image name="basic_search" width="8px" height="8px"}</span>
110 {$APP.LBL_SEARCH_EXTERNAL_API}</h4>
111 <span id="{{$idName}}_remoteNameSpan" style="display: none;">
112 <input type="text" class="sqsEnabled" name="{{$idName}}_remoteName" id="{{$idName}}_remoteName" size="{{$displayParams.size|default:30}}" 
113 {{if !empty($displayParams.accesskey)}} accesskey='{{$displayParams.accesskey}}' {{/if}} 
114 {{if !empty($vardef.len)}}
115     maxlength='{{$vardef.len}}'
116 {{elseif !empty($displayParams.maxlength)}}
117     maxlength="{{$displayParams.maxlength}}"
118 {{else}}
119     maxlength="255"
120 {{/if}} autocomplete="off" value="{if !empty($fields[{{$vardef.docId}}].value)}{{sugarvar key='name'}}{/if}">
121
122 {{if empty($displayParams.hideButtons) }}
123 <span class="id-ff multiple">
124 <button type="button" name="{{$idName}}_remoteSelectBtn" id="{{$idName}}_remoteSelectBtn" tabindex="{{$tabindex}}" title="{sugar_translate label="{{$displayParams.accessKeySelectTitle}}"}" class="button firstChild" value="{sugar_translate label="{{$displayParams.accessKeySelectLabel}}"}"
125 onclick="SUGAR.field.file.openPopup('{{$idName}}'); return false;">
126 {sugar_getimage alt=$app_strings.LBL_ID_FF_SELECT name="id-ff-select" ext=".png" other_attributes=''}</button>
127 <button type="button" name="{{$idName}}_remoteClearBtn" id="{{$idName}}_remoteClearBtn" tabindex="{{$tabindex}}" title="{$APP.LBL_CLEAR_BUTTON_TITLE}" class="button lastChild" value="{$APP.LBL_CLEAR_BUTTON_LABEL}" onclick="SUGAR.field.file.clearRemote('{{$idName}}'); return false;">
128 {sugar_getimage name="id-ff-clear" alt=$app_strings.LBL_ID_FF_CLEAR ext=".png" other_attributes=''}
129 </button>
130 </span>
131 {{/if}}
132 </span>
133
134 <div style="display: none;" id="{{$idName}}_securityLevelBox">
135   <b>{$APP.LBL_EXTERNAL_SECURITY_LEVEL}: </b>
136   <select name="{{$idName}}_securityLevel" id="{{$idName}}_securityLevel">
137   </select>
138 </div>
139 <script type="text/javascript">
140 YAHOO.util.Event.onDOMReady(function() {ldelim}
141 SUGAR.field.file.setupEapiShowHide("{{$idName}}","{{$vardef.docType}}","{$form_name}");
142 {rdelim});
143
144 if ( typeof(sqs_objects) == 'undefined' ) {ldelim}
145     sqs_objects = new Array;
146 {rdelim}
147
148 sqs_objects["{$form_name}_{{$idName}}_remoteName"] = {ldelim}
149 "form":"{$form_name}",
150 "method":"externalApi",
151 "api":"",
152 "modules":["EAPM"],
153 "field_list":["name", "id", "url", "id"],
154 "populate_list":["{{$idName}}_remoteName", "{{$vardef.docId}}", "{{$vardef.docUrl}}", "{{$idName}}"],
155 "required_list":["name"],
156 "conditions":[],
157 "no_match_text":"No Match"
158 {rdelim};
159
160 if(typeof QSProcessedFieldsArray != 'undefined') {ldelim}
161         QSProcessedFieldsArray["{$form_name}_{{$idName}}_remoteName"] = false;
162 {rdelim}
163 {if $showRemove && strlen("{{$vardef.docType}}") > 0 }
164 document.getElementById("{{$vardef.docType}}").disabled = true;
165 {/if}
166 enableQS(false);
167 </script>
168 {{/if}}
169 {else}
170 {* No change possible *}
171
172 {{if isset($vardef.allowEapm) && $vardef.allowEapm}}
173 <script type="text/javascript">
174 YAHOO.util.Event.onDOMReady(function() 
175 {ldelim}
176 document.getElementById("{{$vardef.docType}}").disabled = true;
177 {rdelim});
178 </script>
179 {{/if}}
180
181 {/if}
182
183 {{if !empty($displayParams.onchangeSetFileNameTo) }}
184 <script type="text/javascript">
185
186 var {{$idName}}_setFileName = function()
187 {literal}
188 {
189     var dom = YAHOO.util.Dom;
190 {/literal}    
191     sourceElement = "{{$idName}}_file";
192     targetElement = "{{$displayParams.onchangeSetFileNameTo}}";
193         src = new String(dom.get(sourceElement).value);
194         target = new String(dom.get(targetElement).value);
195 {literal}
196         if (target.length == 0) 
197         {
198                 lastindex=src.lastIndexOf("/");
199                 if (lastindex == -1) {
200                         lastindex=src.lastIndexOf("\\");
201                 } 
202                 if (lastindex == -1) {
203                         dom.get(targetElement).value=src;
204                 } else {
205                         dom.get(targetElement).value=src.substr(++lastindex, src.length);
206                 }       
207         }       
208 }
209 {/literal}
210
211 YAHOO.util.Event.onDOMReady(function() 
212 {ldelim}
213 if(document.getElementById("{{$displayParams.onchangeSetFileNameTo}}"))
214 {ldelim}
215 YAHOO.util.Event.addListener('{{$idName}}_file', 'change', {{$idName}}_setFileName);
216 YAHOO.util.Event.addListener(['{{$idName}}_file', '{{$vardef.docType}}'], 'change', SUGAR.field.file.checkFileExtension,{ldelim} fileEl: '{{$idName}}_file', targEl: '{{$displayParams.onchangeSetFileNameTo}}'{rdelim});
217 {rdelim}
218 {rdelim});
219 </script>
220 {{/if}}
221
222 </span>