Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a3f90d6f

Von Sven Schöling vor etwa 14 Jahren hinzugefügt

  • ID a3f90d6fa23d0a8d026682511e7624bd847d532f
  • Vorgänger 48c946bd
  • Nachfolger 6326597d

Druckeradministration in die Adminumgebung verschoben.

Printercommands werden mit webuser Rechnten ausgeführt, deshalb darf ein User
keine anlegen. Da die Umgebung da völlig anders ist, geht das mit einem Rewrite
der Masken einher.

Unterschiede anzeigen:

bin/mozilla/am.pl
2014 2014
  $main::lxdebug->leave_sub();
2015 2015
}
2016 2016

  
2017

  
2018
sub add_printer {
2019
  $main::lxdebug->enter_sub();
2020

  
2021
  my $form     = $main::form;
2022

  
2023
  $main::auth->assert('config');
2024

  
2025
  $form->{title} = "Add";
2026

  
2027
  $form->{callback} = "am.pl?action=add_printer" unless $form->{callback};
2028

  
2029
  &printer_header;
2030
  &form_footer;
2031

  
2032
  $main::lxdebug->leave_sub();
2033
}
2034

  
2035
sub edit_printer {
2036
  $main::lxdebug->enter_sub();
2037

  
2038
  my $form     = $main::form;
2039
  my %myconfig = %main::myconfig;
2040

  
2041
  $main::auth->assert('config');
2042

  
2043
  $form->{title} = "Edit";
2044

  
2045
  AM->get_printer(\%myconfig, \%$form);
2046

  
2047
  &printer_header;
2048

  
2049
  $form->{orphaned} = 1;
2050
  &form_footer;
2051

  
2052
  $main::lxdebug->leave_sub();
2053
}
2054

  
2055
sub list_printer {
2056
  $main::lxdebug->enter_sub();
2057

  
2058
  my $form     = $main::form;
2059
  my %myconfig = %main::myconfig;
2060
  my $locale   = $main::locale;
2061

  
2062
  $main::auth->assert('config');
2063

  
2064
  AM->printer(\%myconfig, \%$form);
2065

  
2066
  $form->{callback} = "am.pl?action=list_printer";
2067

  
2068
  my $callback = $form->escape($form->{callback});
2069

  
2070
  $form->{title} = $locale->text('Printer');
2071

  
2072
  my @column_index = qw(printer_description printer_command template_code);
2073
  my %column_header;
2074
  $column_header{printer_description} =
2075
      qq|<th class=listheading width=60%>|
2076
    . $locale->text('Printer Description')
2077
    . qq|</th>|;
2078
  $column_header{printer_command} =
2079
      qq|<th class=listheading width=10%>|
2080
    . $locale->text('Printer Command')
2081
    . qq|</th>|;
2082
  $column_header{template_code} =
2083
      qq|<th class=listheading>|
2084
    . $locale->text('Template Code')
2085
    . qq|</th>|;
2086

  
2087
  $form->header;
2088

  
2089
  print qq|
2090
<body>
2091

  
2092
<table width=100%>
2093
  <tr>
2094
    <th class=listtop>$form->{title}</th>
2095
  </tr>
2096
  <tr height="5"></tr>
2097
  <tr>
2098
    <td>
2099
      <table width=100%>
2100
        <tr class=listheading>
2101
|;
2102

  
2103
  map { print "$column_header{$_}\n" } @column_index;
2104

  
2105
  print qq|
2106
        </tr>
2107
|;
2108

  
2109
  my ($i, %column_data);
2110
  foreach my $ref (@{ $form->{ALL} }) {
2111

  
2112
    $i++;
2113
    $i %= 2;
2114

  
2115
    print qq|
2116
        <tr valign=top class=listrow$i>
2117
|;
2118

  
2119

  
2120
    $column_data{printer_description} = qq|<td><a href="am.pl?action=edit_printer&id=$ref->{id}&callback=$callback">$ref->{printer_description}</td>|;
2121
    $column_data{printer_command}           = qq|<td align=right>$ref->{printer_command}</td>|;
2122
    $column_data{template_code} =
2123
      qq|<td align=right>$ref->{template_code}</td>|;
2124

  
2125
    map { print "$column_data{$_}\n" } @column_index;
2126

  
2127
    print qq|
2128
        </tr>
2129
|;
2130
  }
2131

  
2132
  print qq|
2133
      </table>
2134
    </td>
2135
  </tr>
2136
  <tr>
2137
  <td><hr size=3 noshade></td>
2138
  </tr>
2139
</table>
2140

  
2141
<br>
2142
<form method=post action=am.pl>
2143

  
2144
<input name=callback type=hidden value="$form->{callback}">
2145

  
2146
<input type=hidden name=type value=printer>
2147

  
2148
<input class=submit type=submit name=action value="|
2149
    . $locale->text('Add') . qq|">
2150

  
2151
  </form>
2152

  
2153
  </body>
2154
  </html>
2155
|;
2156

  
2157
  $main::lxdebug->leave_sub();
2158
}
2159

  
2160
sub printer_header {
2161
  $main::lxdebug->enter_sub();
2162

  
2163
  my $form     = $main::form;
2164
  my $locale   = $main::locale;
2165

  
2166
  $main::auth->assert('config');
2167

  
2168
  $form->{title}    = $locale->text("$form->{title} Printer");
2169

  
2170
  # $locale->text('Add Printer')
2171
  # $locale->text('Edit Printer')
2172

  
2173
  $form->{printer_description} =~ s/\"/&quot;/g;
2174
  $form->{template_code} =~ s/\"/&quot;/g;
2175
  $form->{printer_command} =~ s/\"/&quot;/g;
2176

  
2177

  
2178
  $form->header;
2179

  
2180
  print qq|
2181
<body>
2182

  
2183
<form method=post action=am.pl>
2184

  
2185
<input type=hidden name=id value=$form->{id}>
2186
<input type=hidden name=type value=printer>
2187

  
2188
<table width=100%>
2189
  <tr>
2190
    <th class=listtop colspan=2>$form->{title}</th>
2191
  </tr>
2192
  <tr height="5"></tr>
2193
  <tr>
2194
    <th align=right>| . $locale->text('Printer') . qq|</th>
2195
    <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
2196
  <tr>
2197
  <tr>
2198
    <th align=right>| . $locale->text('Printer Command') . qq|</th>
2199
    <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
2200
  </tr>
2201
  <tr>
2202
    <th align=right>| . $locale->text('Template Code') . qq|</th>
2203
    <td><input name=template_code size=5 value="$form->{template_code}"></td>
2204
  </tr>
2205
  <td colspan=2><hr size=3 noshade></td>
2206
  </tr>
2207
</table>
2208
|;
2209

  
2210
  $main::lxdebug->leave_sub();
2211
}
2212

  
2213
sub save_printer {
2214
  $main::lxdebug->enter_sub();
2215

  
2216
  my $form     = $main::form;
2217
  my %myconfig = %main::myconfig;
2218
  my $locale   = $main::locale;
2219

  
2220
  $main::auth->assert('config');
2221

  
2222
  $form->isblank("printer_description", $locale->text('Description missing!'));
2223
  $form->isblank("printer_command", $locale->text('Printer Command missing!'));
2224
  AM->save_printer(\%myconfig, \%$form);
2225
  $form->redirect($locale->text('Printer saved!'));
2226

  
2227
  $main::lxdebug->leave_sub();
2228
}
2229

  
2230
sub delete_printer {
2231
  $main::lxdebug->enter_sub();
2232

  
2233
  my $form     = $main::form;
2234
  my %myconfig = %main::myconfig;
2235
  my $locale   = $main::locale;
2236

  
2237
  $main::auth->assert('config');
2238

  
2239
  AM->delete_printer(\%myconfig, \%$form);
2240
  $form->redirect($locale->text('Printer deleted!'));
2241

  
2242
  $main::lxdebug->leave_sub();
2243
}
2244

  
2245 2017
sub add_payment {
2246 2018
  $main::lxdebug->enter_sub();
2247 2019

  
......
2722 2494
    { 'name' => $locale->text('Queue'),   'value' => 'queue',   'selected' => $selected{queue}, },
2723 2495
    ];
2724 2496

  
2725
  AM->printer(\%myconfig, $form);
2726

  
2727 2497
  $form->{PRINTERS} = [];
2728
  foreach my $printer (@{$form->{"ALL"}}) {
2498
  foreach my $printer (SL::Printer->all_printers(%::myconfig)) {
2729 2499
    push @{ $form->{PRINTERS} }, {
2730 2500
      'name'     => $printer->{printer_description},
2731 2501
      'value'    => $printer->{id},

Auch abrufbar als: Unified diff