source: extensions/upload_form/upload.tpl @ 31953

Revision 4897, 5.1 KB checked in by plg, 10 years ago (diff)

feature 1409 added: new tab "Settings".

Note: I would have like to use jQuery UI sliders for resize dimensions and
image quality BUT I can't even find the documentation of the very old version
of jQuery UI we use. I'll implement theses widget when integrating UploadForm
into trunk (with jQuery + jQuery UI updated).

Line 
1{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"}
2
3{literal}
4<script>
5$(document).ready(function(){
6
7  $("input[name=category_type]").click(function () {
8    $("[id^=category_type_]").hide();
9    $("#category_type_"+$(this).attr("value")).show();
10  });
11});
12</script>
13{/literal}
14
15{if $upload_mode eq 'html'}
16<script type="text/javascript" src="{$plugin_path}include/upload.js"></script>
17{elseif $upload_mode eq 'multiple'}
18<script type="text/javascript" src="{$plugin_path}uploadify/swfobject.js"></script>
19<script type="text/javascript" src="{$plugin_path}uploadify/jquery.uploadify.v2.1.0.min.js"></script>
20
21<script type="text/javascript">
22var basepath = '{$plugin_path}';
23var upload_id = '{$upload_id}';
24var session_id = '{$session_id}';
25var pwg_token = '{$pwg_token}';
26var buttonText = 'Browse';
27
28{literal}
29jQuery(document).ready(function() {
30  jQuery("#uploadify").uploadify({
31    'uploader'       : basepath + 'uploadify/uploadify.swf',
32    'script'         : basepath + 'uploadify/uploadify.php',
33    'scriptData'     : {
34      'upload_id' : upload_id,
35      'session_id' : session_id,
36      'pwg_token' : pwg_token,
37    },
38    'cancelImg'      : basepath + 'uploadify/cancel.png',
39    'queueID'        : 'fileQueue',
40    'auto'           : false,
41    'displayData'    : 'speed',
42    'buttonText'     : buttonText,
43    'multi'          : true,
44    'onAllComplete'  : function(event, data) {
45      if (data.errors) {
46        return false;
47      }
48      else {
49        $("input[name=submit_upload]").click();
50      }
51    }
52  });
53});
54{/literal}
55</script>
56{/if}
57
58<div class="titrePage" style="height:25px">
59  <h2>{'Upload Form'|@translate}</h2>
60</div>
61
62{if count($setup_errors) > 0}
63<div class="errors">
64  <ul>
65  {foreach from=$setup_errors item=error}
66    <li>{$error}</li>
67  {/foreach}
68  </ul>
69</div>
70{else}
71
72{if !empty($thumbnails)}
73<fieldset>
74  <legend>{'Uploaded Photos'|@translate}</legend>
75  <div>
76  {foreach from=$thumbnails item=thumbnail}
77    <a href="{$thumbnail.link}" onclick="window.open(this.href); return false;">
78      <img src="{$thumbnail.src}" alt="{$thumbnail.file}" title="{$thumbnail.title}" class="thumbnail">
79    </a>
80  {/foreach}
81  </div>
82  <p id="batchLink"><a href="{$batch_link}">{$batch_label}</a></p>
83</fieldset>
84{/if}
85
86
87<form id="uploadForm" enctype="multipart/form-data" method="post" action="{$F_ACTION}" class="properties">
88{if $upload_mode eq 'multiple'}
89<input name="upload_id" value="{$upload_id}" type="hidden">
90{/if}
91
92    <div class="formField">
93      <div class="formFieldTitle">{'Drop into category'|@translate}</div>
94     
95      <label><input type="radio" name="category_type" value="existing"> {'existing category'|@translate}</label>
96      <label><input type="radio" name="category_type" value="new" checked="checked"> {'create a new category'|@translate}</label>
97
98      <div id="category_type_existing" style="display:none" class="category_selection">
99        <select class="categoryDropDown" name="category">
100          {html_options options=$category_options}
101        </select>
102      </div>
103
104      <div id="category_type_new" class="category_selection">
105        <table>
106          <tr>
107            <td>{'Parent category'|@translate}</td>
108            <td>
109              <select class="categoryDropDown" name="category_parent">
110                <option value="0">------------</option>
111                {html_options options=$category_options}
112              </select>
113            </td>
114          </tr>
115          <tr>
116            <td>{'Category name'|@translate}</td>
117            <td>
118              <input type="text" name="category_name" value="{$F_CATEGORY_NAME}" style="width:400px">
119            </td>
120          </tr>
121        </table>
122      </div>
123    </div>
124
125    <div class="formField">
126      <div class="formFieldTitle">{'Who can see these photos?'|@translate}</div>
127
128      <select name="level" size="1">
129        {html_options options=$level_options selected=$level_options_selected}
130      </select>
131    </div>
132
133    <div class="formField">
134      <div class="formFieldTitle">{'Select files'|@translate}</div>
135
136{if $upload_mode eq 'html'}
137    <p><a href="{$switch_url}">{'... or switch to the multiple files form'|@translate}</a></p>
138
139      <p>{'JPEG files or ZIP archives with JPEG files inside please.'|@translate}</p>
140
141      <div id="uploadBoxes">
142        <p><input class="file" type="file" size="60" name="image_upload[]" /></p>
143      </div>
144      <div id="addUploadBox">
145        <a href="javascript: UpdateUploadSlots()">{'+ Add an upload box'|@translate}</a>
146      </div>
147   
148    </div> <!-- formField -->
149
150    <p>
151      <input class="submit" type="submit" name="submit_upload" value="{'Upload'|@translate}" {$TAG_INPUT_ENABLED}/>
152    </p>
153{elseif $upload_mode eq 'multiple'}
154    </table>
155
156    <p>
157      <input type="file" name="uploadify" id="uploadify" />
158    </p>
159
160    <p><a href="{$switch_url}">{'... or switch to the old style form'|@translate}</a></p>
161
162    <div id="fileQueue"></div>
163
164    </div> <!-- formField -->
165    <p>
166      <input class="submit" type="button" value="{'Upload'|@translate}" onclick="javascript:jQuery('#uploadify').uploadifyUpload()"/>
167      <input type="submit" name="submit_upload" style="display:none"/>
168    </p>
169{/if}
170</form>
171{/if}
Note: See TracBrowser for help on using the repository browser.