]> git.imager.perl.org - bse.git/blobdiff - site/templates/admin/edit_product.tmpl
allow metadata to be defined for new products
[bse.git] / site / templates / admin / edit_product.tmpl
index a541a5ca6c255d854563a2c0875cb1d420d47af4..5f05dad6674482fe2edf629c2a7f8c5d7dfba2d4 100644 (file)
-<html><head><title>Edit product - Shop administration</title>
-  <link rel="stylesheet" type="text/css" href="/css/admin.css">
-</head>
-<body>
-<h1>Shop Administration</h1>
-<h2><:action:> Product</h2>
-<p><:message:> | <a href="/admin/">Admin menu</a> | <a href="<:script:>">Product list</a> | 
-  <a href="<:script:>?id=<:product id:>&product_detail=1">Product details</a> 
-  <:if Product listed:> | <a href="<:script:>?id=<:product id:>&delete_product=1">Hide</a> 
-  |<:or Product:> | <a href="<:script:>?id=<:product id:>&undelete_product=1">Show</a> 
-  |<:eif Product:> <:hiddenNote:></p>
-
-<form action="<:script:>" method=POST><p><input type=submit name=showimages value="Image Wizard"></p></form>
-
-<form action="<:script:>" enctype="multipart/form-data" method="POST">
-<input type="hidden" name="id" value="<:product id:>">
-  <table border="0" cellspacing="0" cellpadding="0" bgcolor="#000000">
-    <tr>
-      <td>
-        <table border=0 cellpadding="6" cellspacing="1">
+<:.set article_type = "Product" -:>
+<:wrap admin/base.tmpl title => [cond [ifNew] "Add Product" "Edit Product"], menuitem=>"edit", showtitle=>"1", js => "admin_edit.js" :>
+<:ifMessage:>
+<p><b><:message:></b></p>
+<:or:><:eif:> 
+<:.set oldf = @{name, def: cgi.param(name).defined ? cgi.param(name) : def} -:>
+<:include admin/product_menu.tmpl:>
+<:ifNew:><:or:><:if Or [iadminuser_count] [iadmingroup_count]:>
+      <form action="/cgi-bin/admin/adminusers.pl">
+  <input type="hidden" name="id" value="<: article id:>" />
+        <table class="editform editformtiny">
+          <tr>
+            <th>Manage access:</th>
+            <td>
+              <select name="adminid">
+<:iterator begin adminusers:>
+<option value="<:iadminuser id:>">User <:iadminuser logon:>
+</option><:iterator end adminusers:>
+<:iterator begin admingroups:>
+<option value="<:iadmingroup id:>">Group <:iadmingroup name:>
+</option><:iterator end admingroups:>
+              </select>
+              <input type="submit" name="a_showobjectart" value="Manage" />
+      </td>
+            <td class="help"><:help access manage:>
+        </td>
+          </tr>
+        </table>
+      </form>
+<br />
+<:or Or:><:eif Or:><:eif:>
+<form action="<:script:>" enctype="multipart/form-data" method="post">
+    <input type="hidden" name="lastModified" value="<:article lastModified:>" />
+    <input type="hidden" name="type" value="Product" />
+    <input type="hidden" name="id" value="<:product id:>" />
+<:ifNew:><:csrfp admin_add_article hidden:><:or:><:csrfp admin_save_article hidden:><:eif:>
+        <table class="editform">
+                    <tr> 
+            <th>Catalog:</th>
+            <td>
+<:ifFieldPerm parentid:><select name="parentid"><:list:></select><:or:><:parent title:> (<:parent id:>)<:eif:></td>
+            <td nowrap="nowrap" bgcolor="#FFFFFF"><:help product catalog:> <:error_img
+              parentid:></td>
+          </tr>
+                 <tr> 
+            <th>Title:</th>
+            <td><:ifFieldPerm title:><input type="text" name="title" value="<:old title default title:>" size="60" /><:or:><:product title:><:eif:> </td>
+            <td class="help"><:help product title:> <:error_img title:></td>
+          </tr>
+          <:if Cfg "title alias" [concatenate level [article level]]:><tr>
+            <th>Alias:</th>
+            <td>
+              <:if FieldPerm titleAlias:><input type="text" name="titleAlias" maxlength="<:cfg fields alias_size 60:>" size="60" value="<:old titleAlias article titleAlias:>" /><:or FieldPerm:><:article titleAlias:><:eif FieldPerm:>
+            </td>
+            <td class="help"><:help edit titleAlias:> <:error_img titleAlias:></td>
+          </tr><:or Cfg:><:eif Cfg:>
+          <tr> 
+            <th>Summary:</th>
+            <td><:ifFieldPerm summary:><input type="text" name="summary" value="<:old summary default summary:>" size="60" /><:or:><:product summary:><:eif:> </td>
+            <td class="edit"><:help product summary:> <:error_img
+            summary:></td>
+          </tr>
+          <tr> 
+            <th>Description:</th>
+            <td><:ifFieldPerm description:><input type="text" name="description" value="<:old description default description:>" size="60" /><:or:><:product description:><:eif:> </td>
+            <td class="help"><:help product description:> <:error_img
+            description:></td>
+          </tr>
           <tr> 
