/[PLies]/burst.pl
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 /burst.pl

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

revision 1.1.1.1 by dpavlin, Tue Apr 17 08:35:10 2001 UTC revision 1.5 by dpavlin, Sat May 5 03:31:31 2001 UTC
# Line 1  Line 1 
1  #!/usr/local/bin/perl  #!/usr/bin/perl
2  #  #
3  # SLies Copyright 2001 Dobrica Pavlinusic <dpavlin@rot13.org>  # SLies Copyright 2001 Dobrica Pavlinusic <dpavlin@rot13.org>
4  #  #
# Line 42  Line 42 
42  #  #
43  # Sami Lempinen - lempinen@iki.fi  # Sami Lempinen - lempinen@iki.fi
44  # http://www.snowman.sgic.fi/ssl/xslies/  # http://www.snowman.sgic.fi/ssl/xslies/
45    #
46    # Text::FastTemplate:
47    # Robert Lehr - bozzio@the-lehrs.com
48    
49  make_dotgif("pero.gif");  use Text::FastTemplate;
50    
51  ##############################################################################  ##############################################################################
52  ## default values of variables  ## default values of variables
# Line 101  $talkTitle = 'Talk'; Line 104  $talkTitle = 'Talk';
104  ## standard style sheets  ## standard style sheets
105  $cssStandard = '../PLies/css/default.css';  $cssStandard = '../PLies/css/default.css';
106    
107    ## template name
108    $template = '../PLies/default';
109    
110  ## default charset use in meta tag http-equiv (undef to skip)  ## default charset use in meta tag http-equiv (undef to skip)
111  #$charset = 'ISO-8859-1';  #$charset = 'ISO-8859-1';
112    
# Line 113  $toc_on_page = 10; Line 119  $toc_on_page = 10;
119  ## use progress bar  ## use progress bar
120  $progress_bar = 1;  $progress_bar = 1;
121    
122    ## content hight for each slide
123    $content_hight = "70%";
124    
125  ## end of default values for the presentation  ## end of default values for the presentation
126  ##############################################################################  ##############################################################################
127    
# Line 120  $progress_bar = 1; Line 129  $progress_bar = 1;
129  my $logo_html;  my $logo_html;
130  my $date_html;  my $date_html;
131  my $last_toc_title;  my $last_toc_title;
132    my %page_data;
133    my %overview_data;
134    
135  ##############################################################################  ##############################################################################
136  ## reading user input from $infos  ## reading user input from $infos
# Line 150  if (open(INFOS, $infos)) { Line 161  if (open(INFOS, $infos)) {
161  ## process arguments  ## process arguments
162  ## each preset variable is now re-attributed using the user preferences  ## each preset variable is now re-attributed using the user preferences
163  foreach (@PARAM) {  foreach (@PARAM) {
164      @_ = split(/ *= */,$_,2);          my ($var,$value) = split(/ *= */,$_,2);
165      $cmd="\$$_[0] = \'$_[1]\';";          $value=~s/'/\\'/g;
166      if (length $_[1] != 0) {          $cmd="\$$var = \'$value\';";
167          eval($cmd);          if ($value) {
168      }                  eval($cmd) || die "problem with eval of: $cmd";
169            } else {
170                    die "no value defined for $var";
171            }
172  }  }
173    
174  ## use charset  ## use charset
# Line 165  if ($charset) { Line 179  if ($charset) {
179          $http_equiv='';          $http_equiv='';
180  }  }
181    
   
 ## build an html string for the author variable  
 ## containing the presentation author name linked to  
 ## a location of his choice  
 if ($authorUrl) {  
     $author = "<a href=\"$authorUrl\">$author</a>";  
 }  
   
 ## same string is built if there is a second author for the presentation  
 if ($author2Url) {  
     $author2 = "<br><a href=\"$author2Url\">$author2</a>";  
 } elsif ($author2) {  
     $author2 = "<br>$author2";  
 }  
   
