public
Description: The ultra-lightweight ultra-flexible blogging engine with a fetish for birds and misspellings.
Homepage: http://chyrp.net/
Clone URL: git://github.com/vito/chyrp.git
Click here to lend your support to: chyrp and make a donation at www.pledgie.com !
* Moved all date representations that I can find over to strftime. [#120 
state:resolved]
* Improved Edit Comment form appearance.
* "More Options" JS magic has more liberal checking to determine whether or not 
it should do its stuff.
vito (author)
Tue Jun 24 14:59:32 -0700 2008
commit  5cffbb5ea3452a720f132995f5a98bb2da5a20a9
tree    353450dbff62584f49d5a2c2e444c1bffcfe7abf
parent  acc28e6d525aad5d39e38f173b44229352b5a848
...
23
24
25
26
 
27
28
29
...
23
24
25
 
26
27
28
29
0
@@ -23,7 +23,7 @@
0
             <select name="month">
0
               <option value="">----------</option>
0
               {% for archive in theme.archives_list %}
0
-              <option value="${ archive.when | date("Y-m") }"${ GET.month | option_selected(archive.when | date("Y-m")) }>${ archive.when | date("F Y") } ($archive.count)</option>
0
+              <option value="${ archive.when | strftime("%Y-%m") }"${ GET.month | option_selected(archive.when | strftime("%Y-%m")) }>${ archive.when | strftime("%B %Y") } ($archive.count)</option>
0
               {% endfor %}
0
             </select>
0
             <button type="submit" class="inline">${ "Show &rarr;" | translate }</button>
...
34
35
36
37
 
38
39
40
...
34
35
36
 
37
38
39
40
0
@@ -34,7 +34,7 @@
0
           $status = (empty($status)) ? "public" : str_replace(array_keys($status_translate), array_values($status_translate), $status[1]) ;
0
           $clean = (empty($basename)) ? sanitize($title) : str_replace("_", "-", $basename[1]) ;
0
           $url = Post::check_url($clean);
0
-          $timestamp = (empty($date)) ? datetime() : date("Y-m-d H:i:s", strtotime($date[1])) ;
0
+          $timestamp = (empty($date)) ? datetime() : datetime($date[1]) ;
0
 
0
           # Damn it feels good to be a gangsta...
0
           $_POST['status'] = $status;
...
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
41
42
...
18
19
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
0
@@ -18,25 +18,25 @@ $(function(){
0
       alert(response.replace(/(HEY_JAVASCRIPT_THIS_IS_AN_ERROR_JUST_SO_YOU_KNOW|<([^>]+)>\n?)/gm, ""))
0
   })
0
 
0
-<?php if (match(array("/edit_(post|page)/", "/write_(post|page)/"), $action)): ?>
0
-  // Fancify the "More Options" links.
0
-  $(document.createElement("a")).attr({
0
-    id: "more_options_link",
0
-    href: "javascript:void(0)"
0
-  }).addClass("more_options_link").html("<?php echo $more_options_string; ?>").insertBefore(".buttons")
0
-  $("#more_options").clone().insertAfter("#more_options_link").removeClass("js_disabled")<?php if (empty($_COOKIE['show_more_options'])): ?>.css("display", "none")<?php endif; ?>
0
-
0
-  $("#more_options_link").click(function(){
0
-    if ($("#more_options").css("display") == "none") {
0
-      $(this).html("<?php echo __("&laquo; Fewer Options"); ?>")
0
-      Cookie.set("show_more_options", "true", 30)
0
-    } else {
0
-      $(this).html("<?php echo __("More Options &raquo;"); ?>")
0
-      Cookie.destroy("show_more_options")
0
-    }
0
-    $("#more_options").slideToggle()
0
-  })
0
-<?php endif; ?>
0
+  if ($("#more_options").size()) {
0
+    // Fancify the "More Options" links.
0
+    $(document.createElement("a")).attr({
0
+      id: "more_options_link",
0
+      href: "javascript:void(0)"
0
+    }).addClass("more_options_link").html("<?php echo $more_options_string; ?>").insertBefore(".buttons")
0
+    $("#more_options").clone().insertAfter("#more_options_link").removeClass("js_disabled")<?php if (empty($_COOKIE['show_more_options'])): ?>.css("display", "none")<?php endif; ?>
0
+
0
+    $("#more_options_link").click(function(){
0
+      if ($("#more_options").css("display") == "none") {
0
+        $(this).html("<?php echo __("&laquo; Fewer Options"); ?>")
0
+        Cookie.set("show_more_options", "true", 30)
0
+      } else {
0
+        $(this).html("<?php echo __("More Options &raquo;"); ?>")
0
+        Cookie.destroy("show_more_options")
0
+      }
0
+      $("#more_options").slideToggle()
0
+    })
0
+  }
0
 
