Following is a patch (against 9e48dad49b) to add a new option to the
/setup_timeline web page to specify the default query parameters for
the /timeline web page, that works without modifications to the web UI
skins.

To keep it simple and avoid code duplication, the QUERY_STRING
variable is processed in cgi_init(), but this may not be the right
hook point. Also, I'm not sure if this covers all the possible web
server entry points.

Please ignore it if it does not meet Fossil's requirements regarding
feature set and/or code quality, but it may still be a starting point
for somebody to model a more compliant version, if it's of general
interest.

--Florian

----------

Index: src/cgi.c
==================================================================
--- src/cgi.c
+++ src/cgi.c
@@ -987,10 +987,19 @@
   z = (char*)P("QUERY_STRING");
   if( z ){
     z = mprintf("%s",z);
     add_param_list(z, '&');
   }
+
+  /* Apply default query parameters for the /timeline web page */
+  if( strlen(z)==0 ){
+    z = (char*)P("PATH_INFO");
+    if( fossil_strcmp(z,"/timeline")==0 ){
+      z = mprintf("%s",db_get("timeline-default-query",""));
+      add_param_list(z,'&');
+    }
+  }

   z = (char*)P("REMOTE_ADDR");
   if( z ){
     g.zIpAddr = mprintf("%s", z);
   }

Index: src/configure.c
==================================================================
--- src/configure.c
+++ src/configure.c
@@ -94,10 +94,11 @@
   { "background-mimetype",    CONFIGSET_SKIN },
   { "background-image",       CONFIGSET_SKIN },
   { "timeline-block-markup",  CONFIGSET_SKIN },
   { "timeline-max-comment",   CONFIGSET_SKIN },
   { "timeline-plaintext",     CONFIGSET_SKIN },
+  { "timeline-default-query", CONFIGSET_SKIN },
   { "adunit",                 CONFIGSET_SKIN },
   { "adunit-omit-if-admin",   CONFIGSET_SKIN },
   { "adunit-omit-if-user",    CONFIGSET_SKIN },

 #ifdef FOSSIL_ENABLE_TH1_DOCS

Index: src/setup.c
==================================================================
--- src/setup.c
+++ src/setup.c
@@ -1520,10 +1520,19 @@
                   "timeline-max-comment", "tmc", "0", 0);
   @ <p>The maximum length of a comment to be displayed in a timeline.
   @ "0" there is no length limit.
   @ (Property: "timeline-max-comment")</p>

+  @ <hr />
+  entry_attribute("Default timeline query parameters", 12,
+                  "timeline-default-query", "tdq", "", 0);
+  @ <p>The default query parameters handed to the "/timeline" web
+  @ page for requests not otherwise including any query parameters.
+  @ Query parameters can be copied from the URL generated by the
+  @ timeline filter menu. The default is "y=all&n=50".
+  @ (Property: "timeline-default-query")</p>
+
   @ <hr />
   @ <p><input type="submit"  name="submit" value="Apply Changes" /></p>
   @ </div></form>
   db_end_transaction(0);
   style_footer();
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to