Diff
Not logged in

Differences From:

File src/info.c part of check-in [50a58adb76] - Many changes and bug fixes in the wiki processing. Moving toward a workable wiki system. The "Home" menu option now takes you to the wiki page whose name is the same as the Project Name. There is a "wcontent" page, but no link to it yet. Many other changes. by drh on 2007-10-10 21:15:17. [view]

To:

File src/info.c part of check-in [677aa71bca] - The g.zExtra parameter is now always available as P("name"). This means the /wiki/xyz and /wiki?name=xyz are equivalent URLs. by drh on 2007-10-12 22:56:18. [view]

@@ -290,11 +290,11 @@
 
 
 /*
 ** WEBPAGE: vinfo
+** URL:  /vinfo?name=RID|UUID
 **
-** Return information about a version.  The version number is contained
-** in g.zExtra.
+** Return information about a version.
 */
 void vinfo_page(void){
   Stmt q;
   int rid;
@@ -301,9 +301,9 @@
   int isLeaf;
 
   login_check_credentials();
   if( !g.okHistory ){ login_needed(); return; }
-  rid = name_to_rid(g.zExtra);
+  rid = name_to_rid(PD("name","0"));
   if( rid==0 ){
     style_header("Version Information Error");
     @ No such object: %h(g.argv[2])
     style_footer();
@@ -365,9 +365,9 @@
       @ <b>Added:</b>
     }else{
       @ <b>Deleted:</b>
     }
-    @ <a href="%s(g.zBaseURL)/finfo/%T(zName)">%h(zName)</a></li>
+    @ <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a></li>
   }
   @ </ul>
   compute_leaves(rid);
   showDescendents(rid, 2, "Descendents");