-            <th align="left">Title:</th>
-            <td bgcolor="#FFFFFF"><:product title:></td>
+            <th>Product Code:</th>
+            <td><:ifFieldPerm product_code:><input type="text" name="product_code" value="<:old product_code default product_code:>" size="60" /><:or:><:product product_code:><:eif:> </td>
+            <td class="help"><:help product product_code:> <:error_img
+            product_code:></td>
           </tr>
           <tr> 
-            <th align="left">Catalog:</th>
-            <td bgcolor="#FFFFFF"><:catalogs:></td>
+            <th> Body:</th>
+            <td> 
+              <:ifFieldPerm body:><textarea name="body" rows="15" cols="60" ><:old body default body:></textarea><:or:><:bodytext product body:><:eif:>
+            </td>
+            <td class="help"><:help body body:> <:error_img
+            body:></td>
+          </tr>
+          <:if Cfgsection [concatenate level [article level] " menus"]:><tr> 
+            <th>Menu:</th>
+            <td> 
+              <:if FieldPerm menu:><select name="menu" id="menu">
+                <:iterator begin cfgsection [concatenate level [article level] " menus"] sort=key:><option value="<:cfgentry key:>"<:if Eq [old menu] [cfgentry key]:> selected="selected"<:or Eq:><:eif Eq:>><:cfgentry value:></option><:iterator separator cfgsection:>
+                <:iterator end cfgsection:>
+              </select><:or FieldPerm:><:article menu:><:eif FieldPerm:>
+            </td>
+            <td class="help"><:help article menu:> <:error_img menu:></td>
+          </tr><:or Cfgsection:><:eif Cfgsection:>
+                 <tr> 
+            <th>Template:</th>
+            <td><:ifFieldPerm template:><:templates:><:or:><:product template:><:eif:></td>
+            <td class="help"><:help product template:> <:error_img
+            template:></td>
+          </tr>
+                 <tr> 
+            <th>List article:</th>
+            <td> <:if FieldPerm listed:><:list listed:><:or FieldPerm:><:if Article listed:><:ifEq [article listed] "1":>Yes<:or:>In Sections, but not menu<:eif:><:or Article:>No<:eif Article:><:eif FieldPerm:> </td>
+            <td class="help"><:help edit listed:> <:error_img listed:></td>
+          </tr>
+          <tr> 
+            <th>Link alias:</th>
+            <td> 
+            <:ifFieldPerm linkAlias:><input type="text" name="linkAlias" maxlength="<:cfg fields linkAlias_size 255:>" size="40" value="<: old linkAlias article linkAlias :>" />
+            <:or:><:default linkAlias:><:eif:></td>
+            <td class="help"><:help edit linkAlias:> <:error_img linkAlias:></td>
+          </tr>
+                 <tr>
+            <th>Flags:</th>
+            <td><:iterator begin flags:><:if FieldPerm flags:>
+              <input type="checkbox" name="flags" value="<:flag id:>" <:ifFlagSet [flag id]:>checked="checked"<:or:>
+              <:eif:> /><:or FieldPerm:><:ifFlagSet [flag id]:>Yes<:or:>No<:eif:>
+              <:eif FieldPerm:><:flag desc:><:iterator separator flags:><br /><:iterator end flags:></td>
+            <td class="help"><:help edit flags:> <:error_img flags:></td>
           </tr>
           <tr>
