X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fhxsp%2Fsplitted%2F6.commands.p.pl;fp=helm%2Fhxsp%2Fsplitted%2F6.commands.p.pl;h=0000000000000000000000000000000000000000;hb=c7514aaa249a96c5fdd39b1123fbdb38d92f20b6;hp=142acc590f36d6ba5323a8a4dcb372ad2c2be5cd;hpb=1c7fb836e2af4f2f3d18afd0396701f2094265ff;p=helm.git diff --git a/helm/hxsp/splitted/6.commands.p.pl b/helm/hxsp/splitted/6.commands.p.pl deleted file mode 100644 index 142acc590..000000000 --- a/helm/hxsp/splitted/6.commands.p.pl +++ /dev/null @@ -1,215 +0,0 @@ -################################################################################################# -################################################################################################# -################################################################################################# -# Commands subrutines -################################################################################################# -################################################################################################# -################################################################################################# - -################################################################################################# -# sub add -# Usage: add($http_query); -# Returns: values for HTTP::Response -# Do: add stylesheet(s) to hash -# Used by: daemon -# Uses : addparsequery, addvalues, ok_replace, -# ok_print, synerror_print, operror_print -################################################################################################# -sub add -{ - my $http_query = shift(@_); # querystring - my $cont =""; # return value - my @binds; #values of binds passed via querystring - my $err; # error string - if ($err = addparsequery($http_query,\@binds)) { return synerror_print($err,$add_usage); } - else - { - foreach my $bind (@binds) - { - my ($a_key , $e_uri) = split(/,/,$bind,2); - my $une_uri = uri_unescape($e_uri); - if ($err = addvalues($a_key,$une_uri)) { $cont .= "$err\n"; } - else { $cont .= ok_replace("$s_add\n",$a_key,$une_uri); } - }#foreach - return ok_print($cont); - } -} -################################################################################################# - -################################################################################################# -# sub remove -# Usage: remove($http_query); -# Returns: values for HTTP::Response -# Do: remove stylesheet(s) from hash -# Used by: daemon -# Uses : reparsequery, getkeys, recheckvalues, removevalues, -# ok_print, synerror_print, operror_print -################################################################################################# -sub remove -{ - my $http_query = shift(@_); # querystring - my $rem_keys; - my $cont=""; - my $err; - if ($http_query eq "") - { - my $i=0; - foreach my $rem_key (keys %stylesheet_hash) - { - $cont .= removevalues($rem_key); - $i++; - } - if ($i==0) { return operror_print($error{"re_no_sl"}); } - } - elsif ($err = reparsequery($http_query,$rem_keys)){return synerror_print($err,$remove_usage);} - else - { - foreach my $rem_key (split (/,/,$rem_keys)) - { - if (my $err = recheckvalues($rem_key)) { $cont .= "$err\n"; } - else { $cont .= removevalues($rem_key); } - } - } - return ok_print($cont); -} -################################################################################################# - -################################################################################################# -# sub reload -# Usage: remove($http_query); -# Returns: values for HTTP::Response -# Do: remove stylesheet(s) from hash -# Used by: daemon -# Uses : reparsequery, getkeys, recheckvalues, removevalues, -# ok_print, synerror_print, operror_print -################################################################################################# -sub reload #reload stylesheet(s) from hash -{ - my $http_query = shift(@_); - my $rel_keys; - my @rel_k; - my $dr_cont = ""; - if ($http_query eq "") - { - my $i=0; - foreach my $key (keys %stylesheet_hash) - { - if (my $err = reloadvalues($key)) { return $dr_cont .= $err; } - else {$dr_cont .= ok_replace("$s_reload\n",$key,$stylesheet_hash{$key}[0]);} - $i++; - } - if ($i==0) { return operror_print($error{"re_no_sl"}); } - } - elsif ($err = reparsequery($http_query,$rel_keys)){return synerror_print($err,$reload_usage);} - else - { - foreach my $key (split (/,/,$rel_keys)) - { - if (my $err = reloadvalues($key)) { return $dr_cont .= $err; } - else {$dr_cont .= ok_replace("$s_reload\n",$key,$stylesheet_hash{$key}[0]);} - } - } - return ok_print($dr_cont); -} -################################################################################################# - -sub apply #apply stylesheets -{ - my $http_query = shift(@_); - my $headers_ptr = shift(@_); - my $xmluri; - my @applykeys; - my %app_param; - my %app_prop; - my $results; - my $lastkey; - my $enc; - - if (my $err=applyparsequery($http_query,\@applykeys,\%app_param,\%app_prop,$xmluri)) - { - return synerror_print($err,$apply_usage); - } - elsif (my $err=applycheckvalues(\@applykeys)) { return operror_print($err); } - elsif (my $err=load_xml_doc($xmluri,$results)) { return operror_print($err); } - #apply - foreach my $applykey (@applykeys) - { - $lastkey=$applykey; - if (my $err=apply_style($applykey,\%{$app_param{$applykey}},$results)) - { - return operror_print($err); - } - }#foreach - my $i=0; - while (my ($n, $v) = each %app_prop) - { - if (($n eq "method") or ($n eq "METHOD")) - { - if ($v eq 'html') { $headers_ptr->{'Content-Type'}='text/html'; } - elsif ($v eq 'text') { $headers_ptr->{'Content-Type'}='text/plain'; } - else { $headers_ptr->{'Content-Type'}='text/xml'; } - } - if (($n eq "encoding") or ($n eq "ENCODING")) - { - $headers_ptr->{'Content-Encoding'}=$v; - if ($v ne "UTF-8") { $enc = $v; } - } - if (($n eq "media-type") or ($n eq "MEDIA_TYPE") or ($n eq "MEDIA-TYPE")) - { - $headers_ptr->{'Content-Type'}=$v; - } - $i++; - } - if ($i == 0) - { - %$headers_ptr= ('Cache-Control' => 'no-cache','Pragma' => "no-cache",'Expires' => '0'); - return get_results($lastkey,$results); - } - else - { - my $result; - $headers_ptr->{'Cache-Control'} = 'no-cache'; - $headers_ptr->{'Pragma'} = "no-cache"; - $headers_ptr->{'Expires'} = '0'; - if ($headers_ptr->{'Content-Type'} eq 'text/html') - { - $result = get_results_html($results); - } - else - { - $result = get_results_prop($results); - if ($enc) - { - $result = decode($result,$enc); - } - } - return $result; - } -} - -sub list #list all the stylesheet loaded -{ - my $cont=""; - my $ind = 0; - foreach $key (keys %stylesheet_hash) - { - $cont .= ok_replace("$list\n",$key,$stylesheet_hash{$key}[0]); - $ind++; - } - if ($ind > 0) { return ok_print($cont); } - else { return ok_print($empty); } -} - -sub home #return Dispay active -{ - if ($_[0] ne "") { return synerror_print($error{"home_qs"},$all_usage); } - else { - return ok_print($home_message.$all_usage); - } -} - -sub help #return html help -{ - if ($_[0] ne "") { return synerror_print($error{"help_qs"},$help_usage); } - return ok_print($help_message.$all_usage); -}