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