Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 52131da1

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID 52131da17ff7e648b2fc2f2f853e6082dfe238e5
  • Vorgänger ea0f9b7e
  • Nachfolger 5f6d6d4e

Artikelstammdaten: HTML in Langtexten nutzen

Unterschiede anzeigen:

SL/DB/Part.pm
9 9
use SL::DB::MetaSetup::Part;
10 10
use SL::DB::Manager::Part;
11 11
use SL::DB::Chart;
12
use SL::DB::Helper::AttrHTML;
12 13
use SL::DB::Helper::TransNumberGenerator;
13 14
use SL::DB::Helper::CustomVariables (
14 15
  module      => 'IC',
......
40 41

  
41 42
__PACKAGE__->meta->initialize;
42 43

  
44
__PACKAGE__->attr_html('notes');
45

  
43 46
__PACKAGE__->before_save('_before_save_set_partnumber');
44 47

  
45 48
sub _before_save_set_partnumber {
SL/DB/Translation.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4 1
package SL::DB::Translation;
5 2

  
6 3
use strict;
7 4

  
8 5
use SL::DB::MetaSetup::Translation;
6
use SL::DB::Helper::AttrHTML;
9 7

  
10 8
__PACKAGE__->meta->initialize;
11 9

  
12
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
13 10
__PACKAGE__->meta->make_manager_class;
14 11

  
12
__PACKAGE__->attr_html('longdescription');
13

  
15 14
1;
SL/IC.pm
40 40

  
41 41
use SL::CVar;
42 42
use SL::DBUtils;
43
use SL::HTML::Restrict;
43 44
use SL::TransNumber;
44 45

  
45 46
use strict;
......
227 228
  my @values;
228 229
  # connect to database, turn off AutoCommit
229 230
  my $dbh = $form->get_standard_dbh;
231
  my $restricter = SL::HTML::Restrict->create;
230 232

  
231 233
  # save the part
232 234
  # make up a unique handle and store in partnumber field
......
371 373
             $form->{lastcost},
372 374
             $form->{weight},
373 375
             $form->{unit},
374
             $form->{notes},
376
             $restricter->process($form->{notes}),
375 377
             $form->{formel},
376 378
             $form->{rop},
377 379
             conv_i($form->{warehouse_id}),
......
405 407
    $sth   = $dbh->prepare($query);
406 408

  
407 409
    foreach my $translation (@translations) {
408
      do_statement($form, $sth, $query, conv_i($form->{id}), conv_i($translation->{language_id}), $translation->{translation}, $translation->{longdescription});
410
      do_statement($form, $sth, $query, conv_i($form->{id}), conv_i($translation->{language_id}), $translation->{translation}, $restricter->process($translation->{longdescription}));
409 411
    }
410 412

  
411 413
    $sth->finish();
bin/mozilla/ic.pl
39 39
use SL::CVar;
40 40
use SL::IC;
41 41
use SL::Helper::Flash;
42
use SL::HTML::Util;
42 43
use SL::ReportGenerator;
43 44

  
44 45
#use SL::PE;
......
1382 1383
    }
1383 1384
    map { $row->{$_}{link} = $ref->{$_} } qw(drawing microfiche);
1384 1385

  
1386
    $row->{notes}{data} = SL::HTML::Util->strip($ref->{notes});
1387

  
1385 1388
    $report->add_data($row);
1386 1389

  
1387 1390
    my $next_ref = $form->{parts}[$idx + 1];
......
1628 1631
  CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}, show_disabled_message => 1)
1629 1632
    if (scalar @{ $form->{CUSTOM_VARIABLES} });
1630 1633

  
1634
  $::request->layout->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery);
1631 1635
  $form->header;
1632 1636
  #print $form->parse_html_template('ic/form_header', { ALL_PRICE_FACTORS => $form->{ALL_PRICE_FACTORS},
1633 1637
  #                                                     ALL_UNITS         => $form->{ALL_UNITS},
templates/webpages/ic/form_header.html
1 1
[%- USE T8 %]
2 2
[%- USE HTML %]
3
[%- USE LxERP %][%- USE L -%]
3
[%- USE LxERP %][%- USE L -%][%- USE P -%]
4 4
[% PROCESS 'common/select_warehouse_bin.html' %]
5 5
 <p><div class="listtop">[% title %]  [% HTML.escape(partnumber) %]  [% HTML.escape(description) %]</div></p>
