b0VIM 7.1ɌGAVagentzagentz-office~agentz/hack/openapi/trunk/demo/Blog/blog.jsutf-8 3210#"! Utpn"ad$4yS. u_FDC$ x X R = < v p 5 #  w Z =  { G E D  ] 2   lfS?lA3)"sqp<sD%oK!}{zZ-~}W43 i if (!openapi.isSuccess(res)) {function renderRecentComments (res) {} openapi.get('/=/view/RecentPosts/limit/6'); openapi.callback = renderRecentPosts;function getRecentPosts () {} openapi.get('/=/view/RecentComments/limit/6'); openapi.callback = renderRecentComments;function getRecentComments () {} } } cell.html() + ''); cell.html('' + //alert("cell html: " + cell.html()); if (cell.length == 0) return; var cell = $("#" + id); //alert("ID: " + id); var id = 'day-' + year + '-' + month + '-' + line.day; prev_day = line.day; if (prev_day == line.day) continue; var line = res[i]; for (var i = 0; i < res.length; i++) { var prev_day = 0; //alert(JSON.stringify(res)); } else { JSON.stringify(res)); error("Failed to fetch posts for calendar: " + if (!openapi.isSuccess(res)) {function renderPostsInCalendar (res, year, month) {} openapi.get('/=/view/PostsByMonth/~/~', { year: year, month: month + 1 }); }; renderPostsInCalendar(res, year, month); openapi.callback = function (res) { ); ) } end_of_month: end_of_month first_day_of_week: first_day_of_week, month: month, year: year, { 'calendar.tt', Jemplate.process( $(".module-calendar").html( //alert(month); //alert(year); } end_of_month = Math.round(delta/1000/60/60/24); var delta = new Date(year, month + 1, 1) - date; } else { end_of_month = 31; if (month == 11) { var end_of_month; var first_day_of_week = date.getDay(); var date = new Date(year, month, 1); } month = now.getMonth(); year = now.getFullYear(); var now = new Date(); if (year == undefined || month == undefined) {function getCalendar (year, month) {} $(".blog-top").attr('id', 'post-list-' + page); openapi.get('/=/view/RowCount/model/Post'); openapi.callback = function (res) { renderPager(res, page); }; }); limit: itemsPerPage offset: itemsPerPage * (page - 1), order_by: 'id:desc', count: itemsPerPage, openapi.get('/=/model/Post/~/~', { //openapi.user = 'agentzh.Public'; openapi.callback = renderPostList; page = parseInt(match[1]) || 1; if (match) var page = 1; match = hash.match(/^(?:post-list|post-list-(\d+))$/); } return; goToPost(postId); //alert("Post ID: " + postId); var postId = match[1]; if (match) { var match = hash.match(/^post-(\d+)(:comments|comment-(\d+))?/); position = hash; } location.hash = 'main'; hash = 'main'; if (hash == "") { return; if (position == hash) hash = hash.replace(/^\#/, ''); //alert(hash); var hash = location.hash;function dispatchByAnchor () {} getRecentComments(); getRecentPosts(); getCalendar(); setInterval(dispatchByAnchor, 300); //openapi.formId = 'new_model'; ); { server: host, user: 'agentzh.Public' } openapi = new OpenAPI.Client( //var host = 'http://127.0.0.1'; var host = 'http://10.62.136.86';function init () {} alert(msg);function error (msg) {$(window).ready(init);var itemsPerPage = 5;var position;var openapi;ad B "fCf[U20/  Q . } r K E C B A } } location.hash = location.hash; ); ) { page: page, page_count: pageCount, title: 'Pages' } 'pager.tt', Jemplate.process( $("#beta-pager.pkg").html( if (pageCount < 2) return; var pageCount = Math.ceil(parseInt(res[0].count) / itemsPerPage); } else { error("Failed to render pager: " + JSON.stringify(res)); if (!openapi.isSuccess(res)) {function renderPager (res, page) {} location.hash = location.hash; } ); Jemplate.process('post-list.tt', { post_list: res }) $("#beta-inner.pkg").html( //alert(JSON.stringify(data)); } else { error("Failed to render post list: " + JSON.stringify(res)); if (!openapi.isSuccess(res)) {function renderPostList (res) {} } location.hash = location.hash; ); Jemplate.process('comments.tt', { comments: res })adncSF o \ .  d N   k Y W V 4  V - m B {mbHxP-]P5pe%$a>zZ`  $(".comments-content").html( } else { error("Failed to render post list: " + JSON.stringify(data)); if (!openapi.isSuccess(res)) { //alert("Comments: " + JSON.stringify(res));function renderComments (res) {} } location.hash = location.hash; ); Jemplate.process('nav.tt', { posts: res, current: currentId }) $(".content-nav").html( //alert("Going to render prev next post navigation: " + JSON.stringify(res)); } else { JSON.stringify(res)); error("Failed to render prev next post navigation: " + if (!openapi.isSuccess(res)) {function renderPrevNextPost (currentId, res) {} } $("#beta-pager.pkg").html(''); openapi.get('/=/model/Comment/post/' + post.id); openapi.callback = renderComments; openapi.get('/=/view/PrevNextPost/current/' + post.id); }; renderPrevNextPost(post.id, res); openapi.callback = function (res) { ); Jemplate.process('post-page.tt', { post: post }) $("#beta-inner.pkg").html( var post = res[0]; } else { error("Failed to render post: " + JSON.stringify(res)); if (!openapi.isSuccess(res)) { //alert(JSON.stringify(post));function renderPost (res) {} openapi.get('/=/model/Post/id/' + id); openapi.callback = renderPost; //alert($(".blog-top").attr('id')); $(".blog-top").attr('id', 'post-' + id); //alert("Go to Post " + id);function goToPost (id) {} } ); '/=/model/Post/id/' + postId { comments: commentCount + 1 }, openapi.putByGet( }; } spans.text(commentCount + 1); } else { postId + ": " + JSON.stringify(res)); error("Failed to increment the comment count for post " + if (!openapi.isSuccess(res)) { openapi.callback = function (res) { openapi.get('/=/model/Comment/post/' + postId); var postId = spans.attr('post'); var commentCount = parseInt(spans.text()); var spans = $(".comment-count"); openapi.callback = renderComments; //alert(JSON.stringify(res)); } else { error("Failed to post the comment: " + JSON.stringify(res)); if (!openapi.isSuccess(res)) { //alert("HERE!!!");function afterPostComment (res) {} return false; openapi.post(data, '/=/model/Comment/~/~'); openapi.formId = 'comment-form'; openapi.callback = afterPostComment; //openapi.purge(); } return false; error("Comment text cannot be empty :)"); if (!data.body) { //alert(JSON.stringify(data)); data.post = $("#comment-for").val(); data.body = $("#comment-text").val(); data.url = $("#comment-url").val(); data.email = $("#comment-email").val(); data.sender = $("#comment-author").val(); var data = {};function postComment (form) {} } $("#recent-posts").html(html); var html = Jemplate.process('recent-posts.tt', { posts: res }); //alert("Get the recent posts: " + JSON.stringify(res)); } else { error("Failed to get the recent posts: " + JSON.stringify(res)); if (!openapi.isSuccess(res)) {function renderRecentPosts (res) {} } $("#recent-comments").html(html); var html = Jemplate.process('recent-comments.tt', { comments: res }); //alert("Get the recent comments: " + JSON.stringify(res)); } else { error("Failed to get the recent comments: " + JSON.stringify(res));