kizu (ki_zu) wrote in changelog,
kizu
ki_zu
changelog

[ljcom] r7597: LJSUP-4793: adding space between cells

Committer: rkomarov
LJSUP-4793: adding space between cells

U   trunk/bin/upgrading/s2layers/sup/themes.s2
Modified: trunk/bin/upgrading/s2layers/sup/themes.s2
===================================================================
--- trunk/bin/upgrading/s2layers/sup/themes.s2	2009-08-26 04:28:15 UTC (rev 7596)
+++ trunk/bin/upgrading/s2layers/sup/themes.s2	2009-08-26 09:13:24 UTC (rev 7597)
@@ -219,7 +219,71 @@
         "</li>";
     }
 }
+function _calendar(YearMonth mon) {
+    var string month = $mon->month_format("%%month%%");
+    var string year = $mon->month_format("%%yyyy%%");
+    var int[] weekdays = weekdays();
+    var int pre_empty = $mon.weeks[0].pre_empty;
+    var int post_empty = $mon.weeks[size $mon.weeks-1].post_empty;
+    var YearDay[] Days;
+    var YearDay noday;
+    $noday.day = 0;
+    $noday.num_entries = 0;
+    if ($*reg_firstdayofweek == "monday") {
+        $weekdays = [2,3,4,5,6,7,1];
+        $pre_empty = $pre_empty==0?6:$pre_empty-1;
+        $post_empty = $post_empty==6?0:$post_empty+1;
+    }
+    if ($pre_empty != 0) {
+        foreach var int i (1..$pre_empty) {
+            $Days[size $Days] = $noday;
+        }
+    }
+    foreach var YearWeek week ($mon.weeks) {
+        foreach var YearDay day ($week.days) {
+            $Days[size $Days] = $day;
+        }
+    }
+    if ($post_empty != 0) {
+        foreach var int i (1..$post_empty) {
+            $Days[size $Days] = $noday;
+        }
+    }
+"""
+<table cellspacing="1">
+    <caption><a href="$mon.url" class="month">$month</a> <a href="$*base_url/$year/" class="year">$year</a></caption>
+    <thead>
+        <tr>""";
+    var int i = 1;
+    foreach var int d ($weekdays) {
+        """<th class="child-$i"><div>${*lang_dayname_shorter[$d]}</div></th>""";
+        $i++;
+    }
+"""</tr>
+    </thead>
+    <tbody>
+    """;
+    var int counter = 1;
+    foreach var YearDay day ($Days) {
+        if ($counter%7 == 1) {
+"""
+        <tr>""";
+        }
+        """<td>""";
+        if ($day.num_entries > 0) { """<a href="$day.url">"""; }
+        print $day.day == 0?" ":string($day.day);
+        if ($day.num_entries > 0) { """</a>"""; }
 
+        """</td>""";
+        if ($counter%7 == 0) {
+"""    </tr>
+""";
+        }
+        $counter++;
+    }
+    "</tbody></table>";
+}
+
 #NEWLAYER: sup/10y-penguins
 layerinfo "type" = "theme";
 layerinfo "name" = "Penguins";

Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments