29
30:- module(plweb_parms,
31 [ server/2, 32 server/3 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/http_cors)). 38:- use_module(library(http/html_head)). 39:- use_module(library(www_browser)). 40:- use_module(library(settings)). 41:- use_module(library(pengines)). 42
43
44:- setting(http:served_file_extensions,
45 list(atom),
46 [ html, gif, png, jpeg, jpg, css, js, tgz, exe, c, zip ],
47 'List of extensions that are served as plain files'). 48:- setting(http:index_files,
49 list(atom),
50 [ 'index.txt', 'index.html' ],
51 'List of files that provide a directory index'). 52:- setting(http:port,
53 integer,
54 3040,
55 'Default port'). 56:- setting(http:workers,
57 integer,
58 10,
59 'Number of worker threads'). 60
61:- set_setting_default(pengines:allow_from, []). 62:- set_setting_default(http:logfile, 'log/httpd.log'). 63:- set_setting_default(http:cors, [*]). 64
65
66 69
70http:location(pldoc, root(pldoc), [priority(10)]).
71http:location(download, root(download), []).
72http:location(icons, root(icons), []).
73http:location(css, root(css), []).
74http:location(jq, root('js/jquery'), []).
75
76
77 80
81:- multifile
82 user:url_path/2. 83
84user:url_path(swi, 'http://www.swi-prolog.org').
85user:url_path(hcs, 'http://hcs.science.uva.nl').
86user:url_path(pkg, pl(package)).
87user:url_path(dmoz, 'http://dmoz.org').
88user:url_path(dmoz_pl, dmoz('Computers/Programming/Languages/Prolog/Implementations/')).
89user:url_path(ffii, 'http://swpat.ffii.org/index.en.html').
90user:url_path(fsf, 'http://www.fsf.org').
91user:url_path(gnu, 'http://www.gnu.org').
92user:url_path(gpl, gnu('licences/gpl.html')).
93user:url_path(lgpl, gnu('licences/lgpl.html')).
94user:url_path(wordnet, 'http://www.cogsci.princeton.edu/~wn/').
95user:url_path(gmp, 'http://gmplib.org/').
96user:url_path(mailman, 'http://www.list.org/').
97user:url_path(bonn, 'https://lists.iai.uni-bonn.de/mailman').
98user:url_path(maillist, bonn('listinfo.cgi/swi-prolog')).
99user:url_path(mailarchive, bonn('public/swi-prolog/')).
100user:url_path(nabble, 'http://www.nabble.com').
101user:url_path(pl_nabble, nabble('SWI-Prolog-f448.html')).
102user:url_path(gmane, 'http://blog.gmane.org').
103user:url_path(pl_gmane, gmane('gmane.comp.ai.prolog.swi')).
104user:url_path(chr_mail, 'http://listserv.cc.kuleuven.ac.be/archives/chr.html').
105user:url_path(bugzilla, 'http://www.swi-prolog.org/bugzilla/').
106user:url_path(gitweb, 'http://www.swi-prolog.org/git/').
107user:url_path(swieditor, 'http://arbeitsplattform.bildung.hessen.de/fach/informatik/swiprolog/indexe.html').
108user:url_path(pub, hcs('projects/SWI-Prolog/articles')).
109user:url_path(swipub, swi('download/publications')).
110user:url_path(git, 'http://git-scm.com/').
111user:url_path(msysgit, 'http://code.google.com/p/msysgit/').
112user:url_path(tortoisegit, 'http://code.google.com/p/tortoisegit/').
113user:url_path(macports, 'http://www.macports.org/').
114user:url_path(xquartz, 'http://xquartz.macosforge.org/').
115user:url_path(json, 'http://json.org/').
116user:url_path(multimedian, 'http://e-culture.multimedian.nl/').
117user:url_path(thea, 'http://www.semanticweb.gr/TheaOWLLib/').
118user:url_path(dig, 'http://dl.kr.org/dig/interface.html').
119user:url_path(sparql, 'http://www.w3.org/TR/rdf-sparql-query/').
120user:url_path(serql, 'http://www.openrdf.org').
121
122
123 126
127:- html_resource(swipl_css,
128 [ virtual(true),
129 requires([ css('swipl.css') ])
130 ]). 131:- html_resource(plweb,
132 [ virtual(true),
133 requires([ pldoc_css,
134 css('plweb.css')
135 ])
136 ]). 137:- if(\+html_current_resource(jquery)). 138:- html_resource(jquery,
139 [ virtual(true),
140 requires([ jq('jquery.js')
141 ])
142 ]). 143:- endif. 144:- html_resource(js('jquery/ui/jquery-ui.min.js'),
145 [ requires([ jquery
146 ])
147 ]). 148:- html_resource(jquery_ui,
149 [ virtual(true),
150 requires([ js('jquery/ui/jquery-ui.min.js'),
151 js('jquery/ui/jquery-ui.min.css')
152 ])
153 ]). 154:- html_resource(jq('menu.js'),
155 [ requires([ jquery
156 ])
157 ]). 158
159
160 163
164:- multifile user:file_search_path/2. 165:- dynamic user:file_search_path/2. 166
167:- prolog_load_context(directory, Dir),
168 ( user:file_search_path(plweb, Dir)
169 -> true
170 ; asserta(user:file_search_path(plweb, Dir))
171 ). 172
173user:file_search_path(document_root, plweb(www)).
174user:file_search_path(plgit, plweb(git)).
175user:file_search_path(icons, document_root(icons)).
176user:file_search_path(css, document_root(css)).
177user:file_search_path(js, document_root(js)).
178user:file_search_path(yui, document_root('yui/2.7.0')).
179user:file_search_path(cgi_bin, plweb('git-web')).
180user:file_search_path(download, plweb(download)).
181user:file_search_path(gitweb, plweb('git-web')).
182
183
184
196server(Type, Host) :-
197 server(Type, Host, _HostName).
198
199server(cdn, 'www.swi-prolog.org', -).
200server(slave, 'us.swi-prolog.org', 'swi-prolog.osuosl.org').
201server(master, 'eu.swi-prolog.org', -).