-            <th align="left">Description:</th>
-            <td bgcolor="#FFFFFF">
-              <textarea name=body rows=15 cols=60 wrap=virtual><:product body:></textarea>
+            <th>Page title:</th>
+            <td>
+              <:ifFieldPerm pageTitle:><input type="text" name="pageTitle" value='<:old pageTitle article pageTitle:>' size="60" maxlength="255" /> (alternate title)<:or:><:article pageTitle:><:eif:>
             </td>
+           <td class="help"><:help edit pageTitle:> <:error_img pageTitle:></td>
+          </tr>
+          <tr>
+            <th>Meta description:</th>
+            <td>
+              <:ifFieldPerm metaDescription:><input type="text" name="metaDescription" value='<:old metaDescription article metaDescription:>' size="60" maxlength="255" /><:or:><:article metaDescription:><:eif:>
+            </td>
+           <td class="help"><:help edit metaDescription:> <:error_img metaDescription:></td>
+          </tr>
+          <tr>
+            <th>Meta keywords:</th>
+            <td>
+              <:ifFieldPerm metaKeywords:><input type="text" name="metaKeywords" value='<:old metaKeywords article metaKeywords:>' size="60" maxlength="255" /> (comma separated)<:or:><:article metaKeywords:><:eif:>
+            </td>
+           <td class="help"><:help edit metaKeywords:> <:error_img metaKeywords:></td>
+          </tr>
+          <tr>
+            <th>Author name:</th>
+            <td>
+              <:if FieldPerm author:><input type="text" name="author" value='<:ifCfg editor auto_author:><:old author adminuser name:><:or:><:old author:><:eif:>' size="40" maxlength="255" /><:or FieldPerm:><:article author:><:eif FieldPerm:>
+            </td>
+            <td class="help"><:help edit author:> <:error_img author:></td>
           </tr>
           <tr> 
-            <th nowrap align="left">Lead time:</th>
-            <td nowrap bgcolor="#FFFFFF"> 
-              <input type="text" name="leadTime" value="<:product leadTime:>" size=5>
+            <th>Lead time:</th>
+            <td> 
+              <:ifFieldPerm leadTime:>
+              <input type="text" name="leadTime" value="<:old leadTime default leadTime:>" size="5" /><:or:><:product leadTime:><:eif:>
               days</td>
