View source with raw comments or as raw
    1/*  Part of SWI-Prolog
    2
    3    Author:        Jan Wielemaker
    4    E-mail:        J.Wielemaker@cs.vu.nl
    5    WWW:           http://www.swi-prolog.org
    6    Copyright (C): 2009, VU University Amsterdam
    7
    8    This program is free software; you can redistribute it and/or
    9    modify it under the terms of the GNU General Public License
   10    as published by the Free Software Foundation; either version 2
   11    of the License, or (at your option) any later version.
   12
   13    This program is distributed in the hope that it will be useful,
   14    but WITHOUT ANY WARRANTY; without even the implied warranty of
   15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16    GNU General Public License for more details.
   17
   18    You should have received a copy of the GNU General Public
   19    License along with this library; if not, write to the Free Software
   20    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   21
   22    As a special exception, if you link this library with other files,
   23    compiled with a Free Software compiler, to produce an executable, this
   24    library does not by itself cause the resulting executable to be covered
   25    by the GNU General Public License. This exception does not however
   26    invalidate any other reasons why the executable file might be covered by
   27    the GNU General Public License.
   28*/
   29
   30:- module(plweb_parms,
   31	  [ server/2,			% ?Role, ?Host
   32	    server/3			% ?Role, ?Host, -HostName
   33	  ]).   34:- use_module(library(http/http_log)).   35:- use_module(library(http/http_path)).   36:- use_module(library(http/http_dispatch)).   37:- use_module(library(http/html_head)).   38:- use_module(library(www_browser)).   39:- use_module(library(settings)).   40:- use_module(library(pengines)).   41
   42
   43:- setting(http:served_file_extensions,
   44	   list(atom),
   45	   [ html, gif, png, jpeg, jpg, css, js, tgz, exe, c, zip ],
   46	   'List of extensions that are served as plain files').   47:- setting(http:index_files,
   48	   list(atom),
   49	   [ 'index.txt', 'index.html' ],
   50	   'List of files that provide a directory index').   51:- setting(http:port,
   52	   integer,
   53	   3040,
   54	   'Default port').   55:- setting(http:workers,
   56	   integer,
   57	   10,
   58	   'Number of worker threads').   59
   60:- set_setting_default(pengines:allow_from, []).   61:- set_setting_default(http:logfile, 'log/httpd.log').   62
   63
   64		 /*******************************
   65		 *	     LOCATIONS		*
   66		 *******************************/
   67
   68http:location(pldoc,	root(pldoc),	   [priority(10)]).
   69http:location(download,	root(download),	   []).
   70http:location(icons,	root(icons),	   []).
   71http:location(css,	root(css),	   []).
   72http:location(jq,	root('js/jquery'), []).
   73
   74
   75		 /*******************************
   76		 *	   EXTERNAL URLS	*
   77		 *******************************/
   78
   79:- multifile
   80	user:url_path/2.   81
   82user:url_path(swi,	'http://www.swi-prolog.org').
   83user:url_path(hcs,	'http://hcs.science.uva.nl').
   84user:url_path(pkg,	pl(package)).
   85user:url_path(dmoz,	'http://dmoz.org').
   86user:url_path(dmoz_pl,	dmoz('Computers/Programming/Languages/Prolog/Implementations/')).
   87user:url_path(ffii,	'http://swpat.ffii.org/index.en.html').
   88user:url_path(fsf,	'http://www.fsf.org').
   89user:url_path(gnu,	'http://www.gnu.org').
   90user:url_path(gpl,	gnu('licences/gpl.html')).
   91user:url_path(lgpl,	gnu('licences/lgpl.html')).
   92user:url_path(wordnet,	'http://www.cogsci.princeton.edu/~wn/').
   93user:url_path(gmp,	'http://gmplib.org/').
   94user:url_path(mailman,	'http://www.list.org/').
   95user:url_path(bonn,	'https://lists.iai.uni-bonn.de/mailman').
   96user:url_path(maillist,	bonn('listinfo.cgi/swi-prolog')).
   97user:url_path(mailarchive, bonn('public/swi-prolog/')).
   98user:url_path(nabble,	'http://www.nabble.com').
   99user:url_path(pl_nabble, nabble('SWI-Prolog-f448.html')).
  100user:url_path(gmane,     'http://blog.gmane.org').
  101user:url_path(pl_gmane,  gmane('gmane.comp.ai.prolog.swi')).
  102user:url_path(chr_mail,  'http://listserv.cc.kuleuven.ac.be/archives/chr.html').
  103user:url_path(bugzilla,  'http://www.swi-prolog.org/bugzilla/').
  104user:url_path(gitweb,	 'http://www.swi-prolog.org/git/').
  105user:url_path(swieditor, 'http://arbeitsplattform.bildung.hessen.de/fach/informatik/swiprolog/indexe.html').
  106user:url_path(pub,	 hcs('projects/SWI-Prolog/articles')).
  107user:url_path(swipub,	 swi('download/publications')).
  108user:url_path(git,	 'http://git-scm.com/').
  109user:url_path(msysgit,	 'http://code.google.com/p/msysgit/').
  110user:url_path(tortoisegit, 'http://code.google.com/p/tortoisegit/').
  111user:url_path(macports,	 'http://www.macports.org/').
  112user:url_path(xquartz,	 'http://xquartz.macosforge.org/').
  113user:url_path(json,	 'http://json.org/').
  114user:url_path(multimedian, 'http://e-culture.multimedian.nl/').
  115user:url_path(thea,	 'http://www.semanticweb.gr/TheaOWLLib/').
  116user:url_path(dig,	 'http://dl.kr.org/dig/interface.html').
  117user:url_path(sparql,	 'http://www.w3.org/TR/rdf-sparql-query/').
  118user:url_path(serql,	 'http://www.openrdf.org').
  119
  120
  121		 /*******************************
  122		 *	      RESOURCES		*
  123		 *******************************/
  124
  125:- html_resource(swipl_css,
  126		 [ virtual(true),
  127		   requires([ css('swipl.css') ])
  128		 ]).  129:- html_resource(plweb,
  130		 [ virtual(true),
  131		   requires([ pldoc_css,
  132			      css('plweb.css')
  133			    ])
  134		 ]).  135:- if(\+html_current_resource(jquery)).  136:- html_resource(jquery,
  137		 [ virtual(true),
  138		   requires([ jq('jquery.js')
  139			    ])
  140		 ]).  141:- endif.  142:- html_resource(js('jquery/ui/jquery-ui.min.js'),
  143		 [ requires([ jquery
  144			    ])
  145		 ]).  146:- html_resource(jquery_ui,
  147		 [ virtual(true),
  148		   requires([ js('jquery/ui/jquery-ui.min.js'),
  149			      js('jquery/ui/jquery-ui.min.css')
  150			    ])
  151		 ]).  152:- html_resource(jq('menu.js'),
  153		 [ requires([ jquery
  154			    ])
  155		 ]).  156
  157
  158		 /*******************************
  159		 *	       FILES		*
  160		 *******************************/
  161
  162:- multifile user:file_search_path/2.  163:- dynamic   user:file_search_path/2.  164
  165:- prolog_load_context(directory, Dir),
  166   (   user:file_search_path(plweb, Dir)
  167   ->  true
  168   ;   asserta(user:file_search_path(plweb, Dir))
  169   ).  170
  171user:file_search_path(document_root, plweb(www)).
  172user:file_search_path(plgit,	     plweb(git)).
  173user:file_search_path(icons,	     document_root(icons)).
  174user:file_search_path(css,	     document_root(css)).
  175user:file_search_path(js,	     document_root(js)).
  176user:file_search_path(yui,	     document_root('yui/2.7.0')).
  177user:file_search_path(cgi_bin,	     plweb('git-web')).
  178user:file_search_path(download,	     plweb(download)).
  179user:file_search_path(gitweb,	     plweb('git-web')).
  180
  181
  182		 /*******************************
  183		 *	   MASTER/SLAVE		*
  184		 *******************************/
 server(?Type, ?Host) is nondet
 server(?Type, ?Host, ?HostName) is nondet
Describe known servers and their role. Currently, the only important role is master. Logged in sessions are redirected to the master to simplify keeping one view of the data. In future versions we might go for a more distributed database.
  194server(Type, Host) :-
  195	server(Type, Host, _HostName).
  196
  197server(cdn,    'www.swi-prolog.org', -).
  198server(slave,  'us.swi-prolog.org', 'swi-prolog.osuosl.org').
  199server(master, 'eu.swi-prolog.org', -).
  200%server(master, 'localhost', -).