Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
friguzzi committed Jun 30, 2016
2 parents 8bdb7f7 + 7619b7f commit e32e316
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
6 changes: 6 additions & 0 deletions client/swish-ask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

server=${SWISH_SERVER-http://localhost:3050}
srctext=
curlarg=
format=${SWISH_FORMAT-prolog}
program=$(basename $0)

Expand Down Expand Up @@ -57,6 +58,10 @@ while [ $done = false ]; do
esac
shift
;;
https://*.pl|http://*.pl)
curlarg+=" -d src_url=$1"
shift
;;
*.pl)
script=$(echo $1 | sed 's/.*=//')
srctext+=":- include('$script'). "
Expand Down Expand Up @@ -84,4 +89,5 @@ curl -s \
-d format=csv \
-d chunk=10 \
-d solutions=all \
$curlarg \
$server/pengine/create
10 changes: 10 additions & 0 deletions lib/authenticate.pl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
[ swish_add_user/3, % +User, +Passwd, +Fields
swish_add_user/1, % +Dict
swish_add_user/0,
swish_logged_in/3, % +Request, -User, -Data
swish_current_user/2 % ?User, ?Data
]).
:- use_module(library(pengines), []).
Expand Down Expand Up @@ -198,6 +199,15 @@
password_file(File),
http_current_user(File, User, [_Hash,Group,RealName,Email]).

%% swish_logged_in(+Request, -User, -UserData) is det.
%
% True when Request is associated with User.

swish_logged_in(Request, User, UserData) :-
logged_in(Request, User),
swish_current_user(User, UserData).


%% swish_add_user(+User, +Passwd, +Fields) is det.
%
% Add a new user to the SWISH password file. Defined Fields are
Expand Down
2 changes: 1 addition & 1 deletion lib/page.pl
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
ModifiedWhenLoaded \== Modified.
source_metadata(Path, _Code, module, Module) :-
file_name_extension(_, Ext, Path),
prolog_file_type(Ext, prolog),
user:prolog_file_type(Ext, prolog),
xref_public_list(Path, _, [module(Module)]).

confirm_access(Path, Options) :-
Expand Down
8 changes: 4 additions & 4 deletions lib/render.pl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
%
% @see use_rendering/2.

:- multifile user:term_expansion/2.
:- multifile system:term_expansion/2.

use_rendering(Rendering) :-
use_rendering(Rendering, []).
Expand All @@ -111,9 +111,9 @@
retractall(Into:'swish renderer'(Renderer, _)),
assertz(Into:'swish renderer'(Renderer, Options)).

user:term_expansion((:- use_rendering(Renderer)), Expanded) :-
system:term_expansion((:- use_rendering(Renderer)), Expanded) :-
expand_rendering(Renderer, [], Expanded).
user:term_expansion((:- use_rendering(Renderer, Options)), Expanded) :-
system:term_expansion((:- use_rendering(Renderer, Options)), Expanded) :-
expand_rendering(Renderer, Options, Expanded).

expand_rendering(Module:Renderer, Options,
Expand Down Expand Up @@ -224,6 +224,6 @@
throw(error(context_error(nodirective, register_renderer(Name, Comment)),
_)).

user:term_expansion((:- register_renderer(Name, Comment)),
system:term_expansion((:- register_renderer(Name, Comment)),
swish_render:renderer(Name, Module, Comment)) :-
prolog_load_context(module, Module).
4 changes: 2 additions & 2 deletions lib/template_hint.pl
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@
Type = directory.
file_type(_, Name, Type) :-
file_name_extension(_, Ext, Name),
prolog_file_type(Ext, prolog),
\+ prolog_file_type(Ext, qlf),
user:prolog_file_type(Ext, prolog),
\+ user:prolog_file_type(Ext, qlf),
Type = prolog.

%% library_template_from(+From:list, -Template) is det.
Expand Down

0 comments on commit e32e316

Please sign in to comment.