@@ -377,19 +377,19 @@
 }
 
 /*
 ** WEBPAGE: winfo
+** URL:  /winfo?name=RID
 **
-** Return information about a wiki page.  The version number is contained
-** in g.zExtra.
+** Return information about a wiki page.
 */
 void winfo_page(void){
   Stmt q;
   int rid;
 
   login_check_credentials();
   if( !g.okHistory ){ login_needed(); return; }
-  rid = name_to_rid(g.zExtra);
+  rid = name_to_rid(PD("name","0"));
   if( rid==0 ){
     style_header("Wiki Page Information Error");
     @ No such object: %h(g.argv[2])
     style_footer();
@@ -422,9 +422,9 @@
     @ <tr><th>Original&nbsp;User:</th><td>%s(db_column_text(&q, 3))</td></tr>
     @ <tr><th>Commands:</th>
     @   <td>
 /*    @     <a href="%s(g.zBaseURL)/wdiff/%d(rid)">diff</a> | */
-    @     <a href="%s(g.zBaseURL)/whistory/%t(zName)">history</a>
+    @     <a href="%s(g.zBaseURL)/whistory?page=%t(zName)">history</a>
     @     | <a href="%s(g.zBaseURL)/fview/%d(rid)">raw-text</a>
     @   </td>
     @ </tr>
     @ </table></p>
@@ -437,20 +437,22 @@
 }
 
 /*
 ** WEBPAGE: finfo
+** URL: /finfo?name=FILENAME
 **
-** Show the complete change history for a single file.  The name
-** of the file is in g.zExtra
+** Show the complete change history for a single file.
 */
 void finfo_page(void){
   Stmt q;
+  const char *zFilename;
   char zPrevDate[20];
   login_check_credentials();
   if( !g.okHistory ){ login_needed(); return; }
   style_header("File History");
 
   zPrevDate[0] = 0;
+  zFilename = PD("name","");
   db_prepare(&q,
     "SELECT a.uuid, substr(b.uuid,1,10), datetime(event.mtime,'localtime'),"
     "       coalesce(event.ecomment, event.comment),"
     "       coalesce(event.euser, event.user),"
@@ -460,11 +462,11 @@
     "   AND a.rid=mlink.mid"
     "   AND b.rid=mlink.fid"
     "   AND event.objid=mlink.mid"
     " ORDER BY event.mtime DESC",
-    g.zExtra
+    zFilename
   );
-  @ <h2>History of %h(g.zExtra)</h2>
+  @ <h2>History of %h(zFilename)</h2>
   @ <table cellspacing=0 border=0 cellpadding=0>
   while( db_step(&q)==SQLITE_ROW ){
     const char *zVers = db_column_text(&q, 0);
     const char *zUuid = db_column_text(&q, 1);
@@ -490,9 +492,11 @@
     hyperlink_to_uuid(zVers);
     @ %h(zCom) (By: %h(zUser))
     @ Id: %s(zUuid)/%d(frid)
     @ <a href="%s(g.zBaseURL)/fview/%d(frid)">[view]</a>
-    @ <a href="%s(g.zBaseURL)/fdiff?v1=%d(fpid)&amp;v2=%d(frid)">[diff]</a>
+    if( fpid ){
+      @ <a href="%s(g.zBaseURL)/fdiff?v1=%d(fpid)&amp;v2=%d(frid)">[diff]</a>
+    }
     @ </td>
   }
   db_finalize(&q);
   @ </table>
@@ -516,10 +520,11 @@
 }
 
 /*
 ** WEBPAGE: vdiff
+** URL: /vdiff?name=RID
 **
-** Show all differences for a particular check-in specified by g.zExtra
+** Show all differences for a particular check-in.
 */
 void vdiff_page(void){
   int rid;
   Stmt q;
@@ -528,9 +533,9 @@
   login_check_credentials();
   if( !g.okHistory ){ login_needed(); return; }
   style_header("Version Diff");
 
-  rid = name_to_rid(g.zExtra);
+  rid = name_to_rid(PD("name",""));
   if( rid==0 ){
     cgi_redirect("index");
   }
   db_prepare(&q,
@@ -548,9 +553,9 @@
   while( db_step(&q)==SQLITE_ROW ){
     int pid = db_column_int(&q,0);
     int fid = db_column_int(&q,1);
     const char *zName = db_column_text(&q,2);
-    @ <p><a href="%s(g.zBaseURL)/finfo/%T(zName)">%h(zName)</a></p>
+    @ <p><a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a></p>
     @ <blockquote><pre>
     append_diff(pid, fid);
     @ </pre></blockquote>
   }
@@ -597,9 +602,9 @@
     const char *zFuuid = db_column_text(&q, 2);
     const char *zCom = db_column_text(&q, 3);
     const char *zUser = db_column_text(&q, 4);
     const char *zVers = db_column_text(&q, 5);
-    @ File <a href="%s(g.zBaseURL)/finfo/%T(zName)">%h(zName)</a>
+    @ File <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a>
     @ uuid %s(zFuuid) part of check-in
     hyperlink_to_uuid(zVers);
     @ %s(zCom) by %s(zUser) on %s(zDate).
     cnt++;
@@ -620,9 +625,10 @@
     const char *zPagename = db_column_text(&q, 0);
     const char *zDate = db_column_text(&q, 1);
     const char *zUser = db_column_text(&q, 2);
     const char *zUuid = db_column_text(&q, 3);
-    @ Wiki page [<a href="%s(g.zBaseURL)/wiki/%t(zPagename)">%h(zPagename)</a>]
+    @ Wiki page
+    @ [<a href="%s(g.zBaseURL)/wiki?page=%t(zPagename)">%h(zPagename)</a>]
     @ uuid %s(zUuid) by %h(zUser) on %s(zDate)
     nWiki++;
     cnt++;
   }
@@ -693,9 +699,9 @@
 
 /*
 ** WEBPAGE: info
 ** WEBPAGE: fview
-** URL: /fview/UUID
+** URL: /fview?name=UUID
 **
 ** Show the complete content of a file identified by UUID
 ** as preformatted text.
 */
@@ -702,9 +708,9 @@
 void fview_page(void){
   int rid;
   Blob content;
 
-  rid = name_to_rid(g.zExtra);
+  rid = name_to_rid(PD("name","0"));
   login_check_credentials();
   if( !g.okHistory ){ login_needed(); return; }
   if( g.zPath[0]=='i' ){
     if( db_exists("SELECT 1 FROM tagxref JOIN tag USING(tagid)"