[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[6385] trunk



Revision: 6385
          http://sourceforge.net/p/ledger-smb/code/6385
Author:   einhverfr
Date:     2014-01-05 10:22:26 +0000 (Sun, 05 Jan 2014)
Log Message:
-----------
Template editing mostly working.  There are double escaping issues that will need to be resolved.  I will also add a file upload capability in the preview screen.

Modified Paths:
--------------
    trunk/LedgerSMB/Report/Listings/Templates.pm
    trunk/LedgerSMB/Scripts/template.pm
    trunk/LedgerSMB/Template/DB.pm
    trunk/UI/templates/edit.html
    trunk/UI/templates/preview.html
    trunk/tools/load_templates.pl

Modified: trunk/LedgerSMB/Report/Listings/Templates.pm
===================================================================
--- trunk/LedgerSMB/Report/Listings/Templates.pm	2014-01-05 10:04:15 UTC (rev 6384)
+++ trunk/LedgerSMB/Report/Listings/Templates.pm	2014-01-05 10:22:26 UTC (rev 6385)
@@ -45,11 +45,11 @@
 
 sub columns {
     return [
-      { col_id => 'template_name'
+      { col_id => 'template_name',
           name => LedgerSMB::Report::text('File Name'),
           type => 'href',
      href_base => 'templates.pl?action=display&' },
-      { col_id => 'format'
+      { col_id => 'format',
           name => LedgerSMB::Report::text('Format'),
           type => 'text' },
    ];

Modified: trunk/LedgerSMB/Scripts/template.pm
===================================================================
--- trunk/LedgerSMB/Scripts/template.pm	2014-01-05 10:04:15 UTC (rev 6384)
+++ trunk/LedgerSMB/Scripts/template.pm	2014-01-05 10:22:26 UTC (rev 6385)
@@ -41,11 +41,12 @@
 sub display {
     my ($request) = @_;
     my $dbtemp = LedgerSMB::Template::DB->get(%$request);
+    $dbtemp->{content} = $dbtemp->template;
     LedgerSMB::Template->new(
         user     => $request->{_user},
         locale   => $request->{_locale},
         path     => 'UI/templates',
-        template => 'review',
+        template => 'preview',
         format   => 'HTML'
     )->render($dbtemp);
 }
@@ -59,6 +60,7 @@
 sub edit {
     my ($request) = @_;
     my $dbtemp = LedgerSMB::Template::DB->get(%$request);
+    $dbtemp->{content} = $dbtemp->template;
     LedgerSMB::Template->new(
         user     => $request->{_user},
         locale   => $request->{_locale},

Modified: trunk/LedgerSMB/Template/DB.pm
===================================================================
--- trunk/LedgerSMB/Template/DB.pm	2014-01-05 10:04:15 UTC (rev 6384)
+++ trunk/LedgerSMB/Template/DB.pm	2014-01-05 10:22:26 UTC (rev 6385)
@@ -41,6 +41,7 @@
 
 =head2 format text (required)
 
+
 =cut
 
 has id             => (is => 'ro', isa => 'Int', required => 0);
@@ -49,6 +50,7 @@
 has format         => (is => 'ro', isa => 'Str', required => 1);
 has template       => (is => 'ro', isa => 'Str', required => 1);
 
+
 =head1 METHODS
 
 =head2 get_template(template_name, language_code, format)
@@ -109,7 +111,7 @@
     return __PACKAGE__->new(%$temp);
 }
 
-=head2 get_from_file($path)
+=head2 get_from_file($path, $language_code)
 
 Loads a template from a file path.  This should only be used during database
 setup because it could be used to access any file on the system that the web 
@@ -119,7 +121,7 @@
 =cut
 
 sub get_from_file {
-    my ($package, $path) = @_;
+    my ($package, $path, $language_code) = @_;
     my $fname = $path;
     if ($path =~ m|/.*:| ){
        die 'Cannot run on NTFS alternate data stream!';

Modified: trunk/UI/templates/edit.html
===================================================================
--- trunk/UI/templates/edit.html	2014-01-05 10:04:15 UTC (rev 6384)
+++ trunk/UI/templates/edit.html	2014-01-05 10:22:26 UTC (rev 6385)
@@ -1,11 +1,12 @@
 <?lsmb INCLUDE "ui-header.html";
  PROCESS "elements.html" ?>
-<body class="<?lsmb dojo-theme ?>">
+<body class="<?lsmb dojo_theme ?>">
 <div class="listtop"><?lsmb template_name ?>.<?lsmb format ?><?lsmb
  IF language_code; "($language_code)"; ELSE; "(" _ text("No language") _ ")";
  END; ?></div>
 <form action="template.pl" method="post">
-<textarea class="template-body <?lsmb format ?>"><?lsmb template ?></textarea>
+<textarea class="template-body <?lsmb format ?>" 
+    cols=80><?lsmb content ?></textarea><br/>
 <?lsmb 
 PROCESS input element_data = {
     type = 'hidden'

Modified: trunk/UI/templates/preview.html
===================================================================
--- trunk/UI/templates/preview.html	2014-01-05 10:04:15 UTC (rev 6384)
+++ trunk/UI/templates/preview.html	2014-01-05 10:22:26 UTC (rev 6385)
@@ -1,10 +1,10 @@
 <?lsmb INCLUDE "ui-header.html";
  PROCESS "elements.html" ?>
-<body class="<?lsmb dojo-theme ?>">
+<body class="<?lsmb dojo_theme ?>">
 <div class="listtop"><?lsmb template_name ?>.<?lsmb format ?><?lsmb
  IF language_code; "($language_code)"; ELSE; "(" _ text("No language") _ ")";
  END; ?></div>
-<div class="template_body"><?lsmb template ?></div>
+<div class="template_body"><pre><?lsmb content ?></pre></div>
 <form action="template.pl" method="get">
 <?lsmb 
 PROCESS input element_data = {

Modified: trunk/tools/load_templates.pl
===================================================================
--- trunk/tools/load_templates.pl	2014-01-05 10:04:15 UTC (rev 6384)
+++ trunk/tools/load_templates.pl	2014-01-05 10:22:26 UTC (rev 6385)
@@ -65,7 +65,7 @@
 
 sub load_template {
     my ($path) = @_;
-    my $dbtemp = LedgerSMB::Template::DB->get_from_file($path);
+    my $dbtemp = LedgerSMB::Template::DB->get_from_file($path, $language_code);
     $dbtemp->save;
 }
 

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits