-<html>
-<head>
+<:.set article_type = cfg.entry("level names", article.level, "Article") -:>
+<:.define image_move:>
+<:-.if images.size > 1 -:>
+<:.set up_url = loop.is_first ? ""
+ : cfg.admin_url2("add", "moveimgup",
+ { id: article.id,
+ imageid: image.id,
+ _t: "img",
+ _csrfp: request.get_csrf_token("admin_move_image")
+ }) -:>
+<:.set down_url = loop.is_last ? ""
+ : cfg.admin_url2("add", "moveimgdown",
+ { id: article.id,
+ imageid: image.id,
+ _t: "img",
+ _csrfp: request.get_csrf_token("admin_move_image")
+ }) -:>
+<:.call "make_arrows", down_url:down_url, up_url: up_url -:>
+<:-.end if -:>
+<:.end define:>
+<:.wrap "admin/basej.tmpl", title:"Image Wizard", js:"admin_jedit.js" :>
+<h1><:.if article.id == -1:>Global<:.else:><:= article_type :><:.end if:> Image Wizard</h1>
- <title>Administration - <: articleType :> Image Wizard</title>
+<:.call "messages":>
- <link rel="stylesheet" type="text/css" href="/css/admin.css">
+<p>| <a href="<:= cfg.admin_url("menu") :>">Admin menu</a> |
+<:.if article.generator =~ /Product/ :>
+ <a href="<:= cfg.admin_url("add", { id: article.id }) :>">Edit product</a> |
+ <a href="<:= cfg.admin_url("shopadmin") :>">Manage catalogs</a> |
+<:.elsif article.id == cfg.entry("articles", "shop", 3) -:>
+ <a href="/cgi-bin/admin/add.pl?id=<:article id:>">Edit shop</a> |
+<:.elsif article.id == -1 -:>
+ <a href="/cgi-bin/admin/add.pl?id=<:article id:>">Edit sections</a> |
+<:.else -:>
+<a href="/cgi-bin/admin/add.pl?id=<:article id:>"><:.if article.generator =~ /Catalog/:>Edit catalog<:.else:>Edit article<:.end if:></a> |
+<:.end if :>
-</head>
+<:.if thumbs -:>
+ <a href="<:= cfg.admin_url("add", {id:article.id, "_t": "img", f_showfull:1}) :>">Full size images</a> |
+<:.else -:>
+ <:.if can_thumbs -:>
+ <a href="<:= cfg.admin_url("add", {id:article.id, _t: "img"}):>">With Thumbnails</a> |
+ <:.end if :>
+<:.end if:>
+</p>
+<:.if request.user_can("edit_images_add", article) -:>
+<h2>Add new image</h2>
-<body>
+<form method="post" action="<:script:>" enctype="multipart/form-data" name="add">
- <input type="button" onclick="history.go(0);" value=" Refresh ">
-
- <h1><: articleType :> Image Wizard</h1>
-
- <h2>Add a new image</h2>
-
-<:message:><p>
-
-<form method="POST" action="<:script:>" enctype="multipart/form-data">
-
-<input type="hidden" name="level" value="<: level :>">
-<input type="hidden" name="id" value="<: article id :>">
-<input type="hidden" name="parentid" value="<: article parentid :>">
-<input type="hidden" name="imgtype" value="<: articleType :>">
- <table border="0" cellspacing="0" cellpadding="0" bgcolor="#000000">
- <tr>
- <td>
- <table cellpadding="6" border="0" cellspacing="1">
+<input type="hidden" name="level" value="<:= article.level :>" />
+<input type="hidden" name="id" value="<:= article.id :>" />
+<input type="hidden" name="parentid" value="<:= article.parentid :>" />
+<input type="hidden" name="_t" value="img" />
+<:csrfp admin_add_image hidden:>
+ <table>
+ <tr>
+ <th>Image file to add:</th>
+ <td>
+ <input type="file" name="image" />
+ </td>
+ <td class="help"><:help image file:> <:.call "error_img", field: "image":></td>
+ </tr>
+ <tr>
+ <th>Alt text for image:</th>
+ <td>
+ <input type="text" name="altIn" value="<:.call "old", field:"altIn":>" />
+ </td>
+ <td class="help"><:help image alt:> <:.call "error_img", field: "altIn":></td>
+ </tr>
<tr>
- <th bgcolor="#FFFFFF"> Image file to add: </th>
- <td bgcolor="#FFFFFF">
- <input type="file" name="image">
+ <th>URL for image:</th>
+ <td>
+ <input type="text" name="url" value="<:.call "old", field: "url":>" />
</td>
+ <td class="help"><:help image url:> <:.call "error_img", field: "url":></td>
</tr>
<tr>
- <th bgcolor="#FFFFFF"> Alt text for image: </th>
- <td bgcolor="#FFFFFF">
- <input type="text" name="altIn">
+ <th>Identifier for image:</th>
+ <td>
+ <input type="text" name="name" value="<:.call "old", field: "name":>" />
</td>
+ <td class="help"><:help image name:> <:.call "error_img", field: "name":></td>
</tr>
+ <tr>
+ <th>Tags</th>
+ <td>
+ <input type="hidden" name="_save_tags" value="1" />
+ <div class="tags">
+ <:- .set tags = [ cgi.param("tags") ] :>
+ <:- .if tags.size == 0 :>
+ <:% tags.push("") :>
+ <:- .end if :>
+ <:.for tag in tags :>
+ <div class="tag"><input type="text" name="tags" value="<:= tag :>" /><:.call "error_img_n", field:"tags", index:loop.index :></div>
+ <:.end for:>
+ </div>
+ </td>
+ <td class="help"><:help edit tags:></td>
+ </tr>
<tr>
- <th bgcolor="#FFFFFF"> URL for image: </th>
- <td bgcolor="#FFFFFF">
- <input type="text" name="url" width="40">
+ <th>Storage:</th>
+ <td>
+<select name="storage">
+<option value="">(Auto)</option>
+<:iterator begin image_stores:>
+<option value="<:image_store name:>"><:image_store description:></option>
+<:iterator end image_stores:>
+</select>
</td>
+ <td class="help"><:help image storage:> <:error_img storage:></td>
</tr>
<tr>
- <td bgcolor="#FFFFFF" colspan="2" align="right">
- <input type="submit" name="addimg" value=" Add Image ">
+ <td colspan="3" class="buttons">
+ <input type="submit" name="addimg" value="Add Image" />
</td>
</tr>
</table>
- </td>
- </tr>
- </table>
</form>
+<:.end if -:>
+<:.set images = [ article.images ] -:>
+<:.set can_save = request.user_can("edit_images_save", article) -:>
+<:.set can_delete = request.user_can("edit_images_delete", article) -:>
+<:.set delete_token = request.get_csrf_token("admin_remove_image") -:>
-<form method="POST" action="<:script:>" enctype="multipart/form-data">
-<input type="hidden" name="level" value="<: level :>">
-<input type="hidden" name="id" value="<: article id :>">
-<input type="hidden" name="parentid" value="<: article parentid :>">
-<input type="hidden" name="imgtype" value="<: articleType :>">
- <h2>Manage Images</h2>
+<form method="post" action="<:= cfg.admin_url("add") :>" enctype="multipart/form-data" name="manage">
+<input type="hidden" name="level" value="<:= article.level :>" />
+<input type="hidden" name="id" value="<:= article.id :>" />
+<input type="hidden" name="parentid" value="<:= article.parentid :>" />
+<input type="hidden" name="_t" value="img" />
+<:csrfp admin_save_images hidden:>
+ <h2>Manage images</h2>
+ <table class="editform images">
+<:.if images.size:><:.if article.id != -1
+ and cfg.entry("basic", "auto_images", 1)-:>
+<tr>
+ <th colspan="5">First Image Position</th>
+ </tr>
+ <tr>
+ <td colspan="5">
+<input type="radio" name="imagePos" value="tl" <:= article.imagePos eq "tl" ? "checked " : "":>/>Top Left
+<input type="radio" name="imagePos" value="tr" <:= article.imagePos eq "tr" ? "checked " : "":>/>Top Right
+<input type="radio" name="imagePos" value="bl" <:= article.imagePos eq "bl" ? "checked " : "":>/>Bottom Left
+<input type="radio" name="imagePos" value="br" <:= article.imagePos eq "br" ? "checked " : "":>/>Bottom Right
+<input type="radio" name="imagePos" value="xx" <:= article.imagePos eq "xx" ? "checked " : "":>/>Don't automatically insert images
-<table border="0" cellspacing="0" cellpadding="0" bgcolor="#000000">
- <tr>
- <td>
- <table cellpadding="6" border="0" cellspacing="1">
- <tr bgcolor="#FFFFFF">
- <th> Image</th>
- <th> Alt Text</th>
- <th> URL</th>
+<:help image position:>
- <th> Modify</th>
+ </td>
</tr>
- <: iterator begin image :>
- <tr bgcolor="#FFFFFF">
- <td align="center"> <img src="/images/<: image image :>" alt="<: image alt :>"<:
- image height :><: image width :>></td>
- <td valign="top">
- <input type="text" name="alt" value="<: image alt :>">
+<:-.end if:>
+<:.if thumbs:>
+ <tr>
+ <th>Image</th>
+ <th colspan="2"> </th>
+ <th class="col_modify"> Modify</th>
+ <th class="col_move"> Move</th>
+ </tr>
+<:.for image in images:>
+ <tr>
+ <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>
+ <th>Alt text:</th>
+ <td class="col_field">
+ <:.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:>
+ </td>
+ <td class="col_modify" rowspan="5">
+<:.if can_delete -:>
+ <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:>
+<:.if can_save -:>
+<a href="<:= cfg.admin_url2("add", "edit_image", { id:article.id, image_id:image. id}):>">Edit</a>
+<:-.end if-:>
+</td>
+ <td class="col_move" rowspan="5">
+<:.call "image_move":></td>
+ </tr>
+ <tr>
+ <th>URL:</th>
+ <td class="col_field">
+ <:.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:>
</td>
- <td valign="top">
- <input type="text" name="url" value="<: image url :>">
+ </tr>
+ <tr>
+ <th>Identifier:</th>
+ <td class="col_field">
+ <:.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:>
</td>
+ </tr>
+ <tr>
+ <th>Image file:</th>
+ <td class="col_field">
+ <:.if can_save :><input type="file" name="image<:= image.id:>" size="32" /> <:.call "error_img", field: "image" _ image.id:><:.else:><:= image.displayName :><:.end if:>
+ </td>
+ </tr>
+ <tr>
+ <th>Stored:</th>
+ <td class="col_field">
+ <:.if can_save -:>
+<:.set stores = [ image_stores() ] -:>
+<:.set oldstore = cgi.param("storage").defined
+ ? cgi.param("storage") : image.storage -:>
- <td valign="bottom" nowrap>
- <input type="submit" name="removeimg_<: image order :>" value="Delete" onClick="return window.alert('Remember to update the article after deletion is complete')" >
- <:imgmove:> </td>
+<select name="storage<:= image.id:>">
+<option value="">(Auto)</option>
+<:.for store in stores :>
+<option value="<:= store.name:>"<:= oldstore eq store.name ? " selected" : "" :>><:= store.description:></option>
+<:.end for -:>
+</select><:.call "error_img", field: "storage" _ image.id:><:.else:><:= image.storage :><:.end if:>
+ </td>
+ </tr>
+<:.end for:>
+<:.else :>
+ <tr>
+ <th colspan="5">Image</th>
</tr>
- <: iterator separator image :>
- <tr bgcolor="#FFFFFF">
- <td colspan="4"> </td>
+ <:.for image in images :>
+ <tr>
+ <td class="col_image" colspan="5"><:= image.inline("align", "center") |raw:></td>
</tr>
- <: iterator end image :>
<tr>
- <th valign="top" bgcolor="#FFFFFF"> First Image Position: </th>
- <td bgcolor="#FFFFFF"> <input type="radio" name="imagePos" value="tl"<:
- checked tl :>> Top Left <br><input type="radio" name="imagePos" value="tr"
- <: checked tr :>> Top Right <br><input type="radio" name="imagePos" value="bl"
- <: checked bl :>> Bottom Left <br><input type="radio" name="imagePos" value="br"
- <: checked br :>> Bottom Right</td>
- <td colspan="2" align="right" valign="bottom" bgcolor="#FFFFFF">
- <input type="submit" name="process" value="Save changes">
+ <th> Alt Text</th>
+ <th class="col_url"> URL</th>
+ <th> Identifier</th>
+ <th class="col_modify"> Modify</th>
+ <th class="col_move"> Move</th>
+ </tr>
+ <tr>
+ <td>
+ <:.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:>
+ </td>
+ <td class="col_url">
+ <:.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:>
+ </td>
+ <td class="col_identifier">
+ <:.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:>
</td>
+ <td class="col_modify">
+ <:.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>
+ <td class="col_move"><:.call "image_move":></td>
+ </tr>
+ <:.if !loop.is_last :>
+ <tr>
+ <td colspan="5"> </td>
+ </tr>
+ <:.end if:>
+ <: .end for :>
+<:.end if:>
+<:.if can_save:>
+ <tr>
+ <td colspan="5" class="buttons">
+ <input type="submit" name="process" value="Save changes" />
+ </td>
+ </tr>
+<:.end if:>
+<:.else-:>
+ <tr><td colspan="5" align="center" bgcolor="#FFFFFF">
+ <:-= article.id == -1 ? "There are no global images"
+ : "No images are attached to this article" :></td>
+ </tr><:.end if:>
</table>
-</td>
-</tr>
-</table>
-
- <p>
- <input type="submit" name="back" value=" << Back "></p>
</form>
-
-<p><font size="-1">BSE Release <:release:></font></p>
-</body
-></html>