/* ** Copyright (c) 2014 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) ** This program is distributed in the hope that it will be useful, ** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file contains code to implement the sitemap webpage. */ #include "config.h" #include "sitemap.h" #include /* ** WEBPAGE: sitemap ** ** List some of the web pages offered by the Fossil web engine. This ** page is intended as a supplement to the menu bar on the main screen. ** That is, this page is designed to hold links that are omitted from ** the main menu due to lack of space. ** ** Additional entries defined by the "sitemap-extra" setting are included ** in the sitemap. "sitemap-extra" should be a TCL script with three ** values per entry: ** ** * The displayed text ** ** * The URL ** ** * A "capexpr" expression that determines whether or not to include ** the entry based on user capabilities. "*" means always include ** the entry and "{}" means never. ** ** If the "e=1" query parameter is present, then the standard content ** is omitted and only the sitemap-extra content is shown. If "e=2" is ** present, then only the standard content is shown and sitemap-extra ** content is omitted. ** ** If the "popup" query parameter is present and this is a POST request ** from the same origin, then the normal HTML header and footer information ** is omitted and the HTML text returned is just a raw "". */ void sitemap_page(void){ int srchFlags; int inSublist = 0; int i; int isPopup = 0; /* This is an XMLHttpRequest() for /sitemap */ int e = atoi(PD("e","0")); const char *zExtra; login_check_credentials(); if( P("popup")!=0 ){ /* The "popup" query parameter ** then disable anti-robot defenses */ isPopup = 1; g.perm.Hyperlink = 1; g.jsHref = 0; } srchFlags = search_restrict(SRCH_ALL); if( !isPopup ){ style_header("Site Map"); style_adunit_config(ADUNIT_RIGHT_OK); } @ inSublist = 0; } @ if( db_open_local(0) && cgi_is_loopback(g.zIpAddr) ){ @
  • %z(href("%R/ckout"))Checkout Status
  • } if( g.perm.Read ){ const char *zEditGlob = db_get("fileedit-glob",""); @
  • %z(href("%R/tree"))File Browser @ } if( g.perm.Read ){ @
  • %z(href("%R/timeline"))Project Timeline @ @
  • } if( g.perm.Read ){ @
  • %z(href("%R/brlist"))Branches @ @
  • } if( srchFlags ){ @
  • %z(href("%R/search"))Search
  • } if( g.perm.Chat ){ @
  • %z(href("%R/chat"))Chat
  • } if( g.perm.RdForum ){ const char *zTitle = db_get("forum-title","Forum"); @
  • %z(href("%R/forum"))%h(zTitle) @ @
  • } if( g.perm.RdTkt ){ @
  • %z(href("%R/reportlist"))Tickets/Bug Reports @ @
  • } if( g.perm.RdWiki ){ @
  • %z(href("%R/wikihelp"))Wiki @ @
  • } if( !g.zLogin ){ @
  • %z(href("%R/login"))Login @ if( !isPopup ){ style_finish_page(); } } /* ** WEBPAGE: sitemap-test ** ** List some of the web pages offered by the Fossil web engine for testing ** purposes. This is similar to /sitemap, but is focused only on showing ** pages associated with testing. */ void sitemap_test_page(void){ int isPopup = 0; /* This is an XMLHttpRequest() for /sitemap */ login_check_credentials(); style_set_current_feature("sitemap"); if( P("popup")!=0 && cgi_csrf_safe(0) ){ /* If this is a POST from the same origin with the popup=1 parameter, ** then disable anti-robot defenses */ isPopup = 1; g.perm.Hyperlink = 1; g.jsHref = 0; } if( !isPopup ){ style_header("Test Page Map"); style_adunit_config(ADUNIT_RIGHT_OK); } @