Umstellung der Kontenübersicht auf die Verwendung von "Template".
authorMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 12 Jul 2007 13:39:09 +0000 (13:39 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 12 Jul 2007 13:39:09 +0000 (13:39 +0000)
SL/Form.pm
bin/mozilla/am.pl
templates/webpages/am/list_accounts_de.html
templates/webpages/am/list_accounts_master.html

index c62c8ad..b9ef3e1 100644 (file)
@@ -386,10 +386,15 @@ sub header {
 
   if ($ENV{HTTP_USER_AGENT}) {
 
-    if ($self->{stylesheet} && (-f "css/$self->{stylesheet}")) {
-      $stylesheet =
-        qq|<LINK REL="stylesheet" HREF="css/$self->{stylesheet}" TYPE="text/css" TITLE="Lx-Office stylesheet">
- |;
+    my $stylesheets = "$self->{stylesheet} $self->{stylesheets}";
+
+    $stylesheets =~ s|^\s*||;
+    $stylesheets =~ s|\s*$||;
+    foreach my $file (split m/\s+/, $stylesheets) {
+      $file =~ s|.*/||;
+      next if (! -f "css/$file");
+
+      $stylesheet .= qq|<link rel="stylesheet" href="css/$file" TYPE="text/css" TITLE="Lx-Office stylesheet">\n|;
     }
 
     $self->{favicon}    = "favicon.ico" unless $self->{favicon};
index 4f8f3bc..87ec9b3 100644 (file)
@@ -413,16 +413,14 @@ sub list_account {
 
   foreach $ca (@{ $form->{CA} }) {
 
-    $ca->{debit}  = "&nbsp;";
-    $ca->{credit} = "&nbsp;";
+    $ca->{debit}  = "";
+    $ca->{credit} = "";
 
     if ($ca->{amount} > 0) {
-      $ca->{credit} =
-        $form->format_amount(\%myconfig, $ca->{amount}, 2, "&nbsp;");
+      $ca->{credit} = $form->format_amount(\%myconfig, $ca->{amount}, 2);
     }
     if ($ca->{amount} < 0) {
-      $ca->{debit} =
-        $form->format_amount(\%myconfig, -1 * $ca->{amount}, 2, "&nbsp;");
+      $ca->{debit} = $form->format_amount(\%myconfig, -1 * $ca->{amount}, 2);
     }
     $ca->{heading}   = ( $ca->{charttype} eq 'H' ) ? 1:''; 
     $ca->{link_edit_account} = 
@@ -437,16 +435,16 @@ sub list_account {
              ."&password=$form->{password}&action=list_account_details&";
   
   
-  my $pjx = new CGI::Ajax( 
-             'list_account_details' => $list_account_details_url 
-  );
+  my $pjx = new CGI::Ajax('list_account_details' => $list_account_details_url);
 
   # Eneable AJAX debuging
   #$pjx->DEBUG(1);
   #$pjx->JSDEBUG(1);
     
   push(@ { $form->{AJAX} }, $pjx);
-  
+
+  $form->{stylesheets} = "list_accounts.css";
+
   $form->header;
   
   
@@ -455,7 +453,7 @@ sub list_account {
   };
   
   # Ausgabe des Templates
-  print($form->parse_html_template('am/list_accounts', $parameters_ref));
+  print($form->parse_html_template2('am/list_accounts', $parameters_ref));
   
   $lxdebug->leave_sub();
 
index 017c830..2f0543a 100644 (file)
+[% USE HTML %]<body>
 
-  <style type="text/css">
-  
-  /* Kontenliste Styles */
-
-  .coa_listtop { 
-       background-color:rgb(236,233,216); 
-       text-align:left;
-       padding:5px;
-       font-size:12pt; 
-       color:black; 
-       font-weight: bolder;
-       border-style:dashed;
-       border-width:thin;
-  }
-
-  .coa_listheading { 
-       background-color:rgb(236,233,216); 
-       color: black; 
-       background-image:url("../image/fade.png");
-  }
-  
-  .coa_listheading_element { 
-       font-size:10pt; 
-       padding:3px;
-       font-weight:bolder;
-       text-align:left;
-       border-style:dotted;
-       border-width:thin;
-  }
-  
-  .coa_listrow1 { 
-       background-color: rgb(208,207,201); 
-       color: black; 
-       vertical-align: top; 
-  }
-
-  .coa_listrow0 { 
-        background-color: rgb(236,233,216); 
-        color: black; 
-        vertical-align: top; 
-  }
-
-  .coa_amount {
-        text-align:right;
-        font-familiy:monospace;
-  }
-
-  .coa_account_header {
-        font-size:10pt; 
-       padding:3px;
-       font-weight:bolder;
-       text-align:left;
-       border-style:none;
-       border-width:thin;
-  
-  }
-
-  .coa_account_header_sc {
-        font-size:10pt; 
-       padding:3px;
-       font-weight:bolder;
-       text-align:left;
-       border-style:none;
-       border-width:thin;
-        cursor:s-resize;
-  }
-  
-  .coa_detail {
-       padding:0px;
-       border-style:none;
-  }
-  
-  .coa_detail_emph {
-        font-size:10pt;
-        font-weight:bold;
-        color:darkred;
-  }
-                    
-  .coa_details_header {
-        font-size:8pt; 
-       padding:3px;
-       font-weight:bolder;
-       text-align:center;
-       border-style:none;
-       border-width:thin;
-  }
-
-  .coa_details_header2 {
-        font-size:8pt; 
-       padding:3px;
-       font-weight:normal;
-       text-align:left;
-       border-style:none;
-       border-width:thin;
-  }
-  
-  </style>
-
-</head>
-
-<body>
-
-<br/><div id='pjxdebugrequest'></div><br/>
-
-
-<table width=100%>
-  <tr class="coa_listtop">
-      <th class="coa_listtop"><TMPL_VAR title ESCAPE=HTML></th>
-  </tr>
-</table>
+ <br/><div id='pjxdebugrequest'></div><br/>
+
+ <div class="coa_listtop">[% title %]</div>
 
-<br />
+ <br />
 
-<table width="100%">
+ <table width="100%">
 
   <colgroup>
-      <col width="10%">
-      <col width="10%">
-      <col width="10%">
-      <col width="50%">
-      <col width="10%">
-      <col width="10%">
+   <col width="10%">
+   <col width="10%">
+   <col width="10%">
+   <col width="50%">
+   <col width="10%">
+   <col width="10%">
   </colgroup>
-  
+
   <tr class="coa_listheading">
-    
-    <td class="coa_listheading_element">
-        Konto
-    </td>
-    <td colspan="3" class="coa_listheading_element">
-        Beschreibung (Klick
-  öffnet einzelne Kontendetails)
-    </td>
-    <td class="coa_listheading_element">
-        Soll
-    </td>
-    <td class="coa_listheading_element">
-        Haben
-    </td>
+   <td class="coa_listheading_element">Konto</td>
+   <td colspan="3" class="coa_listheading_element">Beschreibung (Klick
+  öffnet einzelne Kontendetails)</td>
+   <td class="coa_listheading_element">Soll</td>
+   <td class="coa_listheading_element">Haben</td>
   </tr>
 
-<TMPL_LOOP CA>
-
-  <TMPL_IF heading>
-        <tr>
-          <td class="accountlistheading">
-            <a href="<TMPL_VAR link_edit_account>" >
-            <TMPL_VAR accno>
-            </a>
-          </td>
-          <td colspan="5" class="accountlistheading">
-            <TMPL_VAR description>
-          </td>
-        </tr>
-  <TMPL_ELSE>
-
-    <TMPL_IF __odd__>
-        <tr class="coa_listrow1">
-    <TMPL_ELSE>
-        <tr class="coa_listrow0">
-    </TMPL_IF>
-    
-
-    <td class="coa_account_header">
-        <b><a href="<TMPL_VAR link_edit_account>" ><TMPL_VAR accno></a></b>
+  [% SET row_odd = '1' %][% FOREACH row = CA %]
 
-    </td>
-    <input type="hidden" name="chart_id" value="<TMPL_VAR id ESCAPE=HTML>"
-    id="chart_id_<TMPL_VAR id ESCAPE=HTML>" >
-    <td colspan="3" id="accountcontent<TMPL_VAR id
-      ESCAPE=HTML>-title" class="coa_account_header_sc"
-      onclick="list_account_details( ['chart_id_<TMPL_VAR id ESCAPE=HTML>'],
-      ['ajaxcontent<TMPL_VAR id ESCAPE=HTML>'] )">
-    <TMPL_VAR description ESCAPE=HTML>&nbsp;
-    </td>
-    <td class="coa_account_header">
-            <div class="coa_amount"><TMPL_VAR debit></div>
-    </td>
-    <td class="coa_account_header">
-            <div class="coa_amount"><TMPL_VAR credit>&nbsp;</div>
+  [% IF row.heading %]
+  <tr>
+   <td class="accountlistheading"><a href="[% row.link_edit_account %]">[% HTML.escape(row.accno) %]</a></td>
+   <td colspan="5" class="accountlistheading">[% HTML.escape(row.description) %]</td>
+  </tr>
+
+  [% ELSE %]
+
+  <tr class="coa_listrow[% IF row_odd %]1[% SET row_odd = '0' %][% ELSE %]0[% SET row_odd = '1' %][% END %]">
+
+   <td class="coa_account_header">
+    <b><a href="[% row.link_edit_account %]" >[% HTML.escape(row.accno) %]</a></b>
+   </td>
+
+   <input type="hidden" name="chart_id" value="[% HTML.escape(row.id) %]" id="chart_id_[% HTML.escape(row.id) %]" >
+   <td colspan="3" id="accountcontent[% HTML.escape(row.id) %]-title" class="coa_account_header_sc"
+       onclick="list_account_details( ['chart_id_[% HTML.escape(row.id) %]'], ['ajaxcontent[% HTML.escape(row.id) %]'] )">
+    [% HTML.escape(row.description) %]
+   </td>
+
+    <td class="coa_account_header"><div class="coa_amount">[% HTML.escape(row.debit) %]</div></td>
+    <td class="coa_account_header"><div class="coa_amount">[% HTML.escape(row.credit) %]</div>
     </td>
   </tr>
+
   <tr class="coa_detail">
-    <td colspan="6" width="100%"> 
-        <div id="ajaxcontent<TMPL_VAR id ESCAPE=HTML>">
-      </div>
-    </td>
+   <td colspan="6" width="100%"><div id="ajaxcontent[% HTML.escape(row.id) %]"></div></td>
   </tr>
-  
-  </TMPL_IF>
-  
-</TMPL_LOOP>
 
-</table>
+  [% END %]
 
-</body>
-</html>
+  [% END %]
 
+ </table>
 
+</body>
+</html>
index e921a1f..da998e2 100644 (file)
+[% USE HTML %]<body>
 
-  <style type="text/css">
-  
-  /* Kontenliste Styles */
-
-  .coa_listtop { 
-       background-color:rgb(236,233,216); 
-       text-align:left;
-       padding:5px;
-       font-size:12pt; 
-       color:black; 
-       font-weight: bolder;
-       border-style:dashed;
-       border-width:thin;
-  }
-
-  .coa_listheading { 
-       background-color:rgb(236,233,216); 
-       color: black; 
-       background-image:url("../image/fade.png");
-  }
-  
-  .coa_listheading_element { 
-       font-size:10pt; 
-       padding:3px;
-       font-weight:bolder;
-       text-align:left;
-       border-style:dotted;
-       border-width:thin;
-  }
-  
-  .coa_listrow1 { 
-       background-color: rgb(208,207,201); 
-       color: black; 
-       vertical-align: top; 
-  }
-
-  .coa_listrow0 { 
-        background-color: rgb(236,233,216); 
-        color: black; 
-        vertical-align: top; 
-  }
-
-  .coa_amount {
-        text-align:right;
-        font-familiy:monospace;
-  }
-
-  .coa_account_header {
-        font-size:10pt; 
-       padding:3px;
-       font-weight:bolder;
-       text-align:left;
-       border-style:none;
-       border-width:thin;
-  
-  }
-
-  .coa_account_header_sc {
-        font-size:10pt; 
-       padding:3px;
-       font-weight:bolder;
-       text-align:left;
-       border-style:none;
-       border-width:thin;
-        cursor:s-resize;
-  }
-  
-  .coa_detail {
-       padding:0px;
-       border-style:none;
-  }
-  
-  .coa_detail_emph {
-        font-size:10pt;
-        font-weight:bold;
-        color:darkred;
-  }
-                    
-  .coa_details_header {
-        font-size:8pt; 
-       padding:3px;
-       font-weight:bolder;
-       text-align:center;
-       border-style:none;
-       border-width:thin;
-  }
-
-  .coa_details_header2 {
-        font-size:8pt; 
-       padding:3px;
-       font-weight:normal;
-       text-align:left;
-       border-style:none;
-       border-width:thin;
-  }
-  
-  </style>
-
-</head>
-
-<body>
-
-<br/><div id='pjxdebugrequest'></div><br/>
-
-
-<table width=100%>
-  <tr class="coa_listtop">
-      <th class="coa_listtop"><TMPL_VAR title ESCAPE=HTML></th>
-  </tr>
-</table>
+ <br/><div id='pjxdebugrequest'></div><br/>
+
+ <div class="coa_listtop">[% title %]</div>
 
-<br />
+ <br />
 
-<table width="100%">
+ <table width="100%">
 
   <colgroup>
-      <col width="10%">
-      <col width="10%">
-      <col width="10%">
-      <col width="50%">
-      <col width="10%">
-      <col width="10%">
+   <col width="10%">
+   <col width="10%">
+   <col width="10%">
+   <col width="50%">
+   <col width="10%">
+   <col width="10%">
   </colgroup>
-  
+
   <tr class="coa_listheading">
-    
-    <td class="coa_listheading_element">
-        <translate>Account</translate>
-    </td>
-    <td colspan="3" class="coa_listheading_element">
-        <translate>Description (Click on Description for details)</translate>
-    </td>
-    <td class="coa_listheading_element">
-        <translate>Debit</translate>
-    </td>
-    <td class="coa_listheading_element">
-        <translate>Credit</translate>
-    </td>
+   <td class="coa_listheading_element"><translate>Account</translate></td>
+   <td colspan="3" class="coa_listheading_element"><translate>Description (Click on Description for details)</translate></td>
+   <td class="coa_listheading_element"><translate>Debit</translate></td>
+   <td class="coa_listheading_element"><translate>Credit</translate></td>
   </tr>
 
-<TMPL_LOOP CA>
-
-  <TMPL_IF heading>
-        <tr>
-          <td class="accountlistheading">
-            <a href="<TMPL_VAR link_edit_account>" >
-            <TMPL_VAR accno>
-            </a>
-          </td>
-          <td colspan="5" class="accountlistheading">
-            <TMPL_VAR description>
-          </td>
-        </tr>
-  <TMPL_ELSE>
-
-    <TMPL_IF __odd__>
-        <tr class="coa_listrow1">
-    <TMPL_ELSE>
-        <tr class="coa_listrow0">
-    </TMPL_IF>
-    
-
-    <td class="coa_account_header">
-        <b><a href="<TMPL_VAR link_edit_account>" ><TMPL_VAR accno></a></b>
+  [% SET row_odd = '1' %][% FOREACH row = CA %]
 
-    </td>
-    <input type="hidden" name="chart_id" value="<TMPL_VAR id ESCAPE=HTML>"
-    id="chart_id_<TMPL_VAR id ESCAPE=HTML>" >
-    <td colspan="3" id="accountcontent<TMPL_VAR id
-      ESCAPE=HTML>-title" class="coa_account_header_sc"
-      onclick="list_account_details( ['chart_id_<TMPL_VAR id ESCAPE=HTML>'],
-      ['ajaxcontent<TMPL_VAR id ESCAPE=HTML>'] )">
-    <TMPL_VAR description ESCAPE=HTML>&nbsp;
-    </td>
-    <td class="coa_account_header">
-            <div class="coa_amount"><TMPL_VAR debit></div>
-    </td>
-    <td class="coa_account_header">
-            <div class="coa_amount"><TMPL_VAR credit>&nbsp;</div>
+  [% IF row.heading %]
+  <tr>
+   <td class="accountlistheading"><a href="[% row.link_edit_account %]">[% HTML.escape(row.accno) %]</a></td>
+   <td colspan="5" class="accountlistheading">[% HTML.escape(row.description) %]</td>
+  </tr>
+
+  [% ELSE %]
+
+  <tr class="coa_listrow[% IF row_odd %]1[% SET row_odd = '0' %][% ELSE %]0[% SET row_odd = '1' %][% END %]">
+
+   <td class="coa_account_header">
+    <b><a href="[% row.link_edit_account %]" >[% HTML.escape(row.accno) %]</a></b>
+   </td>
+
+   <input type="hidden" name="chart_id" value="[% HTML.escape(row.id) %]" id="chart_id_[% HTML.escape(row.id) %]" >
+   <td colspan="3" id="accountcontent[% HTML.escape(row.id) %]-title" class="coa_account_header_sc"
+       onclick="list_account_details( ['chart_id_[% HTML.escape(row.id) %]'], ['ajaxcontent[% HTML.escape(row.id) %]'] )">
+    [% HTML.escape(row.description) %]
+   </td>
+
+    <td class="coa_account_header"><div class="coa_amount">[% HTML.escape(row.debit) %]</div></td>
+    <td class="coa_account_header"><div class="coa_amount">[% HTML.escape(row.credit) %]</div>
     </td>
   </tr>
+
   <tr class="coa_detail">
-    <td colspan="6" width="100%"> 
-        <div id="ajaxcontent<TMPL_VAR id ESCAPE=HTML>">
-      </div>
-    </td>
+   <td colspan="6" width="100%"><div id="ajaxcontent[% HTML.escape(row.id) %]"></div></td>
   </tr>
-  
-  </TMPL_IF>
-  
-</TMPL_LOOP>
 
-</table>
+  [% END %]
 
-</body>
-</html>
+  [% END %]
 
+ </table>
 
+</body>
+</html>