allow metadata to be defined for new products
[bse.git] / site / templates / admin / edit_product.tmpl
1 <:.set article_type = "Product" -:>
2 <:wrap admin/base.tmpl title => [cond [ifNew] "Add Product" "Edit Product"], menuitem=>"edit", showtitle=>"1", js => "admin_edit.js" :>
3 <:ifMessage:>
4 <p><b><:message:></b></p>
5 <:or:><:eif:> 
6 <:.set oldf = @{name, def: cgi.param(name).defined ? cgi.param(name) : def} -:>
7 <:include admin/product_menu.tmpl:>
8 <:ifNew:><:or:><:if Or [iadminuser_count] [iadmingroup_count]:>
9       <form action="/cgi-bin/admin/adminusers.pl">
10   <input type="hidden" name="id" value="<: article id:>" />
11         <table class="editform editformtiny">
12           <tr>
13             <th>Manage access:</th>
14             <td>
15               <select name="adminid">
16 <:iterator begin adminusers:>
17 <option value="<:iadminuser id:>">User <:iadminuser logon:>
18 </option><:iterator end adminusers:>
19 <:iterator begin admingroups:>
20 <option value="<:iadmingroup id:>">Group <:iadmingroup name:>
21 </option><:iterator end admingroups:>
22               </select>
23               <input type="submit" name="a_showobjectart" value="Manage" />
24       </td>
25             <td class="help"><:help access manage:>
26         </td>
27           </tr>
28         </table>
29       </form>
30 <br />
31 <:or Or:><:eif Or:><:eif:>
32 <form action="<:script:>" enctype="multipart/form-data" method="post">
33     <input type="hidden" name="lastModified" value="<:article lastModified:>" />
34     <input type="hidden" name="type" value="Product" />
35     <input type="hidden" name="id" value="<:product id:>" />
36 <:ifNew:><:csrfp admin_add_article hidden:><:or:><:csrfp admin_save_article hidden:><:eif:>
37         <table class="editform">
38                     <tr> 
39             <th>Catalog:</th>
40             <td>
41 <:ifFieldPerm parentid:><select name="parentid"><:list:></select><:or:><:parent title:> (<:parent id:>)<:eif:></td>
42             <td nowrap="nowrap" bgcolor="#FFFFFF"><:help product catalog:> <:error_img
43               parentid:></td>
44           </tr>
45                   <tr> 
46             <th>Title:</th>
47             <td><:ifFieldPerm title:><input type="text" name="title" value="<:old title default title:>" size="60" /><:or:><:product title:><:eif:> </td>
48             <td class="help"><:help product title:> <:error_img title:></td>
49           </tr>
50           <:if Cfg "title alias" [concatenate level [article level]]:><tr>
51             <th>Alias:</th>
52             <td>
53               <: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:>
54             </td>
55             <td class="help"><:help edit titleAlias:> <:error_img titleAlias:></td>
56           </tr><:or Cfg:><:eif Cfg:>
57           <tr> 
58             <th>Summary:</th>
59             <td><:ifFieldPerm summary:><input type="text" name="summary" value="<:old summary default summary:>" size="60" /><:or:><:product summary:><:eif:> </td>
60             <td class="edit"><:help product summary:> <:error_img
61             summary:></td>
62           </tr>
63           <tr> 
64             <th>Description:</th>
65             <td><:ifFieldPerm description:><input type="text" name="description" value="<:old description default description:>" size="60" /><:or:><:product description:><:eif:> </td>
66             <td class="help"><:help product description:> <:error_img
67             description:></td>
68           </tr>
69           <tr> 
70             <th>Product Code:</th>
71             <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>
72             <td class="help"><:help product product_code:> <:error_img
73             product_code:></td>
74           </tr>
75           <tr> 
76             <th> Body:</th>
77             <td> 
78               <:ifFieldPerm body:><textarea name="body" rows="15" cols="60" ><:old body default body:></textarea><:or:><:bodytext product body:><:eif:>
79             </td>
80             <td class="help"><:help body body:> <:error_img
81             body:></td>
82           </tr>
83           <:if Cfgsection [concatenate level [article level] " menus"]:><tr> 
84             <th>Menu:</th>
85             <td> 
86               <:if FieldPerm menu:><select name="menu" id="menu">
87                 <: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:>
88                 <:iterator end cfgsection:>
89               </select><:or FieldPerm:><:article menu:><:eif FieldPerm:>
90             </td>
91             <td class="help"><:help article menu:> <:error_img menu:></td>
92           </tr><:or Cfgsection:><:eif Cfgsection:>
93                   <tr> 
94             <th>Template:</th>
95             <td><:ifFieldPerm template:><:templates:><:or:><:product template:><:eif:></td>
96             <td class="help"><:help product template:> <:error_img
97             template:></td>
98           </tr>
99                   <tr> 
100             <th>List article:</th>
101             <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>
102             <td class="help"><:help edit listed:> <:error_img listed:></td>
103           </tr>
104           <tr> 
105             <th>Link alias:</th>
106             <td> 
107             <:ifFieldPerm linkAlias:><input type="text" name="linkAlias" maxlength="<:cfg fields linkAlias_size 255:>" size="40" value="<: old linkAlias article linkAlias :>" />
108             <:or:><:default linkAlias:><:eif:></td>
109             <td class="help"><:help edit linkAlias:> <:error_img linkAlias:></td>
110           </tr>
111                   <tr>
112             <th>Flags:</th>
113             <td><:iterator begin flags:><:if FieldPerm flags:>
114               <input type="checkbox" name="flags" value="<:flag id:>" <:ifFlagSet [flag id]:>checked="checked"<:or:>
115               <:eif:> /><:or FieldPerm:><:ifFlagSet [flag id]:>Yes<:or:>No<:eif:>
116               <:eif FieldPerm:><:flag desc:><:iterator separator flags:><br /><:iterator end flags:></td>
117             <td class="help"><:help edit flags:> <:error_img flags:></td>
118           </tr>
119           <tr>
120             <th>Page title:</th>
121             <td>
122               <:ifFieldPerm pageTitle:><input type="text" name="pageTitle" value='<:old pageTitle article pageTitle:>' size="60" maxlength="255" /> (alternate title)<:or:><:article pageTitle:><:eif:>
123             </td>
124            <td class="help"><:help edit pageTitle:> <:error_img pageTitle:></td>
125           </tr>
126           <tr>
127             <th>Meta description:</th>
128             <td>
129               <:ifFieldPerm metaDescription:><input type="text" name="metaDescription" value='<:old metaDescription article metaDescription:>' size="60" maxlength="255" /><:or:><:article metaDescription:><:eif:>
130             </td>
131            <td class="help"><:help edit metaDescription:> <:error_img metaDescription:></td>
132           </tr>
133           <tr>
134             <th>Meta keywords:</th>
135             <td>
136               <:ifFieldPerm metaKeywords:><input type="text" name="metaKeywords" value='<:old metaKeywords article metaKeywords:>' size="60" maxlength="255" /> (comma separated)<:or:><:article metaKeywords:><:eif:>
137             </td>
138            <td class="help"><:help edit metaKeywords:> <:error_img metaKeywords:></td>
139           </tr>
140           <tr>
141             <th>Author name:</th>
142             <td>
143               <: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:>
144             </td>
145             <td class="help"><:help edit author:> <:error_img author:></td>
146           </tr>
147           <tr> 
148             <th>Lead time:</th>
149             <td> 
150               <:ifFieldPerm leadTime:>
151               <input type="text" name="leadTime" value="<:old leadTime default leadTime:>" size="5" /><:or:><:product leadTime:><:eif:>
152               days</td>
153             <td class="help"><:help product leadtime:> <:error_img leadTime:></td>
154           </tr>
155           <tr> 
156             <th><:cfg "product fields" retailPrice "Retail price":>:</th>
157             <td>$ 
158               <:ifFieldPerm retailPrice:><input type="text" name="retailPrice" value="<:= oldf("retailPrice", bse.number("money", product.retailPrice)) :>" size="7" />
159               (0.00)<:or:><:money product retailPrice:><:eif:> </td>
160             <td class="help"><:help product retail:> <:error_img retailPrice:></td>
161           </tr>
162 <:if Price_tiers:>
163           <tr>
164             <th><:cfg "product field" tier_prices "Tier prices":>:</th>
165             <td>
166 <input type="hidden" name="save_pricing_tiers" value="1" />
167             <table class="editform editformtiny">
168 <:iterator begin price_tiers:>
169 <tr>
170   <th><:price_tier description:></th>
171   <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>
172   <td class="help"><:error_img [cat "tier_price_" [price_tier id]]:></td>
173
174 </tr>
175 <:iterator end price_tiers:>
176             </table>
177             </td>
178 <td class="help"><:help product tier_price:></td>
179           </tr>
180 <:or Price_tiers:><:eif Price_tiers:>
181           <tr> 
182             <th>Wholesale price:</th>
183             <td>$ 
184               <:ifFieldPerm wholesalePrice:><input type="text" name="wholesalePrice" value="<:old wholesalePrice money default wholesalePrice:>" size="7" />
185               (0.00)<:or:><:money product wholesalePrice:><:eif:></td>
186             <td class="help"><:help product wholesale:> <:error_img wholesalePrice:></td>
187           </tr>
188           <tr> 
189             <th>GST:</th>
190             <td>$ 
191               <:ifFieldPerm gst:><input type="text" name="gst" value="<:old gst money default gst:>" size="7" />
192               (0.00)<:or:><:money product gst:><:eif:></td>
193             <td class="help"><:help product gst:> <:error_img gst:></td>
194           </tr>
195           <tr>
196             <th>Weight:</th>
197             <td><:ifFieldPerm weight:><input type="text" name="weight" value="<:old weight default weight:>" size="7" /><:or:><:product weight:><:eif:> grams</td>
198             <td class="help"><:help product weight:> <:error_img weight:></td>
199           </tr>
200           <tr>
201             <th>Length:</th>
202             <td><:ifFieldPerm length:><input type="text" name="length" value="<:old length default length:>" size="7" /><:or:><:product length:><:eif:> mm</td>
203             <td class="help"><:help product length:> <:error_img length:></td>
204           </tr>
205           <tr>
206             <th>Width:</th>
207             <td><:ifFieldPerm width:><input type="text" name="width" value="<:old width default width:>" size="7" /><:or:><:product width:><:eif:> mm</td>
208             <td class="help"><:help product width:> <:error_img width:></td>
209           </tr>
210           <tr>
211             <th>Height</th>
212             <td><:ifFieldPerm height:><input type="text" name="height" value="<:old height default height:>" size="7" /><:or:><:product height:><:eif:> mm</td>
213             <td class="help"><:help product height:> <:error_img height:></td>
214           </tr>
215           <tr> 
216             <th>Release date:</th>
217             <td> 
218               <:ifFieldPerm release:><input type="text" name="release" value="<:old release date "%d/%m/%Y" default release:>" size="11" />
219               (dd/mm/yyyy)<:or:><:date "%d/%m/%Y" product release:><:eif:></td>
220             <td class="help"><:help product release:> <:error_img
221             release:></td>
222           </tr>
223           <tr> 
224             <th>Expiry date:</th>
225             <td> 
226               <:ifFieldPerm expire:><input type="text" name="expire" value="<:old expire date "%d/%m/%Y" default expire:>" size="11" />
227               (dd/mm/yyyy)<:or:><:date "%d/%m/%Y" product expire:><:eif:></td>
228             <td class="help"><:help product expire:> <:error_img
229             expire:></td>
230           </tr>
231           <tr> 
232             <th>Summary length:</th>
233             <td> 
234               <:ifFieldPerm summaryLength:><input type="text" name="summaryLength" size="10" maxlength="10" value="<:old summaryLength default summaryLength:>" /><:or:><:product summaryLength:><:eif:>
235             </td>
236             <td class="help"><:help product summary:> <:error_img summaryLength:></td>
237           </tr>
238           <tr> 
239             <th>Display threshold:</th>
240             <td> 
241               <:ifFieldPerm threshold:><input type="text" name="threshold" size="10" maxlength="10" value="<:old threshold default threshold:>" /><:or:><:product threshold:><:eif:>
242             </td>
243             <td class="help"><:help product threshold:> <:error_img threshold:></td>
244           </tr>
245 <:include admin/include/edit_common.tmpl:>
246           <tr> 
247             <th>Options:</th>
248             <td> 
249               <:ifFieldPerm options:><input type="text" name="options" value="<:old options default options:>" size="30" />
250               (<:alloptions:>)<:or:><:product options:><:eif:> </td>
251             <td class="help"><:help product options:> <:error_img options:></td>
252           </tr>
253 <:include admin/product_custom.tmpl optional -:>
254 <:include admin/include/custom/product_custom.tmpl optional -:>
255 <:include admin/include/product_custom.tmpl optional -:>
256 <:include admin/include/article_cfg_custom.tmpl -:>
257           <tr> 
258             <th>Thumbnail image:</th>
259             <td> 
260               <:ifFieldPerm thumbImage:><input type="file" name="thumbnail" /><:or:><:eif:>
261               <:ifProduct thumbImage:><img src="/images/<:product thumbImage:>"> 
262               <:if FieldPerm thumbImage:><input type="checkbox" name="remove_thumb" />
263               Remove<:or FieldPerm:><:eif FieldPerm:><:or:><:eif:> </td>
264             <td class="help"><:help product thumb:> <:error_img
265             thumbImage:></td>
266           </tr>
267                   <:if Article id:>
268           <tr> 
269             <th><a name="files"></a>Files:</th>
270             <td> <:if Files:> 
271                     <table class="editform editformsmall">
272                       <tr> 
273                         <th>Filename</th>
274                         <th>Size</th>
275                         <th>Type</th>
276                         <th>D/l</th>
277                         <th>Pay</th>
278                         <th>User</th>
279                       </tr>
280                       <:iterator begin files:> 
281                       <tr> 
282                         <td><:file displayName:></td>
283                         <td align="center"><:kb file sizeInBytes:></td>
284                         <td><:file contentType:></td>
285                         <td align="center"><:ifFile download:>Yes<:or:>No<:eif:></td>
286                         <td align="center"><:ifFile forSale:>Yes<:or:>No<:eif:></td>
287                         <td align="center"><:ifFile requireUser:>Yes<:or:>No<:eif:></td>
288                       </tr>
289                       <:iterator end files:> 
290                     </table>
291               <p><a href="<:script:>?filelist=1&amp;id=<:article id:>"><b>Manage Files</b></a>
292               </p>
293               <:or Files:>
294               No files are attached to this article. <a href="<:script:>?filelist=1&amp;id=<:article id:>"><b>Manage Files</b></a><:eif Files:>
295             </td>
296             <td class="help"><:help product 
297               files:> <:error_img files:></td>
298           </tr>
299           <tr> 
300             <th>Images:</th>
301             <td> <:if Images:> <:iterator begin 
302               images:> <img src="/images/<: image image :>" alt="<:image alt :>" width= 
303               <:image width:> height=<:image height:>> <:iterator separator images:> 
304               <hr noshade size="1">
305               <: iterator end images :>
306               <p align="left"><a href="<:script:>?id=<:article id:>&amp;showimages=1"><b>Manage Images</b></a></p>
307               <:or Images:>No images are attached to this article.  <a href="<:script:>?id=<:article id:>&amp;showimages=1"><b>Manage Images</b></a>
308               <:eif Images:>
309             </td>
310             <td class="help"><:help product images:> <:error_img
311             images:></td>
312           </tr>
313                   <:or Article:><:eif Article:>
314           <tr> 
315             <th>Purchase subscribes to:</th>
316             <td> 
317               <select name="subscription_id">
318                 <option value="-1"<:ifEq [old subscription_id] "-1":> selected="selected"<:or:><:eif:>>(nothing)</option>
319 <:iterator begin subscriptions:>
320                 <option value="<:subscription subscription_id:>"<:ifEq [old subscription_id] [subscription subscription_id]:> selected="selected"<:or:><:eif:>><:subscription title:></option>
321 <:iterator end subscriptions:>
322               </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.
323             </td>
324             <td class="help"><:help product subscription_id:></td>
325           </tr>
326           <tr> 
327             <th>Can be used to:</th>
328             <td> 
329               <select name="subscription_usage">
330                 <option value="3"<:ifEq [old subscription_usage] "3":> selected="selected"<:or:><:eif:>>Start or renew a subscription</option>
331                 <option value="1"<:ifEq [old subscription_usage] "1":> selected="selected"<:or:><:eif:>>Start a subscription only</option>
332                 <option value="2"<:ifEq [old subscription_usage] "2":> selected="selected"<:or:><:eif:>>Renew a subscription only</option>
333               </select>
334             </td>
335             <td class="help"><:help product subscription_usage:></td>
336           </tr>
337           <tr> 
338             <th>User must be subscribed to:</th>
339             <td> 
340               <select name="subscription_required">
341                 <option value="-1"<:ifEq [old subscription_required] "-1":> selected="selected"<:or:><:eif:>>(nothing)</option>
342 <:iterator begin subscriptions:>
343                 <option value="<:subscription subscription_id:>"<:ifEq [old subscription_required] [subscription subscription_id]:> selected="selected"<:or:><:eif:>><:subscription title:></option>
344 <:iterator end subscriptions:>
345               </select> to purchase this product
346             </td>
347             <td class="help"><:help product subscription_id:></td>
348           </tr>
349   <tr><td colspan="3">*These fields cannot be modified once this product has been
350       included in an order.</td></tr>
351 <:.call "admin/include/edit_metadata.tmpl", tr: 1:>
352   <:if UserCan edit_save:article:>
353   <tr>
354     <td colspan="3" class="buttons"><:ifNew:><input type="submit" name="save" value="Add Product" /><:or:><input type="submit" name="save" value="Update Product" /><:eif:>
355   </td></tr><:or UserCan:><:eif UserCan:>
356         </table>
357 </form>
358