]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/SugarFields/Fields/File/EditView.tpl
Release 6.4.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-2011 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' 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($vardef.len)}}
96     maxlength='{{$vardef.len}}'
97 {{elseif !empty($displayParams.maxlength)}}
98     maxlength="{{$displayParams.maxlength}}"
99 {{else}}
100     maxlength="255"
101 {{/if}}
102 {{$displayParams.field}}>
103
104 {{if isset($vardef.allowEapm) && $vardef.allowEapm}}
105 <span id="{{$idName}}_externalApiSelector" style="display:none;">
106 <br><h4 id="{{$idName}}_externalApiLabel">
107 <span id="{{$idName}}_more">{sugar_image name="advanced_search" width="8px" height="8px"}</span>
108 <span id="{{$idName}}_less" style="display: none;">{sugar_image name="basic_search" width="8px" height="8px"}</span>
109 {$APP.LBL_SEARCH_EXTERNAL_API}</h4>
110 <span id="{{$idName}}_remoteNameSpan" style="display: none;">
111 <input type="text" class="sqsEnabled" name="{{$idName}}_remoteName" id="{{$idName}}_remoteName" size="{{$displayParams.size|default:30}}" 
112 {{if !empty($vardef.len)}}
113     maxlength='{{$vardef.len}}'
114 {{elseif !empty($displayParams.maxlength)}}
115     maxlength="{{$displayParams.maxlength}}"
116 {{else}}
117     maxlength="255"
118 {{/if}} autocomplete="off" value="{if !empty($fields[{{$vardef.docId}}].value)}{{sugarvar key='name'}}{/if}">
119
120 {{if empty($displayParams.hideButtons) }}
121 <span class="id-ff multiple">
122 <button type="button" name="{{$idName}}_remoteSelectBtn" id="{{$idName}}_remoteSelectBtn" tabindex="{{$tabindex}}" title="{sugar_translate label="{{$displayParams.accessKeySelectTitle}}"}" accessKey="{sugar_translate label="{{$displayParams.accessKeySelect}}"}" class="button firstChild" value="{sugar_translate label="{{$displayParams.accessKeySelectLabel}}"}"
123 onclick="SUGAR.field.file.openPopup('{{$idName}}'); return false;">
124 {sugar_getimage alt=$app_strings.LBL_ID_FF_SELECT name="id-ff-select" ext=".png" other_attributes=''}</button>
125 <button type="button" name="{{$idName}}_remoteClearBtn" id="{{$idName}}_remoteClearBtn" tabindex="{{$tabindex}}" title="{$APP.LBL_CLEAR_BUTTON_TITLE}" accessKey="{$APP.LBL_CLEAR_BUTTON_KEY}" class="button lastChild" value="{$APP.LBL_CLEAR_BUTTON_LABEL}" onclick="SUGAR.field.file.clearRemote('{{$idName}}'); return false;">
126 {sugar_getimage name="id-ff-clear" alt=$app_strings.LBL_ID_FF_CLEAR ext=".png" other_attributes=''}
127 </button>
128 </span>
129 {{/if}}
130 </span>
131
132 <div style="display: none;" id="{{$idName}}_securityLevelBox">
133   <b>{$APP.LBL_EXTERNAL_SECURITY_LEVEL}: </b>
134   <select name="{{$idName}}_securityLevel" id="{{$idName}}_securityLevel">
135   </select>
136 </div>
137 <script type="text/javascript">
138 YAHOO.util.Event.onDOMReady(function() {ldelim}
139 SUGAR.field.file.setupEapiShowHide("{{$idName}}","{{$vardef.docType}}","{$form_name}");
140 {rdelim});
141
142 if ( typeof(sqs_objects) == 'undefined' ) {ldelim}
143     sqs_objects = new Array;
144 {rdelim}
145
146 sqs_objects["{$form_name}_{{$idName}}_remoteName"] = {ldelim}
147 "form":"{$form_name}",
148 "method":"externalApi",
149 "api":"",
150 "modules":["EAPM"],
151 "field_list":["name", "id", "url", "id"],
152 "populate_list":["{{$idName}}_remoteName", "{{$vardef.docId}}", "{{$vardef.docUrl}}", "{{$idName}}"],
153 "required_list":["name"],
154 "conditions":[],
155 "no_match_text":"No Match"
156 {rdelim};
157
158 if(typeof QSProcessedFieldsArray != 'undefined') {ldelim}
159         QSProcessedFieldsArray["{$form_name}_{{$idName}}_remoteName"] = false;
160 {rdelim}
161 {if $showRemove && strlen("{{$vardef.docType}}") > 0 }
162 document.getElementById("{{$vardef.docType}}").disabled = true;
163 {/if}
164 enableQS(false);
165 </script>
166 {{/if}}
167 {else}
168 {* No change possible *}
169
170 {{if isset($vardef.allowEapm) && $vardef.allowEapm}}
171 <script type="text/javascript">
172 YAHOO.util.Event.onDOMReady(function() 
173 {ldelim}
174 document.getElementById("{{$vardef.docType}}").disabled = true;
175 {rdelim});
176 </script>
177 {{/if}}
178
179 {/if}
180
181 {{if !empty($displayParams.onchangeSetFileNameTo) }}
182 <script type="text/javascript">
183
184 var {{$idName}}_setFileName = function()
185 {literal}
186 {
187     var dom = YAHOO.util.Dom;
188 {/literal}    
189     sourceElement = "{{$idName}}_file";
190     targetElement = "{{$displayParams.onchangeSetFileNameTo}}";
191         src = new String(dom.get(sourceElement).value);
192         target = new String(dom.get(targetElement).value);
193 {literal}
194         if (target.length == 0) 
195         {
196                 lastindex=src.lastIndexOf("/");
197                 if (lastindex == -1) {
198                         lastindex=src.lastIndexOf("\\");
199                 } 
200                 if (lastindex == -1) {
201                         dom.get(targetElement).value=src;
202                 } else {
203                         dom.get(targetElement).value=src.substr(++lastindex, src.length);
204                 }       
205         }       
206 }
207 {/literal}
208
209 YAHOO.util.Event.onDOMReady(function() 
210 {ldelim}
211 if(document.getElementById("{{$displayParams.onchangeSetFileNameTo}}"))
212 {ldelim}
213 YAHOO.util.Event.addListener('{{$idName}}_file', 'change', {{$idName}}_setFileName);
214 YAHOO.util.Event.addListener(['{{$idName}}_file', '{{$vardef.docType}}'], 'change', SUGAR.field.file.checkFileExtension,{ldelim} fileEl: '{{$idName}}_file', targEl: '{{$displayParams.onchangeSetFileNameTo}}'{rdelim});
215 {rdelim}
216 {rdelim});
217 </script>
218 {{/if}}
219
220 </span>