+            <td class="help"><:help product leadtime:> <:error_img leadTime:></td>
+          </tr>
+          <tr> 
+            <th><:cfg "product fields" retailPrice "Retail price":>:</th>
+            <td>$ 
+              <:ifFieldPerm retailPrice:><input type="text" name="retailPrice" value="<:= oldf("retailPrice", bse.number("money", product.retailPrice)) :>" size="7" />
+              (0.00)<:or:><:money product retailPrice:><:eif:> </td>
+            <td class="help"><:help product retail:> <:error_img retailPrice:></td>
+          </tr>
+<:if Price_tiers:>
+          <tr>
+           <th><:cfg "product field" tier_prices "Tier prices":>:</th>
+           <td>
+<input type="hidden" name="save_pricing_tiers" value="1" />
+           <table class="editform editformtiny">
+<:iterator begin price_tiers:>
+<tr>
+  <th><:price_tier description:></th>
+  <td>$<:if FieldPerm retailPrice:><input type="text" name="tier_price_<:price_tier id:>" value="<:ifEq [tier_price] "":><:oldi [cat "tier_price_" [price_tier id]] 0:><:or:><:oldi [cat "tier_price_" [price_tier id]] 0 money tier_price:><:eif:>" size="7" /> (0.00)<:or FieldPerm:><:ifEq [tier_price] "":>-<:or:><:money tier_price:><:eif:><:eif FieldPerm:></td>
+  <td class="help"><:error_img [cat "tier_price_" [price_tier id]]:></td>
+
+</tr>
+<:iterator end price_tiers:>
+           </table>
+           </td>
+<td class="help"><:help product tier_price:></td>
+         </tr>
+<:or Price_tiers:><:eif Price_tiers:>
+          <tr> 
+            <th>Wholesale price:</th>
+            <td>$ 
+              <:ifFieldPerm wholesalePrice:><input type="text" name="wholesalePrice" value="<:old wholesalePrice money default wholesalePrice:>" size="7" />
+              (0.00)<:or:><:money product wholesalePrice:><:eif:></td>
+            <td class="help"><:help product wholesale:> <:error_img wholesalePrice:></td>
           </tr>
           <tr> 
-            <th align="left">Retail price:</th>
-            <td bgcolor="#FFFFFF">$ 
-              <input type="text" name="retailPrice" value="<:money retailPrice:>" size=7>
-              (0.00)</td>
+            <th>GST:</th>
+            <td>$ 
+              <:ifFieldPerm gst:><input type="text" name="gst" value="<:old gst money default gst:>" size="7" />
+              (0.00)<:or:><:money product gst:><:eif:></td>
+            <td class="help"><:help product gst:> <:error_img gst:></td>
+          </tr>
+          <tr>
+            <th>Weight:</th>
+            <td><:ifFieldPerm weight:><input type="text" name="weight" value="<:old weight default weight:>" size="7" /><:or:><:product weight:><:eif:> grams</td>
+            <td class="help"><:help product weight:> <:error_img weight:></td>
+          </tr>
+          <tr>
+            <th>Length:</th>
+            <td><:ifFieldPerm length:><input type="text" name="length" value="<:old length default length:>" size="7" /><:or:><:product length:><:eif:> mm</td>
+            <td class="help"><:help product length:> <:error_img length:></td>
+          </tr>
+          <tr>
+            <th>Width:</th>
+            <td><:ifFieldPerm width:><input type="text" name="width" value="<:old width default width:>" size="7" /><:or:><:product width:><:eif:> mm</td>
+            <td class="help"><:help product width:> <:error_img width:></td>
+          </tr>
+          <tr>
+            <th>Height</th>
+            <td><:ifFieldPerm height:><input type="text" name="height" value="<:old height default height:>" size="7" /><:or:><:product height:><:eif:> mm</td>
+            <td class="help"><:help product height:> <:error_img height:></td>
           </tr>
           <tr> 
-            <th align="left">Wholesale price:</th>
-            <td bgcolor="#FFFFFF">$ 
-              <input type="text" name="wholesalePrice" value="<:money wholesalePrice:>" size=7>
-              (0.00)</td>
+            <th>Release date:</th>
+            <td> 
+              <:ifFieldPerm release:><input type="text" name="release" value="<:old release date "%d/%m/%Y" default release:>" size="11" />
+              (dd/mm/yyyy)<:or:><:date "%d/%m/%Y" product release:><:eif:></td>
+            <td class="help"><:help product release:> <:error_img
+            release:></td>
           </tr>
           <tr> 
-            <th align="left">GST:</th>
-            <td bgcolor="#FFFFFF">$ 
-              <input type="text" name="gst" value="<:money gst:>" size=7>
-              (0.00)</td>
+            <th>Expiry date:</th>
+            <td> 
+              <:ifFieldPerm expire:><input type="text" name="expire" value="<:old expire date "%d/%m/%Y" default expire:>" size="11" />
+              (dd/mm/yyyy)<:or:><:date "%d/%m/%Y" product expire:><:eif:></td>
+            <td class="help"><:help product expire:> <:error_img
+            expire:></td>
           </tr>
           <tr> 
