From 482895eca4e88941d9ace5379cf1204fd814c402 Mon Sep 17 00:00:00 2001 From: Jan Wielemaker Date: Tue, 14 Jun 2016 15:30:04 +0200 Subject: [PATCH 1/4] FIXED: Avoid relying on auto-importing from user: --- lib/page.pl | 2 +- lib/template_hint.pl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/page.pl b/lib/page.pl index 1bf1c289a..6c42c7575 100644 --- a/lib/page.pl +++ b/lib/page.pl @@ -250,7 +250,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) :- diff --git a/lib/template_hint.pl b/lib/template_hint.pl index eba917e86..0272c8863 100644 --- a/lib/template_hint.pl +++ b/lib/template_hint.pl @@ -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. From 226d24f5e1c26a596ebfe5154573797808b202ba Mon Sep 17 00:00:00 2001 From: Jan Wielemaker Date: Tue, 14 Jun 2016 15:37:31 +0200 Subject: [PATCH 2/4] Register term_expansion in module `system` to allow installing as part of SWI-Prolog itself. --- lib/render.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/render.pl b/lib/render.pl index 2fa89d03a..e4e167915 100644 --- a/lib/render.pl +++ b/lib/render.pl @@ -90,7 +90,7 @@ % % @see use_rendering/2. -:- multifile user:term_expansion/2. +:- multifile system:term_expansion/2. use_rendering(Rendering) :- use_rendering(Rendering, []). @@ -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, @@ -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). From 37d8c91f6f48361937c8aa47da54c3e62c7e8bbd Mon Sep 17 00:00:00 2001 From: Jan Wielemaker Date: Fri, 24 Jun 2016 18:00:30 +0200 Subject: [PATCH 3/4] ADDED: swish_logged_in/3 --- lib/authenticate.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/authenticate.pl b/lib/authenticate.pl index 52ef8c57f..8881f4c77 100644 --- a/lib/authenticate.pl +++ b/lib/authenticate.pl @@ -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), []). @@ -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 From 7619b7f92237a53f413acdb543419c483ed0a430 Mon Sep 17 00:00:00 2001 From: Jan Wielemaker Date: Thu, 30 Jun 2016 16:07:14 +0200 Subject: [PATCH 4/4] ADDED: Post programs to swish as URL. Fabrizio Riguzzi. --- client/swish-ask.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/swish-ask.sh b/client/swish-ask.sh index 8de1c9d34..39dc91126 100755 --- a/client/swish-ask.sh +++ b/client/swish-ask.sh @@ -7,6 +7,7 @@ server=${SWISH_SERVER-http://localhost:3050} srctext= +curlarg= format=${SWISH_FORMAT-prolog} program=$(basename $0) @@ -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'). " @@ -84,4 +89,5 @@ curl -s \ -d format=csv \ -d chunk=10 \ -d solutions=all \ + $curlarg \ $server/pengine/create