6 6

  
......
133 133
              <th align="left">[% 'Part Notes' | $T8 %]</th>
134 134
              <th align="left">[% 'Formula' | $T8 %]</th>
135 135
             </tr>
136
             <tr>
136
             <tr valign="top">
137 137
              <td>
138
               <textarea name="notes" rows="[% HTML.escape(notes_rows) %]" cols="45" wrap="soft">[% HTML.escape(notes) %]</textarea>
138
               [% L.textarea_tag("notes", P.restricted_html(notes), class="texteditor", style="width: 600px; height: 200px") %]
139 139
              </td>
140 140
              <td>
141 141
               <ilayer>
templates/webpages/ic/parts_language_selection.html
1
[%- USE T8 %]
2
[%- USE HTML %][%- USE L -%][%- USE P -%]
3
 <form name="Form">
4

  
5
  <input type="hidden" name="input_name" value="[% HTML.escape(input_name) %]">
6

  
7
  <div class="listtop">[% title %]</div>
8

  
9
  <p>[% 'Please insert your language values below' | $T8 %]</p>
10

  
11
  <p>
12
   <table>
13
    <tr class="listheading">
14
     <th class="listheading">&nbsp;</th>
15
     [%- FOREACH col = HEADER %]
16
     <th nowrap class="listheading">[% col.column_title %]</th>
17
     [%- END %]
18
    </tr>
19

  
20
    [%- FOREACH row = LANGUAGES %]
21
    <tr class="listrow[% loop.count % 2 %]">
22
     <td>[% L.hidden_tag("id_" _ loop.count, row.id) %][% HTML.escape(row.description) %]</td>
23
     <td>
24
       [%- IF row.translation_area %]
25
         [% L.textarea_tag("translation_" _ loop.count, row.translation, rows=row.translation_rows, cols="40", wrap="soft") %]
26
       [%- ELSE %]
27
         [% L.input_tag("translation_" _ loop.count, row.translation) %]
28
       [%- END %]
29
     </td>
30
     <td>
31
      [% L.textarea_tag("longdescription_" _ loop.count, P.restricted_html(row.longdescription), class="texteditor", style="width: 500px; height: 100px") %]
32
     </td>
33
    </tr>
34

  
35
    [%- IF loop.last %]
36
    <input type="hidden" id="rowcount" name="rowcount" value="[% loop.count %]">
37
    [%- END %]
38
    [%- END %]
39
   </table>
40
  </p>
41

  
42
  <p>
43
   <button type="button" onclick="languages_updated()">[% 'Close' | $T8 %]</button>
44
  </p>
45

  
46
 </form>
47

  
48
 <script type="text/javascript">
49
  <!--
50
      function languages_updated() {
51
        var languages = "";
52
        for (var i = 1; i <= (document.getElementsByName("rowcount")[0].value); i++) {
53
          var id              = "id_" + i ;
54
          var translation     = "translation_" + i ;
55
          var longdescription = "longdescription_" + i;
56

  
57
          languages = languages +
58
            "---+++---" + $('#id_' + i).val() +
59
            "--++--" + $('#translation_' + i).val() +
60
            "--++--"  + $('#longdescription_' + i).val();
61
        }
62
        console.info(languages);
63

  
64
        window.opener.document.getElementsByName(document.Form.input_name.value)[0].value = languages;
65

  
66
        self.close();
67
      }
68
      //-->
69
 </script>
templates/webpages/ic/tabs/_edit_translations.html
15 15
   <tr class="listrow" valign="top">
16 16
    <td>[% HTML.escape(language.description) %]</td>
17 17
    <td>[% L.input_tag("translations[].translation", translation.translation) %]</td>
18
    <td>[% L.textarea_tag("translations[].longdescription", translation.longdescription, id="translations_longdescription_" _ language_id, style="width: 500px; height: 100px") %]</td>
18
    <td>[% L.textarea_tag("translations[].longdescription", P.restricted_html(translation.longdescription), id="translations_longdescription_" _ language_id, class="texteditor", style="width: 500px; height: 100px") %]</td>
19 19
   </tr>
20 20
  [%- END %]
21 21
 </table>

Auch abrufbar als: Unified diff