Ticket #154: index.cgi.json.patch
| File index.cgi.json.patch, 1.1 kB (added by perigrin, 2 years ago) |
|---|
-
.cgi
old new 15 15 use OpenGuides::CGI; 16 16 use OpenGuides::Config; 17 17 use OpenGuides::RDF; 18 use OpenGuides::JSON; 18 19 use OpenGuides::Utils; 19 20 use OpenGuides::Template; 20 21 use Time::Piece; … … 178 179 } else { # Default is to display a node. 179 180 if ( $format and $format eq "rdf" ) { 180 181 display_node_rdf( node => $node ); 182 } elsif ($format and $format eq 'json') { 183 display_node_json( node => $node ); 181 184 } elsif ( $format and $format eq 'raw' ) { 182 185 $guide->display_node( 183 186 id => $node, … … 348 351 print $rdf_writer->emit_rdfxml( node => $args{node} ); 349 352 } 350 353 354 sub display_node_json { 355 my %args = @_; 356 my $json_writer = OpenGuides::JSON->new( wiki => $wiki, config => $config ); 357 print "Content-type: text/javascript\n\n"; 358 print $json_writer->emit_json( node => $args{node} ); 359 } 360 351 361 sub process_template { 352 362 my ($template, $node, $vars, $conf, $omit_header) = @_; 353 363
