Quick Search:

View

Revision:

Diff

Diff from 1246 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/osCommerce/branches/frank/osc-tickets/admin/templates/pages/products_edit.php

Annotated File View

hpdl
1
1 <?php
2 /*
hpdl
121
3   $Id: products_edit.php 1246 2007-02-11 11:42:36Z frank $
hpdl
1
4
5   osCommerce, Open Source E-Commerce Solutions
6   http://www.oscommerce.com
7
hpdl
443
8   Copyright (c) 2006 osCommerce
hpdl
1
9
10   Released under the GNU General Public License
11 */
12
hpdl
608
13   if (isset($_GET['pID'])) {
14     $Qp = $osC_Database->query('select products_id, products_quantity, products_price, products_weight, products_weight_class, products_date_added, products_last_modified, date_format(products_date_available, "%Y-%m-%d") as products_date_available, products_status, products_tax_class_id, manufacturers_id from :table_products where products_id = :products_id');
hpdl
1
15     $Qp->bindTable(':table_products', TABLE_PRODUCTS);
16     $Qp->bindInt(':products_id', $_GET['pID']);
17     $Qp->execute();
18
hpdl
365
19     $Qpd = $osC_Database->query('select products_name, products_description, products_model, products_keyword, products_tags, products_url, language_id from :table_products_description where products_id = :products_id');
hpdl
1
20     $Qpd->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
21     $Qpd->bindInt(':products_id', $_GET['pID']);
22     $Qpd->execute();
23
24     $pd_extra = array();
25     while ($Qpd->next()) {
26       $pd_extra['products_name'][$Qpd->valueInt('language_id')] = $Qpd->value('products_name');
27       $pd_extra['products_description'][$Qpd->valueInt('language_id')] = $Qpd->value('products_description');
hpdl
365
28       $pd_extra['products_model'][$Qpd->valueInt('language_id')] = $Qpd->value('products_model');
29       $pd_extra['products_keyword'][$Qpd->valueInt('language_id')] = $Qpd->value('products_keyword');
30       $pd_extra['products_tags'][$Qpd->valueInt('language_id')] = $Qpd->value('products_tags');
hpdl
1
31       $pd_extra['products_url'][$Qpd->valueInt('language_id')] = $Qpd->value('products_url');
32     }
33
34     $pInfo = new objectInfo(array_merge($Qp->toArray(), $pd_extra));
35   }
36
37   $Qmanufacturers = $osC_Database->query('select manufacturers_id, manufacturers_name from :table_manufacturers order by manufacturers_name');
38   $Qmanufacturers->bindTable(':table_manufacturers', TABLE_MANUFACTURERS);
39   $Qmanufacturers->execute();
40
41   $manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE));
42   while ($Qmanufacturers->next()) {
43     $manufacturers_array[] = array('id' => $Qmanufacturers->valueInt('manufacturers_id'),
44                                    'text' => $Qmanufacturers->value('manufacturers_name'));
45   }
46
47   $Qtc = $osC_Database->query('select tax_class_id, tax_class_title from :table_tax_class order by tax_class_title');
48   $Qtc->bindTable(':table_tax_class', TABLE_TAX_CLASS);
49   $Qtc->execute();
50
51   $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE));
52   while ($Qtc->next()) {
53     $tax_class_array[] = array('id' => $Qtc->valueInt('tax_class_id'),
54                                'text' => $Qtc->value('tax_class_title'));
55   }
56
57   $Qwc = $osC_Database->query('select weight_class_id, weight_class_title from :table_weight_class where language_id = :language_id order by weight_class_title');
58   $Qwc->bindTable(':table_weight_class', TABLE_WEIGHT_CLASS);
hpdl
121
59   $Qwc->bindInt(':language_id', $osC_Language->getID());
hpdl
1
60   $Qwc->execute();
61
62   $weight_class_array = array();
63   while ($Qwc->next()) {
64     $weight_class_array[] = array('id' => $Qwc->valueInt('weight_class_id'),
65                                   'text' => $Qwc->value('weight_class_title'));
66   }
hpdl
608
67 ?>
hpdl
1
68
hpdl
608
69 <script language="javascript" type="text/javascript" src="../ext/prototype/prototype.js"></script>
70 <script language="javascript" type="text/javascript" src="../ext/scriptaculous/scriptaculous.js"></script>
hpdl
1
71
72 <style type="text/css">@import url('external/jscalendar/calendar-win2k-1.css');</style>
73 <script type="text/javascript" src="external/jscalendar/calendar.js"></script>
74 <script type="text/javascript" src="external/jscalendar/lang/calendar-en.js"></script>
75 <script type="text/javascript" src="external/jscalendar/calendar-setup.js"></script>
76
77 <style type="text/css">
78 .attributeRemove {
79   background-color: #FFC6C6;
80 }
81
82 .attributeAdd {
83   background-color: #E8FFC6;
84 }
85 </style>
86
hpdl
365
87 <script type="text/javascript"><!--
hpdl
1
88   var tax_rates = new Array();
hpdl
1076
89
hpdl
1
90 <?php
91   foreach ($tax_class_array as $tc_entry) {
92     if ($tc_entry['id'] > 0) {
hpdl
758
93       echo '  tax_rates["' . $tc_entry['id'] . '"] = ' . $osC_Tax->getTaxRate($tc_entry['id']) . ';' . "\n";
hpdl
1
94     }
95   }
96 ?>
97
98   function doRound(x, places) {
99     return Math.round(x * Math.pow(10, places)) / Math.pow(10, places);
100   }
101
102   function getTaxRate() {
hpdl
613
103     var selected_value = document.forms["product"].products_tax_class_id.selectedIndex;
104     var parameterVal = document.forms["product"].products_tax_class_id[selected_value].value;
hpdl
1
105
106     if ( (parameterVal > 0) && (tax_rates[parameterVal] > 0) ) {
107       return tax_rates[parameterVal];
108     } else {
109       return 0;
110     }
111   }
112
hpdl
443
113   function updateGross(field) {
hpdl
1
114     var taxRate = getTaxRate();
hpdl
443
115     var grossValue = document.getElementById(field).value;
hpdl
1
116
117     if (taxRate > 0) {
118       grossValue = grossValue * ((taxRate / 100) + 1);
119     }
120
hpdl
443
121     document.getElementById(field + "_gross").value = doRound(grossValue, 4);
hpdl
1
122   }
123
hpdl
443
124   function updateNet(field) {
hpdl
1
125     var taxRate = getTaxRate();
hpdl
443
126     var netValue = document.getElementById(field + "_gross").value;
hpdl
1
127
128     if (taxRate > 0) {
129       netValue = netValue / ((taxRate / 100) + 1);
130     }
131
hpdl
443
132     document.getElementById(field).value = doRound(netValue, 4);
hpdl
1
133   }
134
135   var counter = 0;
136
137   function moreFields() {
hpdl
613
138     var existingFields = document.product.getElementsByTagName('input');
hpdl
1
139     var attributeExists = false;
140
141     for (i=0; i<existingFields.length; i++) {
hpdl
613
142       if (existingFields[i].name == 'attribute_price[' + document.product.attributes.options[document.product.attributes.options.selectedIndex].parentNode.id + '][' + document.product.attributes.options[document.product.attributes.options.selectedIndex].value + ']') {
hpdl
1
143         attributeExists = true;
144         break;
145       }
146     }
147
148     if (attributeExists == false) {
149       counter++;
150       var newFields = document.getElementById('readroot').cloneNode(true);
151       newFields.id = '';
152       newFields.style.display = 'block';
153
154       var spanFields = newFields.getElementsByTagName('span');
155       var inputFields = newFields.getElementsByTagName('input');
156       var selectFields = newFields.getElementsByTagName('select');
157
hpdl
613
158       spanFields[0].innerHTML = document.product.attributes.options[document.product.attributes.options.selectedIndex].parentNode.label;
159       spanFields[1].innerHTML = document.product.attributes.options[document.product.attributes.options.selectedIndex].text;
hpdl
1
160
161       for (y=0; y<inputFields.length; y++) {
162         if (inputFields[y].type != 'button') {
hpdl
613
163           inputFields[y].name = inputFields[y].name.substr(4) + '[' + document.product.attributes.options[document.product.attributes.options.selectedIndex].parentNode.id + '][' + document.product.attributes.options[document.product.attributes.options.selectedIndex].value + ']';
hpdl
1
164           inputFields[y].disabled = false;
165         }
166       }
167
168       for (y=0; y<selectFields.length; y++) {
hpdl
613
169         selectFields[y].name = selectFields[y].name.substr(4) + '[' + document.product.attributes.options[document.product.attributes.options.selectedIndex].parentNode.id + '][' + document.product.attributes.options[document.product.attributes.options.selectedIndex].value + ']';
hpdl
1
170         selectFields[y].disabled = false;
171       }
172
173       var insertHere = document.getElementById('writeroot');
174       insertHere.parentNode.insertBefore(newFields,insertHere);
175     }
176   }
177
178   function toggleAttributeStatus(attributeID) {
179     var row = document.getElementById(attributeID);
180     var rowButton = document.getElementById(attributeID + '-button');
181     var inputFields = row.getElementsByTagName('input');
182     var selectFields = row.getElementsByTagName('select');
183
184     if (rowButton.value == '-') {
185       for (rF=0; rF<inputFields.length; rF++) {
186         if (inputFields[rF].type != 'button') {
187           inputFields[rF].disabled = true;
188         }
189       }
190
191       for (rF=0; rF<selectFields.length; rF++) {
192         selectFields[rF].disabled = true;
193       }
194
195       row.className = 'attributeRemove';
196       rowButton.value = '+';
197     } else {
198       for (rF=0; rF<inputFields.length; rF++) {
199         if (inputFields[rF].type != 'button') {
200           inputFields[rF].disabled = false;
201         }
202       }
203
204       for (rF=0; rF<selectFields.length; rF++) {
205         selectFields[rF].disabled = false;
206       }
207
208       row.className = '';
209       rowButton.value = '-';
210     }
211   }
212
hpdl
875
213 <?php
214   if (isset($_GET['pID'])) {
215 ?>
216
hpdl
608
217   function handleHttpResponseRemoveImage(http) {
frank
1154
218     var result = /\[\[([^|]*?)(?:\|([^|]*?)){0,1}\]\]/.exec(http.responseText);
219     result.shift();
hpdl
1
220
frank
1154
221     if (result[0] == '1') {
222       document.getElementById('image_' + result[1]).style.display = 'none';
hpdl
608
223
frank
1154
224       if (document.getElementById('image_' + result[1]).parentNode.id == 'imagesOriginal') {
hpdl
608
225         getImagesOthers();
226       }
227     }
hpdl
1
228   }
hpdl
608
229
230   function removeImage(id) {
231     var objOverlay = document.getElementById('overlay');
232     var objActionLayer = document.getElementById('actionLayer');
233
234     var arrayPageSize = getPageSize();
235     var arrayPageScroll = getPageScroll();
236
237     objOverlay.style.height = (arrayPageSize[1] + 'px');
238     objOverlay.style.display = 'block';
239
240     objActionLayer.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - parseInt(objActionLayer.style.height)) / 2) + 'px');
241     objActionLayer.style.left = (((arrayPageSize[0] - 20 - parseInt(objActionLayer.style.width)) / 2) + 'px');
242
243     var s = new String(objActionLayer.innerHTML);
244     s = s.replace(/removeImageConfirmation\(\'[a-zA-Z0-9_]*\'\)/, 'removeImageConfirmation(\'' + id + '\')');
245     s = s.replace(/cancelRemoveImage\(\'[a-zA-Z0-9_]*\'\)/, 'cancelRemoveImage(\'' + id + '\')');
246
247     objActionLayer.innerHTML = s;
248
249     objActionLayer.style.display = 'block';
250   }
251
252   function removeImageConfirmation(id) {
253     var image = id.split('_');
254
255     document.getElementById('actionLayer').style.display = 'none';
256     document.getElementById('overlay').style.display = 'none';
257
258     new Ajax.Request("rpc.php?action=deleteProductImage&image=" + image[1], {onSuccess: handleHttpResponseRemoveImage});
259   }
260
261   function cancelRemoveImage(id) {
262     document.getElementById('actionLayer').style.display = 'none';
263     document.getElementById('overlay').style.display = 'none';
264     document.getElementById(id).style.backgroundColor = '#ffffff';
265   }
266
267   function handleHttpResponseSetDefaultImage(http) {
frank
1154
268     var result = /\[\[([^|]*?)(?:\|([^|]*?)){0,1}\]\]/.exec(http.responseText);
269     result.shift();
hpdl
608
270
frank
1154
271     if (result[0] == '1') {
hpdl
608
272       getImagesOriginals();
273     }
274   }
275
276   function setDefaultImage(id) {
277     var image = id.split('_');
278
279     new Ajax.Request("rpc.php?action=setDefaultImage&image=" + image[1], {onSuccess: handleHttpResponseSetDefaultImage});
280   }
281
282   function handleHttpResponseReorderImages(http) {
frank
1154
283     var result = /\[\[([^|]*?)(?:\|([^|]*?)){0,1}\]\]/.exec(http.responseText);
284     result.shift();
hpdl
608
285
frank
1154
286     if (result[0] == '1') {
hpdl
608
287       getImagesOthers();
288     }
289   }
290
291   function handleHttpResponseGetImages(http) {
frank
1182
292     var result = /\[\[([^|]*?)(?:\|([^|]*?)){0,1}\]\]/.exec(http.responseText);
293     result.shift();
hpdl
608
294
frank
1154
295     if (result[0] == '1') {
296       var str_array = result[1].split('[x]');
hpdl
608
297
298       for (i = 0; i < str_array.length; ++i) {
299         var str_ele = str_array[i].split('[-]');
300
hpdl
749
301         var style = 'width: <?php echo $osC_Image->getWidth('mini') + 20; ?>px; padding: 10px; float: left; text-align: center;';
hpdl
608
302
303         if (str_ele[1] == '1') { // original (products_images_groups_id)
hpdl
1078
304           var onmouseover = 'this.style.backgroundColor=\'#EFEBDE\'; this.style.backgroundImage=\'url(<?php echo osc_href_link_admin('templates/' . $osC_Template->getCode() . '/images/icons/16x16/drag.png'); ?>)\'; this.style.backgroundRepeat=\'no-repeat\'; this.style.backgroundPosition=\'0 0\';';
hpdl
608
305
306           if (str_ele[6] == '1') { // default_flag
307             style += ' background-color: #E5EFE5;';
308
309             var onmouseout = 'this.style.backgroundColor=\'#E5EFE5\'; this.style.backgroundImage=\'none\';';
310           } else {
311             var onmouseout = 'this.style.backgroundColor=\'#FFFFFF\'; this.style.backgroundImage=\'none\';';
312           }
313         } else {
314           var onmouseover = 'this.style.backgroundColor=\'#EFEBDE\';';
315           var onmouseout = 'this.style.backgroundColor=\'#FFFFFF\';';
316         }
317
318         var newdiv = '<span id="image_' + str_ele[0] + '" style="' + style + '" onmouseover="' + onmouseover + '" onmouseout="' + onmouseout + '">';
frank
1246
319         newdiv += '<a href="' + str_ele[4] + '" target="_blank"><img src="<?php echo DIR_WS_HTTP_CATALOG . 'images/products/mini/'; ?>' + str_ele[2] + '" border="0" height="<?php echo $osC_Image->getHeight('mini'); ?>" alt="' + str_ele[2] + '" title="' + str_ele[2] + '" style="max-width: <?php echo $osC_Image->getWidth('mini') + 20; ?>px;" /></a><div style="height: 38px;">' + str_ele[3] + '<br />' + str_ele[5] + ' bytes</div>';
hpdl
608
320
321         if (str_ele[1] == '1') {
322           if (str_ele[6] == '1') {
hpdl
755
323             newdiv += '<?php echo osc_icon('default.png', IMAGE_DEFAULT); ?>&nbsp;';
hpdl
608
324           } else {
hpdl
755
325             newdiv += '<a href="#" onclick="setDefaultImage(\'image_' + str_ele[0] + '\');"><?php echo osc_icon('default_grey.png', IMAGE_DEFAULT); ?></a>&nbsp;';
hpdl
608
326           }
327
hpdl
755
328           newdiv += '<a href="#" onclick="removeImage(\'image_' + str_ele[0] + '\');"><?php echo osc_icon('trash.png', IMAGE_DELETE); ?></a>';
hpdl
608
329         }
330
331         newdiv += '</span>';
332
333         if (str_ele[1] == '1') {
334           document.getElementById('imagesOriginal').innerHTML += newdiv;
335         } else {
336           document.getElementById('imagesOther').innerHTML += newdiv;
337         }
338       }
339
340       Sortable.create('imagesOriginal', {tag: 'span', overlap: 'horizontal', constraint: false, onUpdate: function() {
341         new Ajax.Request("rpc.php?action=reorderImages&pID=<?php echo urlencode($_GET['pID']); ?>&" + Sortable.serialize('imagesOriginal'), {onSuccess: handleHttpResponseReorderImages});
342       }});
343     }
344
345     if (document.getElementById('showProgressOriginal').style.display != 'none') {
346       document.getElementById('showProgressOriginal').style.display = 'none';
347     }
348
349     if (document.getElementById('showProgressOther').style.display != 'none') {
350       document.getElementById('showProgressOther').style.display = 'none';
351     }
352   }
353
354   function getImages() {
355     getImagesOriginals(false);
356     getImagesOthers(false);
357
358     new Ajax.Request("rpc.php?action=getImages&pID=<?php echo urlencode($_GET['pID']); ?>", {onSuccess: handleHttpResponseGetImages});
359   }
360
361   function getImagesOriginals(makeCall) {
hpdl
755
362     document.getElementById('imagesOriginal').innerHTML = '<div id="showProgressOriginal" style="float: left; padding-left: 10px;"><?php echo osc_icon('progress_ani.gif') . '&nbsp;Loading images from server...'; ?></div>';
hpdl
608
363
364     if (makeCall != false) {
365       new Ajax.Request("rpc.php?action=getImages&pID=<?php echo urlencode($_GET['pID']); ?>&filter=originals", {onSuccess: handleHttpResponseGetImages});
366     }
367   }
368
369   function getImagesOthers(makeCall) {
hpdl
755
370     document.getElementById('imagesOther').innerHTML = '<div id="showProgressOther" style="float: left; padding-left: 10px;"><?php echo osc_icon('progress_ani.gif') . '&nbsp;Loading images from server...'; ?></div>';
hpdl
608
371
372     if (makeCall != false) {
373       new Ajax.Request("rpc.php?action=getImages&pID=<?php echo urlencode($_GET['pID']); ?>&filter=others", {onSuccess: handleHttpResponseGetImages});
374     }
375   }
hpdl
749
376
hpdl
875
377 <?php
378   }
379 ?>
380
hpdl
749
381   function handleHttpResponseGetLocalImages(http) {
frank
1154
382     var result = /\[\[([^|]*?)(?:\|([^|]*?)){0,1}\]\]/.exec(http.responseText);
383     result.shift();
hpdl
749
384
frank
1154
385     if (result[0] == '1') {
hpdl
749
386       var i = 0;
387
388       var selectList = document.getElementById('localImagesSelection');
389
390       for (i = selectList.options.length; i >= 0; i--) {
391         selectList.options[i] = null;
392       }
393
frank
1154
394       if (result[1].length > 0) {
395         var entries = result[1].split('#');
hpdl
749
396
397         for (i = 0; i < entries.length; i++) {
398           selectList.options[i] = new Option(entries[i]);
399           selectList.options[i].selected = false;
400         }
401       }
402     }
403
404     document.getElementById('showProgressGetLocalImages').style.display = 'none';
405   }
406
407   function getLocalImages() {
408     document.getElementById('showProgressGetLocalImages').style.display = 'inline';
409
410     new Ajax.Request("rpc.php?action=getLocalImages", {onSuccess: handleHttpResponseGetLocalImages});
411   }
412
413   function setFileUploadField() {
hpdl
755
414     document.getElementById('fileUploadField').innerHTML = '<?php echo osc_draw_file_field('products_image', true); ?>';
hpdl
749
415   }
416
417   function switchImageFilesView(layer) {
418     if (layer == 'local') {
419       var layer1 = document.getElementById('remoteFiles');
420       var layer1link = document.getElementById('remoteFilesLink');
421       var layer2 = document.getElementById('localFiles');
422       var layer2link = document.getElementById('localFilesLink');
423     } else {
424       var layer1 = document.getElementById('localFiles');
425       var layer1link = document.getElementById('localFilesLink');
426       var layer2 = document.getElementById('remoteFiles');
427       var layer2link = document.getElementById('remoteFilesLink');
428     }
429
430     if ( (layer != 'local') || ((layer == 'local') && (layer1.style.display != 'none')) ) {
431       layer1.style.display='none';
432       layer2.style.display='inline';
433       layer1link.style.backgroundColor='';
434       layer2link.style.backgroundColor='#E5EFE5';
435     } else {
436       getLocalImages();
437     }
438   }
hpdl
1
439 //--></script>
440
hpdl
608
441 <style type="text/css"><!--
442 #overlay img {
443   border: none;
444 }
445
446 #overlay {
hpdl
1078
447   background-image: url(<?php echo osc_href_link_admin('templates/' . $osC_Template->getCode() . '/images/overlay.png'); ?>);
hpdl
608
448 }
449
450 * html #overlay {
451   background-color: #000;
452   back\ground-color: transparent;
hpdl
1078
453   background-image: url(<?php echo osc_href_link_admin('templates/' . $osC_Template->getCode() . '/images/overlay.png'); ?>);
454   filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="<?php echo osc_href_link_admin('templates/' . $osC_Template->getCode() . '/images/overlay.png'); ?>", sizingMethod="scale");
hpdl
608
455   }
456 //--></style>
457
hpdl
1
458 <link type="text/css" rel="stylesheet" href="external/tabpane/css/luna/tab.css" />
459 <script type="text/javascript" src="external/tabpane/js/tabpane.js"></script>
460
hpdl
608
461 <div id="overlay" style="display: none; position: absolute; top: 0; left: 0; z-index: 90; width: 100%;"></div>
hpdl
1
462
hpdl
608
463 <div id="actionLayer" style="display: none; position: absolute; z-index: 100; width: 400px; height: 200px;">
hpdl
755
464   <div class="infoBoxHeading"><?php echo osc_icon('trash.png', IMAGE_DELETE) . ' Delete Image'; ?></div>
hpdl
608
465   <div class="infoBoxContent">
466     <p>Are you sure you want to delete this product image?</p>
467
468     <p align="center"><?php echo '<button onclick="removeImageConfirmation(\'\')" class="operationButton">' . IMAGE_DELETE . '</button> <button onclick="cancelRemoveImage(\'\')" class="operationButton">' . IMAGE_CANCEL . '</button>'; ?></p>
469   </div>
470 </div>
471
hpdl
908
472 <h1><?php echo (isset($pInfo) && isset($pInfo->products_name[$osC_Language->getID()])) ? $pInfo->products_name[$osC_Language->getID()] : TEXT_NEW_PRODUCT; ?></h1>
hpdl
608
473
hpdl
1
474 <div class="tab-pane" id="mainTabPane">
475   <script type="text/javascript"><!--
476     var mainTabPane = new WebFXTabPane( document.getElementById( "mainTabPane" ) );
477   //--></script>
478
hpdl
749
479   <form name="product" method="post" enctype="multipart/form-data">
hpdl
1
480
481   <div class="tab-page" id="tabDescription">
482     <h2 class="tab"><?php echo TAB_GENERAL; ?></h2>
483
484     <script type="text/javascript"><!--
485       mainTabPane.addTabPage( document.getElementById( "tabDescription" ) );
486     //--></script>
487
488     <div class="tab-pane" id="descriptionTabPane">
489       <script type="text/javascript"><!--
490         var descriptionTabPane = new WebFXTabPane( document.getElementById( "descriptionTabPane" ) );
491       //--></script>
492
493 <?php
hpdl
121
494   foreach ($osC_Language->getAll() as $l) {
hpdl
1
495 ?>
496
hpdl
121
497       <div class="tab-page" id="tabDescriptionLanguages_<?php echo $l['code']; ?>">
hpdl
755
498         <h2 class="tab"><?php echo osc_image('../includes/languages/' . $l['code'] . '/images/' . $l['image'], $l['name']) . '&nbsp;' . $l['name']; ?></h2>
hpdl
1
499
500         <script type="text/javascript"><!--
hpdl
121
501           descriptionTabPane.addTabPage( document.getElementById( "tabDescriptionLanguages_<?php echo $l['code']; ?>" ) );
hpdl
1
502         //--></script>
503
504         <table border="0" width="100%" cellspacing="0" cellpadding="2">
505           <tr>
506             <td class="smallText"><?php echo TEXT_PRODUCTS_NAME; ?></td>
hpdl
755
507             <td class="smallText"><?php echo osc_draw_input_field('products_name[' . $l['id'] . ']', (isset($pInfo) && is_array($pInfo->products_name) && isset($pInfo->products_name[$l['id']]) ? $pInfo->products_name[$l['id']] : null)); ?></td>
hpdl
1
508           </tr>
509           <tr>
510             <td class="smallText" valign="top"><?php echo TEXT_PRODUCTS_DESCRIPTION; ?></td>
hpdl
755
511             <td class="smallText"><?php echo osc_draw_textarea_field('products_description[' . $l['id'] . ']', (isset($pInfo) && is_array($pInfo->products_description) && isset($pInfo->products_description[$l['id']]) ? $pInfo->products_description[$l['id']] : null), 70, 15, 'style="width: 100%;"'); ?></td>
hpdl
1
512           </tr>
513           <tr>
hpdl
365
514             <td class="smallText"><?php echo TEXT_PRODUCTS_MODEL; ?></td>
hpdl
755
515             <td class="smallText"><?php echo osc_draw_input_field('products_model[' . $l['id'] . ']', (isset($pInfo) && is_array($pInfo->products_model) && isset($pInfo->products_model[$l['id']]) ? $pInfo->products_model[$l['id']] : null)); ?></td>
hpdl
365
516           </tr>
517           <tr>
518             <td class="smallText"><?php echo TEXT_PRODUCTS_KEYWORD; ?></td>
hpdl
755
519             <td class="smallText"><?php echo osc_draw_input_field('products_keyword[' . $l['id'] . ']', (isset($pInfo) && is_array($pInfo->products_keyword) && isset($pInfo->products_keyword[$l['id']]) ? $pInfo->products_keyword[$l['id']] : null)); ?></td>
hpdl
365
520           </tr>
521           <tr>
522             <td class="smallText"><?php echo TEXT_PRODUCTS_TAGS; ?></td>
hpdl
755
523             <td class="smallText"><?php echo osc_draw_input_field('products_tags[' . $l['id'] . ']', (isset($pInfo) && is_array($pInfo->products_tags) && isset($pInfo->products_tags[$l['id']]) ? $pInfo->products_tags[$l['id']] : null)); ?></td>
hpdl
365
524           </tr>
525           <tr>
hpdl
1
526             <td class="smallText"><?php echo TEXT_PRODUCTS_URL; ?></td>
hpdl
755
527             <td class="smallText"><?php echo osc_draw_input_field('products_url[' . $l['id'] . ']', (isset($pInfo) && is_array($pInfo->products_url) && isset($pInfo->products_url[$l['id']]) ? $pInfo->products_url[$l['id']] : null)); ?></td>
hpdl
1
528           </tr>
529         </table>
530       </div>
531
532 <?php
533   }
534 ?>
535
536     </div>
537   </div>
538
539   <div class="tab-page" id="tabData">
540     <h2 class="tab"><?php echo TAB_DATA; ?></h2>
541
542     <script type="text/javascript"><!--
543       mainTabPane.addTabPage( document.getElementById( "tabData" ) );
544     //--></script>
545
546     <table border="0" width="100%" cellspacing="0" cellpadding="2">
547       <tr>
548         <td class="smallText" width="50%" height="100%" valign="top">
549           <fieldset style="height: 100%;">
550             <legend>Price</legend>
551
552             <table border="0" width="100%" cellspacing="0" cellpadding="2">
553               <tr>
554                 <td class="smallText"><?php echo TEXT_PRODUCTS_TAX_CLASS; ?></td>
hpdl
755
555                 <td class="smallText"><?php echo osc_draw_pull_down_menu('products_tax_class_id', $tax_class_array, (isset($pInfo) ? $pInfo->products_tax_class_id : null), 'onchange="updateGross(\'products_price\');"'); ?></td>
hpdl
1
556               </tr>
557               <tr>
558                 <td class="smallText"><?php echo TEXT_PRODUCTS_PRICE_NET; ?></td>
hpdl
755
559                 <td class="smallText"><?php echo osc_draw_input_field('products_price', (isset($pInfo) ? $pInfo->products_price : null), 'onkeyup="updateGross(\'products_price\')"'); ?></td>
hpdl
1
560               </tr>
561               <tr>
562                 <td class="smallText"><?php echo TEXT_PRODUCTS_PRICE_GROSS; ?></td>
hpdl
755
563                 <td class="smallText"><?php echo osc_draw_input_field('products_price_gross', (isset($pInfo) ? $pInfo->products_price : null), 'onkeyup="updateNet(\'products_price\')"'); ?></td>
hpdl
1
564               </tr>
565             </table>
566
hpdl
365
567             <script type="text/javascript"><!--
hpdl
443
568               updateGross('products_price');
hpdl
1
569             //--></script>
570           </fieldset>
571         </td>
572         <td class="smallText" width="50%" height="100%" valign="top">
573           <fieldset style="height: 100%;">
574             <legend>Data</legend>
575
576             <table border="0" width="100%" cellspacing="0" cellpadding="2">
577               <tr>
578                 <td class="smallText"><?php echo TEXT_PRODUCTS_MANUFACTURER; ?></td>
hpdl
755
579                 <td class="smallText"><?php echo osc_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($pInfo) ? $pInfo->manufacturers_id : null)); ?></td>
hpdl
1
580               </tr>
581               <tr>
582                 <td class="smallText"><?php echo TEXT_PRODUCTS_QUANTITY; ?></td>
hpdl
755
583                 <td class="smallText"><?php echo osc_draw_input_field('products_quantity', (isset($pInfo) ? $pInfo->products_quantity : null)); ?></td>
hpdl
1
584               </tr>
585               <tr>
586                 <td class="smallText"><?php echo TEXT_PRODUCTS_WEIGHT; ?></td>
hpdl
755
587                 <td class="smallText"><?php echo osc_draw_input_field('products_weight', (isset($pInfo) ? $pInfo->products_weight : null)). '&nbsp;' . osc_draw_pull_down_menu('products_weight_class', $weight_class_array, (isset($pInfo) ? $pInfo->products_weight_class : SHIPPING_WEIGHT_UNIT)); ?></td>
hpdl
1
588               </tr>
589             </table>
590           </fieldset>
591         </td>
592       </tr>
593       <tr>
594         <td class="smallText" width="50%" height="100%" valign="top">
595           <fieldset style="height: 100%;">
596             <legend><?php echo TEXT_PRODUCTS_STATUS; ?></legend>
597
hpdl
755
598             <?php echo osc_draw_radio_field('products_status', array(array('id' => '1', 'text' => TEXT_PRODUCT_AVAILABLE), array('id' => '0', 'text' => TEXT_PRODUCT_NOT_AVAILABLE)), (isset($pInfo) ? $pInfo->products_status : '0'), null, '<br />'); ?>
hpdl
1
599           </fieldset>
600         </td>
601         <td class="smallText" width="50%" height="100%" valign="top">
602           <fieldset style="height: 100%;">
603             <legend>Information</legend>
604
605             <table border="0" width="100%" cellspacing="0" cellpadding="2">
606               <tr>
607                 <td class="smallText"><?php echo TEXT_PRODUCTS_DATE_AVAILABLE; ?></td>
hpdl
755
608                 <td class="smallText"><?php echo osc_draw_input_field('products_date_available', (isset($pInfo) ? $pInfo->products_date_available : null)); ?><input type="button" value="..." id="calendarTrigger" class="operationButton"><script type="text/javascript">Calendar.setup( { inputField: "products_date_available", ifFormat: "%Y-%m-%d", button: "calendarTrigger" } );</script><small>(YYYY-MM-DD)</small></td>
hpdl
1
609               </tr>
610             </table>
611           </fieldset>
612         </td>
613       </tr>
614     </table>
615   </div>
616
617   <div class="tab-page" id="tabImages">
618     <h2 class="tab"><?php echo TAB_IMAGES; ?></h2>
619
620     <script type="text/javascript"><!--
621       mainTabPane.addTabPage( document.getElementById( "tabImages" ) );
622     //--></script>
623
624     <table border="0" width="100%" cellspacing="0" cellpadding="2">
625       <tr>
hpdl
608
626         <td class="smallText" width="100%" height="100%" valign="top">
627           <fieldset style="height: 100%;">
hpdl
749
628             <legend>New Image</legend>
hpdl
1
629
hpdl
749
630             <div style="float: right;">
631               <a href="#" id="remoteFilesLink" onclick="switchImageFilesView('remote');" style="background-color: #E5EFE5;">Remote File Upload</a> | <a href="#" id="localFilesLink" onclick="switchImageFilesView('local');">Local Files</a>
632             </div>
633
634             <div id="remoteFiles">
635               <span id="fileUploadField"></span>
636
637 <?php
638     if (isset($pInfo)) {
hpdl
1076
639       echo '<input type="submit" value="Send To Server" class="operationButton" onclick="document.product.target=\'fileUploadFrame\'; document.product.action=\'' . osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&action=fileUpload' . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '')) . '\'; document.getElementById(\'showProgress\').style.display=\'inline\';" /><div id="showProgress" style="display: none; padding-left: 10px;">' . osc_icon('progress_ani.gif') . '&nbsp;Uploading image to server...</div>';
hpdl
749
640     }
641 ?>
642             </div>
643
644 <script type="text/javascript"><!--
645   setFileUploadField();
646 //--></script>
647
648             <div id="localFiles" style="display: none;">
649               <p><?php echo 'Product images can be uploaded via FTP to the following directory:<br /><br />' . realpath('../images/products/_upload'); ?></p>
650
651               <select id="localImagesSelection" name="localimages[]" size="5" multiple="multiple" style="width: 100%;"></select>
652
hpdl
755
653               <div id="showProgressGetLocalImages" style="display: none; float: right; padding-right: 10px;"><?php echo osc_icon('progress_ani.gif') . '&nbsp;Retrieving local images..'; ?></div>
hpdl
749
654
655 <?php
656     if (isset($pInfo)) {
hpdl
1076
657       echo '<input type="submit" value="Assign To Product" class="operationButton" onclick="document.product.target=\'fileUploadFrame\'; document.product.action=\'' . osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&action=assignLocalImages' . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '')) . '\'; document.getElementById(\'showProgressAssigningLocalImages\').style.display=\'inline\';" /><div id="showProgressAssigningLocalImages" style="display: none; padding-left: 10px;">' . osc_icon('progress_ani.gif') . '&nbsp;Uploading image(s) to server...</div>';
hpdl
749
658     }
659 ?>
660
661             </div>
662
663             <iframe id="fileUploadFrame" name="fileUploadFrame" style="height: 0px; width: 0px; border: 0px"></iframe>
hpdl
608
664           </fieldset>
hpdl
1
665
hpdl
749
666 <script type="text/javascript"><!--
667   getLocalImages();
668 //--></script>
669
670 <?php
671     if (isset($pInfo)) {
672 ?>
673
hpdl
608
674           <fieldset style="height: 100%;">
675             <legend>Original Images</legend>
676
677             <div id="imagesOriginal" style="overflow: auto;"></div>
678           </fieldset>
679
680           <fieldset style="height: 100%;">
681             <legend>Images</legend>
682
683             <div id="imagesOther" style="overflow: auto;"></div>
684           </fieldset>
685
686 <script type="text/javascript"><!--
687   getImages();
688 //--></script>
689
690 <?php
hpdl
749
691     }
hpdl
608
692 ?>
693
hpdl
1
694         </td>
695       </tr>
696     </table>
697   </div>
698
699   <div class="tab-page" id="tabAttributes">
700     <h2 class="tab"><?php echo TAB_ATTRIBUTES; ?></h2>
701
702 <script type="text/javascript">mainTabPane.addTabPage( document.getElementById( "tabAttributes" ) );</script>
703
704     <table border="0" width="100%" cellspacing="0" cellpadding="2">
705       <tr>
706         <td width="30%" valign="top"><select name="attributes" size="20" style="width: 100%;">
707 <?php
708   $Qoptions = $osC_Database->query('select products_options_id, products_options_name from :table_products_options where language_id = :language_id order by products_options_name');
709   $Qoptions->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
hpdl
121
710   $Qoptions->bindInt(':language_id', $osC_Language->getID());
hpdl
1
711   $Qoptions->execute();
712
713   while ($Qoptions->next()) {
714     echo '          <optgroup label="' . $Qoptions->value('products_options_name') . '" id="' . $Qoptions->value('products_options_id') . '">' . "\n";
715
716     $Qvalues = $osC_Database->query('select pov.products_options_values_id, pov.products_options_values_name from :table_products_options_values pov, :table_products_options_values_to_products_options pov2po where pov2po.products_options_id = :products_options_id and pov2po.products_options_values_id = pov.products_options_values_id and pov.language_id = :language_id order by pov.products_options_values_name');
717     $Qvalues->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
718     $Qvalues->bindTable(':table_products_options_values_to_products_options', TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS);
719     $Qvalues->bindInt(':products_options_id', $Qoptions->valueInt('products_options_id'));
hpdl
121
720     $Qvalues->bindInt(':language_id', $osC_Language->getID());
hpdl
1
721     $Qvalues->execute();
722
723     while ($Qvalues->next()) {
724       echo '            <option value="' . $Qvalues->valueInt('products_options_values_id') . '">' . $Qvalues->value('products_options_values_name') . '</option>' . "\n";
725     }
726
727     echo '          </optgroup>' . "\n";
728   }
729 ?>
730         </select></td>
731         <td align="center" width="10%" class="smallText">
hpdl
365
732           <input type="button" value=">>" onclick="moreFields()" class="infoBoxButton">
hpdl
1
733         </td>
734         <td width="60%" valign="top" class="smallText">
735           <fieldset>
736             <legend><?php echo FIELDSET_ASSIGNED_ATTRIBUTES; ?></legend>
737
738 <?php
hpdl
894
739   if (isset($_GET['pID'])) {
740     echo '<table border="0" width="100%" cellspacing="0" cellpadding="2">';
hpdl
1
741
hpdl
894
742     $Qattributes = $osC_Database->query('select po.products_options_id, po.products_options_name, pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from :table_products_attributes pa, :table_products_options po, :table_products_options_values pov where pa.products_id = :products_id and pa.options_id = po.products_options_id and po.language_id = :language_id and pa.options_values_id = pov.products_options_values_id and pov.language_id = :language_id order by po.products_options_name, pov.products_options_values_name');
743     $Qattributes->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
744     $Qattributes->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
745     $Qattributes->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
746     $Qattributes->bindInt(':products_id', $_GET['pID']);
747     $Qattributes->bindInt(':language_id', $osC_Language->getID());
748     $Qattributes->bindInt(':language_id', $osC_Language->getID());
749     $Qattributes->execute();
hpdl
1
750
hpdl
894
751     $current_attribute_group = '';
752
753     while ($Qattributes->next()) {
754       if ($Qattributes->value('products_options_name') != $current_attribute_group) {
755         echo '              <tr>' . "\n" .
756              '                <td class="smallText" colspan="3"><b>' . $Qattributes->value('products_options_name') . '</b></td>' . "\n" .
757              '              </tr>' . "\n";
758
759         $current_attribute_group = $Qattributes->value('products_options_name');
760       }
761
762       echo '              <tr id="attribute-' . $Qattributes->valueInt('products_options_id') . '_' . $Qattributes->valueInt('products_options_values_id') . '">' . "\n" .
763            '                <td class="smallText" width="50%">' . $Qattributes->value('products_options_values_name') . '</td>' . "\n" .
764            '                <td class="smallText">' . osc_draw_pull_down_menu('attribute_prefix[' . $Qattributes->valueInt('products_options_id') . '][' . $Qattributes->valueInt('products_options_values_id') . ']', array(array('id' => '+', 'text' => '+'), array('id' => '-', 'text' => '-')), $Qattributes->value('price_prefix')) . '&nbsp;' . osc_draw_input_field('attribute_price[' . $Qattributes->valueInt('products_options_id') . '][' . $Qattributes->valueInt('products_options_values_id') . ']', $Qattributes->value('options_values_price')) . '</td>' . "\n" .
765            '                <td class="smallText" align="right"><input type="button" value="-" id="attribute-' . $Qattributes->valueInt('products_options_id') . '_' . $Qattributes->valueInt('products_options_values_id') . '-button" onclick="toggleAttributeStatus(\'attribute-' . $Qattributes->valueInt('products_options_id') . '_' . $Qattributes->valueInt('products_options_values_id') . '\');" class="infoBoxButton"></td>' . "\n" .
hpdl
1
766            '              </tr>' . "\n";
767     }
768
hpdl
894
769     echo '</table>';
hpdl
1
770   }
771 ?>
772
773             <span id="writeroot"></span>
774
775             <div id="readroot" style="display: none">
776               <table border="0" width="100%" cellspacing="0" cellpadding="2">
777                 <tr>
778                   <td class="smallText" colspan="3"><b><span id="attribteGroupName">&nbsp;</span></b></td>
779                 </tr>
780                 <tr class="attributeAdd">
781                   <td class="smallText" width="50%"><span id="attributeKey">&nbsp;</span></td>
hpdl
755
782                   <td class="smallText"><?php echo osc_draw_pull_down_menu('new_attribute_prefix', array(array('id' => '+', 'text' => '+'), array('id' => '-', 'text' => '-')), '+', 'disabled="disabled"') . '&nbsp;' . osc_draw_input_field('new_attribute_price', null, 'disabled="disabled"'); ?></td>
hpdl
365
783                   <td class="smallText" align="right"><input type="button" value="-" onclick="this.parentNode.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode.parentNode);" class="infoBoxButton"></td>
hpdl
1
784                 </tr>
785               </table>
786             </div>
787           </fieldset>
788         </td>
789       </tr>
790     </table>
791   </div>
792
793   <div class="tab-page" id="tabCategories">
794     <h2 class="tab"><?php echo TAB_CATEGORIES; ?></h2>
795
796 <script type="text/javascript">mainTabPane.addTabPage( document.getElementById( "tabCategories" ) );</script>
797
798     <table border="0" width="100%" cellspacing="0" cellpadding="2">
799       <tr>
800         <td class="smallText"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">
801           <thead>
802             <tr>
803               <th>Categories</th>
804               <th>Selected</th>
805             </tr>
806           </thead>
807           <tbody>
808 <?php
809   $product_categories_array = array();
810
hpdl
877
811   if (isset($_GET['pID'])) {
812     $Qcategories = $osC_Database->query('select categories_id from :table_products_to_categories where products_id = :products_id');
813     $Qcategories->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
814     $Qcategories->bindInt(':products_id', $_GET['pID']);
815     $Qcategories->execute();
hpdl
1
816
hpdl
877
817     while ($Qcategories->next()) {
818       $product_categories_array[] = $Qcategories->valueInt('categories_id');
819     }
hpdl
1
820   }
821
822   $assignedCategoryTree = new osC_CategoryTree();
823   $assignedCategoryTree->setBreadcrumbUsage(false);
824   $assignedCategoryTree->setSpacerString('&nbsp;', 5);
825
826   foreach ($assignedCategoryTree->getTree() as $value) {
hpdl
365
827     echo '          <tr onmouseover="rowOverEffect(this);" onmouseout="rowOutEffect(this);">' . "\n" .
hpdl
613
828          '            <td class="smallText"><a href="#" onclick="document.product.categories_' . $value['id'] . '.checked=!document.product.categories_' . $value['id'] . '.checked;">' . $value['title'] . '</a></td>' . "\n" .
hpdl
1
829          '            <td class="smallText" align="right">' . osc_draw_checkbox_field('categories[]', $value['id'], in_array($value['id'], $product_categories_array), 'id="categories_' . $value['id'] . '"') . '</td>' . "\n" .
830          '          </tr>' . "\n";
831   }
832 ?>
833         </table></td>
834       </tr>
835     </table>
836   </div>
837
hpdl
1076
838   <p align="right"><?php echo '<input type="submit" value="' . IMAGE_SAVE . '" class="operationButton" onclick="' . (isset($pInfo) ? 'setFileUploadField(); ' : '') . 'document.product.target=\'_self\'; document.product.action=\'' . osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&cPath=' . $_GET['cPath'] . '&search=' . $_GET['search'] . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '') . '&action=save') . '\';"> <input type="button" value="' . IMAGE_CANCEL . '" onclick="document.location.href=\'' . osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&cPath=' . $_GET['cPath'] . '&search=' . $_GET['search'] . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '')) . '\';" class="operationButton">'; ?></p>
hpdl
1
839
840   </form>
hpdl
749
841 </div>