/[suikacvs]/webroot/swe/lib/suikawiki/main.pl
Suika

Diff of /webroot/swe/lib/suikawiki/main.pl

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

revision 1.37 by wakaba, Mon Sep 14 02:03:25 2009 UTC revision 1.38 by wakaba, Mon Sep 14 02:13:13 2009 UTC
# Line 1  Line 1 
1  use strict;  use strict;
2  use warnings;  use warnings;
3  use feature 'state';  use feature 'state';
 use UNIVERSAL::require;  
4    
5  ## --- Configurations  ## --- Configurations
6    
# Line 11  my $db_global_lock_dir_name = $db_dir_na Line 10  my $db_global_lock_dir_name = $db_dir_na
10  my $db_id_dir_name = $db_dir_name . q[ids/];  my $db_id_dir_name = $db_dir_name . q[ids/];
11  my $db_name_dir_name = $db_dir_name . q[names/];  my $db_name_dir_name = $db_dir_name . q[names/];
12    
 my @content_type =  
 (  
   {type => 'text/x-suikawiki', module => 'SWE::Lang::SWML',  
    label => 'SWML'},  
   {type => 'text/x.suikawiki.image', module => 'SWE::Lang::SWML'},  
   {type => 'application/x.suikawiki.config'},  
   {type => 'text/plain', label => 'Plain text'},  
   {type => 'image/x-canvas-instructions+text',  
    module => 'SWE::Lang::CanvasInstructions',  
    label => 'Drawing'},  
   {type => 'text/css', label => 'CSS'},  
 );  
 my %content_type = map { $_->{type} => $_ } @content_type;  
   
13  ## --- Common modules  ## --- Common modules
14    
15  require Encode;  require Encode;
# Line 38  use Message::CGI::Util qw/percent_encode Line 23  use Message::CGI::Util qw/percent_encode
23    
24  require Char::Normalize::FullwidthHalfwidth;  require Char::Normalize::FullwidthHalfwidth;
25    
26    use SWE::Lang qw/@ContentMediaType/;
27    
28  ## --- Prepares database access variables (commonly used ones)  ## --- Prepares database access variables (commonly used ones)
29    
30  require SWE::DB;  require SWE::DB;
# Line 1181  sub get_content_type_parameter () { Line 1168  sub get_content_type_parameter () {
1168    my $ct = $cgi->get_parameter ('content-type') // 'text/x-suikawiki';    my $ct = $cgi->get_parameter ('content-type') // 'text/x-suikawiki';
1169        
1170    my $valid_ct;    my $valid_ct;
1171    for (@content_type) {    for (@ContentMediaType) {
1172      if ($_->{type} eq $ct) {      if ($_->{type} eq $ct) {
1173        $valid_ct = 1;        $valid_ct = 1;
1174        last;        last;
# Line 1200  sub set_content_type_options ($$;$) { Line 1187  sub set_content_type_options ($$;$) {
1187    $ct //= 'text/x-suikawiki';    $ct //= 'text/x-suikawiki';
1188        
1189    my $has_ct;    my $has_ct;
1190    for (@content_type) {    for (@ContentMediaType) {
1191      next unless defined $_->{label};      next unless defined $_->{label};
1192      my $option_el = $doc->create_element_ns (HTML_NS, 'option');      my $option_el = $doc->create_element_ns (HTML_NS, 'option');
1193      $option_el->set_attribute (value => $_->{type});      $option_el->set_attribute (value => $_->{type});

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24