-            <th align="left">Release date:</th>
-            <td bgcolor="#FFFFFF"> 
-              <input type="text" name="release" value="<:date release:>" size=11>
-              (dd/mm/yyyy)</td>
+            <th>Summary length:</th>
+            <td> 
+              <:ifFieldPerm summaryLength:><input type="text" name="summaryLength" size="10" maxlength="10" value="<:old summaryLength default summaryLength:>" /><:or:><:product summaryLength:><:eif:>
+            </td>
+            <td class="help"><:help product summary:> <:error_img summaryLength:></td>
           </tr>
           <tr> 
-            <th align="left">Expiry date:</th>
-            <td bgcolor="#FFFFFF"> 
-              <input type="text" name="expire" value="<:date expire:>" size=11>
-              (dd/mm/yyyy)</td>
+            <th>Display threshold:</th>
+            <td> 
+              <:ifFieldPerm threshold:><input type="text" name="threshold" size="10" maxlength="10" value="<:old threshold default threshold:>" /><:or:><:product threshold:><:eif:>
+            </td>
+            <td class="help"><:help product threshold:> <:error_img threshold:></td>
           </tr>
+<:include admin/include/edit_common.tmpl:>
           <tr> 
-            <th align="left">Options:</th>
-            <td bgcolor="#FFFFFF"> 
-              <input type="text" name="options" value="<:product options:>" size=30> (<:alloptions:>)
-              </td>
+            <th>Options:</th>
+            <td> 
+              <:ifFieldPerm options:><input type="text" name="options" value="<:old options default options:>" size="30" />
+              (<:alloptions:>)<:or:><:product options:><:eif:> </td>
+            <td class="help"><:help product options:> <:error_img options:></td>
           </tr>
-          <tr>
-            <th nowrap align="left">Thumbnail image:</th>
-            <td nowrap bgcolor="#FFFFFF">
-              <input type="file" name="thumbnail"> <:ifProduct thumbImage:><img src="/images/<:product thumbImage:>"><input type=checkbox name="remove_thumb"> Remove<:or:><:eif:>
+<:include admin/product_custom.tmpl optional -:>
+<:include admin/include/custom/product_custom.tmpl optional -:>
+<:include admin/include/product_custom.tmpl optional -:>
+<:include admin/include/article_cfg_custom.tmpl -:>
+          <tr> 
+            <th>Thumbnail image:</th>
+            <td> 
+              <:ifFieldPerm thumbImage:><input type="file" name="thumbnail" /><:or:><:eif:>
+              <:ifProduct thumbImage:><img src="/images/<:product thumbImage:>"> 
+              <:if FieldPerm thumbImage:><input type="checkbox" name="remove_thumb" />
+              Remove<:or FieldPerm:><:eif FieldPerm:><:or:><:eif:> </td>
+            <td class="help"><:help product thumb:> <:error_img
+            thumbImage:></td>
+          </tr>
+                 <:if Article id:>
+          <tr> 
+            <th><a name="files"></a>Files:</th>
+            <td> <:if Files:> 
+                    <table class="editform editformsmall">
+                      <tr> 
+                        <th>Filename</th>
+                        <th>Size</th>
+                        <th>Type</th>
+                        <th>D/l</th>
+                        <th>Pay</th>
+                        <th>User</th>
+                      </tr>
+                      <:iterator begin files:> 
+                      <tr> 
+                        <td><:file displayName:></td>
+                        <td align="center"><:kb file sizeInBytes:></td>
+                        <td><:file contentType:></td>
+                        <td align="center"><:ifFile download:>Yes<:or:>No<:eif:></td>
+                        <td align="center"><:ifFile forSale:>Yes<:or:>No<:eif:></td>
+                        <td align="center"><:ifFile requireUser:>Yes<:or:>No<:eif:></td>
+                      </tr>
+                      <:iterator end files:> 
+                    </table>
+              <p><a href="<:script:>?filelist=1&amp;id=<:article id:>"><b>Manage Files</b></a>
+              </p>
+              <:or Files:>
+              No files are attached to this article. <a href="<:script:>?filelist=1&amp;id=<:article id:>"><b>Manage Files</b></a><:eif Files:>
+            </td>
+            <td class="help"><:help product 
+              files:> <:error_img files:></td>
+          </tr>
+          <tr> 
+            <th>Images:</th>
+            <td> <:if Images:> <:iterator begin 
+              images:> <img src="/images/<: image image :>" alt="<:image alt :>" width= 
+              <:image width:> height=<:image height:>> <:iterator separator images:> 
+              <hr noshade size="1">
+              <: iterator end images :>
+              <p align="left"><a href="<:script:>?id=<:article id:>&amp;showimages=1"><b>Manage Images</b></a></p>
+             <:or Images:>No images are attached to this article.  <a href="<:script:>?id=<:article id:>&amp;showimages=1"><b>Manage Images</b></a>
+             <:eif Images:>
+            </td>
+            <td class="help"><:help product images:> <:error_img
+            images:></td>
+          </tr>
+                 <:or Article:><:eif Article:>
+          <tr> 
+            <th>Purchase subscribes to:</th>
+            <td> 
+             <select name="subscription_id">
+                <option value="-1"<:ifEq [old subscription_id] "-1":> selected="selected"<:or:><:eif:>>(nothing)</option>
+<:iterator begin subscriptions:>
+                <option value="<:subscription subscription_id:>"<:ifEq [old subscription_id] [subscription subscription_id]:> selected="selected"<:or:><:eif:>><:subscription title:></option>
+<:iterator end subscriptions:>
+             </select> for <input type="text" name="subscription_period" value="<:ifEq [old subscription_period] "":><:default subscription_period:><:or:><:old subscription_period:><:eif:>" size="3" /><:error_img subscription_period:> months.
             </td>
