OSDN Git Service

next.
authorvisor <visor@users.sourceforge.jp>
Tue, 2 Jun 2009 15:40:17 +0000 (00:40 +0900)
committervisor <visor@users.sourceforge.jp>
Tue, 2 Jun 2009 15:40:17 +0000 (00:40 +0900)
i/wiki.js
lib-wikifunc.ml
lib.ml

index 13a1096..15766c6 100644 (file)
--- a/i/wiki.js
+++ b/i/wiki.js
@@ -71,15 +71,15 @@ function showWiki(xml){
        if(html) $('WikiPane').innerHTML=html.stringValue();
        if(lu&&lu.value.size()>0) $('LastUpdate').innerHTML=lu.stringValue();
 }
+function showWikiHandler(r){
+       showWiki(r.responseXML.documentElement);
+}
 //
 function SubmitForm(form,page,data,func){
        if(func){
-               callWiki(page,form.serialize(true).update(data),func);
+               callWiki(page,$H($(form).serialize(true)).update(data),func);
        }else{
-               var f=function(r){
-                       showWiki(r.responseXML.documentElement);
-               };
-               callWiki(page,form.serialize(true).update(data),f);
+               callWiki(page,$H($(form).serialize(true)).update(data),showWikiHandler);
        }
 }
 //
index 54d86d5..7d13ca3 100644 (file)
        (motor-raw "opLogout();")
 )
 
+(defun-wiki-link SubmitForm (page)
+       (motor-raw (concat "SubmitForm(this,'" (js page) "');return false;"))
+)
+
 (defun-wiki-command PageIndex (vpage vtitle)
        (wiki-page-index nil (wikivar vpage) (wikivar vtitle))
 )
                )
        )
 )
+
+(defun-wiki-command WikiSearch (key vpage vtitle vsp)
+       (wiki-search key (wikivar vpage) (wikivar vtitle) (wikivar vsp))
+)
diff --git a/lib.ml b/lib.ml
index 0ef5a15..143ec11 100644 (file)
--- a/lib.ml
+++ b/lib.ml
        )
 )
 
+(defun wiki-page-backup-list (page vdate)
+       (sql "select Date from BackupIndex where PID=:pid and Page=:page order by Date desc"
+               :bind (list ':pid PID ':page page)
+               :@answer (list vdate))
+)
+
+(defun wiki-page-date (page date)
+       (let (title text)
+               (if (emptyp date)
+                               (sql "select b.Title,b.WikiText from WikiIndex a,Wiki b using(WID) where a.PID=:pid and a.Page=:page"
+                                       :bind (list ':pid PID ':page page)
+                                       :answer '(title text))
+                       (sql "select b.Title,b.WikiText from BackupIndex a,Wiki b using(WID) where a.PID=:pid and a.Page=:page and Date=:date"
+                               :bind (list ':pid PID ':page page ':date date)
+                               :answer '(title text))
+               )
+               (list title text)
+       )
+)
+
 (defun wiki-save (page title text)
        (let (iid wid date uid nwid)
                (sql "begin")
                        )
        )
 )
+
+(defun wiki-search (key vpage vtitle vsp)
+       ($estcmd 'wiki-index
+               (search key
+                       :attribute "Page" vpage
+                       :attribute "@title" vtitle
+                       :snippet vsp
+                       :cond (concat "Proj STREQ " PID))
+       )
+       (doarray (list vtitle)
+               (if (emptyp (getvar vtitle))
+                               (setvar vtitle "<タイトル未設定>")
+               )
+       )
+)
+
+(defun wiki-diff (page otime ntime vo1 vo2 vn1 vn2)
+       (let (to tn)
+               ($sqlite3 'database
+                       (sql
+               )
+       )
+)