/[suikacvs]/markup/html/html5/spec-ja/edit2.cgi
Suika

Diff of /markup/html/html5/spec-ja/edit2.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by wakaba, Sun Oct 26 08:44:19 2008 UTC revision 1.8 by wakaba, Sun Nov 2 04:49:55 2008 UTC
# Line 18  if ($path eq '/') { Line 18  if ($path eq '/') {
18        return Encode::decode ('utf-8', $_[1]);        return Encode::decode ('utf-8', $_[1]);
19      };      };
20            
21      my $en = $cgi->get_parameter ('en');      my $en = normalize_width ($cgi->get_parameter ('en'));
22      my $ja = $cgi->get_parameter ('ja');      my $ja = normalize_width ($cgi->get_parameter ('ja'));
23      my $is_pattern = $cgi->get_parameter ('pattern');      my $is_pattern = $cgi->get_parameter ('pattern');
24      my $tags = [map {normalize ($_)}      my $tags = [map {normalize ($_)}
25                  split /[\x0D\x0A]+/, $cgi->get_parameter ('tags') // ''];                  split /[\x0D\x0A]+/,
26                    normalize_width ($cgi->get_parameter ('tags') // '')];
27    
28      my $hash = get_hash ($en);      my $hash = get_hash ($en);
29        my $entry = {en => $en, ja => $ja, tags => $tags,
30                     isPattern => $is_pattern};
31        
32      lock_entry ($hash);      lock_entry ($hash);
33      set_entry ($hash, $is_pattern => {en => $en, ja => $ja, tags => $tags});      set_entry ($hash, $is_pattern => $entry);
34      commit_entries ("$path: $hash updated by $ENV{AUTH_USER}");      commit_entries ("$path: $hash updated by $ENV{REMOTE_USER}");
35        
36        print "Status: 200 Saved\n";
37    
38        my $updates = {$hash => $entry};
39        
40        binmode STDOUT, ':encoding(utf-8)';
41        print "Content-Type: application/json\n\n";
42            
43      print "Status: 204 Saved\n\n";      require JSON;
44        print scalar JSON::objToJson ($updates);
45      exit;      exit;
46    } else {    } else {
47      print q[Status: 405 Method Not Allowed      print q[Status: 405 Method Not Allowed
# Line 68  print q[Content-Type: text/plain ; chars Line 79  print q[Content-Type: text/plain ; chars
79  Status: 404 Not Found  Status: 404 Not Found
80    
81  404];  404];
82    
83    ## Author: Wakaba <w@suika.fam.cx>.
84    ## License: Copyright 2008 Wakaba.  You are granted a license to use,
85    ##     reproduce and create derivative works of this script.
86    ## $Date$

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.8

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24