Check-in [68c24b1857]
Not logged in
Overview

SHA1 Hash:68c24b185731fad5e835f816428aaa739552cdd5
Date: 2008-05-16 18:11:39
User: drh
Comment:Progress toward getting ticket handling to work.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/diff.c from [626c13bd4e] to [cebb8ba99c].

@@ -738,13 +738,13 @@
   int i;
   Annotator ann;
 
   login_check_credentials();
   if( !g.okRead ){ login_needed(); return; }
-  if( mid==0 || fnid==0 ){ cgi_redirect("index"); }
+  if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
   if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
-    cgi_redirect("index");
+    fossil_redirect_home();
   }
   style_header("File Annotation");
   annotate_file(&ann, fnid, mid, 1);
   @ <pre>
   for(i=0; i<ann.nOrig; i++){

Modified src/info.c from [60d6be822b] to [0c704d219d].

@@ -97,11 +97,12 @@
       printf("checkout:     nil\n");
     }else{
       show_common_info(vid, "checkout:", 1);
     }
   }else{
-    int rid = name_to_rid(g.argv[2]);
+    int rid;
+    rid = name_to_rid(g.argv[2]);
     if( rid==0 ){
       fossil_panic("no such object: %s\n", g.argv[2]);
     }
     show_common_info(rid, "uuid:", 1);
   }
@@ -582,11 +583,11 @@
   style_header("Baseline Changes");
   login_anonymous_available();
 
   rid = name_to_rid(PD("name",""));
   if( rid==0 ){
-    cgi_redirect("index");
+    fossil_redirect_home();
   }
   db_prepare(&q,
      "SELECT pid, fid, name"
      "  FROM mlink, filename"
      " WHERE mlink.mid=%d"
@@ -805,14 +806,18 @@
 void info_page(void){
   const char *zName;
   int rid, nName;
 
   zName = P("name");
-  if( zName==0 ) cgi_redirect("index");
+  if( zName==0 ) fossil_redirect_home();
   nName = strlen(zName);
   if( nName<4 || nName>UUID_SIZE || !validate16(zName, nName) ){
-    cgi_redirect("index");
+    fossil_redirect_home();
+  }
+  if( db_exists("SELECT 1 FROM ticket WHERE tkt_uuid GLOB '%s*'", zName) ){
+    tktview_page();
+    return;
   }
   rid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%s*'", zName);
   if( rid==0 ){
     style_header("Broken Link");
     @ <p>No such object: %h(zName)</p>

Modified src/main.c from [1f3362585e] to [d5882d7323].

@@ -453,10 +453,17 @@
     g.zTop = &g.zBaseURL[7+strlen(zHost)];
   }
 }
 
 /*
+** Send an HTTP redirect back to the designated Index Page.
+*/
+void fossil_redirect_home(void){
+  cgi_redirectf("%s%s", g.zBaseURL, db_get("index-page", "/index"));
+}
+
+/*
 ** Preconditions:
 **
 **    * Environment variables are set up according to the CGI standard.
 **    * The respository database has been located and opened.
 **
@@ -474,11 +481,11 @@
   */
   set_base_url();
   zPathInfo = P("PATH_INFO");
   if( zPathInfo==0 || zPathInfo[0]==0
       || (zPathInfo[0]=='/' && zPathInfo[1]==0) ){
-    cgi_redirectf("%s%s", g.zBaseURL, db_get("index-page", "/index"));
+    fossil_redirect_home();
   }else{
     zPath = mprintf("%s", zPathInfo);
   }
 
   /* Remove the leading "/" at the beginning of the path.

Modified src/style.c from [ba8c800cff] to [8d5949ed7f].

@@ -88,10 +88,11 @@
   Th_Store("manifest_date", MANIFEST_DATE);
   if( g.zLogin ){
     Th_Store("login", g.zLogin);
   }
   Th_Render(zHeader);
+  Th_Unstore("title");   /* Avoid collisions with ticket field names */
   cgi_destination(CGI_BODY);
   g.cgiPanic = 1;
 }
 
 /*

Modified src/th_main.c from [7258c955ba] to [6295c8f141].

@@ -280,10 +280,19 @@
 ** Store a string value in a variable in the interpreter.
 */
 void Th_Store(const char *zName, const char *zValue){
   Th_FossilInit();
   Th_SetVar(g.interp, (uchar*)zName, -1, (uchar*)zValue, strlen(zValue));
+}
+
+/*
+** Unset a variable.
+*/
+void Th_Unstore(const char *zName){
+  if( g.interp ){
+    Th_UnsetVar(g.interp, (uchar*)zName, -1);
+  }
 }
 
 /*
 ** Retrieve a string value from the interpreter.  If no such
 ** variable exists, return NULL.

Modified src/tkt.c from [e7e06add5c] to [5b74369b2c].

@@ -298,10 +298,11 @@
   db_end_transaction(0);
 }
 
 /*
 ** WEBPAGE: tktview
+** URL:  tktview?name=UUID
 **
 ** View a ticket.
 */
 void tktview_page(void){
   char *zScript;