0
   // Remove things that only exist for JS-disabled users.
0
   $(".js_disabled").remove()
...
86
87
88
 
89
90
91
...
98
99
100
101
 
102
103
104
105
106
 
 
107
108
109
...
86
87
88
89
90
91
92
...
99
100
101
 
102
103
104
105
106
 
107
108
109
110
111
0
@@ -86,6 +86,7 @@
0
           $archives[$timestamp] = array("posts" => array(),
0
                                         "year" => $time->year,
0
                                         "month" => strftime("%B", $timestamp),
0
+                                        "timestamp" => $timestamp,
0
                                         "url" => $route->url("archive/".when("Y/m/", $time->created_at)));
0
 
0
           $archives[$timestamp]["posts"] = Post::find(array("where" => "`__posts`.`created_at` like :created_at",
0
@@ -98,12 +99,13 @@
0
           error(__("Error"), __("Please enter a valid year and month."));
0
 
0
         $timestamp = mktime(0, 0, 0, $_GET['month'], fallback($_GET['day'], "1", true), $_GET['year']);
0
-        $theme->title = _f("Archive of %s", array(date("F Y", $timestamp)));
0
+        $theme->title = _f("Archive of %s", array(strftime("%B %Y", $timestamp)));
0
 
0
         $theme->load("content/archive", array("posts" => $posts,
0
                                               "archive" => array("year" => $_GET['year'],
0
                                                                  "month" => strftime("%B", $timestamp),
0
-                                                                 "day" => date("jS", $timestamp),
0
+                                                                 "day" => strftime("%d", $timestamp),
0
+                                                                 "timestamp" => $timestamp,
0
                                                                  "depth" => isset($_GET['day']) ? "day" : (isset($_GET['month']) ? "month" : (isset($_GET['year']) ? "year" : ""))
0
                                                            )
0
                                         ));
...
215
216
217
218
219
220
 
 
 
221
222
223
...
215
216
217
 
 
 
218
219
220
221
222
223
0
@@ -215,9 +215,9 @@
0
 
0
     public function author_link() {
0
       if ($this->author_url != "") # If a URL is set
0
-        echo '<a href="'.$this->author_url.'">'.$this->author.'</a>';
0
-      else # If not, just show their name
0
-        echo $this->author;
0
+        return '<a href="'.$this->author_url.'">'.$this->author.'</a>';
0
+      else # If not, just return their name
0
+        return $this->author;
0
     }
0
 
0
     public function update($author, $author_email, $author_url, $body, $status, $timestamp) {
...
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
...
43
44
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
47
48
...
7
8
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
11
12
...
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
0
@@ -7,32 +7,6 @@
0
       <form id="edit_form" action="{% admin "update_comment" %}" method="post" accept-charset="utf-8" enctype="multipart/form-data">
0
         <fieldset>
0
           <p>
0
-            <label for="author">${ "Author" | translate }</label>
0
-            <input class="text" type="text" name="author" value="${ comment.author | escape }" id="author" />
0
-          </p>
0
-          <p>
0
-            <label for="author_email">${ "Author E-Mail" | translate }</label>
0
-            <input class="text" type="text" name="author_email" value="${ comment.author_email | escape }" id="author_email" />
0
-          </p>
0
-          <p>
0
-            <label for="author_url">${ "Author Website" | translate }</label>
0
-            <input class="text" type="text" name="author_url" value="${ comment.author_url | escape }" id="author_url" />
0
-          </p>
0
-          <p>
0
-            <label for="status">${ "Status" | translate }</label>
0
-            <select name="status" id="status">
0
-              <option value="approved"${ comment.status | option_selected("approved") }>${ "Approved" | translate }</option>
0
-              <option value="denied"${ comment.status | option_selected("denied") }>${ "Denied" | translate }</option>
0
-              <option value="spam"${ comment.status | option_selected("spam") }>${ "Spam" | translate }</option>
0
-              <option value="pingback"${ comment.status | option_selected("pingback") }>${ "Pingback" | translate }</option>
0
-              <option value="trackback"${ comment.status | option_selected("trackback") }>${ "Trackback" | translate }</option>
0
-            </select>
0
-          </p>
0
-          <p>
0
-            <label for="created_at">${ "Timestamp" | translate }</label>
0
-            <input class="text" type="text" name="created_at" value="${ comment.created_at | date }" id="created_at" />
0
-          </p>
0
-          <p>
0
             <label for="body">${ "Body" | translate }</label>
0
             <textarea class="wide preview_me" rows="12" name="body" id="body" cols="50">${ comment.body | escape }</textarea>
0
           </p>
0
@@ -43,6 +17,39 @@
0
             </button>
0
           </div>
0
 
0
+          <div class="clear"></div>
0
+          <noscript><br /></noscript>
0
+          <div id="more_options" class="more_options js_disabled">
0
+            <p>
0
+              <label for="author">${ "Author" | translate }</label>
0
+              <input class="text" type="text" name="author" value="${ comment.author | escape }" id="author" />
0
+            </p>
0
+            <p>
0
+              <label for="author_email">${ "Author E-Mail" | translate }</label>
0
+              <input class="text" type="text" name="author_email" value="${ comment.author_email | escape }" id="author_email" />
0
+            </p>
0
+            <p>
0
+              <label for="author_url">${ "Author Website" | translate }</label>
0
+              <input class="text" type="text" name="author_url" value="${ comment.author_url | escape }" id="author_url" />
0
+            </p>
0
+            <p>
0
+              <label for="status">${ "Status" | translate }</label>
0
+              <select name="status" id="status">
0
+                <option value="approved"${ comment.status | option_selected("approved") }>${ "Approved" | translate }</option>
0
+                <option value="denied"${ comment.status | option_selected("denied") }>${ "Denied" | translate }</option>
0
+                <option value="spam"${ comment.status | option_selected("spam") }>${ "Spam" | translate }</option>
0
+                <option value="pingback"${ comment.status | option_selected("pingback") }>${ "Pingback" | translate }</option>
0
+                <option value="trackback"${ comment.status | option_selected("trackback") }>${ "Trackback" | translate }</option>
0
+              </select>
0
+            </p>
0
+            <p>
0
+              <label for="created_at">${ "Timestamp" | translate }</label>
0
+              <input class="text" type="text" name="created_at" value="${ comment.created_at | strftime }" id="created_at" />
0
+            </p>
0
+            ${ trigger.call("edit_comment_options", comment) }
0
+            <div class="clear"></div>
0
+          </div>
0
+
0
           <input type="hidden" name="hash" value="$site.secure_hashkey" id="hash" />
0
           <input type="hidden" name="id" value="$comment.id" id="id" />
0
         </fieldset>
...
2
3
4
5
 
6
7
8
 
9
10
11
...
14
15
16
17
 
18
19
20
 
21
22
23
...
2
3
4
 
5
6
7
 
8
9
10
11
...
14
15
16
 
17
18
19
 
20
21
22
23
0
@@ -2,10 +2,10 @@
0
 {% block content %}
0
 {% if archives %} {# List? (For all/yearly archives) #}
0
   {% for archive in archives %}
0
-  <h2><a href="$archive.url">$archive.month $archive.year</a></h2>
0
+  <h2><a href="$archive.url">${ archive.timestamp | strftime("%B %Y") }</a></h2>
0
   <ul>
0
     {% for post in archive.posts %}
0
-    <li>${ post.created_at | date("d") }: <a href="$post.url">${ post.title | normalize | truncate(70) }</a></li>
0
+    <li>${ post.created_at | strftime("%d") }: <a href="$post.url">${ post.title | normalize | truncate(70) }</a></li>
0
     {% endfor %}
0
   </ul>
0
   <br />
0
@@ -14,10 +14,10 @@
0
 
0
 {% if posts.paginated %} {# Posts? (For daily/monthly archives) #}
0
 {% if archive.depth == "day" %}
0
-  <h2>${ "Archive of" | translate } $archive.month $archive.day, $archive.year</h2>
0
+  <h2>${ "Archive of %s" | translate | format(archive.timestamp | strftime("%B %d, %Y")) }</h2>
0
 {% endif %}
0
 {% if archive.depth == "month" %}
0
-  <h2>${ "Archive of" | translate } $archive.month $archive.year</h2>
0
+  <h2>${ "Archive of %s" | translate | format(archive.timestamp | strftime("%B %Y")) }</h2>
0
 {% endif %}
0
   {% for post in posts.paginated %}
0
   {% include "content/post.twig" %}
...
6
7
8
9
10
11
12
13
14
15
16
17
 
 
 
18
19
...
6
7
8
 
 
 
 
 
 
 
 
 
9
10
11
12
13
0
@@ -6,14 +6,8 @@
0
         <p>$comment.body</p>
0
       </blockquote>
0
       <cite>
0
-        <strong>$comment.author_link</strong> ${ "on" | translate }
0
-        ${ comment.created_at | date("F jS, 2008, \\a\\\t g:i A") }
0
-        {% if comment.editable %}
0
-        <em>|</em> $comment.edit_link
0
-        {% endif %}
0
-
0
-        {% if comment.deletable %}
0
-        <em>|</em> $comment.delete_link
0
-        {% endif %}
0
+        ${ "<strong>%s</strong> on %s" | translate | format(comment.author_link, comment.created_at | strftime("%B %d, %Y, at %I:%M %r")) }
0
+        ${ comment.edit_link("Edit" | translate, "<em>|</em> ") }
0
+        ${ comment.delete_link("Delete" | translate, "<em>|</em> ") }
0
       </cite>
0
     </li>
...
13
14
15
16
 
17
18
19
...
13
14
15
 
16
17
18
19
0
@@ -13,7 +13,7 @@
0
               {% endif %}
0
               <div class="clear"></div>
0
               <span class="info">
0
-                <strong><a href="$post.url">${ post.created_at | date("F jS @ g:i A") }</a></strong>
0
+                <strong><a href="$post.url">${ post.created_at | strftime("%B %d @ %I:%M %p") }</a></strong>
0
                 {% if enabled_modules.categorize and post.category.id != 0 %}
0
                 <em>|</em> <a href="$post.category.url" rel="tag">$post.category.name</a>
0
                 {% endif %}
...
35
36
37
38
 
39
40
41
...
35
36
37
 
38
39
40
41
0
@@ -35,7 +35,7 @@ ${ trigger.call("sidebar") }
0
         <h1>${ "Archives" | translate }</h1>
0
         <ul>
0
 {% for archive in theme.archives_list %}
0
-          <li><a href="$archive.url">${ archive.when | date("F Y") }</a> <span class="sub">($archive.count)</span></li>
0
+          <li><a href="$archive.url">${ archive.when | strftime("%B %Y") }</a> <span class="sub">($archive.count)</span></li>
0
 {% endfor %}
0
         </ul>
0
 {% endif %}

Comments