30
31:- module(cp_skin,
32 [ server_address//1, 33 current_page_doc_link//0
34 ]). 35:- use_module(library(http/html_write)). 36:- use_module(library(http/html_head)). 37:- use_module(library(http/http_wrapper)). 38:- use_module(library(http/http_dispatch)). 39:- use_module(library(http/http_path)). 40:- use_module(library(version)). 41:- use_module(components(menu)). 42:- use_module(components(simple_search)). 43:- use_module(applications(help/version)).
81:- http_handler('/favicon.ico',
82 http_reply_file(icons('favicon.ico'), []),
83 []). 84
85:- html_resource(js('cliopatria.js'),
86 [ requires([jquery])
87 ]). 88:- html_resource(plain,
89 [ virtual(true),
90 requires([ css('plain.css')
91 ])
92 ]). 93:- html_resource(cliopatria,
94 [ virtual(true),
95 requires([ css('cliopatria.css'),
96 js('cliopatria.js')
97 ])
98 ]).
105:- multifile
106 user:body//2. 107
108user:body(cliopatria(Style), Body) -->
109 cliopatria:page_body(cliopatria(Style), Body), !.
110user:body(cliopatria(_), Body) -->
111 cliopatria:page_body(Body), !.
112user:body(cliopatria(plain), Body) -->
113 html_requires(plain),
114 html(body(class(['yui-skin-sam', cliopatria]),
115 [ div([id('cp-menu'), class(menu)], \cp_logo_and_menu),
116 \simple_search_form([value(p(q))]),
117 br(clear(all)),
118 div([id('cp-content'), class(content)], Body),
119 br(clear(all)),
120 div([id('cp-footer'), class(footer)], \address)
121 ])).
122user:body(cliopatria(_), Body) -->
123 html_requires(cliopatria),
124 html(body(class(['yui-skin-sam', cliopatria]),
125 [ div([id('cp-menu'), class(menu)], \cp_logo_and_menu),
126 \simple_search_form([value(p(q))]),
127 br(clear(all)),
128 div([id('cp-content'), class(content)], Body),
129 br(clear(all)),
130 div([id('cp-footer'), class(footer)], \address)
131 ])).
132
133cp_logo_and_menu -->
134 cp_logo,
135 cp_menu.
136
137cp_logo -->
138 cliopatria:logo, !.
139cp_logo -->
140 { File = 'cliopatria-logo.png',
141 absolute_file_name(icons(File), _Logo,
142 [access(read), file_errors(fail)]),
143 http_absolute_location(icons(File), Src, []),
144 http_link_to_id(home, [], Home)
145 },
146 html(a([class(logo), href(Home), style('float:left')
147 ],
148 img([src(Src)]))).
158address -->
159 cliopatria:server_address, !.
160address -->
161 server_address('ClioPatria').
180server_address(Component) -->
181 html([ address(class(footer),
182 [ \component_address(Component),
183 \current_page_doc_link
184 ])
185 ]).
191component_address(Component) -->
192 ( { git_module_property(Component, home_url(Home)) }
193 -> html(a([ class(home), href(Home),
194 title(Component+' home')
195 ], Component))
196 ; html(span(class(home), Component))
197 ),
198 html(' (version '),
199 component_version(Component),
200 html(')').
207component_version(Component) -->
208 { ( git_module_property(Component, version(Version))
209 -> true
210 ; Version = 'no GIT?'
211 ),
212 http_link_to_id(version_info, [], VREF)
213 },
214 html(a([title('About versions'),
215 class(version),
216 href(VREF)],
217 Version)).
227:- if(current_predicate(http_help:page_documentation_link//1)). 228current_page_doc_link -->
229 { http_current_request(Request) },
230 http_help:page_documentation_link(Request).
231:- else. 232current_page_doc_link --> [].
233:- endif.
ClioPatria skin
This page defines the overall layout of ClioPatria pages. All pages are returned using reply_html_page/3, using the page class
cliopatria(Id)
, where Id is currently alwaysdefault
. Pages can be redefined by providing a rule for user:body//2, where the first argument must unify with the page class.The default skin provides the overall menu, a simple search form, the content and the `server-address'. Because the search-form uses the YUI autocomplete widgets, the body must include class
yui-skin-sam
. The default body has the classesyui-skin-sam
andcliopatria
.The default skin provided by this can be overruled using two hooks:
This library also provides building blocks, notably for server_address//0:
run.pl
.in.The CSS file
css('cliopatria.css')
contains the ClioPatria style that is makes ClioPatria look pretty to our eyes, but is not essential. The plugin config-available/fix_menu.pl
contains example code to extend the ClioPatria skin. */