]>
Commit | Line | Data |
---|---|---|
1 | <:.set article_type = cfg.entry("level names", article.level, "Article") -:> | |
2 | <:.define image_move:> | |
3 | <:-.if images.size > 1 -:> | |
4 | <:.set up_url = loop.is_first ? "" | |
5 | : cfg.admin_url2("add", "moveimgup", | |
6 | { id: article.id, | |
7 | imageid: image.id, | |
8 | _t: "img", | |
9 | _csrfp: request.get_csrf_token("admin_move_image") | |
10 | }) -:> | |
11 | <:.set down_url = loop.is_last ? "" | |
12 | : cfg.admin_url2("add", "moveimgdown", | |
13 | { id: article.id, | |
14 | imageid: image.id, | |
15 | _t: "img", | |
16 | _csrfp: request.get_csrf_token("admin_move_image") | |
17 | }) -:> | |
18 | <:.call "make_arrows", down_url:down_url, up_url: up_url -:> | |
19 | <:-.end if -:> | |
20 | <:.end define:> | |
21 | <:.wrap "admin/basej.tmpl", title:"Image Wizard", js:"admin_jedit.js" :> | |
22 | <h1><:.if article.id == -1:>Global<:.else:><:= article_type :><:.end if:> Image Wizard</h1> | |
23 | ||
24 | <:.call "messages":> | |
25 | ||
26 | <p>| <a href="<:= cfg.admin_url("menu") :>">Admin menu</a> | | |
27 | <:.if article.generator =~ /Product/ :> | |
28 | <a href="<:= cfg.admin_url("add", { id: article.id }) :>">Edit product</a> | | |
29 | <a href="<:= cfg.admin_url("shopadmin") :>">Manage catalogs</a> | | |
30 | <:.elsif article.id == cfg.entry("articles", "shop", 3) -:> | |
31 | <a href="/cgi-bin/admin/add.pl?id=<:article id:>">Edit shop</a> | | |
32 | <:.elsif article.id == -1 -:> | |
33 | <a href="/cgi-bin/admin/add.pl?id=<:article id:>">Edit sections</a> | | |
34 | <:.else -:> | |
35 | <a href="/cgi-bin/admin/add.pl?id=<:article id:>"><:.if article.generator =~ /Catalog/:>Edit catalog<:.else:>Edit article<:.end if:></a> | | |
36 | <:.end if :> | |
37 | ||
38 | <:.if thumbs -:> | |
39 | <a href="<:= cfg.admin_url("add", {id:article.id, "_t": "img", f_showfull:1}) :>">Full size images</a> | | |
40 | <:.else -:> | |
41 | <:.if can_thumbs -:> | |
42 | <a href="<:= cfg.admin_url("add", {id:article.id, _t: "img"}):>">With Thumbnails</a> | | |
43 | <:.end if :> | |
44 | <:.end if:> | |
45 | </p> | |
46 | <:.if request.user_can("edit_images_add", article) -:> | |
47 | <h2>Add new image</h2> | |
48 | ||
49 | <form method="post" action="<:script:>" enctype="multipart/form-data" name="add"> | |
50 | ||
51 | <input type="hidden" name="level" value="<:= article.level :>" /> | |
52 | <input type="hidden" name="id" value="<:= article.id :>" /> | |
53 | <input type="hidden" name="parentid" value="<:= article.parentid :>" /> | |
54 | <input type="hidden" name="_t" value="img" /> | |
55 | <:csrfp admin_add_image hidden:> | |
56 | <table> | |
57 | <tr> | |
58 | <th>Image file to add:</th> | |
59 | <td> | |
60 | <input type="file" name="image" /> | |
61 | </td> | |
62 | <td class="help"><:help image file:> <:.call "error_img", field: "image":></td> | |
63 | </tr> | |
64 | <tr> | |
65 | <th>Alt text for image:</th> | |
66 | <td> | |
67 | <input type="text" name="altIn" value="<:.call "old", field:"altIn":>" /> | |
68 | </td> | |
69 | <td class="help"><:help image alt:> <:.call "error_img", field: "altIn":></td> | |
70 | </tr> | |
71 | <tr> | |
72 | <th>URL for image:</th> | |
73 | <td> | |
74 | <input type="text" name="url" value="<:.call "old", field: "url":>" /> | |
75 | </td> | |
76 | <td class="help"><:help image url:> <:.call "error_img", field: "url":></td> | |
77 | </tr> | |
78 | <tr> | |
79 | <th>Identifier for image:</th> | |
80 | <td> | |
81 | <input type="text" name="name" value="<:.call "old", field: "name":>" /> | |
82 | </td> | |
83 | <td class="help"><:help image name:> <:.call "error_img", field: "name":></td> | |
84 | </tr> | |
85 | <tr> | |
86 | <th>Tags</th> | |
87 | <td> | |
88 | <input type="hidden" name="_save_tags" value="1" /> | |
89 | <div class="tags"> | |
90 | <:- .set tags = [ cgi.param("tags") ] :> | |
91 | <:- .if tags.size == 0 :> | |
92 | <:% tags.push("") :> | |
93 | <:- .end if :> | |
94 | <:.for tag in tags :> | |
95 | <div class="tag"><input type="text" name="tags" value="<:= tag :>" /><:.call "error_img_n", field:"tags", index:loop.index :></div> | |
96 | <:.end for:> | |
97 | </div> | |
98 | </td> | |
99 | <td class="help"><:help edit tags:></td> | |
100 | </tr> | |
101 | <tr> | |
102 | <th>Storage:</th> | |
103 | <td> | |
104 | <select name="storage"> | |
105 | <option value="">(Auto)</option> | |
106 | <:iterator begin image_stores:> | |
107 | <option value="<:image_store name:>"><:image_store description:></option> | |
108 | <:iterator end image_stores:> | |
109 | </select> | |
110 | </td> | |
111 | <td class="help"><:help image storage:> <:error_img storage:></td> | |
112 | </tr> | |
113 | <tr> | |
114 | <td colspan="3" class="buttons"> | |
115 | <input type="submit" name="addimg" value="Add Image" /> | |
116 | </td> | |
117 | </tr> | |
118 | </table> | |
119 | </form> | |
120 | <:.end if -:> | |
121 | ||
122 | <:.set images = [ article.images ] -:> | |
123 | <:.set can_save = request.user_can("edit_images_save", article) -:> | |
124 | <:.set can_delete = request.user_can("edit_images_delete", article) -:> | |
125 | <:.set delete_token = request.get_csrf_token("admin_remove_image") -:> | |
126 | ||
127 | <form method="post" action="<:= cfg.admin_url("add") :>" enctype="multipart/form-data" name="manage"> | |
128 | <input type="hidden" name="level" value="<:= article.level :>" /> | |
129 | <input type="hidden" name="id" value="<:= article.id :>" /> | |
130 | <input type="hidden" name="parentid" value="<:= article.parentid :>" /> | |
131 | <input type="hidden" name="_t" value="img" /> | |
132 | <:csrfp admin_save_images hidden:> | |
133 | <h2>Manage images</h2> | |
134 | <table class="editform images"> | |
135 | <:.if images.size:><:.if article.id != -1 | |
136 | and cfg.entry("basic", "auto_images", 1)-:> | |
137 | <tr> | |
138 | <th colspan="6">First Image Position</th> | |
139 | </tr> | |
140 | <tr> | |
141 | <td colspan="6"> | |
142 | <input type="radio" name="imagePos" value="tl" <:= article.imagePos eq "tl" ? "checked " : "":>/>Top Left | |
143 | <input type="radio" name="imagePos" value="tr" <:= article.imagePos eq "tr" ? "checked " : "":>/>Top Right | |
144 | <input type="radio" name="imagePos" value="bl" <:= article.imagePos eq "bl" ? "checked " : "":>/>Bottom Left | |
145 | <input type="radio" name="imagePos" value="br" <:= article.imagePos eq "br" ? "checked " : "":>/>Bottom Right | |
146 | <input type="radio" name="imagePos" value="xx" <:= article.imagePos eq "xx" ? "checked " : "":>/>Don't automatically insert images | |
147 | ||
148 | <:help image position:> | |
149 | ||
150 | </td> | |
151 | </tr> | |
152 | <:-.end if:> | |
153 | <:.if thumbs:> | |
154 | <tr> | |
155 | <th>Image</th> | |
156 | <th colspan="2"> </th> | |
157 | <th class="col_tags">Tags</th> | |
158 | <th class="col_modify"> Modify</th> | |
159 | <th class="col_move"> Move</th> | |
160 | </tr> | |
161 | <:.for image in images:> | |
162 | <tr> | |
163 | <td rowspan="5" class="col_thumbnail"><a href="#" onclick="window.open('<:= image.src:>', 'fullimage', 'width=<:= 20 + image.width:>,height=<:= 30 + image.height:>,location=no,status=no,menubar=no,scrollbars=yes'); return false;"><:= image.thumb("geo", "editor") |raw:></a></td> | |
164 | <th>Alt text:</th> | |
165 | <td class="col_field"> | |
166 | <:.if can_save:><input type="text" name="alt<:= image.id:>" value="<:.call "old", field:"alt" _ image.id, default: image.alt :>" size="32" /><:.else:><:= image.alt :><:.end if:> | |
167 | </td> | |
168 | <td class="col_tags" rowspan="5"> | |
169 | <input type="hidden" name="_save_image_tags<:= image.id:>" value="1"> | |
170 | <div class="tags" data-name="tags<:= image.id :>"> | |
171 | <:.if cgi.param("_save_image_tags" _ image.id) -:> | |
172 | <:.set image_tags = [ cgi.param("tags" _ image.id) ] -:> | |
173 | <:.else -:> | |
174 | <:.set image_tags = [ image.tags ] -:> | |
175 | <:% image_tags.push("") -:> | |
176 | <:.end if -:> | |
177 | <:.for tag in image_tags :> | |
178 | <div class="tag"><input type="text" name="tags<:= image.id :>" value="<:= tag :>"><:.call "error_img_n", field:"tags" _ image.id, index: loop.index :></div> | |
179 | <:.end for :> | |
180 | </div> | |
181 | </td> | |
182 | <td class="col_modify" rowspan="5"> | |
183 | <:.if can_delete -:> | |
184 | <b><a href="<:= cfg.admin_url("add", { id:article.id, "removeimg_" _ image.id:1, _t:"img", _csrfp: delete_token}):>" onClick="return window.confirm('Are you sure you want to delete this Image')">Delete</a></b> | |
185 | <:-.end if:> | |
186 | <:.if can_save -:> | |
187 | <a href="<:= cfg.admin_url2("add", "edit_image", { id:article.id, image_id:image. id}):>">Edit</a> | |
188 | <:-.end if-:> | |
189 | </td> | |
190 | <td class="col_move" rowspan="5"> | |
191 | <:.call "image_move":></td> | |
192 | </tr> | |
193 | <tr> | |
194 | <th>URL:</th> | |
195 | <td class="col_field"> | |
196 | <:.if can_save :><input type="text" name="url<:= image.id :>" value="<:.call "old", field:"url" _ image.id, default:image.url :>" size="32" /><:.else:><:= image.url :><:.end if:> | |
197 | </td> | |
198 | </tr> | |
199 | <tr> | |
200 | <th>Identifier:</th> | |
201 | <td class="col_field"> | |
202 | <:.if can_save :><input type="text" name="name<:= image.id:>" value="<:.call "old", field: "name" _ image.id, default: image.name :>" size="32" /> <:.call "error_img", field: "name" _ image.id :><:.else:><:= image.name :><:.end if:> | |
203 | </td> | |
204 | </tr> | |
205 | <tr> | |
206 | <th>Image file:</th> | |
207 | <td class="col_field"> | |
208 | <:.if can_save :><input type="file" name="image<:= image.id:>" size="32" /> <:.call "error_img", field: "image" _ image.id:><:.else:><:= image.displayName :><:.end if:> | |
209 | </td> | |
210 | </tr> | |
211 | <tr> | |
212 | <th>Stored:</th> | |
213 | <td class="col_field"> | |
214 | <:.if can_save -:> | |
215 | <:.set stores = [ image_stores() ] -:> | |
216 | <:.set oldstore = cgi.param("storage").defined | |
217 | ? cgi.param("storage") : image.storage -:> | |
218 | ||
219 | <select name="storage<:= image.id:>"> | |
220 | <option value="">(Auto)</option> | |
221 | <:.for store in stores :> | |
222 | <option value="<:= store.name:>"<:= oldstore eq store.name ? " selected" : "" :>><:= store.description:></option> | |
223 | <:.end for -:> | |
224 | </select><:.call "error_img", field: "storage" _ image.id:><:.else:><:= image.storage :><:.end if:> | |
225 | </td> | |
226 | </tr> | |
227 | <:.end for:> | |
228 | <:.else :> | |
229 | <tr> | |
230 | <th colspan="5">Image</th> | |
231 | </tr> | |
232 | <:.for image in images :> | |
233 | <tr> | |
234 | <td class="col_image" colspan="5"><:= image.inline("align", "center") |raw:></td> | |
235 | </tr> | |
236 | <tr> | |
237 | <th> Alt Text</th> | |
238 | <th class="col_url"> URL</th> | |
239 | <th> Identifier</th> | |
240 | <th class="col_modify"> Modify</th> | |
241 | <th class="col_move"> Move</th> | |
242 | </tr> | |
243 | <tr> | |
244 | <td> | |
245 | <:.if can_save:><input type="text" name="alt<:= image.id:>" value="<:.call "old", field: "alt" _ image.id, default: image.alt:>" size="32" /><:.else:><:= image.alt :><:.end if:> | |
246 | </td> | |
247 | <td class="col_url"> | |
248 | <:.if can_save:><input type="text" name="url<:=image.id:>" value="<:.call "old", field: "url" _ image.id, default: image.url :>" size="32" /><:.else:><:= image.url :><:.end if:> | |
249 | </td> | |
250 | <td class="col_identifier"> | |
251 | <:.if can_save:><input type="text" name="name<:= image.id:>" value="<:.call "old", field: "name" _ image.id, default: image.name:>" size="32" /> <:.call "error_img", field: "name" _ image.id :><:.else:><:= image.name :><:.end if:> | |
252 | </td> | |
253 | <td class="col_modify"> | |
254 | <:.if can_save:><b><a href="<:= cfg.admin_url("add", { id:article.id, "removeimg_" _ image.id:1, _t:"img", _csrfp: delete_token}):>" onClick="return window.confirm('Are you sure you want to delete this Image')">Delete</a></b><:.end if:></td> | |
255 | <td class="col_move"><:.call "image_move":></td> | |
256 | </tr> | |
257 | <:.if !loop.is_last :> | |
258 | <tr> | |
259 | <td colspan="5"> </td> | |
260 | </tr> | |
261 | <:.end if:> | |
262 | <: .end for :> | |
263 | <:.end if:> | |
264 | <:.if can_save:> | |
265 | <tr> | |
266 | <td colspan="6" class="buttons"> | |
267 | <input type="submit" name="process" value="Save changes" /> | |
268 | </td> | |
269 | </tr> | |
270 | <:.end if:> | |
271 | <:.else-:> | |
272 | <tr><td colspan="5" align="center" bgcolor="#FFFFFF"> | |
273 | <:-= article.id == -1 ? "There are no global images" | |
274 | : "No images are attached to this article" :></td> | |
275 | </tr><:.end if:> | |
276 | </table> | |
277 | ||
278 | </form> |