From 1350e9cc68cd96d2b2031d85e8ae8ab0a7d95b71 Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Sun, 29 Apr 2012 18:06:07 -0400 Subject: [PATCH] Add DatePicker support --- include/staff/header.inc.php | 5 +++-- include/staff/syslogs.inc.php | 8 ++------ include/staff/ticket-edit.inc.php | 11 +++++------ include/staff/ticket-open.inc.php | 11 +++++------ include/staff/tickets.inc.php | 4 ++-- scp/css/scp.css | 13 +++++++++++++ scp/js/scp.js | 8 ++++++++ 7 files changed, 38 insertions(+), 22 deletions(-) diff --git a/include/staff/header.inc.php b/include/staff/header.inc.php index b0a7c4efe..46722948c 100644 --- a/include/staff/header.inc.php +++ b/include/staff/header.inc.php @@ -14,19 +14,20 @@ </style> <![endif]--> <script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script> - <script type="text/javascript" src="./js/calendar.js"></script> + <script type="text/javascript" src="../js/jquery-ui-1.8.18.custom.min.js"></script> <script type="text/javascript" src="./js/tips.js"></script> <script type="text/javascript" src="./js/nicEdit.js"></script> <script type="text/javascript" src="./js/bootstrap-typeahead.js"></script> <script type="text/javascript" src="./js/scp.js"></script> <link rel="stylesheet" href="./css/scp.css" media="screen"> <link rel="stylesheet" href="./css/typeahead.css" media="screen"> + <link type="text/css" href="../css/ui-lightness/jquery-ui-1.8.18.custom.css" rel="stylesheet" /> </head> <body> <div id="container"> <div id="header"> <a href="index.php" id="logo">osTicket - Customer Support System</a> - <p id="info">Welcome back, <strong><?php echo $thisstaff->getUserName(); ?></strong> + <p id="info">Howdy, <strong><?php echo $thisstaff->getUserName(); ?></strong> <?php if($thisstaff->isAdmin() && !defined('ADMINPAGE')) { ?> | <a href="admin.php">Admin Panel</a> diff --git a/include/staff/syslogs.inc.php b/include/staff/syslogs.inc.php index 5418518f7..e0f5d2098 100644 --- a/include/staff/syslogs.inc.php +++ b/include/staff/syslogs.inc.php @@ -88,13 +88,9 @@ else <form action="syslogs.php" method="get"> <div style="padding-left:2px;"> <b>Date Span</b>: - From <input class="dp" id="sd" size=15 name="startDate" value="<?php echo Format::htmlchars($_REQUEST['startDate']); ?>" - onclick="event.cancelBubble=true;calendar(this);" autocomplete=OFF> - <a href="#" onclick="event.cancelBubble=true;calendar(getObj('sd')); return false;"><img src='images/cal.png'border=0 alt=""></a> + From <input class="dp" id="sd" size=15 name="startDate" value="<?php echo Format::htmlchars($_REQUEST['startDate']); ?>" autocomplete=OFF> to - <input class="dp" id="ed" size=15 name="endDate" value="<?php echo Format::htmlchars($_REQUEST['endDate']); ?>" - onclick="event.cancelBubble=true;calendar(this);" autocomplete=OFF > - <a href="#" onclick="event.cancelBubble=true;calendar(getObj('ed')); return false;"><img src='images/cal.png'border=0 alt=""></a> + <input class="dp" id="ed" size=15 name="endDate" value="<?php echo Format::htmlchars($_REQUEST['endDate']); ?>" autocomplete=OFF> Type: <select name='type'> diff --git a/include/staff/ticket-edit.inc.php b/include/staff/ticket-edit.inc.php index db80cf2f7..7bbf0921e 100644 --- a/include/staff/ticket-edit.inc.php +++ b/include/staff/ticket-edit.inc.php @@ -139,18 +139,17 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$ticket->getUpdateInfo()); Due Date: </td> <td> - <input id="duedate" name="duedate" value="<?php echo Format::htmlchars($info['duedate']); ?>" size="10" - onclick="event.cancelBubble=true;calendar(this);" autocomplete=OFF> - <a href="#" onclick="event.cancelBubble=true;calendar(getObj('duedate')); return false;"><img src='images/cal.png'border=0 alt=""></a> + <input class="dp" id="duedate" name="duedate" value="<?php echo Format::htmlchars($info['duedate']); ?>" size="12" autocomplete=OFF> <?php $min=$hr=null; if($info['time']) - list($hr,$min)=explode(':',$info['time']); - echo Misc::timeDropdown($hr,$min,'time'); + list($hr, $min)=explode(':', $info['time']); + + echo Misc::timeDropdown($hr, $min, 'time'); ?> <font class="error"> <?=$errors['duedate']?> <?php echo $errors['time']; ?></font> - <em>Time is based on your time zone (GM <?php echo $thisstaff->getTZoffset(); ?>)</em> + <em>Time is based on your time zone (GMT <?php echo $thisstaff->getTZoffset(); ?>)</em> </td> </tr> <tr> diff --git a/include/staff/ticket-open.inc.php b/include/staff/ticket-open.inc.php index 4ec32b342..680fbad15 100644 --- a/include/staff/ticket-open.inc.php +++ b/include/staff/ticket-open.inc.php @@ -203,18 +203,17 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); Due Date: </td> <td> - <input id="duedate" name="duedate" value="<?php echo Format::htmlchars($info['duedate']); ?>" size="10" - onclick="event.cancelBubble=true;calendar(this);" autocomplete=OFF> - <a href="#" onclick="event.cancelBubble=true;calendar(getObj('duedate')); return false;"><img src='images/cal.png'border=0 alt=""></a> + <input class="dp" id="duedate" name="duedate" value="<?php echo Format::htmlchars($info['duedate']); ?>" size="12" autocomplete=OFF> <?php $min=$hr=null; if($info['time']) - list($hr,$min)=explode(':',$info['time']); - echo Misc::timeDropdown($hr,$min,'time'); + list($hr, $min)=explode(':', $info['time']); + + echo Misc::timeDropdown($hr, $min, 'time'); ?> <font class="error"> <?=$errors['duedate']?> <?php echo $errors['time']; ?></font> - <em>Time is based on your time zone (GM <?php echo $thisstaff->getTZoffset(); ?>)</em> + <em>Time is based on your time zone (GMT <?php echo $thisstaff->getTZoffset(); ?>)</em> </td> </tr> <tr> diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index 9d6d5c7bc..bd4801c44 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -533,9 +533,9 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting.. </fieldset> <fieldset class="date_range"> <label>Date Range:</label> - <input class="dp" type="input" size="20" name="startDate"><i></i> + <input class="dp" type="input" size="20" name="startDate"> <span>TO</span> - <input class="dp" type="input" size="20" name="endDate"><i></i> + <input class="dp" type="input" size="20" name="endDate"> </fieldset> <p> <span class="buttons"> diff --git a/scp/css/scp.css b/scp/css/scp.css index adde43faf..aa6ca4782 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -1290,3 +1290,16 @@ time { background:#ffd8d8; border:1px solid #a00; } + +/* Custom css for datepicker */ +.ui-datepicker-trigger { + display:inline-block; + border:0; + padding:0; + margin-left:2px; + position:relative; + top:5px; + width:16px; + height:16px; + background:inherit; +} diff --git a/scp/js/scp.js b/scp/js/scp.js index 071c63ff8..b31f673f0 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -185,6 +185,14 @@ $(document).ready(function(){ }, 'json') .error( function() {}); + /* Datepicker */ + + $('.dp').datepicker({ + numberOfMonths: 2, + showButtonPanel: true, + buttonImage: './images/cal.png', + showOn:'both' + }); /* NicEdit richtext init */ var rtes = $('.richtext'); -- GitLab