<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -12,7 +12,7 @@ all:
 	-cp ../../clients/js/*.js out/
 	-rm out/JSON.js
 	-rm out/md5.js
-	-rm out/*dojo*.js
+	#rm out/*dojo*.js
 	-rm template/elem/*.tt~
 	jemplate --runtime &gt; out/blog-jemplate.js
 	jemplate --compile template/elem/ &gt;&gt; out/blog-jemplate.js
@@ -46,7 +46,8 @@ pack: all
 	cp -r out/* pack_out/
 	for file in `find out -name '*.js' | grep -v 'jquery.js'`; do echo &quot;packing $$file...&quot;; cat $$file | jsmin &gt; pack_out/`basename $$file`; done
 	cat pack_out/blog-jemplate.js pack_out/openresty.js pack_out/blog.js &gt; pack_out/blog_min.js
-	rm pack_out/blog-jemplate.js pack_out/openresty.js pack_out/blog.js
+	cat pack_out/jquery.js pack_out/dojo.openresty.js &gt; pack_out/jquery-dojo.js
+	rm pack_out/blog-jemplate.js pack_out/openresty.js pack_out/blog.js pack_out/dojo.openresty.js pack_out/jquery.js
 	rm -rf out
 	mv pack_out out
 </diff>
      <filename>demo/Blog/Makefile</filename>
    </modified>
    <modified>
      <diff>@@ -41,6 +41,7 @@ function debug (msg) {
 
 $.fn.postprocess = function (className, options) {
     return this.find(&quot;a[@href*='#']&quot;).each( function () {
+        //debug(&quot;HERE!&quot;);
         var href = $(this).attr('href');
         // We need the following hack because IE expands href to
         // absolute URL:
@@ -57,7 +58,7 @@ $.fn.postprocess = function (className, options) {
     } );
 };
 
-var count = 0;;
+//var count = 0;;
 function setStatus (isLoading, category) {
     if (isLoading) {
         if (++loadingCount == 1) {
@@ -80,8 +81,8 @@ function setStatus (isLoading, category) {
 
         }
     }
-    count++;
-    debug(&quot;[&quot; + count + &quot;] setStatus: &quot; + category + &quot;: &quot; + loadingCount + &quot;(&quot; + isLoading + &quot;)&quot;);
+    //count++;
+    //debug(&quot;[&quot; + count + &quot;] setStatus: &quot; + category + &quot;: &quot; + loadingCount + &quot;(&quot; + isLoading + &quot;)&quot;);
 }
 
 function init () {
@@ -281,11 +282,13 @@ function getSidebar () {
     //getRecentPosts();
     //getRecentComments();
     //getArchiveList();
+    setStatus(true, 'renderSidebar');
     openresty.callback = function (res) { renderSidebar(res) };
     openresty.get('/=/action/GetSidebar/~/~', { year: thisYear, month: thisMonth + 1 });
 }
 
 function renderSidebar (res) {
+    setStatus(false, 'renderSidebar');
     getCalendar(thisYear, thisMonth, res[0]);
 
     setStatus(true, 'renderRecentPosts');
@@ -455,7 +458,7 @@ function postComment (form) {
     data.email = $(&quot;#comment-email&quot;).val();
     data.url = $(&quot;#comment-url&quot;).val();
     data.body = $(&quot;#comment-text&quot;).val();
-    data.post = $(&quot;#comment-for&quot;).val();
+    data.post_id = $(&quot;#comment-for&quot;).val();
     //alert(JSON.stringify(data));
     if (!data.sender) {
         error(&quot;Name is required.&quot;);
@@ -473,8 +476,8 @@ function postComment (form) {
     //openresty.purge();
     setStatus(true, 'afterPostComment');
     openresty.callback = afterPostComment;
-    //openresty.formId = 'comment-form';
-    openresty.postByGet('/=/model/Comment/~/~', data);
+    openresty.formId = 'comment-form';
+    openresty.post('/=/action/NewComment/~/~', data);
     return false;
 }
 
@@ -492,22 +495,11 @@ function afterPostComment (res) {
 
         //debug(JSON.stringify(res));
         var commentId;
-        var match = res.last_row.match(/\d+$/);
+        var match = res[0].last_row.match(/\d+$/);
         if (match.length) commentId = match[0];
         location.hash = 'post-' + postId + ':' +
             (commentId ? 'comment-' + commentId : 'comments');
-        openresty.callback = function (res) {
-            if (!openresty.isSuccess(res)) {
-                error(&quot;Failed to increment the comment count for post &quot; +
-                    postId + &quot;: &quot; + res.error);
-            } else {
-                spans.text(commentCount + 1);
-            }
-        };
-        openresty.putByGet(
-            '/=/model/Post/id/' + postId,
-            { comments: commentCount + 1 }
-        );
+        spans.text(commentCount + 1);
         getRecentComments(0);
     }
 }</diff>
      <filename>demo/Blog/js/blog.js</filename>
    </modified>
    <modified>
      <diff>@@ -323,10 +323,31 @@ $resty-&gt;post(
 );
 
 $resty-&gt;post(
+    '/=/action/NewComment',
+    {
+        description =&gt; &quot;Get full post (with the navigator and comments&quot;,
+        parameters =&gt; [
+            { name =&gt; 'sender', type =&gt; 'literal' },
+            { name =&gt; 'email', type =&gt; 'literal' },
+            { name =&gt; 'url', type =&gt; 'literal' },
+            { name =&gt; 'body', type =&gt; 'literal' },
+            { name =&gt; 'post_id', type =&gt; 'literal' },
+        ],
+        definition =&gt; q{
+            POST '/=/model/Comment/~/~'
+            { sender: $sender, email: $email, url: $url, body: $body, post: $post_id };
+            update Post set comments = comments + 1 where id = $post_id;
+        },
+    }
+);
+
+
+$resty-&gt;post(
     '/=/role/Public/~/~',
     [
         { method =&gt; &quot;GET&quot;, url =&gt; '/=/action/GetSidebar/~/~' },
         { method =&gt; &quot;GET&quot;, url =&gt; '/=/action/GetFullPost/~/~' },
+        { method =&gt; &quot;POST&quot;, url =&gt; '/=/action/NewComment/~/~' },
 
         { method =&gt; &quot;GET&quot;, url =&gt; '/=/model/Post/~/~' },
         { method =&gt; &quot;GET&quot;, url =&gt; '/=/model/Comment/~/~' },</diff>
      <filename>demo/Blog/script/init.pl</filename>
    </modified>
    <modified>
      <diff>@@ -7,10 +7,11 @@
         'jquery.js',
         'blog-jemplate.js',
         'openresty.js',
+        'dojo.openresty.js',
         'blog.js',
       ];
    ELSE;
-      js_files = ['jquery.js', 'blog_min.js'];
+      js_files = ['jquery-dojo.js', 'blog_min.js'];
    END;
 -%]
 &lt;head&gt;</diff>
      <filename>demo/Blog/template/header.tt</filename>
    </modified>
    <modified>
      <diff>@@ -530,7 +530,7 @@ sub compile_frags {
     my %vars;
     my @canon_cmds;
     for my $cmd (@$cmds) {
-        die &quot;Invalid command: &quot;, Dumper($cmd), &quot;\n&quot; unless ref $cmd;
+        die &quot;Invalid command: &quot;, $OpenResty::Dumper-&gt;($cmd), &quot;\n&quot; unless ref $cmd;
         if ( @$cmd == 1 and ref $cmd-&gt;[0] ) {    # being a SQL command
             my $seq = $cmd-&gt;[0];
 
@@ -541,10 +541,10 @@ sub compile_frags {
 
 # Make sure inferenced variable type is consistent
 # FIXME: 'unknown' type should be overwritten by concrete types (eg. 'symbol')
-                    if ( exists $vars{$var_name}
+                    if ( $var_type ne 'unknown' &amp;&amp; exists $vars{$var_name}
                         &amp;&amp; $vars{$var_name} ne $var_type )
                     {
-                        die &quot;Type inference conflict for variable \&quot;$var_name\&quot;.&quot;;
+                        die &quot;Type inference conflict for variable \&quot;$var_name\&quot;: $var_type expected.\n&quot;;
                     }
 
                     # Collect variable and its type</diff>
      <filename>lib/OpenResty/Handler/Action.pm</filename>
    </modified>
    <modified>
      <diff>@@ -637,7 +637,7 @@ GET /=/model?_user=$TestAccount2&amp;_password=$TestPass2
 
 === TEST 63: recheck Test account 1:
 --- request
-GET /=/model?_user=$TestAccount&amp;_password=$TestPass
+GET /=/model?_user=$TestAccount&amp;_password=$TestPass&amp;_use_cookie=1
 --- response
 [
     {&quot;src&quot;:&quot;/=/model/Carrie&quot;,&quot;name&quot;:&quot;Carrie&quot;,&quot;description&quot;:&quot;&#25105;&#30340;&#20070;&#31614;&quot;},
@@ -646,7 +646,26 @@ GET /=/model?_user=$TestAccount&amp;_password=$TestPass
 
 
 
-=== TEST 64: logout
+=== TEST 64: NewComment
+--- request
+POST /=/action/NewComment
+{
+    &quot;description&quot;:&quot;New comment&quot;,
+    &quot;parameters&quot;:[
+        { &quot;name&quot;: &quot;sender&quot;, &quot;type&quot;: &quot;literal&quot; },
+        { &quot;name&quot;: &quot;email&quot;, &quot;type&quot;: &quot;literal&quot; },
+        { &quot;name&quot;: &quot;url&quot;, &quot;type&quot;: &quot;literal&quot; },
+        { &quot;name&quot;: &quot;body&quot;, &quot;type&quot;: &quot;literal&quot; },
+        { &quot;name&quot;: &quot;post_id&quot;, &quot;type&quot;: &quot;literal&quot; }
+    ],
+    &quot;definition&quot;:&quot;POST '/=/model/Comment/~/~' { sender: $sender, email: $email, url: $url, body: $body, post: $post_id }; update Carrie set num = num + 1 where id = $post_id;&quot;
+}
+--- response
+{&quot;success&quot;:1}
+
+
+
+=== TEST 65: logout
 --- request
 GET /=/logout
 --- response</diff>
      <filename>t/31-action.t</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>20cb17c288cdee0129c4ca01eb891c11a8d52590</id>
    </parent>
  </parents>
  <author>
    <name>agentz</name>
    <email>agentz@b2c27d59-8999-dc11-853b-000bcdefe56b</email>
  </author>
  <url>http://github.com/agentzh/openresty/commit/53a794a1024462db29d02d5a7381ce2246345a81</url>
  <id>53a794a1024462db29d02d5a7381ce2246345a81</id>
  <committed-date>2008-09-26T21:08:00-07:00</committed-date>
  <authored-date>2008-09-26T21:08:00-07:00</authored-date>
  <message>demo/Blog - now we use action for comment posting


git-svn-id: http://svn.openfoundry.org/openapi/trunk@2066 b2c27d59-8999-dc11-853b-000bcdefe56b</message>
  <tree>ee8ad72c7fb4c9a265cbf756190a2d8df59450d2</tree>
  <committer>
    <name>agentz</name>
    <email>agentz@b2c27d59-8999-dc11-853b-000bcdefe56b</email>
  </committer>
</commit>
