{"id":38,"date":"2004-12-15T01:27:12","date_gmt":"2004-12-15T05:27:12","guid":{"rendered":"http:\/\/www.steenhagen.us\/~jake\/trunk\/?p=38"},"modified":"2006-11-28T15:28:19","modified_gmt":"2006-11-28T20:28:19","slug":"rescratching-my-own-itch","status":"publish","type":"post","link":"https:\/\/jacob.steenhagen.us\/blog\/2004\/12\/rescratching-my-own-itch\/","title":{"rendered":"Rescratching My Own Itch"},"content":{"rendered":"<p class=\"first\">Last July, as in July &#8217;03, I <a href=\"http:\/\/jacob.steenhagen.us\/blog\/archives\/000018.html\">posted<\/a> about some modifications I made to MoveableType. One thing I had done was a plugin for SETI stats, the other was an actual code modifcation for a &#8220;recently archived&#8221; sidebar item instead of recently posted. Well, somewhere along the way I seem to have lost that code modification as I noticed my &#8220;recently archived&#8221; item wasn&#8217;t working right. And wouldn&#8217;t you know it, I seemed to have made a really boneheaded mistake of not saving the code anywhere! To make a long story short, I figured out, once again, how to do it. It&#8217;s my goal to make sure I don&#8217;t ever have to spend another couple hours figuring this one out, so I&#8217;m gonna post the patch here. As an added bonus, that means other people can use it, too :).<\/p>\n<pre class=\"code\">--- Context.pm.orig     2004-12-14 23:11:57.000000000 -0500\r\n+++ Context.pm  2004-12-15 01:15:09.000000000 -0500\r\n@@ -626,6 +626,19 @@\r\n$args{direction} = 'descend';\r\n$args{limit} = $last;\r\n$args{offset} = $args->{offset} if $args->{offset};\r\n+        } elsif (my $days_offset = $args->{days_offset}) {\r\n+            my $sec = 3600 * 24;  # Seconds in a day\r\n+            my $days = $args->{days};\r\n+            my @ago = offset_time_list(time - $sec * $days_offset,\r\n+                $ctx->stash('blog_id'));\r\n+            my $ago_s = sprintf \"%04d%02d%02d%02d%02d%02d\",\r\n+                $ago[5]+1900, $ago[4]+1, @ago[3,2,1,0];\r\n+            @ago = offset_time_list(time - $sec * $days_offset - $sec * $days,\r\n+                $ctx->stash('blog_id'));\r\n+            my $ago_e = sprintf \"%04d%02d%02d%02d%02d%02d\",\r\n+                $ago[5]+1900, $ago[4]+1, @ago[3,2,1,0];\r\n+            $terms{created_on} = [ $ago_e, $ago_s ];\r\n+            %args = ( range => { created_on => 1 } );\r\n} elsif (my $days = $args->{days}) {\r\nmy @ago = offset_time_list(time - 3600 * 24 * $days,\r\n$ctx->stash('blog_id'));<\/pre>\n<p>Mostly it&#8217;s a duplicate of the block for <code>$args->{days}<\/code>, but with some modifications to make it do a starting <em>and<\/em> ending date. The template block to get this in my sidebar is (I may tweak these number is the future, but it&#8217;s just a config option):<\/p>\n<pre class=\"code\">&lt;div class=\"sidetitle\"&gt;\r\nRecently Archived\r\n&lt;\/div&gt;\r\n\r\n&lt;div class=\"side\"&gt;\r\n&lt;MTEntries days=\"60\" days_offset=\"21\"&gt;\r\n&lt;a xhref=\"&lt;$MTEntryPermalink$&gt;\" mce_href=\"&lt;$MTEntryPermalink$&gt;\"&gt;&lt;$MTEntryTitle$&gt;&lt;\/a&gt;&lt;br \/&gt;\r\n&lt;\/MTEntries&gt;\r\n&lt;\/div&gt;<\/pre>\n<p>This will put any entry from 21-81 old days under the &#8220;recently archived&#8221; heading. This is, of course, a modification to the version of MoveableType that I&#8217;m running, which is version 2.64. If you&#8217;re running a different version, your results may very.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last July, as in July &#8217;03, I posted about some modifications I made to MoveableType. One thing I had done was a plugin for SETI stats, the other was an actual code modifcation for a &#8220;recently archived&#8221; sidebar item instead of recently posted. Well, somewhere along the way I seem to have lost that code &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/jacob.steenhagen.us\/blog\/2004\/12\/rescratching-my-own-itch\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Rescratching My Own Itch&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[3,15],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7EJi-C","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/jacob.steenhagen.us\/blog\/wp-json\/wp\/v2\/posts\/38"}],"collection":[{"href":"https:\/\/jacob.steenhagen.us\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jacob.steenhagen.us\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jacob.steenhagen.us\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jacob.steenhagen.us\/blog\/wp-json\/wp\/v2\/comments?post=38"}],"version-history":[{"count":0,"href":"https:\/\/jacob.steenhagen.us\/blog\/wp-json\/wp\/v2\/posts\/38\/revisions"}],"wp:attachment":[{"href":"https:\/\/jacob.steenhagen.us\/blog\/wp-json\/wp\/v2\/media?parent=38"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jacob.steenhagen.us\/blog\/wp-json\/wp\/v2\/categories?post=38"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jacob.steenhagen.us\/blog\/wp-json\/wp\/v2\/tags?post=38"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}