Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Replace usage of SpiffyCal with jQuery UI DatePicker widgets

  • Loading branch information...
commit b02041d72c95e4f6036f8b247397e9d074659ced 1 parent f23cf1a
@haraldpdl haraldpdl authored
View
46 catalog/admin/banner_manager.php
@@ -71,7 +71,10 @@
'banners_url' => $banners_url,
'banners_image' => $db_image_location,
'banners_group' => $banners_group,
- 'banners_html_text' => $banners_html_text);
+ 'banners_html_text' => $banners_html_text,
+ 'expires_date' => 'null',
+ 'expires_impressions' => 0,
+ 'date_scheduled' => 'null');
if ($action == 'insert') {
$insert_sql_data = array('date_added' => 'now()',
@@ -91,11 +94,7 @@
}
if (tep_not_null($expires_date)) {
- list($day, $month, $year) = explode('/', $expires_date);
-
- $expires_date = $year .
- ((strlen($month) == 1) ? '0' . $month : $month) .
- ((strlen($day) == 1) ? '0' . $day : $day);
+ $expires_date = substr($expires_date, 0, 4) . substr($expires_date, 5, 2) . substr($expires_date, 8, 2);
tep_db_query("update " . TABLE_BANNERS . " set expires_date = '" . tep_db_input($expires_date) . "', expires_impressions = null where banners_id = '" . (int)$banners_id . "'");
} elseif (tep_not_null($expires_impressions)) {
@@ -103,11 +102,7 @@
}
if (tep_not_null($date_scheduled)) {
- list($day, $month, $year) = explode('/', $date_scheduled);
-
- $date_scheduled = $year .
- ((strlen($month) == 1) ? '0' . $month : $month) .
- ((strlen($day) == 1) ? '0' . $day : $day);
+ $date_scheduled = substr($date_scheduled, 0, 4) . substr($date_scheduled, 5, 2) . substr($date_scheduled, 8, 2);
tep_db_query("update " . TABLE_BANNERS . " set status = '0', date_scheduled = '" . tep_db_input($date_scheduled) . "' where banners_id = '" . (int)$banners_id . "'");
}
@@ -223,7 +218,7 @@ function popupImageWindow(url) {
$bID = tep_db_prepare_input($HTTP_GET_VARS['bID']);
- $banner_query = tep_db_query("select banners_title, banners_url, banners_image, banners_group, banners_html_text, status, date_format(date_scheduled, '%d/%m/%Y') as date_scheduled, date_format(expires_date, '%d/%m/%Y') as expires_date, expires_impressions, date_status_change from " . TABLE_BANNERS . " where banners_id = '" . (int)$bID . "'");
+ $banner_query = tep_db_query("select banners_title, banners_url, banners_image, banners_group, banners_html_text, status, date_format(date_scheduled, '%Y/%m/%d') as date_scheduled, date_format(expires_date, '%Y/%m/%d') as expires_date, expires_impressions, date_status_change from " . TABLE_BANNERS . " where banners_id = '" . (int)$bID . "'");
$banner = tep_db_fetch_array($banner_query);
$bInfo->objectInfo($banner);
@@ -237,12 +232,6 @@ function popupImageWindow(url) {
$groups_array[] = array('id' => $groups['banners_group'], 'text' => $groups['banners_group']);
}
?>
-<link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
-<script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
-<script language="javascript">
- var dateExpires = new ctlSpiffyCalendarBox("dateExpires", "new_banner", "expires_date","btnDate1","<?php echo $bInfo->expires_date; ?>",scBTNMODE_CUSTOMBLUE);
- var dateScheduled = new ctlSpiffyCalendarBox("dateScheduled", "new_banner", "date_scheduled","btnDate2","<?php echo $bInfo->date_scheduled; ?>",scBTNMODE_CUSTOMBLUE);
-</script>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
@@ -285,17 +274,28 @@ function popupImageWindow(url) {
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
- <td class="main"><?php echo TEXT_BANNERS_SCHEDULED_AT; ?><br><small>(dd/mm/yyyy)</small></td>
- <td valign="top" class="main"><script language="javascript">dateScheduled.writeControl(); dateScheduled.dateFormat="dd/MM/yyyy";</script></td>
+ <td class="main"><?php echo TEXT_BANNERS_SCHEDULED_AT; ?></td>
+ <td class="main"><?php echo tep_draw_input_field('date_scheduled', $bInfo->date_scheduled, 'id="date_scheduled"') . ' <small>(YYYY-MM-DD)</small>'; ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
- <td valign="top" class="main"><?php echo TEXT_BANNERS_EXPIRES_ON; ?><br><small>(dd/mm/yyyy)</small></td>
- <td class="main"><script language="javascript">dateExpires.writeControl(); dateExpires.dateFormat="dd/MM/yyyy";</script><?php echo TEXT_BANNERS_OR_AT . '<br>' . tep_draw_input_field('expires_impressions', $bInfo->expires_impressions, 'maxlength="7" size="7"') . ' ' . TEXT_BANNERS_IMPRESSIONS; ?></td>
+ <td valign="top" class="main"><?php echo TEXT_BANNERS_EXPIRES_ON; ?></td>
+ <td class="main"><?php echo tep_draw_input_field('expires_date', $bInfo->expires_date, 'id="expires_date"') . ' <small>(YYYY-MM-DD)</small>' . TEXT_BANNERS_OR_AT . '<br>' . tep_draw_input_field('expires_impressions', $bInfo->expires_impressions, 'maxlength="7" size="7"') . ' ' . TEXT_BANNERS_IMPRESSIONS; ?></td>
</tr>
- </table></td>
+ </table>
+
+<script type="text/javascript">
+$('#date_scheduled').datepicker({
+ dateFormat: 'yy-mm-dd'
+});
+$('#expires_date').datepicker({
+ dateFormat: 'yy-mm-dd'
+});
+</script>
+
+ </td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
View
21 catalog/admin/categories.php
@@ -348,7 +348,7 @@
'products_last_modified' => '',
'products_date_available' => '',
'products_status' => '',
- 'products_tax_class_id' => '',
+ 'products_tax_class_id' => '',
'manufacturers_id' => '');
$pInfo = new objectInfo($parameters);
@@ -388,11 +388,6 @@
default: $in_status = true; $out_status = false;
}
?>
-<link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
-<script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
-<script language="javascript"><!--
- var dateAvailable = new ctlSpiffyCalendarBox("dateAvailable", "new_product", "products_date_available","btnDate1","<?php echo $pInfo->products_date_available; ?>",scBTNMODE_CUSTOMBLUE);
-//--></script>
<script language="javascript"><!--
var tax_rates = new Array();
<?php
@@ -463,8 +458,8 @@ function updateNet() {
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
- <td class="main"><?php echo TEXT_PRODUCTS_DATE_AVAILABLE; ?><br><small>(YYYY-MM-DD)</small></td>
- <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;'; ?><script language="javascript">dateAvailable.writeControl(); dateAvailable.dateFormat="yyyy-MM-dd";</script></td>
+ <td class="main"><?php echo TEXT_PRODUCTS_DATE_AVAILABLE; ?></td>
+ <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_date_available', $pInfo->products_date_available, 'id="products_date_available"') . ' <small>(YYYY-MM-DD)</small>'; ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
@@ -571,7 +566,15 @@ function updateNet() {
<tr>
<td class="smallText" align="right"><?php echo tep_draw_hidden_field('products_date_added', (tep_not_null($pInfo->products_date_added) ? $pInfo->products_date_added : date('Y-m-d'))) . tep_draw_button(IMAGE_PREVIEW, 'document', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : ''))); ?></td>
</tr>
- </table></form>
+ </table>
+
+<script type="text/javascript">
+$('#products_date_available').datepicker({
+ dateFormat: 'yy-mm-dd'
+});
+</script>
+
+ </form>
<?php
} elseif ($action == 'new_product_preview') {
if (tep_not_null($HTTP_POST_VARS)) {
View
7 catalog/admin/includes/stylesheet.css
@@ -136,16 +136,17 @@ FORM { display: inline; }
}
#adminAppMenu h3 {
- font-size: 11px;
}
#adminAppMenu ul {
list-style: none;
- margin: -20px 0 -10px -20px;
+ margin: -5px 0 -5px -10px;
padding: 0;
- line-height: 0.9;
}
#contentText {
margin-left: 160px;
}
+
+/* Custom jQuery UI */
+.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 11px; }
View
2  catalog/admin/newsletters.php
@@ -99,8 +99,6 @@
require(DIR_WS_INCLUDES . 'template_top.php');
?>
-<div id="spiffycalendar" class="text"></div>
-
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
View
46 catalog/admin/specials.php
@@ -28,9 +28,7 @@
$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
$products_price = tep_db_prepare_input($HTTP_POST_VARS['products_price']);
$specials_price = tep_db_prepare_input($HTTP_POST_VARS['specials_price']);
- $day = tep_db_prepare_input($HTTP_POST_VARS['day']);
- $month = tep_db_prepare_input($HTTP_POST_VARS['month']);
- $year = tep_db_prepare_input($HTTP_POST_VARS['year']);
+ $expdate = tep_db_prepare_input($HTTP_POST_VARS['expdate']);
if (substr($specials_price, -1) == '%') {
$new_special_insert_query = tep_db_query("select products_id, products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
@@ -41,13 +39,11 @@
}
$expires_date = '';
- if (tep_not_null($day) && tep_not_null($month) && tep_not_null($year)) {
- $expires_date = $year;
- $expires_date .= (strlen($month) == 1) ? '0' . $month : $month;
- $expires_date .= (strlen($day) == 1) ? '0' . $day : $day;
+ if (tep_not_null($expdate)) {
+ $expires_date = substr($expdate, 0, 4) . substr($expdate, 5, 2) . substr($expdate, 8, 2);
}
- tep_db_query("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status) values ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), '" . tep_db_input($expires_date) . "', '1')");
+ tep_db_query("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status) values ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), " . (tep_not_null($expires_date) ? "'" . tep_db_input($expires_date) . "'" : 'null') . ", '1')");
tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page']));
break;
@@ -55,20 +51,16 @@
$specials_id = tep_db_prepare_input($HTTP_POST_VARS['specials_id']);
$products_price = tep_db_prepare_input($HTTP_POST_VARS['products_price']);
$specials_price = tep_db_prepare_input($HTTP_POST_VARS['specials_price']);
- $day = tep_db_prepare_input($HTTP_POST_VARS['day']);
- $month = tep_db_prepare_input($HTTP_POST_VARS['month']);
- $year = tep_db_prepare_input($HTTP_POST_VARS['year']);
+ $expdate = tep_db_prepare_input($HTTP_POST_VARS['expdate']);
if (substr($specials_price, -1) == '%') $specials_price = ($products_price - (($specials_price / 100) * $products_price));
$expires_date = '';
- if (tep_not_null($day) && tep_not_null($month) && tep_not_null($year)) {
- $expires_date = $year;
- $expires_date .= (strlen($month) == 1) ? '0' . $month : $month;
- $expires_date .= (strlen($day) == 1) ? '0' . $day : $day;
+ if (tep_not_null($expdate)) {
+ $expires_date = substr($expdate, 0, 4) . substr($expdate, 5, 2) . substr($expdate, 8, 2);
}
- tep_db_query("update " . TABLE_SPECIALS . " set specials_new_products_price = '" . tep_db_input($specials_price) . "', specials_last_modified = now(), expires_date = '" . tep_db_input($expires_date) . "' where specials_id = '" . (int)$specials_id . "'");
+ tep_db_query("update " . TABLE_SPECIALS . " set specials_new_products_price = '" . tep_db_input($specials_price) . "', specials_last_modified = now(), expires_date = " . (tep_not_null($expires_date) ? "'" . tep_db_input($expires_date) . "'" : 'null') . " where specials_id = '" . (int)$specials_id . "'");
tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials_id));
break;
@@ -83,18 +75,8 @@
}
require(DIR_WS_INCLUDES . 'template_top.php');
-
- if ( ($action == 'new') || ($action == 'edit') ) {
-?>
-<link rel="stylesheet" type="text/css" href="includes/javascript/calendar.css">
-<script language="JavaScript" src="includes/javascript/calendarcode.js"></script>
-<?php
- }
?>
-<div id="popupcalendar" class="text"></div>
-
-
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
@@ -138,9 +120,17 @@
</tr>
<tr>
<td class="main"><?php echo TEXT_SPECIALS_EXPIRES_DATE; ?>&nbsp;</td>
- <td class="main"><?php echo tep_draw_input_field('day', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('month', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('year', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="javascript:calClick();return false;" onmouseover="calSwapImg('BTN_date', 'img_Date_OVER',true);" onmouseout="calSwapImg('BTN_date', 'img_Date_UP',true);" onclick="calSwapImg('BTN_date', 'img_Date_DOWN');showCalendar('new_special','dteWhen','BTN_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_date"'); ?></a></td>
+ <td class="main"><?php echo tep_draw_input_field('expdate', (tep_not_null($sInfo->expires_date) ? substr($sInfo->expires_date, 0, 4) . '-' . substr($sInfo->expires_date, 5, 2) . '-' . substr($sInfo->expires_date, 8, 2) : ''), 'id="expdate"') . ' <small>(YYYY-MM-DD)</small>'; ?></td>
</tr>
- </table></td>
+ </table>
+
+<script type="text/javascript">
+$('#expdate').datepicker({
+ dateFormat: 'yy-mm-dd'
+});
+</script>
+
+ </td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
Please sign in to comment.
Something went wrong with that request. Please try again.