1 | {known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"} |
---|
2 | |
---|
3 | {if $upload_mode eq 'multiple'} |
---|
4 | <script type="text/javascript" src="{$uploadify_path}/swfobject.js"></script> |
---|
5 | <script type="text/javascript" src="{$uploadify_path}/jquery.uploadify.v2.1.0.min.js"></script> |
---|
6 | {/if} |
---|
7 | |
---|
8 | {literal} |
---|
9 | <script type="text/javascript"> |
---|
10 | jQuery(document).ready(function(){ |
---|
11 | function checkUploadStart() { |
---|
12 | var nbErrors = 0; |
---|
13 | $("#formErrors li").hide(); |
---|
14 | |
---|
15 | if ($("input[name=category_type]:checked").val() == "new" && $("input[name=category_name]").val() == "") { |
---|
16 | $("#formErrors #emptyCategoryName").show(); |
---|
17 | nbErrors++; |
---|
18 | } |
---|
19 | |
---|
20 | var nbFiles = 0; |
---|
21 | if ($("uploadBoxes").size() == 1) { |
---|
22 | $("input[name^=image_upload]").each(function() { |
---|
23 | if ($(this).val() != "") { |
---|
24 | nbFiles++; |
---|
25 | } |
---|
26 | }); |
---|
27 | } |
---|
28 | else { |
---|
29 | nbFiles = $(".uploadifyQueueItem").size(); |
---|
30 | } |
---|
31 | |
---|
32 | if (nbFiles == 0) { |
---|
33 | $("#formErrors #noPhoto").show(); |
---|
34 | nbErrors++; |
---|
35 | } |
---|
36 | |
---|
37 | if (nbErrors != 0) { |
---|
38 | $("#formErrors").show(); |
---|
39 | return false; |
---|
40 | } |
---|
41 | else { |
---|
42 | return true; |
---|
43 | } |
---|
44 | |
---|
45 | } |
---|
46 | |
---|
47 | $("input[name=category_type]").click(function () { |
---|
48 | $("[id^=category_type_]").hide(); |
---|
49 | $("#category_type_"+$(this).attr("value")).show(); |
---|
50 | }); |
---|
51 | |
---|
52 | $("#hideErrors").click(function() { |
---|
53 | $("#formErrors").hide(); |
---|
54 | return false; |
---|
55 | }); |
---|
56 | |
---|
57 | {/literal} |
---|
58 | {if $upload_mode eq 'html'} |
---|
59 | {literal} |
---|
60 | function addUploadBox() { |
---|
61 | var uploadBox = '<p class="file"><input type="file" size="60" name="image_upload[]" /></p>'; |
---|
62 | $(uploadBox).appendTo("#uploadBoxes"); |
---|
63 | } |
---|
64 | |
---|
65 | addUploadBox(); |
---|
66 | |
---|
67 | $("#addUploadBox A").click(function () { |
---|
68 | addUploadBox(); |
---|
69 | }); |
---|
70 | |
---|
71 | $("#uploadForm").submit(function() { |
---|
72 | return checkUploadStart(); |
---|
73 | }); |
---|
74 | {/literal} |
---|
75 | {elseif $upload_mode eq 'multiple'} |
---|
76 | |
---|
77 | var uploadify_path = '{$uploadify_path}'; |
---|
78 | var upload_id = '{$upload_id}'; |
---|
79 | var session_id = '{$session_id}'; |
---|
80 | var pwg_token = '{$pwg_token}'; |
---|
81 | var buttonText = 'Browse'; |
---|
82 | |
---|
83 | {literal} |
---|
84 | jQuery("#uploadify").uploadify({ |
---|
85 | 'uploader' : uploadify_path + '/uploadify.swf', |
---|
86 | 'script' : uploadify_path + '/uploadify.php', |
---|
87 | 'scriptData' : { |
---|
88 | 'upload_id' : upload_id, |
---|
89 | 'session_id' : session_id, |
---|
90 | 'pwg_token' : pwg_token, |
---|
91 | }, |
---|
92 | 'cancelImg' : uploadify_path + '/cancel.png', |
---|
93 | 'queueID' : 'fileQueue', |
---|
94 | 'auto' : false, |
---|
95 | 'displayData' : 'speed', |
---|
96 | 'buttonText' : buttonText, |
---|
97 | 'multi' : true, |
---|
98 | 'fileDesc' : 'Photo files (*.jpg,*.jpeg)', |
---|
99 | 'fileExt' : '*.jpg;*.JPG;*.jpeg;*.JPEG', |
---|
100 | 'onAllComplete' : function(event, data) { |
---|
101 | if (data.errors) { |
---|
102 | return false; |
---|
103 | } |
---|
104 | else { |
---|
105 | $("input[name=submit_upload]").click(); |
---|
106 | } |
---|
107 | } |
---|
108 | }); |
---|
109 | |
---|
110 | $("input[type=button]").click(function() { |
---|
111 | if (!checkUploadStart()) { |
---|
112 | return false; |
---|
113 | } |
---|
114 | |
---|
115 | $("#uploadify").uploadifyUpload(); |
---|
116 | }); |
---|
117 | |
---|
118 | {/literal} |
---|
119 | {/if} |
---|
120 | }); |
---|
121 | </script> |
---|
122 | |
---|
123 | <div class="titrePage"> |
---|
124 | <h2>{'Upload Photos'|@translate}</h2> |
---|
125 | </div> |
---|
126 | |
---|
127 | <div id="photosAddContent"> |
---|
128 | |
---|
129 | {if count($setup_errors) > 0} |
---|
130 | <div class="errors"> |
---|
131 | <ul> |
---|
132 | {foreach from=$setup_errors item=error} |
---|
133 | <li>{$error}</li> |
---|
134 | {/foreach} |
---|
135 | </ul> |
---|
136 | </div> |
---|
137 | {else} |
---|
138 | |
---|
139 | {if !empty($thumbnails)} |
---|
140 | <fieldset> |
---|
141 | <legend>{'Uploaded Photos'|@translate}</legend> |
---|
142 | <div> |
---|
143 | {foreach from=$thumbnails item=thumbnail} |
---|
144 | <a href="{$thumbnail.link}" class="externalLink"> |
---|
145 | <img src="{$thumbnail.src}" alt="{$thumbnail.file}" title="{$thumbnail.title}" class="thumbnail"> |
---|
146 | </a> |
---|
147 | {/foreach} |
---|
148 | </div> |
---|
149 | <p id="batchLink"><a href="{$batch_link}">{$batch_label}</a></p> |
---|
150 | </fieldset> |
---|
151 | {/if} |
---|
152 | |
---|
153 | <div id="formErrors" class="errors" style="display:none"> |
---|
154 | <ul> |
---|
155 | <li id="emptyCategoryName">{'The name of a category should not be empty'|@translate}</li> |
---|
156 | <li id="noPhoto">{'Select at least one picture'|@translate}</li> |
---|
157 | </ul> |
---|
158 | <div class="hideButton" style="text-align:center"><a href="#" id="hideErrors">{'Hide'|@translate}</a></div> |
---|
159 | </div> |
---|
160 | |
---|
161 | <form id="uploadForm" enctype="multipart/form-data" method="post" action="{$F_ACTION}" class="properties"> |
---|
162 | {if $upload_mode eq 'multiple'} |
---|
163 | <input name="upload_id" value="{$upload_id}" type="hidden"> |
---|
164 | {/if} |
---|
165 | |
---|
166 | <fieldset> |
---|
167 | <legend>{'Drop into category'|@translate}</legend> |
---|
168 | |
---|
169 | <label><input type="radio" name="category_type" value="existing"> {'existing category'|@translate}</label> |
---|
170 | <label><input type="radio" name="category_type" value="new" checked="checked"> {'create a new category'|@translate}</label> |
---|
171 | |
---|
172 | <div id="category_type_existing" style="display:none" class="category_selection"> |
---|
173 | <select class="categoryDropDown" name="category"> |
---|
174 | {html_options options=$category_options} |
---|
175 | </select> |
---|
176 | </div> |
---|
177 | |
---|
178 | <div id="category_type_new" class="category_selection"> |
---|
179 | <table> |
---|
180 | <tr> |
---|
181 | <td>{'Parent category'|@translate}</td> |
---|
182 | <td> |
---|
183 | <select class="categoryDropDown" name="category_parent"> |
---|
184 | <option value="0">------------</option> |
---|
185 | {html_options options=$category_options} |
---|
186 | </select> |
---|
187 | </td> |
---|
188 | </tr> |
---|
189 | <tr> |
---|
190 | <td>{'Category name'|@translate}</td> |
---|
191 | <td> |
---|
192 | <input type="text" name="category_name" value="{$F_CATEGORY_NAME}" style="width:400px"> |
---|
193 | </td> |
---|
194 | </tr> |
---|
195 | </table> |
---|
196 | </div> |
---|
197 | </fieldset> |
---|
198 | |
---|
199 | <fieldset> |
---|
200 | <legend>{'Who can see these photos?'|@translate}</legend> |
---|
201 | |
---|
202 | <select name="level" size="1"> |
---|
203 | {html_options options=$level_options selected=$level_options_selected} |
---|
204 | </select> |
---|
205 | </fieldset> |
---|
206 | |
---|
207 | <fieldset> |
---|
208 | <legend>{'Select files'|@translate}</legend> |
---|
209 | |
---|
210 | {if $upload_mode eq 'html'} |
---|
211 | <p><a href="{$switch_url}">{'... or switch to the multiple files form'|@translate}</a></p> |
---|
212 | |
---|
213 | <p>{'JPEG files or ZIP archives with JPEG files inside please.'|@translate}</p> |
---|
214 | |
---|
215 | <div id="uploadBoxes"></div> |
---|
216 | <div id="addUploadBox"> |
---|
217 | <a href="javascript:">{'+ Add an upload box'|@translate}</a> |
---|
218 | </div> |
---|
219 | |
---|
220 | </fieldset> |
---|
221 | |
---|
222 | <p> |
---|
223 | <input class="submit" type="submit" name="submit_upload" value="{'Upload'|@translate}" {$TAG_INPUT_ENABLED}/> |
---|
224 | </p> |
---|
225 | {elseif $upload_mode eq 'multiple'} |
---|
226 | </table> |
---|
227 | |
---|
228 | <p> |
---|
229 | <input type="file" name="uploadify" id="uploadify" /> |
---|
230 | </p> |
---|
231 | |
---|
232 | <p><a href="{$switch_url}">{'... or switch to the old style form'|@translate}</a></p> |
---|
233 | |
---|
234 | <div id="fileQueue"></div> |
---|
235 | |
---|
236 | </fieldset> |
---|
237 | <p> |
---|
238 | <input class="submit" type="button" value="{'Upload'|@translate}"/> |
---|
239 | <input type="submit" name="submit_upload" style="display:none"/> |
---|
240 | </p> |
---|
241 | {/if} |
---|
242 | </form> |
---|
243 | {/if} |
---|
244 | |
---|
245 | </div> <!-- photosAddContent --> |
---|