Diff
Not logged in

Differences From:

File src/report.c part of check-in [9e2d2676a4] - Fix a C++-ism in report.c. by drh on 2008-06-08 15:10:20. [view]

To:

File src/report.c part of check-in [d3e711fd2f] - Work toward getting bug-tracking working well. by drh on 2008-07-15 16:42:48. [view]

@@ -36,9 +36,9 @@
 */
 void view_list(void){
   Stmt q;
   int rn = 0;
-  int cnt = 1;
+  int cnt = 0;
 
   login_check_credentials();
   if( !g.okRdTkt && !g.okNewTkt ){ login_needed(); return; }
   style_header("Bug Report Main Menu");
@@ -45,8 +45,9 @@
   if( g.okNewTkt ){
     @ <p>Enter a new bug report:</p>
     @ <ol><li value="1"><a href="tktnew">New bug report</a></li></ol>
     @
+    cnt++;
   }
   if( !g.okRdTkt ){
     @ <p>You are not authorized to view existing bug reports.</p>
   }else{
@@ -68,9 +69,11 @@
       }
       if( g.okAdmin || (g.okWrTkt && zOwner && strcmp(g.zLogin,zOwner)==0) ){
         @ [<a href="rptedit?rn=%d(rn)" rel="nofollow">edit</a>]
       }
-      @ [<a href="rptsql?rn=%d(rn)" rel="nofollow">sql</a>]
+      if( g.okTktFmt ){
+        @ [<a href="rptsql?rn=%d(rn)" rel="nofollow">sql</a>]
+      }
       @ </li>
     }
   }
   @ </ol>
@@ -253,9 +256,9 @@
   const char *zClrKey;
   Stmt q;
 
   login_check_credentials();
-  if( !g.okQuery ){
+  if( !g.okTktFmt ){
     login_needed();
     return;
   }
   rn = atoi(PD("rn","0"));
@@ -301,9 +304,9 @@
   char *zSQL;
   char *zErr = 0;
 
   login_check_credentials();
-  if( !g.okQuery ){
+  if( !g.okTktFmt ){
     login_needed();
     return;
   }
   /*view_add_functions(0);*/
@@ -435,8 +438,12 @@
 */
 static void report_format_hints(void){
   char *zSchema;
   zSchema = db_text(0,"SELECT sql FROM sqlite_master WHERE name='ticket'");
+  if( zSchema==0 ){
+    zSchema = db_text(0,"SELECT sql FROM repository.sqlite_master"
+                        " WHERE name='ticket'");
+  }
   @ <hr><h3>TICKET Schema</h3>
   @ <blockquote><pre>
   @ %h(zSchema)
   @ </pre></blockquote>
@@ -914,12 +921,14 @@
     db_multi_exec("PRAGMA empty_result_callbacks=ON");
     style_submenu_element("Raw", "Raw",
       "rptview?tablist=1&%s", PD("QUERY_STRING",""));
     if( g.okAdmin
-       || (g.okQuery && g.zLogin && zOwner && strcmp(g.zLogin,zOwner)==0) ){
+       || (g.okTktFmt && g.zLogin && zOwner && strcmp(g.zLogin,zOwner)==0) ){
       style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn);
     }
-    style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn);
+    if( g.okTktFmt ){
+      style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn);
+    }
     style_header(zTitle);
     output_color_key(zClrKey, 1,
         "border=0 cellpadding=3 cellspacing=0 class=\"report\"");
     @ <table border=1 cellpadding=2 cellspacing=0 class="report">