/[webpac2]/trunk/web/browse.cgi
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/web/browse.cgi

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

revision 78 by dpavlin, Sun Nov 20 20:44:15 2005 UTC revision 79 by dpavlin, Sun Nov 20 21:45:09 2005 UTC
# Line 75  sub get_file_in_html($) { Line 75  sub get_file_in_html($) {
75          return $content;          return $content;
76  }  }
77    
78    sub template_list_html($) {
79            my $current = shift || die;
80    
81            my $html = qq{ Template\n<ul> };
82    
83            foreach my $t (sort @templates) {
84                    if ($t eq $current) {
85                            $html .= qq{ <li><b>$t</b></li> };
86                    } else {
87                            $html .= qq{ <li><a href="#" onClick="load_template('$t'); return false;">$t</a></li> };
88                    }
89            }
90    
91            $html .= qq{ </ul> };
92            return $html;
93    }
94    
95  ##----  ##----
96    
97  if ($q->path_info =~ m#xml#) {  if ($q->path_info =~ m#xml#) {
# Line 118  if ($q->path_info =~ m#xml#) { Line 135  if ($q->path_info =~ m#xml#) {
135                  exit;                  exit;
136          }          }
137    
138    } elsif ($q->path_info =~ m#template_list#) {
139    
140                    print qq{<response>
141    <action type='html' target='div_template_list' errorCode='' errorMessage='' >
142    <div>} . template_list_html($template_filename) . qq{</div>
143    </action>
144    </response>
145                    };
146    
147                    exit;
148    
149  } elsif ($q->path_info =~ m#template#) {  } elsif ($q->path_info =~ m#template#) {
150    
151                  my $template_path = $out->{'include_path'} . '/' . $template_filename;                  my $template_path = $out->{'include_path'} . '/' . $template_filename;
# Line 167  $tmpl Line 195  $tmpl
195  </action>  </action>
196  <action type='js'>  <action type='js'>
197  <!--  <!--
198    iwfOpacity('div_template', 100);
199  iwfHideGentlyDelay('div_template_status', 2, 2000, 1);  iwfHideGentlyDelay('div_template_status', 2, 2000, 1);
200  -->  -->
201  </action>  </action>
# Line 231  iwfLog('loaded CSS template'); Line 260  iwfLog('loaded CSS template');
260    
261  } else {  } else {
262    
263          my $template_form = qq{          my $template_list_html = template_list_html($template_filename);
                 <form action="$self" method="get" style="display: inline;">  
                 <select name="template">  
         };  
         foreach my $t (@templates) {  
                 my $s = '';  
                 $s = ' selected' if ($t eq $template_filename);  
                 $template_form .= qq{<option$s>$t</option>};  
         }  
         $template_form .= qq{  
                 </select>  
                 <input type="submit" name="ch_template" value="Switch"/>  
                 </form>  
         };  
264    
265          print <<"_END_OF_HEAD_";          print <<"_END_OF_HEAD_";
266  <html>  <html>
# Line 313  function edit_css() { Line 329  function edit_css() {
329          return false;          return false;
330  }  }
331    
332    function load_template(name) {
333            iwfLog('changing template to '+name);
334            iwfOpacity('div_template', 30);
335            template_filename = name;
336            // load template editor
337            iwfRequest( url+'/template/?template='+template_filename, 'div_template' );
338            load_rec(rec);
339    
340            // refresh template list
341            iwfRequest( url+'/template_list/?template='+template_filename, 'div_template_list' );
342    }
343    
344  function init_page() {  function init_page() {
345          iwfLog('div_css = ' + iwfX('div_css') + ':' + iwfY('div_css'));          iwfLog('div_css = ' + iwfX('div_css') + ':' + iwfY('div_css'));
346          iwfLog('div_template = ' + iwfX('div_template') + ':' + iwfY('div_template'));          iwfLog('div_template = ' + iwfX('div_template') + ':' + iwfY('div_template'));
# Line 322  function init_page() { Line 350  function init_page() {
350    
351          iwfLog('div_css = ' + iwfX('div_css') + ':' + iwfY('div_css'));          iwfLog('div_css = ' + iwfX('div_css') + ':' + iwfY('div_css'));
352    
353          load_rec(rec);          // load template editor and record
354            load_template(template_filename);
355    
         // load template editor  
         iwfRequest( url+'/template/?template='+template_filename, 'div_template' );  
356          // load css editor          // load css editor
357          iwfRequest( url+'/css/', 'div_css' );          iwfRequest( url+'/css/', 'div_css' );
358  }  }
# Line 339  function init_page() { Line 366  function init_page() {
366  </div>  </div>
367    
368  db_path = <tt>$db_path</tt><br/>  db_path = <tt>$db_path</tt><br/>
 template = $template_form<br/>  
369  css = <tt>$css_file</tt>  css = <tt>$css_file</tt>
370    
371  <div style="background: #e0e0e0; padding: 0.5em; display: block;">  <div style="background: #e0e0e0; padding: 0.5em; display: block;">
# Line 352  css = <tt>$css_file</tt> Line 378  css = <tt>$css_file</tt>
378    
379  </div>  </div>
380    
381    
382    <div id="div_template_list" style="display: inline; border: 2px solid #ffcc88; float: right; z-index: 10;">
383    $template_list_html
384    </div>
385    
386  <div>  <div>
387    
388  <div style="display: block;">  <div style="border: 2px solid #ffff80;">
389    
390  Editor  Editor
391  <a id="a_template" href="#" onClick="return edit_template();">template</a>  <a id="a_template" href="#" onClick="return edit_template();">template</a>
392  <a id="a_css" href="#" onClick="return edit_css();">css</a>  <a id="a_css" href="#" onClick="return edit_css();">css</a>
393    
394    
395  <div id="div_template">  <div id="div_template">
396  <span style="color: #808080;"> no template loaded yet. </span>  <span style="color: #808080;"> no template loaded yet. </span>
397  </div>  </div>

Legend:
Removed from v.78  
changed lines
  Added in v.79

  ViewVC Help
Powered by ViewVC 1.1.26