[5123] | 1 | {known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"} |
---|
[5089] | 2 | |
---|
[5736] | 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 | |
---|
[5089] | 8 | {literal} |
---|
[5736] | 9 | <script type="text/javascript"> |
---|
| 10 | jQuery(document).ready(function(){ |
---|
| 11 | function checkUploadStart() { |
---|
| 12 | var nbErrors = 0; |
---|
| 13 | $("#formErrors li").hide(); |
---|
[5089] | 14 | |
---|
[5736] | 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; |
---|
[5737] | 21 | if ($("#uploadBoxes").size() == 1) { |
---|
[5736] | 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 | |
---|
[5089] | 47 | $("input[name=category_type]").click(function () { |
---|
| 48 | $("[id^=category_type_]").hide(); |
---|
| 49 | $("#category_type_"+$(this).attr("value")).show(); |
---|
| 50 | }); |
---|
[5736] | 51 | |
---|
| 52 | $("#hideErrors").click(function() { |
---|
| 53 | $("#formErrors").hide(); |
---|
| 54 | return false; |
---|
| 55 | }); |
---|
| 56 | |
---|
[5089] | 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 | }); |
---|
[5736] | 70 | |
---|
| 71 | $("#uploadForm").submit(function() { |
---|
| 72 | return checkUploadStart(); |
---|
| 73 | }); |
---|
[5089] | 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, |
---|
[5736] | 98 | 'fileDesc' : 'Photo files (*.jpg,*.jpeg)', |
---|
| 99 | 'fileExt' : '*.jpg;*.JPG;*.jpeg;*.JPEG', |
---|
[5089] | 100 | 'onAllComplete' : function(event, data) { |
---|
| 101 | if (data.errors) { |
---|
| 102 | return false; |
---|
| 103 | } |
---|
| 104 | else { |
---|
| 105 | $("input[name=submit_upload]").click(); |
---|
| 106 | } |
---|
| 107 | } |
---|
| 108 | }); |
---|
[5736] | 109 | |
---|
| 110 | $("input[type=button]").click(function() { |
---|
| 111 | if (!checkUploadStart()) { |
---|
| 112 | return false; |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | $("#uploadify").uploadifyUpload(); |
---|
| 116 | }); |
---|
| 117 | |
---|
| 118 | {/literal} |
---|
| 119 | {/if} |
---|
[5089] | 120 | }); |
---|
| 121 | </script> |
---|
| 122 | |
---|
[5098] | 123 | <div class="titrePage"> |
---|
[5299] | 124 | <h2>{'Upload Photos'|@translate}</h2> |
---|
[5089] | 125 | </div> |
---|
| 126 | |
---|
[5174] | 127 | <div id="photosAddContent"> |
---|
| 128 | |
---|
[5089] | 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} |
---|
[5493] | 144 | <a href="{$thumbnail.link}" class="externalLink"> |
---|
[5089] | 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> |
---|
[5742] | 151 | <p><a href="">{'Add another set of photos'|@translate}</a></p> |
---|
| 152 | {else} |
---|
[5089] | 153 | |
---|
[5736] | 154 | <div id="formErrors" class="errors" style="display:none"> |
---|
| 155 | <ul> |
---|
| 156 | <li id="emptyCategoryName">{'The name of a category should not be empty'|@translate}</li> |
---|
| 157 | <li id="noPhoto">{'Select at least one picture'|@translate}</li> |
---|
| 158 | </ul> |
---|
| 159 | <div class="hideButton" style="text-align:center"><a href="#" id="hideErrors">{'Hide'|@translate}</a></div> |
---|
| 160 | </div> |
---|
[5089] | 161 | |
---|
| 162 | <form id="uploadForm" enctype="multipart/form-data" method="post" action="{$F_ACTION}" class="properties"> |
---|
| 163 | {if $upload_mode eq 'multiple'} |
---|
| 164 | <input name="upload_id" value="{$upload_id}" type="hidden"> |
---|
| 165 | {/if} |
---|
| 166 | |
---|
[5174] | 167 | <fieldset> |
---|
| 168 | <legend>{'Drop into category'|@translate}</legend> |
---|
[5089] | 169 | |
---|
| 170 | <label><input type="radio" name="category_type" value="existing"> {'existing category'|@translate}</label> |
---|
| 171 | <label><input type="radio" name="category_type" value="new" checked="checked"> {'create a new category'|@translate}</label> |
---|
| 172 | |
---|
| 173 | <div id="category_type_existing" style="display:none" class="category_selection"> |
---|
| 174 | <select class="categoryDropDown" name="category"> |
---|
| 175 | {html_options options=$category_options} |
---|
| 176 | </select> |
---|
| 177 | </div> |
---|
| 178 | |
---|
| 179 | <div id="category_type_new" class="category_selection"> |
---|
| 180 | <table> |
---|
| 181 | <tr> |
---|
| 182 | <td>{'Parent category'|@translate}</td> |
---|
| 183 | <td> |
---|
| 184 | <select class="categoryDropDown" name="category_parent"> |
---|
| 185 | <option value="0">------------</option> |
---|
| 186 | {html_options options=$category_options} |
---|
| 187 | </select> |
---|
| 188 | </td> |
---|
| 189 | </tr> |
---|
| 190 | <tr> |
---|
| 191 | <td>{'Category name'|@translate}</td> |
---|
| 192 | <td> |
---|
| 193 | <input type="text" name="category_name" value="{$F_CATEGORY_NAME}" style="width:400px"> |
---|
| 194 | </td> |
---|
| 195 | </tr> |
---|
| 196 | </table> |
---|
| 197 | </div> |
---|
[5174] | 198 | </fieldset> |
---|
[5089] | 199 | |
---|
[5174] | 200 | <fieldset> |
---|
| 201 | <legend>{'Who can see these photos?'|@translate}</legend> |
---|
[5089] | 202 | |
---|
| 203 | <select name="level" size="1"> |
---|
| 204 | {html_options options=$level_options selected=$level_options_selected} |
---|
| 205 | </select> |
---|
[5174] | 206 | </fieldset> |
---|
[5089] | 207 | |
---|
[5174] | 208 | <fieldset> |
---|
| 209 | <legend>{'Select files'|@translate}</legend> |
---|
[5089] | 210 | |
---|
| 211 | {if $upload_mode eq 'html'} |
---|
| 212 | <p><a href="{$switch_url}">{'... or switch to the multiple files form'|@translate}</a></p> |
---|
| 213 | |
---|
| 214 | <p>{'JPEG files or ZIP archives with JPEG files inside please.'|@translate}</p> |
---|
| 215 | |
---|
| 216 | <div id="uploadBoxes"></div> |
---|
| 217 | <div id="addUploadBox"> |
---|
| 218 | <a href="javascript:">{'+ Add an upload box'|@translate}</a> |
---|
| 219 | </div> |
---|
| 220 | |
---|
[5174] | 221 | </fieldset> |
---|
[5089] | 222 | |
---|
| 223 | <p> |
---|
| 224 | <input class="submit" type="submit" name="submit_upload" value="{'Upload'|@translate}" {$TAG_INPUT_ENABLED}/> |
---|
| 225 | </p> |
---|
| 226 | {elseif $upload_mode eq 'multiple'} |
---|
| 227 | </table> |
---|
| 228 | |
---|
| 229 | <p> |
---|
| 230 | <input type="file" name="uploadify" id="uploadify" /> |
---|
| 231 | </p> |
---|
| 232 | |
---|
| 233 | <p><a href="{$switch_url}">{'... or switch to the old style form'|@translate}</a></p> |
---|
| 234 | |
---|
| 235 | <div id="fileQueue"></div> |
---|
| 236 | |
---|
[5174] | 237 | </fieldset> |
---|
[5089] | 238 | <p> |
---|
[5736] | 239 | <input class="submit" type="button" value="{'Upload'|@translate}"/> |
---|
[5089] | 240 | <input type="submit" name="submit_upload" style="display:none"/> |
---|
| 241 | </p> |
---|
| 242 | {/if} |
---|
| 243 | </form> |
---|
[5742] | 244 | {/if} {* empty($thumbnails) *} |
---|
| 245 | {/if} {* $setup_errors *} |
---|
[5174] | 246 | |
---|
| 247 | </div> <!-- photosAddContent --> |
---|