Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch form-submenu Excluding Merge-Ins
This is equivalent to a diff from 5260fbf6 to 99e081ef
2015-02-06
| ||
03:30 | Add form elements to the /timeline submenu. Many other related changes and enhancements to the web interface. ... (check-in: c0c0bae7 user: drh tags: trunk) | |
03:28 | Do not let the "Lines:" box go below one on the /timeline. If it does, automatically revert to 10 lines. Also, arrange for the default number of lines to be 50 in most cases, but only 11 if the c= (circa) query parameter is used. Use n=all to see the entire history of the graph. ... (Closed-Leaf check-in: 99e081ef user: drh tags: form-submenu) | |
03:00 | Add the cgi_query_parameters_to_url() routine and use it to cause all query parameters on timeline to be exported. (Need to make this same changes for all other uses of url_render()). Make "context" timelines 11 entries by default. Other cleanups. ... (check-in: b6e1f61a user: drh tags: form-submenu) | |
2015-02-05
| ||
14:42 | Fix a broken hyperlink on the permutedindex.html page. ... (check-in: 0d1d7f64 user: drh tags: trunk) | |
11:58 | Merge trunk fixes into the form-submenu branch. ... (check-in: d539f65c user: drh tags: form-submenu) | |
09:10 | merge trunk ... (check-in: 9e7ea6a2 user: jan.nijtmans tags: svn-import) | |
09:01 | Unfinished comment in search.c, and some more end-of-line spacing removals. No change in functionality. ... (check-in: 5260fbf6 user: jan.nijtmans tags: trunk) | |
02:51 | Fix the "Tickets" menu option on "San Francisco Modern" so that it points to /ticket instead of /reportlist. ... (check-in: b2f2f0ce user: drh tags: trunk) | |
Changes to src/cgi.c.
︙ | ︙ | |||
50 51 52 53 54 55 56 57 58 59 60 61 62 63 | ** or cookie "x", or NULL if there is no such parameter or cookie. PD("x","y") ** does the same except "y" is returned in place of NULL if there is not match. */ #define P(x) cgi_parameter((x),0) #define PD(x,y) cgi_parameter((x),(y)) #define PT(x) cgi_parameter_trimmed((x),0) #define PDT(x,y) cgi_parameter_trimmed((x),(y)) /* ** Destinations for output text. */ #define CGI_HEADER 0 #define CGI_BODY 1 | > | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | ** or cookie "x", or NULL if there is no such parameter or cookie. PD("x","y") ** does the same except "y" is returned in place of NULL if there is not match. */ #define P(x) cgi_parameter((x),0) #define PD(x,y) cgi_parameter((x),(y)) #define PT(x) cgi_parameter_trimmed((x),0) #define PDT(x,y) cgi_parameter_trimmed((x),(y)) #define PB(x) cgi_parameter_boolean(x) /* ** Destinations for output text. */ #define CGI_HEADER 0 #define CGI_BODY 1 |
︙ | ︙ | |||
434 435 436 437 438 439 440 | static int nUsedQP = 0; /* Space actually used in aParamQP[] */ static int sortQP = 0; /* True if aParamQP[] needs sorting */ static int seqQP = 0; /* Sequence numbers */ static struct QParam { /* One entry for each query parameter or cookie */ const char *zName; /* Parameter or cookie name */ const char *zValue; /* Value of the query parameter or cookie */ int seq; /* Order of insertion */ | | > | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | static int nUsedQP = 0; /* Space actually used in aParamQP[] */ static int sortQP = 0; /* True if aParamQP[] needs sorting */ static int seqQP = 0; /* Sequence numbers */ static struct QParam { /* One entry for each query parameter or cookie */ const char *zName; /* Parameter or cookie name */ const char *zValue; /* Value of the query parameter or cookie */ int seq; /* Order of insertion */ char isQP; /* True for query parameters */ char cTag; /* Tag on query parameters */ } *aParamQP; /* An array of all parameters and cookies */ /* ** Add another query parameter or cookie to the parameter set. ** zName is the name of the query parameter or cookie and zValue ** is its fully decoded value. ** |
︙ | ︙ | |||
488 489 490 491 492 493 494 495 496 497 498 499 500 501 | for(i=0; i<nUsedQP; i++){ if( fossil_strcmp(aParamQP[i].zName,zName)==0 ){ aParamQP[i].zValue = zValue; return; } } cgi_set_parameter_nocopy(zName, zValue, 0); } /* ** Add a query parameter. The zName portion is fixed but a copy ** must be made of zValue. */ void cgi_setenv(const char *zName, const char *zValue){ | > > > > > > > > > > > | 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | for(i=0; i<nUsedQP; i++){ if( fossil_strcmp(aParamQP[i].zName,zName)==0 ){ aParamQP[i].zValue = zValue; return; } } cgi_set_parameter_nocopy(zName, zValue, 0); } void cgi_replace_query_parameter(const char *zName, const char *zValue){ int i; for(i=0; i<nUsedQP; i++){ if( fossil_strcmp(aParamQP[i].zName,zName)==0 ){ aParamQP[i].zValue = zValue; assert( aParamQP[i].isQP ); return; } } cgi_set_parameter_nocopy(zName, zValue, 1); } /* ** Add a query parameter. The zName portion is fixed but a copy ** must be made of zValue. */ void cgi_setenv(const char *zName, const char *zValue){ |
︙ | ︙ | |||
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 | if( zIn==0 ) zIn = zDefault; while( fossil_isspace(zIn[0]) ) zIn++; zOut = fossil_strdup(zIn); for(i=0; zOut[i]; i++){} while( i>0 && fossil_isspace(zOut[i-1]) ) zOut[--i] = 0; return zOut; } /* ** Return the name of the i-th CGI parameter. Return NULL if there ** are fewer than i registered CGI parameters. */ const char *cgi_parameter_name(int i){ if( i>=0 && i<nUsedQP ){ | > > > > > > > > > > | 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 | if( zIn==0 ) zIn = zDefault; while( fossil_isspace(zIn[0]) ) zIn++; zOut = fossil_strdup(zIn); for(i=0; zOut[i]; i++){} while( i>0 && fossil_isspace(zOut[i-1]) ) zOut[--i] = 0; return zOut; } /* ** Return true if the CGI parameter zName exists and is not equal to 0, ** or "no" or "off". */ int cgi_parameter_boolean(const char *zName){ const char *zIn = cgi_parameter(zName, 0); if( zIn==0 ) return 0; return zIn[0]==0 || is_truth(zIn); } /* ** Return the name of the i-th CGI parameter. Return NULL if there ** are fewer than i registered CGI parameters. */ const char *cgi_parameter_name(int i){ if( i>=0 && i<nUsedQP ){ |
︙ | ︙ | |||
1140 1141 1142 1143 1144 1145 1146 | if( fossil_strnicmp("fossil-",zName,7)==0 ) continue; } cgi_printf("%h = %h <br />\n", zName, aParamQP[i].zValue); } } /* | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 | if( fossil_strnicmp("fossil-",zName,7)==0 ) continue; } cgi_printf("%h = %h <br />\n", zName, aParamQP[i].zValue); } } /* ** Export all untagged query parameters (but not cookies or environment ** variables) as hidden values of a form. */ void cgi_query_parameters_to_hidden(void){ int i; const char *zN, *zV; for(i=0; i<nUsedQP; i++){ if( aParamQP[i].isQP==0 || aParamQP[i].cTag ) continue; zN = aParamQP[i].zName; zV = aParamQP[i].zValue; @ <input type="hidden" name="%h(zN)" value="%h(zV)"> } } /* ** Export all untagged query parameters (but not cookies or environment ** variables) to the HQuery object. */ void cgi_query_parameters_to_url(HQuery *p){ int i; for(i=0; i<nUsedQP; i++){ if( aParamQP[i].isQP==0 || aParamQP[i].cTag ) continue; url_add_parameter(p, aParamQP[i].zName, aParamQP[i].zValue); } } /* ** Tag query parameter zName so that it is not exported by ** cgi_query_parameters_to_hidden(). Or if zName==0, then ** untag all query parameters. */ void cgi_tag_query_parameter(const char *zName){ int i; if( zName==0 ){ for(i=0; i<nUsedQP; i++) aParamQP[i].cTag = 0; }else{ for(i=0; i<nUsedQP; i++){ if( strcmp(zName,aParamQP[i].zName)==0 ) aParamQP[i].cTag = 1; } } } /* ** This routine works like "printf" except that it has the ** extra formatting capabilities such as %h and %t. */ void cgi_printf(const char *zFormat, ...){ va_list ap; |
︙ | ︙ |
Changes to src/doc.c.
︙ | ︙ | |||
783 784 785 786 787 788 789 | ** WEBPAGE: /docsrch ** ** Search for documents that match a user-supplied pattern. */ void doc_search_page(void){ login_check_credentials(); style_header("Document Search"); | | | 783 784 785 786 787 788 789 790 791 792 | ** WEBPAGE: /docsrch ** ** Search for documents that match a user-supplied pattern. */ void doc_search_page(void){ login_check_credentials(); style_header("Document Search"); search_screen(SRCH_DOC, 0); style_footer(); } |
Changes to src/event.c.
︙ | ︙ | |||
127 128 129 130 131 132 133 | tail = fullbody; } if( g.perm.WrWiki && g.perm.Write && nextRid==0 ){ style_submenu_element("Edit", "Edit", "%s/eventedit?name=%s", g.zTop, zEventId); } zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate); | | < | | | < | | < | | < | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | tail = fullbody; } if( g.perm.WrWiki && g.perm.Write && nextRid==0 ){ style_submenu_element("Edit", "Edit", "%s/eventedit?name=%s", g.zTop, zEventId); } zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate); style_submenu_element("Context", 0, "%R/timeline?c=%.20s", zEventId); if( g.perm.Hyperlink ){ if( verboseFlag ){ style_submenu_element("Plain", 0, "%R/event?name=%.20s&aid=%s", zEventId, zUuid); if( nextRid ){ char *zNext; zNext = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nextRid); style_submenu_element("Next", 0,"%R/event?name=%.20s&aid=%s&v", zEventId, zNext); free(zNext); } if( prevRid ){ char *zPrev; zPrev = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", prevRid); style_submenu_element("Prev", 0, "%R/event?name=%s&aid=%s&v", zEventId, zPrev); free(zPrev); } }else{ style_submenu_element("Detail", 0, "%R/event?name=%.20s&aid=%s&v", zEventId, zUuid); } } if( verboseFlag && g.perm.Hyperlink ){ int i; const char *zClr = 0; Blob comment; |
︙ | ︙ |
Changes to src/search.c.
︙ | ︙ | |||
565 566 567 568 569 570 571 572 573 574 | #endif /* ** Remove bits from srchFlags which are disallowed by either the ** current server configuration or by user permissions. */ unsigned int search_restrict(unsigned int srchFlags){ if( g.perm.Read==0 ) srchFlags &= ~(SRCH_CKIN|SRCH_DOC); if( g.perm.RdTkt==0 ) srchFlags &= ~(SRCH_TKT); if( g.perm.RdWiki==0 ) srchFlags &= ~(SRCH_WIKI); | > > > > > > > > > < > > | < > | | | < | | < < | | 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | #endif /* ** Remove bits from srchFlags which are disallowed by either the ** current server configuration or by user permissions. */ unsigned int search_restrict(unsigned int srchFlags){ static unsigned int knownGood = 0; static unsigned int knownBad = 0; static const struct { unsigned m; const char *zKey; } aSetng[] = { { SRCH_CKIN, "search-ci" }, { SRCH_DOC, "search-doc" }, { SRCH_TKT, "search-tkt" }, { SRCH_WIKI, "search-wiki" }, }; int i; if( g.perm.Read==0 ) srchFlags &= ~(SRCH_CKIN|SRCH_DOC); if( g.perm.RdTkt==0 ) srchFlags &= ~(SRCH_TKT); if( g.perm.RdWiki==0 ) srchFlags &= ~(SRCH_WIKI); for(i=0; i<ArraySize(aSetng); i++){ unsigned int m = aSetng[i].m; if( (srchFlags & m)==0 ) continue; if( ((knownGood|knownBad) & m)!=0 ) continue; if( db_get_boolean(aSetng[i].zKey,0) ){ knownGood |= m; }else{ knownBad |= m; } } return srchFlags & ~knownBad; } /* ** When this routine is called, there already exists a table ** ** x(label,url,score,date,snip). ** |
︙ | ︙ | |||
873 874 875 876 877 878 879 | } /* ** Generate some HTML for doing search. At a minimum include the ** Search-Text entry form. If the "s" query parameter is present, also ** show search results. ** | | | | > > | > > > | > < | > > > > > > > > > > > > > > > > > > > > > > > > | 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 | } /* ** Generate some HTML for doing search. At a minimum include the ** Search-Text entry form. If the "s" query parameter is present, also ** show search results. ** ** The srchFlags parameter restricts the set of documents to be searched. ** srchFlags should normally be either a single search category or all ** categories. Any srchFlags with two or more bits set ** is treated like SRCH_ALL for display purposes. ** ** This routine automatically restricts srchFlag according to user ** permissions and the server configuration. The entry box is shown ** disabled if srchFlags is 0 after these restrictions are applied. ** ** If useYparam is true, then this routine also looks at the y= query ** parameter for further search restrictions. */ void search_screen(unsigned srchFlags, int useYparam){ const char *zType = 0; const char *zClass = 0; const char *zDisable1; const char *zDisable2; const char *zPattern; srchFlags = search_restrict(srchFlags); switch( srchFlags ){ case SRCH_CKIN: zType = " Check-ins"; zClass = "Ckin"; break; case SRCH_DOC: zType = " Docs"; zClass = "Doc"; break; case SRCH_TKT: zType = " Tickets"; zClass = "Tkt"; break; case SRCH_WIKI: zType = " Wiki"; zClass = "Wiki"; break; } if( srchFlags==0 ){ zDisable1 = " disabled"; zDisable2 = " disabled"; zPattern = ""; }else{ zDisable1 = " autofocus"; zDisable2 = ""; zPattern = PD("s",""); } @ <form method='GET' action='%R/%t(g.zPath)'> if( zClass ){ @ <div class='searchForm searchForm%s(zClass)'> }else{ @ <div class='searchForm'> } @ <input type="text" name="s" size="40" value="%h(zPattern)"%s(zDisable1)> if( useYparam && (srchFlags & (srchFlags-1))!=0 && useYparam ){ static const struct { char *z; char *zNm; unsigned m; } aY[] = { { "all", "All", SRCH_ALL }, { "c", "Check-ins", SRCH_CKIN }, { "d", "Docs", SRCH_DOC }, { "t", "Tickets", SRCH_TKT }, { "w", "Wiki", SRCH_WIKI }, }; const char *zY = PD("y","all"); unsigned newFlags = srchFlags; int i; @ <select size='1' name='y'> for(i=0; i<ArraySize(aY); i++){ if( (aY[i].m & srchFlags)==0 ) continue; cgi_printf("<option value='%s'", aY[i].z); if( fossil_strcmp(zY,aY[i].z)==0 ){ newFlags &= aY[i].m; cgi_printf(" selected"); } cgi_printf(">%s</option>\n", aY[i].zNm); } @ </select> srchFlags = newFlags; } @ <input type="submit" value="Search%s(zType)"%s(zDisable2)> if( srchFlags==0 ){ @ <p class="generalError">Search is disabled</p> } @ </div></form> while( fossil_isspace(zPattern[0]) ) zPattern++; if( zPattern[0] ){ |
︙ | ︙ | |||
935 936 937 938 939 940 941 | /* ** WEBPAGE: /search ** ** Search for check-in comments, documents, tickets, or wiki that ** match a user-supplied pattern. */ void search_page(void){ | < < < < < < < < < | | 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 | /* ** WEBPAGE: /search ** ** Search for check-in comments, documents, tickets, or wiki that ** match a user-supplied pattern. */ void search_page(void){ login_check_credentials(); style_header("Search"); search_screen(SRCH_ALL, 1); style_footer(); } /* ** This is a helper function for search_stext(). Writing into pOut ** the search text obtained from pIn according to zMimetype. |
︙ | ︙ | |||
1293 1294 1295 1296 1297 1298 1299 | " SELECT rowid, stext('c',rid,NULL) FROM ftsdocs" " WHERE type='c' AND NOT idxed;" ); db_multi_exec( "REPLACE INTO ftsdocs(rowid,idxed,type,rid,name,label,url,mtime)" " SELECT ftsdocs.rowid, 1, 'c', ftsdocs.rid, NULL," " printf('Check-in [%%.16s] on %%s',blob.uuid,datetime(event.mtime))," | | | 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 | " SELECT rowid, stext('c',rid,NULL) FROM ftsdocs" " WHERE type='c' AND NOT idxed;" ); db_multi_exec( "REPLACE INTO ftsdocs(rowid,idxed,type,rid,name,label,url,mtime)" " SELECT ftsdocs.rowid, 1, 'c', ftsdocs.rid, NULL," " printf('Check-in [%%.16s] on %%s',blob.uuid,datetime(event.mtime))," " printf('/timeline?y=ci&c=%%.20s',blob.uuid)," " event.mtime" " FROM ftsdocs, event, blob" " WHERE ftsdocs.type='c' AND NOT ftsdocs.idxed" " AND event.objid=ftsdocs.rid" " AND blob.rid=ftsdocs.rid" ); } |
︙ | ︙ |
Changes to src/setup.c.
︙ | ︙ | |||
1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 | @ </table> @ @ <p><form action="%s(g.zTop)/setup_login_group" method="post"><div> login_insert_csrf_secret(); @ To leave this login group press @ <input type="submit" value="Leave Login Group" name="leave"> @ </form></p> } style_footer(); } /* ** WEBPAGE: setup_timeline */ | > > > > > > > > > > > > > > > > > | 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 | @ </table> @ @ <p><form action="%s(g.zTop)/setup_login_group" method="post"><div> login_insert_csrf_secret(); @ To leave this login group press @ <input type="submit" value="Leave Login Group" name="leave"> @ </form></p> @ <hr><h2>Implementation Details</h2> @ <p>The following are fields from the CONFIG table related to login-groups, @ provided here for instructional and debugging purposes:</p> @ <table border='1' id='configTab'> @ <thead><tr><th>Config.Name<th>Config.Value<th>Config.mtime</tr></thead><tbody> db_prepare(&q, "SELECT name, value, datetime(mtime,'unixepoch') FROM config" " WHERE name GLOB 'peer-*'" " OR name GLOB 'project-*'" " ORDER BY name"); while( db_step(&q)==SQLITE_ROW ){ @ <tr><td>%h(db_column_text(&q,0))</td> @ <td>%h(db_column_text(&q,1))</td> @ <td>%h(db_column_text(&q,2))</td></tr> } db_finalize(&q); @ </tbody></table> output_table_sorting_javascript("configTab","ttt",1); } style_footer(); } /* ** WEBPAGE: setup_timeline */ |
︙ | ︙ |
Changes to src/sitemap.c.
︙ | ︙ | |||
42 43 44 45 46 47 48 | @ <li>%z(href("%R/tree?ci=trunk"))Tree-view, Trunk Checkin</a></li> @ <li>%z(href("%R/tree?type=flat"))Flat-view</a></li> @ <li>%z(href("%R/fileage?name=trunk"))File ages for Trunk</a></li> @ </ul> @ <li>%z(href("%R/timeline?n=200"))Project Timeline</a></li> @ <ul> @ <li>%z(href("%R/timeline?a=1970-01-01&y=ci&n=10"))First 10 checkins</a></li> | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | @ <li>%z(href("%R/tree?ci=trunk"))Tree-view, Trunk Checkin</a></li> @ <li>%z(href("%R/tree?type=flat"))Flat-view</a></li> @ <li>%z(href("%R/fileage?name=trunk"))File ages for Trunk</a></li> @ </ul> @ <li>%z(href("%R/timeline?n=200"))Project Timeline</a></li> @ <ul> @ <li>%z(href("%R/timeline?a=1970-01-01&y=ci&n=10"))First 10 checkins</a></li> @ <li>%z(href("%R/timeline?n=all&namechng"))All checkins with file name @ changes</a></li> @ <li>%z(href("%R/reports"))Activity Reports</a></li> @ </ul> @ <li>Branches and Tags</a> @ <ul> @ <li>%z(href("%R/brlist"))Branches</a></li> @ <li>%z(href("%R/leaves"))Leaf Checkins</a></li> |
︙ | ︙ |
Changes to src/style.c.
︙ | ︙ | |||
21 22 23 24 25 26 27 | #include "VERSION.h" #include "config.h" #include "style.h" /* ** Elements of the submenu are collected into the following | | > > | > > > > | > > | | | > > > > > > > > > > > > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #include "VERSION.h" #include "config.h" #include "style.h" /* ** Elements of the submenu are collected into the following ** structure and displayed below the main menu. ** ** Populate these structure with calls to ** ** style_submenu_element() ** style_submenu_entry() ** style_submenu_checkbox() ** style_submenu_multichoice() ** ** prior to calling style_footer(). The style_footer() routine ** will generate the appropriate HTML text just below the main ** menu. */ static struct Submenu { const char *zLabel; /* Button label */ const char *zTitle; const char *zLink; /* Jump to this link when button is pressed */ } aSubmenu[30]; static int nSubmenu = 0; /* Number of buttons */ static struct SubmenuCtrl { const char *zName; /* Form query parameter */ const char *zLabel; /* Label. Might be NULL for FF_MULTI */ int eType; /* FF_ENTRY, FF_CKBOX, FF_MULTI */ int iSize; /* Width for FF_ENTRY. Count for FF_MULTI */ const char **azChoice; /* value/display pairs for FF_MULTI */ const char *zFalse; /* FF_BINARY label when false */ } aSubmenuCtrl[20]; static int nSubmenuCtrl = 0; #define FF_ENTRY 1 #define FF_CKBOX 2 #define FF_MULTI 3 #define FF_BINARY 4 /* ** Remember that the header has been generated. The footer is omitted ** if an error occurs before the header. */ static int headerHasBeenGenerated = 0; |
︙ | ︙ | |||
214 215 216 217 218 219 220 | const char *zTitle, const char *zLink, ... ){ va_list ap; assert( nSubmenu < sizeof(aSubmenu)/sizeof(aSubmenu[0]) ); aSubmenu[nSubmenu].zLabel = zLabel; | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | const char *zTitle, const char *zLink, ... ){ va_list ap; assert( nSubmenu < sizeof(aSubmenu)/sizeof(aSubmenu[0]) ); aSubmenu[nSubmenu].zLabel = zLabel; aSubmenu[nSubmenu].zTitle = zTitle ? zTitle : zLabel; va_start(ap, zLink); aSubmenu[nSubmenu].zLink = vmprintf(zLink, ap); va_end(ap); nSubmenu++; } void style_submenu_entry( const char *zName, /* Query parameter name */ const char *zLabel, /* Label before the entry box */ int iSize /* Size of the entry box */ ){ assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) ); aSubmenuCtrl[nSubmenuCtrl].zName = zName; aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel; aSubmenuCtrl[nSubmenuCtrl].iSize = iSize; aSubmenuCtrl[nSubmenuCtrl].eType = FF_ENTRY; nSubmenuCtrl++; } void style_submenu_checkbox( const char *zName, /* Query parameter name */ const char *zLabel /* Label before the checkbox */ ){ assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) ); aSubmenuCtrl[nSubmenuCtrl].zName = zName; aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel; aSubmenuCtrl[nSubmenuCtrl].eType = FF_CKBOX; nSubmenuCtrl++; } void style_submenu_binary( const char *zName, /* Query parameter name */ const char *zTrue, /* Label to show when parameter is true */ const char *zFalse /* Label to show when the parameter is false */ ){ assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) ); aSubmenuCtrl[nSubmenuCtrl].zName = zName; aSubmenuCtrl[nSubmenuCtrl].zLabel = zTrue; aSubmenuCtrl[nSubmenuCtrl].zFalse = zFalse; aSubmenuCtrl[nSubmenuCtrl].eType = FF_BINARY; nSubmenuCtrl++; } void style_submenu_multichoice( const char *zName, /* Query parameter name */ int nChoice, /* Number of options */ const char **azChoice /* value/display pairs. 2*nChoice entries */ ){ assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) ); aSubmenuCtrl[nSubmenuCtrl].zName = zName; aSubmenuCtrl[nSubmenuCtrl].iSize = nChoice; aSubmenuCtrl[nSubmenuCtrl].azChoice = azChoice; aSubmenuCtrl[nSubmenuCtrl].eType = FF_MULTI; nSubmenuCtrl++; } /* ** Compare two submenu items for sorting purposes */ static int submenuCompare(const void *a, const void *b){ const struct Submenu *A = (const struct Submenu*)a; const struct Submenu *B = (const struct Submenu*)b; |
︙ | ︙ | |||
409 410 411 412 413 414 415 | if( !headerHasBeenGenerated ) return; /* Go back and put the submenu at the top of the page. We delay the ** creation of the submenu until the end so that we can add elements ** to the submenu while generating page text. */ cgi_destination(CGI_HEADER); | | > > > > | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | if( !headerHasBeenGenerated ) return; /* Go back and put the submenu at the top of the page. We delay the ** creation of the submenu until the end so that we can add elements ** to the submenu while generating page text. */ cgi_destination(CGI_HEADER); if( nSubmenu+nSubmenuCtrl>0 ){ int i; if( nSubmenuCtrl ){ cgi_printf("<form id='f01' method='GET' action='%R/%s'>", g.zPath); } @ <div class="submenu"> if( nSubmenu>0 ){ qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare); for(i=0; i<nSubmenu; i++){ struct Submenu *p = &aSubmenu[i]; if( p->zLink==0 ){ @ <span class="label">%h(p->zLabel)</span> }else{ @ <a class="label" href="%h(p->zLink)">%h(p->zLabel)</a> } } } if( nSubmenuCtrl>0 ){ for(i=0; i<nSubmenuCtrl; i++){ const char *zQPN = aSubmenuCtrl[i].zName; cgi_tag_query_parameter(zQPN); switch( aSubmenuCtrl[i].eType ){ case FF_ENTRY: { cgi_printf( "<span class='submenuctrl'>" "%h: <input type='text' name='%s' size='%d' " "value='%h'></span>\n", aSubmenuCtrl[i].zLabel, zQPN, aSubmenuCtrl[i].iSize, PD(zQPN,"") ); break; } case FF_CKBOX: { cgi_printf( "<span class='submenuctrl'>" "%h: <input type='checkbox' name='%s'%s " "onchange='gebi(\"f01\").submit();'></span>\n", aSubmenuCtrl[i].zLabel, zQPN, PB(zQPN) ? " checked":"" ); break; } case FF_MULTI: { int j; const char *zVal = P(zQPN); cgi_printf( "<select class='submenuctrl' size='1' name='%s' " "onchange='gebi(\"f01\").submit();'>\n", zQPN ); for(j=0; j<aSubmenuCtrl[i].iSize*2; j+=2){ const char *zQPV = aSubmenuCtrl[i].azChoice[j]; cgi_printf( "<option value='%h'%s>%h</option>\n", zQPV, fossil_strcmp(zVal,zQPV)==0 ? " selected" : "", aSubmenuCtrl[i].azChoice[j+1] ); } @ </select> break; } case FF_BINARY: { int isTrue = PB(zQPN); cgi_printf( "<select class='submenuctrl' size='1' name='%s' " "onchange='gebi(\"f01\").submit();'>\n", zQPN ); cgi_printf( "<option value='1'%s>%h</option>\n", isTrue ? " selected":"", aSubmenuCtrl[i].zLabel ); cgi_printf( "<option value='0'%s>%h</option>\n", (!isTrue) ? " selected":"", aSubmenuCtrl[i].zFalse ); @ </select> break; } } } } @ </div> if( nSubmenuCtrl ){ cgi_query_parameters_to_hidden(); cgi_tag_query_parameter(0); @ </form> } } zAd = style_adunit_text(&mAdFlags); if( (mAdFlags & ADUNIT_RIGHT_OK)!=0 ){ @ <div class="content adunit_right_container"> @ <div class="adunit_right"> cgi_append_content(zAd, -1); |
︙ | ︙ | |||
1244 1245 1246 1247 1248 1249 1250 | login_needed(); return; } for(i=0; i<count(azCgiVars); i++) (void)P(azCgiVars[i]); style_header("Environment Test"); showAll = atoi(PD("showall","0")); if( !showAll ){ | | < | < > | 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 | login_needed(); return; } for(i=0; i<count(azCgiVars); i++) (void)P(azCgiVars[i]); style_header("Environment Test"); showAll = atoi(PD("showall","0")); if( !showAll ){ style_submenu_element("Show Cookies", 0, "%R/test_env?showall=1"); }else{ style_submenu_element("Hide Cookies", 0, "%R/test_env"); } #if !defined(_WIN32) @ uid=%d(getuid()), gid=%d(getgid())<br /> #endif @ g.zBaseURL = %h(g.zBaseURL)<br /> @ g.zHttpsURL = %h(g.zHttpsURL)<br /> @ g.zTop = %h(g.zTop)<br /> @ g.zPath = %h(g.zPath)<br /> for(i=0, c='a'; c<='z'; c++){ if( login_has_capability(&c, 1) ) zCap[i++] = c; } zCap[i] = 0; @ g.userUid = %d(g.userUid)<br /> @ g.zLogin = %h(g.zLogin)<br /> @ g.isHuman = %d(g.isHuman)<br /> |
︙ | ︙ |
Changes to src/th_main.c.
︙ | ︙ | |||
363 364 365 366 367 368 369 370 371 372 373 374 375 376 | } if( g.thTrace ){ Th_Trace("[hascap %#h] => %d<br />\n", argl[1], argv[1], rc); } Th_SetResultInt(interp, rc); return TH_OK; } /* ** TH1 command: hasfeature STRING ** ** Return true if the fossil binary has the given compile-time feature ** enabled. The set of features includes: ** | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | } if( g.thTrace ){ Th_Trace("[hascap %#h] => %d<br />\n", argl[1], argv[1], rc); } Th_SetResultInt(interp, rc); return TH_OK; } /* ** TH1 command: searchable STRING... ** ** Return true if searching in any of the document classes identified ** by STRING is enabled for the repository and user has the necessary ** capabilities to perform the search. ** ** Document classes: ** ** c Check-in comments ** d Embedded documentation ** t Tickets ** w Wiki ** ** To be clear, only one of the document classes identified by each STRING ** needs to be searchable in order for that argument to be true. But ** all arguments must be true for this routine to return true. Hence, to ** see if ALL document classes are searchable: ** ** if {[searchable c d t w]} {...} ** ** But to see if ANY document class is searchable: ** ** if {[searchable cdtw]} {...} ** ** This command is useful for enabling or disabling a "Search" entry ** on the menu bar. */ static int searchableCmd( Th_Interp *interp, void *p, int argc, const char **argv, int *argl ){ int rc = 1, i, j; unsigned int searchCap = search_restrict(SRCH_ALL); if( argc<2 ){ return Th_WrongNumArgs(interp, "hascap STRING ..."); } for(i=1; i<argc && rc; i++){ int match = 0; for(j=0; j<argl[i]; j++){ switch( argv[i][j] ){ case 'c': match |= searchCap & SRCH_CKIN; break; case 'd': match |= searchCap & SRCH_DOC; break; case 't': match |= searchCap & SRCH_TKT; break; case 'w': match |= searchCap & SRCH_WIKI; break; } } if( !match ) rc = 0; } if( g.thTrace ){ Th_Trace("[searchable %#h] => %d<br />\n", argl[1], argv[1], rc); } Th_SetResultInt(interp, rc); return TH_OK; } /* ** TH1 command: hasfeature STRING ** ** Return true if the fossil binary has the given compile-time feature ** enabled. The set of features includes: ** |
︙ | ︙ | |||
1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 | {"puts", putsCmd, (void*)&aFlags[1]}, {"query", queryCmd, 0}, {"randhex", randhexCmd, 0}, {"regexp", regexpCmd, 0}, {"reinitialize", reinitializeCmd, 0}, {"render", renderCmd, 0}, {"repository", repositoryCmd, 0}, {"setParameter", setParameterCmd, 0}, {"setting", settingCmd, 0}, {"styleHeader", styleHeaderCmd, 0}, {"styleFooter", styleFooterCmd, 0}, {"tclReady", tclReadyCmd, 0}, {"trace", traceCmd, 0}, {"stime", stimeCmd, 0}, | > | 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 | {"puts", putsCmd, (void*)&aFlags[1]}, {"query", queryCmd, 0}, {"randhex", randhexCmd, 0}, {"regexp", regexpCmd, 0}, {"reinitialize", reinitializeCmd, 0}, {"render", renderCmd, 0}, {"repository", repositoryCmd, 0}, {"searchable", searchableCmd, 0}, {"setParameter", setParameterCmd, 0}, {"setting", settingCmd, 0}, {"styleHeader", styleHeaderCmd, 0}, {"styleFooter", styleFooterCmd, 0}, {"tclReady", tclReadyCmd, 0}, {"trace", traceCmd, 0}, {"stime", stimeCmd, 0}, |
︙ | ︙ |
Changes to src/timeline.c.
︙ | ︙ | |||
492 493 494 495 496 497 498 499 500 501 502 503 504 505 | " (SELECT uuid FROM blob WHERE rid=fid)," " (SELECT uuid FROM blob WHERE rid=pid)," " (SELECT name FROM filename WHERE fnid=mlink.pfnid) AS oldnm" " FROM mlink" " WHERE mid=:mid AND (pid!=fid OR pfnid>0)" " AND (fid>0 OR" " fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=:mid))" " ORDER BY 3 /*sort*/" ); fchngQueryInit = 1; } db_bind_int(&fchngQuery, ":mid", rid); while( db_step(&fchngQuery)==SQLITE_ROW ){ const char *zFilename = db_column_text(&fchngQuery, 2); | > | 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | " (SELECT uuid FROM blob WHERE rid=fid)," " (SELECT uuid FROM blob WHERE rid=pid)," " (SELECT name FROM filename WHERE fnid=mlink.pfnid) AS oldnm" " FROM mlink" " WHERE mid=:mid AND (pid!=fid OR pfnid>0)" " AND (fid>0 OR" " fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=:mid))" " AND NOT mlink.isaux" " ORDER BY 3 /*sort*/" ); fchngQueryInit = 1; } db_bind_int(&fchngQuery, ":mid", rid); while( db_step(&fchngQuery)==SQLITE_ROW ){ const char *zFilename = db_column_text(&fchngQuery, 2); |
︙ | ︙ | |||
664 665 666 667 668 669 670 | } } if( cSep=='[' ) cgi_printf("["); cgi_printf("],h:\"%s\"}%s", pRow->zUuid, pRow->pNext ? ",\n" : "];\n"); } cgi_printf("var nrail = %d\n", pGraph->mxRail+1); graph_free(pGraph); | | | | | | | | | 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | } } if( cSep=='[' ) cgi_printf("["); cgi_printf("],h:\"%s\"}%s", pRow->zUuid, pRow->pNext ? ",\n" : "];\n"); } cgi_printf("var nrail = %d\n", pGraph->mxRail+1); graph_free(pGraph); @ var cDiv = gebi("canvas"); @ var csty = window.getComputedStyle && window.getComputedStyle(cDiv,null); @ var lineClr = (csty && csty.getPropertyValue('color')) || 'black'; @ var bgClr = (csty && csty.getPropertyValue('background-color')) ||'white'; @ if( bgClr=='transparent' ) bgClr = 'white'; @ var boxColor = lineClr; @ function drawBox(color,x0,y0,x1,y1){ @ var n = document.createElement("div"); @ if( x0>x1 ){ var t=x0; x0=x1; x1=t; } @ if( y0>y1 ){ var t=y0; y0=y1; y1=t; } @ var w = x1-x0+1; @ var h = y1-y0+1; @ n.style.position = "absolute"; @ n.style.overflow = "hidden"; @ n.style.left = x0+"px"; @ n.style.top = y0+"px"; @ n.style.width = w+"px"; @ n.style.height = h+"px"; @ n.style.backgroundColor = color; @ cDiv.appendChild(n); @ return n; @ } @ function absoluteY(id){ @ var obj = gebi(id); @ if( !obj ) return; @ var top = 0; @ if( obj.offsetParent ){ |
︙ | ︙ | |||
709 710 711 712 713 714 715 | @ do{ @ left += obj.offsetLeft; @ }while( obj = obj.offsetParent ); @ } @ return left; @ } @ function drawUpArrow(x,y0,y1){ | | | | | | | | | | | | | | | 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | @ do{ @ left += obj.offsetLeft; @ }while( obj = obj.offsetParent ); @ } @ return left; @ } @ function drawUpArrow(x,y0,y1){ @ drawBox(lineClr,x,y0,x+1,y1); @ if( y0+10>=y1 ){ @ drawBox(lineClr,x-1,y0+1,x+2,y0+2); @ drawBox(lineClr,x-2,y0+3,x+3,y0+4); @ }else{ @ drawBox(lineClr,x-1,y0+2,x+2,y0+4); @ drawBox(lineClr,x-2,y0+5,x+3,y0+7); @ } @ } @ function drawThinArrow(y,xFrom,xTo){ @ if( xFrom<xTo ){ @ drawBox(lineClr,xFrom,y,xTo,y); @ drawBox(lineClr,xTo-3,y-1,xTo-2,y+1); @ drawBox(lineClr,xTo-4,y-2,xTo-4,y+2); @ }else{ @ drawBox(lineClr,xTo,y,xFrom,y); @ drawBox(lineClr,xTo+2,y-1,xTo+3,y+1); @ drawBox(lineClr,xTo+4,y-2,xTo+4,y+2); @ } @ } @ function drawThinLine(x0,y0,x1,y1){ @ drawBox(lineClr,x0,y0,x1,y1); @ } @ function drawNodeBox(color,x0,y0,x1,y1){ @ drawBox(color,x0,y0,x1,y1).style.cursor = "pointer"; @ } @ function drawNode(p, left, btm){ @ drawNodeBox(boxColor,p.x-5,p.y-5,p.x+6,p.y+6); @ drawNodeBox(p.bg||bgClr,p.x-4,p.y-4,p.x+5,p.y+5); @ if( p.u>0 ) drawUpArrow(p.x, rowinfo[p.u-1].y+6, p.y-5); @ if( p.f&1 ) drawNodeBox(boxColor,p.x-1,p.y-1,p.x+2,p.y+2); if( !omitDescenders ){ @ if( p.u==0 ) drawUpArrow(p.x, 0, p.y-5); @ if( p.d ) drawUpArrow(p.x, p.y+6, btm); } @ if( p.mo>0 ){ |
︙ | ︙ | |||
763 764 765 766 767 768 769 | @ } @ var n = p.au.length; @ for(var i=0; i<n; i+=2){ @ var x1 = p.au[i]*railPitch + left; @ var x0 = x1>p.x ? p.x+7 : p.x-6; @ var u = rowinfo[p.au[i+1]-1]; @ if(u.id<p.id){ | | | 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | @ } @ var n = p.au.length; @ for(var i=0; i<n; i+=2){ @ var x1 = p.au[i]*railPitch + left; @ var x0 = x1>p.x ? p.x+7 : p.x-6; @ var u = rowinfo[p.au[i+1]-1]; @ if(u.id<p.id){ @ drawBox(lineClr,x0,p.y,x1,p.y+1); @ drawUpArrow(x1, u.y+6, p.y); @ }else{ @ drawBox("#600000",x0,p.y,x1,p.y+1); @ drawBox("#600000",x1-1,p.y,x1,u.y+1); @ drawBox("#600000",x1,u.y,u.x-6,u.y+1); @ drawBox("#600000",u.x-9,u.y-1,u.x-8,u.y+2); @ drawBox("#600000",u.x-11,u.y-2,u.x-10,u.y+3); |
︙ | ︙ | |||
950 951 952 953 954 955 956 | double mtime; int rid; if( z==0 ) return -1.0; if( fossil_isdate(z) ){ mtime = db_double(0.0, "SELECT julianday(%Q,'utc')", z); if( mtime>0.0 ) return mtime; } | | | | > > > > > > > > > | 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | double mtime; int rid; if( z==0 ) return -1.0; if( fossil_isdate(z) ){ mtime = db_double(0.0, "SELECT julianday(%Q,'utc')", z); if( mtime>0.0 ) return mtime; } rid = symbolic_name_to_rid(z, "*"); if( rid ){ mtime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); }else{ mtime = db_double(-1.0, "SELECT max(event.mtime) FROM event, tag, tagxref" " WHERE tag.tagname GLOB 'event-%q*'" " AND tagxref.tagid=tag.tagid AND tagxref.tagtype" " AND event.objid=tagxref.rid", z ); } return mtime; } /* ** The value of one second in julianday notation */ #define ONE_SECOND (1.0/86400.0) |
︙ | ︙ | |||
1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 | href("%R/finfo?name=%t", zFN), zFN); zSep = " or "; } db_finalize(&q); return blob_str(&out); } /* ** WEBPAGE: timeline ** ** Query parameters: ** ** a=TIMEORTAG after this event | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 | href("%R/finfo?name=%t", zFN), zFN); zSep = " or "; } db_finalize(&q); return blob_str(&out); } /* ** Add the select/option box to the timeline submenu that is used to ** set the y= parameter that determines which elements to display ** on the timeline. */ static void timeline_y_submenu(void){ static int i = 0; static const char *az[12]; if( i==0 ){ az[0] = "all"; az[1] = "All Types"; i = 2; if( g.perm.Read ){ az[i++] = "ci"; az[i++] = "Check-ins"; az[i++] = "g"; az[i++] = "Tags"; } if( g.perm.RdWiki ){ az[i++] = "e"; az[i++] = "Tech Notes"; } if( g.perm.RdTkt ){ az[i++] = "t"; az[i++] = "Tickets"; } if( g.perm.RdWiki ){ az[i++] = "w"; az[i++] = "Wiki"; } assert( i<=ArraySize(az) ); } if( i>2 ){ style_submenu_multichoice("y", i/2, az); } } /* ** WEBPAGE: timeline ** ** Query parameters: ** ** a=TIMEORTAG after this event |
︙ | ︙ | |||
1053 1054 1055 1056 1057 1058 1059 | ** ** If n= is missing, the default count is 20. */ void page_timeline(void){ Stmt q; /* Query used to generate the timeline */ Blob sql; /* text of SQL used to generate timeline */ Blob desc; /* Description of the timeline */ | | | > > > > > > > > > > > > > > > > > > > > > > > < | < | < | < | < < | 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 | ** ** If n= is missing, the default count is 20. */ void page_timeline(void){ Stmt q; /* Query used to generate the timeline */ Blob sql; /* text of SQL used to generate timeline */ Blob desc; /* Description of the timeline */ int nEntry; /* Max number of entries on timeline */ int p_rid = name_to_typed_rid(P("p"),"ci"); /* artifact p and its parents */ int d_rid = name_to_typed_rid(P("d"),"ci"); /* artifact d and descendants */ int f_rid = name_to_typed_rid(P("f"),"ci"); /* artifact f and close family */ const char *zUser = P("u"); /* All entries by this user if not NULL */ const char *zType = PD("y","all"); /* Type of events. All if NULL */ const char *zAfter = P("a"); /* Events after this time */ const char *zBefore = P("b"); /* Events before this time */ const char *zCirca = P("c"); /* Events near this time */ const char *zTagName = P("t"); /* Show events with this tag */ const char *zBrName = P("r"); /* Show events related to this tag */ const char *zSearch = P("s"); /* Search string */ const char *zUses = P("uf"); /* Only show checkins hold this file */ const char *zYearMonth = P("ym"); /* Show checkins for the given YYYY-MM */ const char *zYearWeek = P("yw"); /* Checkins for YYYY-WW (week-of-year) */ int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */ int renameOnly = P("namechng")!=0; /* Show only checkins that rename files */ int tagid; /* Tag ID */ int tmFlags = 0; /* Timeline flags */ const char *zThisTag = 0; /* Suppress links to this tag */ const char *zThisUser = 0; /* Suppress links to this user */ HQuery url; /* URL for various branch links */ int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */ int to_rid = name_to_typed_rid(P("to"),"ci"); /* to= for path timelines */ int noMerge = P("shortest")==0; /* Follow merge links if shorter */ int me_rid = name_to_typed_rid(P("me"),"ci"); /* me= for common ancestory */ int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */ int pd_rid; double rBefore, rAfter, rCirca; /* Boundary times */ const char *z; char *zOlderButton = 0; /* URL for Older button at the bottom */ /* Set number of rows to display */ z = P("n"); if( z ){ if( fossil_strcmp(z,"all")==0 ){ nEntry = 0; }else{ nEntry = atoi(z); if( nEntry<=0 ){ cgi_replace_query_parameter("n","10"); nEntry = 10; } } }else if( zCirca ){ cgi_replace_query_parameter("n","11"); nEntry = 11; }else{ cgi_replace_query_parameter("n","50"); nEntry = 50; } /* To view the timeline, must have permission to read project data. */ pd_rid = name_to_typed_rid(P("dp"),"ci"); if( pd_rid ){ p_rid = d_rid = pd_rid; } login_check_credentials(); if( !g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki ){ login_needed(); return; } url_initialize(&url, "timeline"); cgi_query_parameters_to_url(&url); if( zTagName && g.perm.Read ){ tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTagName); zThisTag = zTagName; }else if( zBrName && g.perm.Read ){ tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'",zBrName); zThisTag = zBrName; }else{ tagid = 0; } if( tagid>0 && db_int(0,"SELECT count(*) FROM tagxref WHERE tagid=%d",tagid)<=nEntry ){ zCirca = zBefore = zAfter = 0; nEntry = -1; } if( zType[0]=='a' ){ tmFlags |= TIMELINE_BRIEF | TIMELINE_GRAPH; }else{ tmFlags |= TIMELINE_GRAPH; } if( PB("ng") || zSearch!=0 ){ tmFlags &= ~TIMELINE_GRAPH; } if( PB("brbg") ){ tmFlags |= TIMELINE_BRCOLOR; } if( PB("unhide") ){ tmFlags |= TIMELINE_UNHIDE; } if( PB("ubg") ){ tmFlags |= TIMELINE_UCOLOR; } if( zUses!=0 ){ int ufid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%q*'", zUses); if( ufid ){ zUses = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ufid); db_multi_exec("CREATE TEMP TABLE usesfile(rid INTEGER PRIMARY KEY)"); compute_uses_file("usesfile", ufid, 0); zType = "ci"; }else{ zUses = 0; } } |
︙ | ︙ | |||
1159 1160 1161 1162 1163 1164 1165 | style_header("Timeline"); login_anonymous_available(); timeline_temp_table(); blob_zero(&sql); blob_zero(&desc); blob_append(&sql, "INSERT OR IGNORE INTO timeline ", -1); blob_append(&sql, timeline_query_for_www(), -1); | | < < | 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 | style_header("Timeline"); login_anonymous_available(); timeline_temp_table(); blob_zero(&sql); blob_zero(&desc); blob_append(&sql, "INSERT OR IGNORE INTO timeline ", -1); blob_append(&sql, timeline_query_for_www(), -1); if( PB("fc") || PB("v") || PB("detail") ){ tmFlags |= TIMELINE_FCHANGES; } if( (tmFlags & TIMELINE_UNHIDE)==0 ){ blob_append_sql(&sql, " AND NOT EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)", TAG_HIDDEN ); } if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.perm.Read ){ /* If from= and to= are present, display all nodes on a path connecting ** the two */ PathNode *p = 0; const char *zFrom = 0; const char *zTo = 0; |
︙ | ︙ | |||
1239 1240 1241 1242 1243 1244 1245 | blob_appendf(&desc, "%d ancestors", np); db_multi_exec("%s", blob_sql_text(&sql)); } if( d_rid==0 && useDividers ) timeline_add_dividers(0, p_rid); } blob_appendf(&desc, " of %z[%S]</a>", href("%R/info/%s", zUuid), zUuid); | < < < < < | < < | < < | < < < < < < < < | < < < | 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 | blob_appendf(&desc, "%d ancestors", np); db_multi_exec("%s", blob_sql_text(&sql)); } if( d_rid==0 && useDividers ) timeline_add_dividers(0, p_rid); } blob_appendf(&desc, " of %z[%S]</a>", href("%R/info/%s", zUuid), zUuid); if( d_rid ){ if( p_rid ){ /* If both p= and d= are set, we don't have the uuid of d yet. */ zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", d_rid); } } style_submenu_binary("v","With Files","Without Files"); style_submenu_entry("n","Lines",1); timeline_y_submenu(); }else if( f_rid && g.perm.Read ){ /* If f= is present, ignore all other parameters other than n= */ char *zUuid; db_multi_exec( "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);" "INSERT INTO ok VALUES(%d);" "INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;" "INSERT OR IGNORE INTO ok SELECT cid FROM plink WHERE pid=%d;", f_rid, f_rid, f_rid ); blob_append_sql(&sql, " AND event.objid IN ok"); db_multi_exec("%s", blob_sql_text(&sql)); if( useDividers ) timeline_add_dividers(0, f_rid); blob_appendf(&desc, "Parents and children of check-in "); zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid); blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%s", zUuid), zUuid); tmFlags |= TIMELINE_DISJOINT; style_submenu_binary("v","With Files","Without Files"); if( (tmFlags & TIMELINE_UNHIDE)==0 ){ timeline_submenu(&url, "Unhide", "unhide", "", 0); } }else{ /* Otherwise, a timeline based on a span of time */ int n; const char *zEType = "timeline item"; |
︙ | ︙ | |||
1314 1315 1316 1317 1318 1319 1320 | } if( tagid>0 ){ blob_append_sql(&sql, "AND (EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)", tagid); if( zBrName ){ | < | 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 | } if( tagid>0 ){ blob_append_sql(&sql, "AND (EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)", tagid); if( zBrName ){ /* The next two blob_appendf() calls add SQL that causes checkins that ** are not part of the branch which are parents or children of the ** branch to be included in the report. This related check-ins are ** useful in helping to visualize what has happened on a quiescent ** branch that is infrequently merged with a much more activate branch. */ blob_append_sql(&sql, |
︙ | ︙ | |||
1346 1347 1348 1349 1350 1351 1352 | if( (tmFlags & TIMELINE_UNHIDE)==0 ){ blob_append_sql(&sql, " AND NOT EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=pid" " WHERE tagid=%d AND tagtype>0 AND cid=blob.rid)", TAG_HIDDEN ); } | < < < < | 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 | if( (tmFlags & TIMELINE_UNHIDE)==0 ){ blob_append_sql(&sql, " AND NOT EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=pid" " WHERE tagid=%d AND tagtype>0 AND cid=blob.rid)", TAG_HIDDEN ); } } } blob_append_sql(&sql, ")"); } if( (zType[0]=='w' && !g.perm.RdWiki) || (zType[0]=='t' && !g.perm.RdTkt) || (zType[0]=='e' && !g.perm.RdWiki) || (zType[0]=='c' && !g.perm.Read) |
︙ | ︙ | |||
1382 1383 1384 1385 1386 1387 1388 | blob_append_sql(&sql, "%c't'", cSep); cSep = ','; } blob_append_sql(&sql, ")"); } }else{ /* zType!="all" */ blob_append_sql(&sql, " AND event.type=%Q", zType); | < | 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 | blob_append_sql(&sql, "%c't'", cSep); cSep = ','; } blob_append_sql(&sql, ")"); } }else{ /* zType!="all" */ blob_append_sql(&sql, " AND event.type=%Q", zType); if( zType[0]=='c' ){ zEType = "checkin"; }else if( zType[0]=='w' ){ zEType = "wiki edit"; }else if( zType[0]=='t' ){ zEType = "ticket change"; }else if( zType[0]=='e' ){ |
︙ | ︙ | |||
1404 1405 1406 1407 1408 1409 1410 | " WHERE user=%Q OR euser=%Q", zUser, zUser); if( n<=nEntry ){ zCirca = zBefore = zAfter = 0; nEntry = -1; } blob_append_sql(&sql, " AND (event.user=%Q OR event.euser=%Q)", zUser, zUser); | < < < < < < < | 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 | " WHERE user=%Q OR euser=%Q", zUser, zUser); if( n<=nEntry ){ zCirca = zBefore = zAfter = 0; nEntry = -1; } blob_append_sql(&sql, " AND (event.user=%Q OR event.euser=%Q)", zUser, zUser); zThisUser = zUser; } if( zSearch ){ blob_append_sql(&sql, " AND (event.comment LIKE '%%%q%%' OR event.brief LIKE '%%%q%%')", zSearch, zSearch); } rBefore = symbolic_name_to_mtime(zBefore); rAfter = symbolic_name_to_mtime(zAfter); rCirca = symbolic_name_to_mtime(zCirca); if( rAfter>0.0 ){ if( rBefore>0.0 ){ blob_append_sql(&sql, " AND event.mtime>=%.17g AND event.mtime<=%.17g" " ORDER BY event.mtime ASC", rAfter-ONE_SECOND, rBefore+ONE_SECOND); nEntry = -1; }else{ blob_append_sql(&sql, " AND event.mtime>=%.17g ORDER BY event.mtime ASC", rAfter-ONE_SECOND); } }else if( rBefore>0.0 ){ blob_append_sql(&sql, " AND event.mtime<=%.17g ORDER BY event.mtime DESC", rBefore+ONE_SECOND); }else if( rCirca>0.0 ){ Blob sql2; blob_init(&sql2, blob_sql_text(&sql), -1); blob_append_sql(&sql2, " AND event.mtime<=%f ORDER BY event.mtime DESC LIMIT %d", rCirca, (nEntry+1)/2 ); db_multi_exec("%s", blob_sql_text(&sql2)); blob_reset(&sql2); blob_append_sql(&sql, " AND event.mtime>=%f ORDER BY event.mtime ASC", rCirca ); nEntry -= (nEntry+1)/2; if( useDividers ) timeline_add_dividers(rCirca, 0); }else{ blob_append_sql(&sql, " ORDER BY event.mtime DESC"); } if( nEntry>0 ) blob_append_sql(&sql, " LIMIT %d", nEntry); db_multi_exec("%s", blob_sql_text(&sql)); n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/"); |
︙ | ︙ | |||
1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 | if( zSearch ){ blob_appendf(&desc, " matching \"%h\"", zSearch); } if( g.perm.Hyperlink ){ if( zAfter || n==nEntry ){ zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/"); timeline_submenu(&url, "Older", "b", zDate, "a"); free(zDate); } if( zBefore || (zAfter && n==nEntry) ){ zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/"); timeline_submenu(&url, "Newer", "a", zDate, "b"); free(zDate); | > < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < > > > > > > > > > | 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 | if( zSearch ){ blob_appendf(&desc, " matching \"%h\"", zSearch); } if( g.perm.Hyperlink ){ if( zAfter || n==nEntry ){ zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/"); timeline_submenu(&url, "Older", "b", zDate, "a"); zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "a", 0)); free(zDate); } if( zBefore || (zAfter && n==nEntry) ){ zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/"); timeline_submenu(&url, "Newer", "a", zDate, "b"); free(zDate); } if( zType[0]=='a' || zType[0]=='c' ){ if( (tmFlags & TIMELINE_UNHIDE)==0 ){ timeline_submenu(&url, "Unhide", "unhide", "", 0); } } style_submenu_binary("v","With Files","Without Files"); if( zUses==0 ) timeline_y_submenu(); style_submenu_entry("n","Lines",1); } } if( P("showsql") ){ @ <blockquote>%h(blob_sql_text(&sql))</blockquote> } if( search_restrict(SRCH_CKIN)!=0 ){ style_submenu_element("Search", 0, "%R/search?y=c"); } if( P("showid") ) tmFlags |= TIMELINE_SHOWRID; blob_zero(&sql); db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/"); @ <h2>%b(&desc)</h2> blob_reset(&desc); www_print_timeline(&q, tmFlags, zThisUser, zThisTag, 0); db_finalize(&q); if( zOlderButton ){ @ %z(xhref("class='button'","%z",zOlderButton))Older</a> } style_footer(); } /* ** The input query q selects various records. Print a human-readable ** summary of those records. ** |
︙ | ︙ | |||
2039 2040 2041 2042 2043 2044 2045 | " FROM plink p, plink c, blob" " WHERE p.cid=c.pid AND p.mtime>c.mtime" " AND blob.rid=c.cid" ); while( db_step(&q)==SQLITE_ROW ){ const char *zUuid = db_column_text(&q, 0); @ <li> | | | 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 | " FROM plink p, plink c, blob" " WHERE p.cid=c.pid AND p.mtime>c.mtime" " AND blob.rid=c.cid" ); while( db_step(&q)==SQLITE_ROW ){ const char *zUuid = db_column_text(&q, 0); @ <li> @ <a href="%s(g.zTop)/timeline?dp=%s(zUuid)&unhide">%S(zUuid)</a> } db_finalize(&q); style_footer(); } |
Changes to src/tkt.c.
︙ | ︙ | |||
1432 1433 1434 1435 1436 1437 1438 | ** ** Full-text search of all current tickets */ void tkt_srchpage(void){ login_check_credentials(); style_header("Ticket Search"); ticket_standard_submenu(T_ALL_BUT(T_SRCH)); | | | 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 | ** ** Full-text search of all current tickets */ void tkt_srchpage(void){ login_check_credentials(); style_header("Ticket Search"); ticket_standard_submenu(T_ALL_BUT(T_SRCH)); search_screen(SRCH_TKT, 0); style_footer(); } |
Changes to src/url.c.
︙ | ︙ | |||
430 431 432 433 434 435 436 | #if INTERFACE /* ** An instance of this object is used to build a URL with query parameters. */ struct HQuery { Blob url; /* The URL */ const char *zBase; /* The base URL */ | | > | | > < > > > | > | > > > > > > > > > | | > > > | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | #if INTERFACE /* ** An instance of this object is used to build a URL with query parameters. */ struct HQuery { Blob url; /* The URL */ const char *zBase; /* The base URL */ int nParam; /* Number of parameters. */ int nAlloc; /* Number of allocated slots */ const char **azName; /* Parameter names */ const char **azValue; /* Parameter values */ }; #endif /* ** Initialize the URL object. */ void url_initialize(HQuery *p, const char *zBase){ memset(p, 0, sizeof(*p)); blob_zero(&p->url); p->zBase = zBase; } /* ** Resets the given URL object, deallocating any memory ** it uses. */ void url_reset(HQuery *p){ blob_reset(&p->url); fossil_free(p->azName); fossil_free(p->azValue); url_initialize(p, p->zBase); } /* ** Add a fixed parameter to an HQuery. */ void url_add_parameter(HQuery *p, const char *zName, const char *zValue){ int i; for(i=0; i<p->nParam; i++){ if( fossil_strcmp(p->azName[i],zName)==0 ){ p->azValue[i] = zValue; return; } } assert( i==p->nParam ); if( i>=p->nAlloc ){ p->nAlloc = p->nAlloc*2 + 10; p->azName = fossil_realloc(p->azName, sizeof(p->azName[0])*p->nAlloc); p->azValue = fossil_realloc(p->azValue, sizeof(p->azValue[0])*p->nAlloc); } p->azName[i] = zName; p->azValue[i] = zValue; p->nParam++; } /* ** Render the URL with a parameter override. ** ** Returned memory is transient and is overwritten on the next call to this ** routine for the same HQuery, or until the HQuery object is destroyed. */ char *url_render( HQuery *p, /* Base URL */ const char *zName1, /* First override */ const char *zValue1, /* First override value */ const char *zName2, /* Second override */ const char *zValue2 /* Second override value */ |
︙ | ︙ |
Changes to src/wiki.c.
︙ | ︙ | |||
289 290 291 292 293 294 295 | ** ** Full-text search of all current wiki text */ void wiki_srchpage(void){ login_check_credentials(); style_header("Wiki Search"); wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX); | | | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | ** ** Full-text search of all current wiki text */ void wiki_srchpage(void){ login_check_credentials(); style_header("Wiki Search"); wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX); search_screen(SRCH_WIKI, 0); style_footer(); } /* ** WEBPAGE: wiki ** URL: /wiki?name=PAGENAME */ |
︙ | ︙ |