182  ##############################################################################  ##############################################################################
183  ## read the raw html presentation  ## read the raw html presentation
184  ##  ##
# Line 227  print STDOUT "\n--- Processing $total sl Line 226  print STDOUT "\n--- Processing $total sl
226  ## start the slide count so we can number them  ## start the slide count so we can number them
227  $slideCount = 1;  $slideCount = 1;
228    
229    ## pre-load template slides using $template dir
230    Text::FastTemplate->defaults(
231                    path => [ $template ]
232            );
233    
234    Text::FastTemplate->preload( [
235                    { file => 'slide.html', key => 'slide' },
236                    { file => 'overview.html', key => 'overview' },
237            ]);
238    
239  ## @table is the array containing each slide with its title  ## @table is the array containing each slide with its title
240  ## for each slide to be generated  ## for each slide to be generated
# Line 313  sub openOverview Line 321  sub openOverview
321          ## here is the standard style sheet          ## here is the standard style sheet
322          $stylelink .= "<link href=\"$cssStandard\" rel=\"stylesheet\" type=\"text/css\" title=\"Talk\" media=\"screen\">";          $stylelink .= "<link href=\"$cssStandard\" rel=\"stylesheet\" type=\"text/css\" title=\"Talk\" media=\"screen\">";
323    
324          if ($logoFile) {          %overview_data = (
325                  $logo_html="<a href=\"$logoLink\"><img src=\"$logoFile\" alt=\"$logoAlt\" border=\"0\"></a>";                  doctype => $doctype,
326          }                  title => $title,
327                    http_equiv => $http_equiv,
328                    stylelink => $stylelink,
329                    body => $body,
330    
331                    logoLink => $logoLink,
332                    logoFile => $logoFile,
333                    logoAlt => $logoAlt,
334    
335                    talkTitle => $talkTitle,
336                    talkSubTitle => $talkSubTitle,
337    
338                    content_hight => $content_hight,
339    
340                    author => $author,
341                    authorUrl => $authorUrl,
342                    author2 => $author2,
343                    authorUrl2 => $authorUrl2,
344    
345          if ($logoFile2) {                  date => $date,
                 $logo_html.="<a href=\"$logoLink2\"><img src=\"$logoFile2\" alt=\"$logoAlt2\" border=\"0\"></a>";  
         }  
346    
347          $title_html="<h1>$talkTitle</h1>";                  toc => $loc_toc,
348          if (length $talkSubTitle != 0) {          );
                 $title_html.="<h2>$talkSubTitle</h2>";  
         }  
   
         if (length $date != 0) {  
                 $date_html="($date)";  
         }  
   
         print FOO <<END;  
 $doctype  
     <head>  
             <title>$talkTitle - $loc_toc</title>  
             $http_equiv  
             $stylelink  
      </head>  
      $body  
         <table height="100%" width="100%">  
             <tr>  
                 <td class="header-first" valign="top">  
                     <table width="100%" border="0">  
                         <tr>  
                             <td class="cell-logo">$logo_html</td>  
                             <td class="cell-heading">$title_html</td>  
                         </tr>  
                     </table>  
                 </td>  
             </tr>  
             <tr>  
                 <td height="80%" class="body" valign="top">  
                     <div class="body">  
                         <h3>$loc_toc</h3>  
                         <ul>  
 END  
