allow editing image tags on the big image tool page
[bse.git] / site / templates / admin / article_img.tmpl
CommitLineData
b0b76264
TC
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:>
9d6987bc 21<:.wrap "admin/basej.tmpl", title:"Image Wizard", js:"admin_jedit.js" :>
b0b76264
TC
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:>
ab2cd916 45</p>
b0b76264 46<:.if request.user_can("edit_images_add", article) -:>
35c0719f 47<h2>Add new image</h2>
f5d30ab9 48
de30d08a 49<form method="post" action="<:script:>" enctype="multipart/form-data" name="add">
f5d30ab9 50
b0b76264
TC
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 :>" />
cc9019d1 54<input type="hidden" name="_t" value="img" />
aa6896b6 55<:csrfp admin_add_image hidden:>
8a3b8db8 56 <table>
f5d30ab9 57 <tr>
8a3b8db8
TC
58 <th>Image file to add:</th>
59 <td>
d09682dd 60 <input type="file" name="image" />
f5d30ab9 61 </td>
b0b76264 62 <td class="help"><:help image file:> <:.call "error_img", field: "image":></td>
f5d30ab9
TC
63 </tr>
64 <tr>
8a3b8db8
TC
65 <th>Alt text for image:</th>
66 <td>
b0b76264 67 <input type="text" name="altIn" value="<:.call "old", field:"altIn":>" />
f5d30ab9 68 </td>
b0b76264 69 <td class="help"><:help image alt:> <:.call "error_img", field: "altIn":></td>
f5d30ab9 70 </tr>
5c5c6eb6 71 <tr>
8a3b8db8
TC
72 <th>URL for image:</th>
73 <td>
b0b76264 74 <input type="text" name="url" value="<:.call "old", field: "url":>" />
5c5c6eb6 75 </td>
b0b76264 76 <td class="help"><:help image url:> <:.call "error_img", field: "url":></td>
5c5c6eb6 77 </tr>
4772671f 78 <tr>
8a3b8db8
TC
79 <th>Identifier for image:</th>
80 <td>
b0b76264 81 <input type="text" name="name" value="<:.call "old", field: "name":>" />
4772671f 82 </td>
b0b76264 83 <td class="help"><:help image name:> <:.call "error_img", field: "name":></td>
4772671f 84 </tr>
a3e0dbc8
TC
85 <tr>
86 <th>Tags</th>
87 <td>
88 <input type="hidden" name="_save_tags" value="1" />
9d6987bc 89 <div class="tags">
a3e0dbc8
TC
90 <:- .set tags = [ cgi.param("tags") ] :>
91 <:- .if tags.size == 0 :>
92 <:% tags.push("") :>
93 <:- .end if :>
94 <:.for tag in tags :>
b0b76264 95 <div class="tag"><input type="text" name="tags" value="<:= tag :>" /><:.call "error_img_n", field:"tags", index:loop.index :></div>
a3e0dbc8
TC
96 <:.end for:>
97 </div>
98 </td>
99 <td class="help"><:help edit tags:></td>
100 </tr>
e63c3728 101 <tr>
8a3b8db8
TC
102 <th>Storage:</th>
103 <td>
e63c3728
TC
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>
8a3b8db8 111 <td class="help"><:help image storage:> <:error_img storage:></td>
e63c3728 112 </tr>
f5d30ab9 113 <tr>
8a3b8db8 114 <td colspan="3" class="buttons">
d09682dd 115 <input type="submit" name="addimg" value="Add Image" />
f5d30ab9
TC
116 </td>
117 </tr>
118 </table>
99ef7979 119</form>
b0b76264 120<:.end if -:>
99ef7979 121
b0b76264
TC
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 :>" />
cc9019d1 131<input type="hidden" name="_t" value="img" />
aa6896b6 132<:csrfp admin_save_images hidden:>
35c0719f 133 <h2>Manage images</h2>
8a3b8db8 134 <table class="editform images">
b0b76264
TC
135<:.if images.size:><:.if article.id != -1
136 and cfg.entry("basic", "auto_images", 1)-:>
137<tr>
6436e424 138 <th colspan="6">First Image Position</th>
35c0719f 139 </tr>
759c295d 140 <tr>
6436e424 141 <td colspan="6">
b0b76264
TC
142<input type="radio" name="imagePos" value="tl" <:= article.imagePos eq "tl" ? "checked " : "":>/>Top Left &nbsp;
143<input type="radio" name="imagePos" value="tr" <:= article.imagePos eq "tr" ? "checked " : "":>/>Top Right &nbsp;
144<input type="radio" name="imagePos" value="bl" <:= article.imagePos eq "bl" ? "checked " : "":>/>Bottom Left &nbsp;
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
1e60d3c4
TC
147
148<:help image position:>
08123550 149
ca9aa2bf 150 </td>
b0b76264
TC
151 </tr>
152<:-.end if:>
153<:.if thumbs:>
8a3b8db8 154 <tr>
ab2cd916
TC
155 <th>Image</th>
156 <th colspan="2"> &nbsp;</th>
6436e424 157 <th class="col_tags">Tags</th>
8a3b8db8
TC
158 <th class="col_modify"> Modify</th>
159 <th class="col_move"> Move</th>
ab2cd916 160 </tr>
b0b76264 161<:.for image in images:>
ab2cd916 162 <tr>
b0b76264 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>
ab2cd916 164 <th>Alt text:</th>
8a3b8db8 165 <td class="col_field">
b0b76264 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:>
ab2cd916 167 </td>
6436e424
TC
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>
8a3b8db8 182 <td class="col_modify" rowspan="5">
b0b76264
TC
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>
ab2cd916
TC
192 </tr>
193 <tr>
194 <th>URL:</th>
8a3b8db8 195 <td class="col_field">
b0b76264 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:>
ab2cd916
TC
197 </td>
198 </tr>
199 <tr>
200 <th>Identifier:</th>
8a3b8db8 201 <td class="col_field">
b0b76264 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:>
b95fc3a0
TC
203 </td>
204 </tr>
205 <tr>
206 <th>Image file:</th>
8a3b8db8 207 <td class="col_field">
b0b76264 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:>
ab2cd916
TC
209 </td>
210 </tr>
e63c3728
TC
211 <tr>
212 <th>Stored:</th>
8a3b8db8 213 <td class="col_field">
b0b76264
TC
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:>">
e63c3728 220<option value="">(Auto)</option>
b0b76264
TC
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:>
e63c3728
TC
225 </td>
226 </tr>
b0b76264
TC
227<:.end for:>
228<:.else :>
8a3b8db8 229 <tr>
4772671f 230 <th colspan="5">Image</th>
27feb834 231 </tr>
b0b76264 232 <:.for image in images :>
8a3b8db8 233 <tr>
b0b76264 234 <td class="col_image" colspan="5"><:= image.inline("align", "center") |raw:></td>
35c0719f 235 </tr>
8a3b8db8 236 <tr>
08123550 237 <th> Alt Text</th>
8a3b8db8 238 <th class="col_url"> URL</th>
4772671f 239 <th> Identifier</th>
8a3b8db8
TC
240 <th class="col_modify"> Modify</th>
241 <th class="col_move"> Move</th>
35c0719f 242 </tr>
8a3b8db8
TC
243 <tr>
244 <td>
b0b76264 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:>
27feb834 246 </td>
8a3b8db8 247 <td class="col_url">
b0b76264 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:>
27feb834 249 </td>
8a3b8db8 250 <td class="col_identifier">
b0b76264 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:>
4772671f 252 </td>
8a3b8db8 253 <td class="col_modify">
b0b76264
TC
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>
27feb834 256 </tr>
b0b76264 257 <:.if !loop.is_last :>
8a3b8db8 258 <tr>
4772671f 259 <td colspan="5">&nbsp;</td>
27feb834 260 </tr>
b0b76264
TC
261 <:.end if:>
262 <: .end for :>
263<:.end if:>
264<:.if can_save:>
27feb834 265 <tr>
6436e424 266 <td colspan="6" class="buttons">
d09682dd 267 <input type="submit" name="process" value="Save changes" />
27feb834 268 </td>
abf5bbc6 269 </tr>
b0b76264
TC
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:>
27feb834 276 </table>
f5d30ab9 277
f5d30ab9 278</form>