+            <td class="help"><:help product subscription_id:></td>
           </tr>
+          <tr> 
+            <th>Can be used to:</th>
+            <td> 
+             <select name="subscription_usage">
+                <option value="3"<:ifEq [old subscription_usage] "3":> selected="selected"<:or:><:eif:>>Start or renew a subscription</option>
+                <option value="1"<:ifEq [old subscription_usage] "1":> selected="selected"<:or:><:eif:>>Start a subscription only</option>
+                <option value="2"<:ifEq [old subscription_usage] "2":> selected="selected"<:or:><:eif:>>Renew a subscription only</option>
+             </select>
+            </td>
+            <td class="help"><:help product subscription_usage:></td>
+          </tr>
+          <tr> 
+            <th>User must be subscribed to:</th>
+            <td> 
+             <select name="subscription_required">
+                <option value="-1"<:ifEq [old subscription_required] "-1":> selected="selected"<:or:><:eif:>>(nothing)</option>
+<:iterator begin subscriptions:>
+                <option value="<:subscription subscription_id:>"<:ifEq [old subscription_required] [subscription subscription_id]:> selected="selected"<:or:><:eif:>><:subscription title:></option>
+<:iterator end subscriptions:>
+             </select> to purchase this product
+            </td>
+            <td class="help"><:help product subscription_id:></td>
+          </tr>
+  <tr><td colspan="3">*These fields cannot be modified once this product has been
+      included in an order.</td></tr>
+<:.call "admin/include/edit_metadata.tmpl", tr: 1:>
+  <:if UserCan edit_save:article:>
+  <tr>
+    <td colspan="3" class="buttons"><:ifNew:><input type="submit" name="save" value="Add Product" /><:or:><input type="submit" name="save" value="Update Product" /><:eif:>
+  </td></tr><:or UserCan:><:eif UserCan:>
         </table>
-      </td>
-    </tr>
-  </table>
-  <p><input type=submit name="save_product" value="Save"></p>
 </form>
 
-</body>
-</html>