349    
350  }  }
351  ##  ##
# Line 366  END Line 357  END
357    
358  sub closeOverview  sub closeOverview
359  {  {
360          my $slide_html=make_progress_bar(0,$total);          $overview_data{slide_html} = make_progress_bar(0,$total);
361          print FOO <<END;          $overview_data{toc_entries} = [ @toc_entries ];
362                          </ul>  
363                      </div>          print "---",$#toc_entries;
364                  </td>          use Data::Dumper;
365              </tr>          print Dumper([ @toc_entries ]);
366              <tr>  
367                  <td class="footer">          my $page= new Text::FastTemplate key => 'overview';
368                      <table border="0" width="100%">          print FOO $page->output( \%overview_data );
                         <tr>  
                             <td width="33%" class="footer-info">  
                                 <p>  
                                     <i>$talkTitle</i>  
                                     <br>$author $date_html  
                                 </p>  
                             </td><td width="33%" class="footer-nav">  
                                 <table border="0">  
                                     <tr>  
                                         <td>  
         [ <a href="slide1.html">On with the show</a> ]  
                                         </td>  
                                     </tr>  
                                 </table>  
                             </td><td width="33%" class="footer-count">  
                                 $slide_html  
                                 $author2</td>  
                         </tr>  
                     </table>  
                 </td>  
             </tr>  
         </table>  
     </body>  
 </html>  
 END  
369    
370          close(FOO);          close(FOO);
371  }  }
# Line 425  sub addTitle Line 391  sub addTitle
391          if ($nr % $toc_on_page == 0) {          if ($nr % $toc_on_page == 0) {
392                  my $toc_nr=int($nr/$toc_on_page);                  my $toc_nr=int($nr/$toc_on_page);
393    
394                  print FOO <<END;                  %item = (
395  <br><small><a accesskey=" " tabindex=" " href="index-toc$toc_nr.html">...</a></small></br>                          pre_html => $pre_ul,
396  END                          accesskey => " ",       # space
397                            href => "index-toc$toc_nr.html",
398                            title => "...",
399                            post_html => $post_ul,
400                            more => 1,      # use style for more pages link (...)
401                    )
402    #               push @toc_entries, %item;
403    
404                  &closeOverview;                  &closeOverview;
405                  &openOverview("$overview-toc$toc_nr");                  &openOverview("$overview-toc$toc_nr");
406                  $last_toc_title='';                  $last_toc_title='';
407          }          }
408    
409          $ul1=$ul2='';          $pre_ul=$post_ul='';
410          if ($last_toc_title eq $title) {          if ($last_toc_title eq $title) {
411                  $title = $subtitle;                  $title = $subtitle;
412                  $ul1='<ul>';                  $pre_ul='<ul>';
413                  $ul2='</ul>';                  $post_ul='</ul>';
414          } else {          } else {
415                  $last_toc_title=$title;                  $last_toc_title=$title;
416          }          }
# Line 445  END Line 418  END
418          # add accesskey for first 9 slides (`1' - `9') or just for first          # add accesskey for first 9 slides (`1' - `9') or just for first
419          # TOC page, and tabindex for all slides          # TOC page, and tabindex for all slides
420          if ($nr < 10 && $nr < $toc_on_page) {          if ($nr < 10 && $nr < $toc_on_page) {
421                  print FOO <<END;                  $item = {
422  $ul1<li><a accesskey="$nr" tabindex="$nr" href="slide$nr.html">$title</a></li>$ul2                          pre_html => $pre_ul,
423  END                          accesskey => "$nr",
424                            tabindex => "$nr",
425                            href => "slide$nr.html",
426                            title => $title,
427                            post_html => $post_ul,
428                            more => 0,
429                    };
430                    push @toc_entries,$item;
431          } else {          } else {
432                  print FOO <<END;                  %item = (
433  $ul1<li><a tabindex="$nr" href="slide$nr.html">$title</a></li>$ul2                          pre_html => $pre_ul,
434  END                          tabindex => "$nr",
435                            href => "slide$nr.html",
436                            title => $title,
437                            post_html => $post_ul,
438                    )
439    #               push @toc_entries,\%item;
440          }          }
441  }  }
442  ##  ##
# Line 529  sub createSlide Line 514  sub createSlide
514    
515          my $slide_html=make_progress_bar($nr,$total);          my $slide_html=make_progress_bar($nr,$total);
516    
517          print SLIDE <<END;          %page_data = (
518  $doctype                  doctype => $doctype,
519      <head>                  talkTitle => $talkTitle,
520              <title>$talkTitle - $title</title>                  title => $title,
521              $http_equiv                  http_equiv => $http_equiv,
522              $stylelink                  stylelink => $stylelink,
523       </head>                  body => $body,
524       $body  
525          <table height="100%" width="100%">                  logo_html => $logo_html,
526              <tr>                  title_html => $title_html,
527                  <td class="header-first" valign="top">                  content_hight => $content_hight,
528                      <table width="100%" border="0">                  content => $content,
529                          <tr>                  author => $author,
530                              <td class="cell-logo">$logo_html</td>                  date_html => $date_html,
531                              <td class="cell-heading">$title_html</td>                  prevlink => $prevlink,
532                          </tr>                  toclink => $toclink,
533                      </table>                  nextlink => $nextlink,
534                  </td>                  slide_html => $slide_html,
535              </tr>                  author2 => $author2
536              <tr>  
537                  <td height="80%" class="body" valign="top">          );
538                      <div class="body">  
539  $content          my $page= new Text::FastTemplate key => 'slide';
540                      </div>          print SLIDE $page->output( \%page_data );
                 </td>  
             </tr>  
             <tr>  
                 <td class="footer">  
                     <table border="0" width="100%">  
                         <tr>  
                             <td width="33%" class="footer-info">  
                                 <p>  
                                     <i>$talkTitle</i>  
                                     <br>$author $date_html  
                                 </p>  
                             </td><td width="33%" class="footer-nav">  
                                 <table border="0">  
                                     <tr>  
                                         <td>  
 $prevlink  
 $toclink  
 $nextlink  
                                         </td>  
                                     </tr>  
                                 </table>  
                             </td><td width="33%" class="footer-count">  
                                 $slide_html  
                                 $author2</td>  
                         </tr>  
                     </table>  
                 </td>  
             </tr>  
         </table>  
     </body>  
 </html>  
 END  
541    
542          close(SLIDE);          close(SLIDE);
543          return 0;          return 0;
# Line 677  sub make_progress_bar { Line 630  sub make_progress_bar {
630                  } else {                  } else {
631                          $r=$t;                          $r=$t;
632                  }                  }
633                  $html='<table border="0" width="30%" cellpadding="0" cellspacing="0" align="right"><tr><td width="'.$pcnt_done.'%" class="pcnt-done">'.$l.'</td><td width="'.$pcnt_left.'%" class="pcnt-left">'.$r.'</td></tr></table>';                  $html='<table border="0" width="50%" cellpadding="0" cellspacing="0" align="right"><tr><td width="'.$pcnt_done.'%" class="pcnt-done">'.$l.'</td><td width="'.$pcnt_left.'%" class="pcnt-left">'.$r.'</td></tr></table>';
634          } else {          } else {
635                  $html="$loc_slide $nr $loc_of $total";                  $html="$loc_slide $nr $loc_of $total";
636          }          }

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.26