Made an improment to the date picker. Shows the week number as well. Many delivery...
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 5 Jun 2008 09:54:14 +0000 (09:54 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 5 Jun 2008 09:54:14 +0000 (09:54 +0000)
Fixed a html layout bug in header.inc

CHANGELOG.txt
includes/page/header.inc
includes/ui/ui_view.inc

index 65d575cf0ac7b014dc3047c59b57b747850ce9c5..4d11e26d4d27908eeebf6f1bd722f947069af798 100644 (file)
@@ -19,6 +19,12 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+05-Jun-2008 Joe Hunt
+! Made an improment to the date picker. Shows the week number as well. Many delivery systems are week number based.
+$ /includes/ui/ui_view.inc
+# Fixed a html layout bug
+$ /includes/page/header.inc
+
 31-May-2008 Joe Hunt
 # A lot of annoying layout bugs taken. Mostly from views and inquiries. A couple of files are critical, ui_view and ui_lists!
 $ /gl/view/gl_deposit_view.php
index 893527e88f1823edac73a5a7217bbc2c762fcc9f..f77de073cb9760b0b9ed161fb4f870aaa95979ee 100644 (file)
@@ -103,7 +103,7 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js=""
        echo "<html dir='" . $_SESSION['language']->dir . "' >\n";
        echo "<head><title>$title</title>";
        $local_stylesheet = $_SESSION['language']->get_stylesheet();
-       echo "<meta http-equiv='Content-type' content='text/html' charset='$encoding'>";
+       echo "<meta http-equiv='Content-type' content='text/html; charset=$encoding'>";
        echo "<link href='$local_path_to_root/themes/$theme/default.css' rel='stylesheet' type='text/css'> \n";
        if (file_exists($local_path_to_root. "/".$local_stylesheet))
                echo "<link href='$local_path_to_root/$local_stylesheet' rel='stylesheet' type='text/css'> \n";
index 3e6d3c4eeb05d2c8c2e18729b1b2c1a6684419df..0832c3f35ed1ef5a261acd34d7d4716b3080c461 100644 (file)
@@ -592,7 +592,7 @@ function get_js_date_picker()
     $fpath = $comp_path.'/'.user_company().'/js_cache/'.'date_picker.js';
 
        $js = "<style>
-#CCIframe { display: none; left: 0px; position: absolute; top: 0px; height: 250px; width: 250px; z-index: 99;}
+#CCIframe { display: none; left: 0px; position: absolute; top: 0px; height: 250px; width: 270px; z-index: 99;}
 #CC { position:absolute; background-color:#FFF; margin:0; padding:0; display:none; z-index: 100;}
 #CC table { font-family: arial, verdana, helvetica, sans-serif;font-size: 8pt; border-left: 1px solid #336; border-right: 1px solid #336;}
 #CC th { font-weight: normal; text-align: center;}
@@ -601,6 +601,7 @@ function get_js_date_picker()
 #CC .header { background-color: #336;}
 #CC .weekday { background-color: #DDD; color: #000;}
 #CC .weekend { background-color: #FFC; color: #000;}
+#CC .weekno { background-color: #c0daf8; color: #555;}
 #CC .current { border: 1px solid #339; background-color: #336; color: #FFF;}
 #CC .weekday,#CC .weekend,#CC .current { display: block; text-decoration: none; border: 1px solid #FFF; width: 2em;}
 #CC .weekday:hover,#CC .weekend:hover,#CC .current:hover { color: #FFF; background-color: #336; border: 1px solid #999;}
@@ -623,6 +624,7 @@ function get_js_date_picker()
        $wstart = (($date_system == 1 || $date_system == 2) ? 6 : ($how == 0 ? 0 : 1));                 // weekstart (sun = 0, mon = 1)
        $months = array(_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),_("July"),_("August"),_("September"),_("October"),_("November"),_("December"));
        $wdays = array(_("Su"),_("Mo"),_("Tu"),_("We"),_("Th"),_("Fr"),_("Sa"));
+       $wno = _("W"); // week no
        $back = _("Back");
        if ($date_system == 1)
                list($cyear, $cmon, $cday) = gregorian_to_jalali(date("Y"), date("n"), date("j"));
@@ -801,6 +803,21 @@ function CC() {
     dateField.value = '';
     hide();
   }
+  this.getWeek = getWeek;
+  function getWeek(year, month, day) {
+";
+       if ($how == 0)
+               $js .= "  day++;";
+       $js .= "
+    var date = new Date(year,month-1,day);
+    var D = date.getDay();
+    if(D == 0) D = 7;
+    date.setDate(date.getDate() + (4 - D));
+    var YN = date.getFullYear();
+    var ZBDoCY = Math.floor((date.getTime() - new Date(YN, 0, 1, -6)) / 86400000);
+    var WN = 1 + Math.floor(ZBDoCY / 7);
+    return WN;
+  }
   this.setDate = setDate;
   function setDate(year, month, day) {
     if (dateField) {
@@ -860,6 +877,7 @@ function CC() {
   function calendarDrawTable() {
     var dayOfMonth = 1;
     var wstart = $wstart;
+    var wno = '&nbsp;$wno&nbsp;';
     var validDay = 0;
     var startDayOfWeek = getDayOfWeek(currentYear, currentMonth, dayOfMonth);
     var daysInMonth = getDaysInMonth(currentYear, currentMonth);
@@ -867,10 +885,11 @@ function CC() {
     var table = \"<table cellspacing='0' cellpadding='0' border='0'>\";
     table += \"<tr class='header'>\";
     table += \"  <td colspan='2' class='previous'><a href='javascript:changeCCMonth(-1);'>&lt;</a><br><a href='javascript:changeCCYear(-1);'>&laquo;</a></td>\";
-    table += \"  <td colspan='3' class='title'>\" + months[currentMonth-1] + \"<br>\" + currentYear + \"</td>\";
+    table += \"  <td colspan='4' class='title'>\" + months[currentMonth-1] + \"<br>\" + currentYear + \"</td>\";
     table += \"  <td colspan='2' class='next'><a href='javascript:changeCCMonth(1);'>&gt;</a><br><a href='javascript:changeCCYear(1);'>&raquo;</a></td>\";
     table += \"</tr>\";
     table += \"<tr>\";
+    table += \"<th class='weekno'>\"+wno+\"</th>\";
     for (var n=0; n<7; n++)
        table += \"<th>\" + wdays[(wstart+n)%7]+\"</th>\";
     table += \"</tr>\";
@@ -883,6 +902,13 @@ function CC() {
         } else if (validDay == 1 && dayOfMonth > daysInMonth) {
           validDay = 0;
         }
+        if (n==0)
+        {
+               if (dayOfMonth > daysInMonth)
+                       table += \"<td class='empty'>&nbsp;</td>\";
+                       else
+                               table += \"<td class='weekno'>\"+getWeek(currentYear, currentMonth, dayOfMonth)+\"</td>\";
+        }
         if(validDay) {
           if (dayOfMonth == selectedDay && currentYear == selectedYear && currentMonth == selectedMonth) {
             css_class = 'current';
@@ -908,7 +934,7 @@ function CC() {
       }
       table += \"</tr>\";
     }
-    table += \"<tr class='header'><th colspan='7' style='padding: 3px;text-align:center;'><a href='javascript:hideCC();'>$back</a></td></tr>\";
+    table += \"<tr class='header'><th colspan='8' style='padding: 3px;text-align:center;'><a href='javascript:hideCC();'>$back</a></td></tr>\";
     table += \"</table>\";
     return table;
   }