Changeset 1252
- Timestamp:
- 01/21/12 16:26:54 (4 months ago)
- Location:
- schulkonsole/linuxmuster-schulkonsole/trunk
- Files:
-
- 8 edited
-
doc/etc/schulkonsole/permissions.conf (modified) (1 diff)
-
lib/Schulkonsole/Config.pm.in (modified) (8 diffs)
-
lib/Schulkonsole/Error.pm (modified) (1 diff)
-
lib/Schulkonsole/Error/Printer.pm (modified) (2 diffs)
-
lib/Schulkonsole/Printer.pm (modified) (2 diffs)
-
shtml/start.shtml (modified) (2 diffs)
-
src/cgi-bin/start.in (modified) (2 diffs)
-
src/util/wrapper-printer.pl.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
schulkonsole/linuxmuster-schulkonsole/trunk/doc/etc/schulkonsole/permissions.conf
r1088 r1252 12 12 13 13 [External Programs] 14 ALL=ovpn_check ovpn_create ovpn_download set_own_password 14 ALL=ovpn_check ovpn_create ovpn_download set_own_password own_print_quota 15 15 teachers=internet_on_off intranet_on_off update_logins update_linbofs urlfilter_check urlfilter_on_off all_on all_on_at printer_on_off printer_allow_deny printer_info share_states shares_on_off ls_collect ls_handout handout collect room_reset edit_own_class_membership print_class set_passwords project_members project_create_drop project_join_no_join 16 16 domadmins=set_passwords print_teachers -
schulkonsole/linuxmuster-schulkonsole/trunk/lib/Schulkonsole/Config.pm.in
r1238 r1252 100 100 $_cmd_printer_reject 101 101 $_cmd_printer_lpadmin 102 $_cmd_linuxmuster_pk 102 103 $_cmd_sophomorix_teacher 103 104 $_cmd_sophomorix_room … … 138 139 PRINTERONOFFAPP 139 140 PRINTERALLOWDENYAPP 141 PRINTERGETOWNQUOTAAPP 140 142 SHARESTATESAPP 141 143 SHARESONOFFAPP … … 281 283 C<printer_allow_deny> 282 284 283 =item C<PRINTER QUOTAAPP>285 =item C<PRINTERGETOWNQUOTAAPP> 284 286 285 287 C<printer_quota> … … 293 295 PRINTERONOFFAPP => 7002, 294 296 PRINTERALLOWDENYAPP => 7003, 297 PRINTERGETOWNQUOTAAPP => 7004, 295 298 }; 296 299 … … 913 916 Path to command to administrate printers C<lpadmin> 914 917 918 =item C<$_cmd_linuxmuster_pk> 919 920 Path to command to query printer quotas C<linuxmuster-pk> 921 915 922 =item C<$_cmd_sophomorix_teacher> 916 923 … … 988 995 $_cmd_printer_reject 989 996 $_cmd_printer_lpadmin 997 $_cmd_linuxmuster_pk 990 998 $_cmd_sophomorix_teacher 991 999 $_cmd_sophomorix_room … … 1120 1128 PRINTERONOFFAPP() => 'printer_on_off', 1121 1129 PRINTERALLOWDENYAPP() => 'printer_allow_deny', 1130 PRINTERGETOWNQUOTAAPP() => 'own_print_quota', 1122 1131 SHARESTATESAPP() => 'share_states', 1123 1132 SHARESONOFFAPP() => 'shares_on_off', … … 1171 1180 $_cmd_printer_lpadmin = '/usr/sbin/lpadmin'; 1172 1181 $_cmd_printer_reject = '/usr/sbin/reject'; 1182 $_cmd_linuxmuster_pk = '/usr/bin/linuxmuster-pk'; 1173 1183 $_cmd_sophomorix_add = '/usr/sbin/sophomorix-add'; 1174 1184 $_cmd_sophomorix_check = '/usr/sbin/sophomorix-check'; -
schulkonsole/linuxmuster-schulkonsole/trunk/lib/Schulkonsole/Error.pm
r1238 r1252 232 232 $this->{code} == Schulkonsole::Error::Printer::WRAPPER_INVALID_USER 233 233 and return 'Ungueltiger Druckernutzer'; 234 $this->{code} == Schulkonsole::Error::Printer::WRAPPER_INVALID_PAGES 235 and return 'Ungueltige Daten fuer genutzte Druckquota'; 236 $this->{code} == Schulkonsole::Error::Printer::WRAPPER_INVALID_MAX_PAGES 237 and return 'Ungueltige Daten fuer Druckquota'; 238 $this->{code} == Schulkonsole::Error::Printer::WRAPPER_UNEXPECTED_DATA 239 and return 'Unerwartete Programmausgabe'; 234 240 $this->{code} == Schulkonsole::Error::Sophomorix::WRAPPER_ON_UNDEFINED 235 241 and return 'on muss 1 oder 0 sein'; -
schulkonsole/linuxmuster-schulkonsole/trunk/lib/Schulkonsole/Error/Printer.pm
r1238 r1252 20 20 WRAPPER_NO_PRINTERS 21 21 WRAPPER_INVALID_USER 22 WRAPPER_INVALID_PAGES 23 WRAPPER_INVALID_MAX_PAGES 24 WRAPPER_UNEXPECTED_DATA 22 25 ); 23 26 … … 38 41 WRAPPER_NO_PRINTERS => 7000 -66, 39 42 WRAPPER_INVALID_USER => 7000 -67, 43 WRAPPER_INVALID_PAGES => 7000 -68, 44 WRAPPER_INVALID_MAX_PAGES => 7000 -69, 45 WRAPPER_UNEXPECTED_DATA => 7000 -70, 40 46 }; 41 47 -
schulkonsole/linuxmuster-schulkonsole/trunk/lib/Schulkonsole/Printer.pm
r1238 r1252 21 21 printer_off 22 22 printer_deny 23 own_quota 23 24 ); 24 25 … … 328 329 329 330 331 =head2 C<own_quota($id, $password)> 332 333 Get print quota of user 334 335 =head3 Parameters 336 337 =over 338 339 =item C<$id> 340 341 The ID (not UID) of the user invoking the command 342 343 =item C<$password> 344 345 The password of the user invoking the command 346 347 =back 348 349 =head3 Description 350 351 This wraps the commands 352 C</usr/bin/linuxmuster-pk --user user -t> 353 to get the number of printed pages 354 and 355 C</usr/bin/linuxmuster-pk --user user -m> 356 maximum number of pages 357 with C<user> = the UID of the user with ID C<$id>. 358 359 Returns an array with number of printed pages and then the maximum number of 360 pages. 361 362 =cut 363 364 sub own_quota { 365 my $id = shift; 366 my $password = shift; 367 368 my $pid = start_wrapper(Schulkonsole::Config::PRINTERGETOWNQUOTAAPP, 369 $id, $password, 370 \*SCRIPTOUT, \*SCRIPTIN, \*SCRIPTIN); 371 372 373 buffer_input(\*SCRIPTIN); 374 375 my ($pages, $max) = $input_buffer =~ /^(\d+)\t(\d+)$/; 376 377 378 stop_wrapper($pid, \*SCRIPTOUT, \*SCRIPTIN, \*SCRIPTIN); 379 380 381 die new Schulkonsole::Error( 382 Schulkonsole::Error::Printer::WRAPPER_UNEXPECTED_DATA, 383 $Schulkonsole::Config::_wrapper_printer) 384 unless defined $max; 385 386 387 return ($pages, $max); 388 } 389 390 391 392 393 330 394 1; -
schulkonsole/linuxmuster-schulkonsole/trunk/shtml/start.shtml
r578 r1252 1 1 <html lang="de"> 2 2 <head> 3 <meta http-equiv="Content-Type" content="text/html; charset= iso-8859-1">3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 4 4 <meta http-equiv="Content-Language" content="de"> 5 5 <title><gettext>Schulkonsole</gettext> - <gettext>Startseite</gettext></title> … … 160 160 161 161 162 <!--#if expr="$printquota" --> 163 <table id="printquota"> 164 <col width="30%"> 165 <col width="70%"> 166 167 <tr> 168 169 <td><gettext>Seiten</gettext></td> 170 171 <td> 172 173 174 <p> 175 <gettext>Seiten:</gettext> 176 <!--#echo var="printquota{usage}" -->/<!--#echo var="printquota{limit}" --> 177 - <!--#echo var="printquota{percent}" -->% 178 </p> 179 180 181 <ul> 182 <li> 183 <span title="Druckseiten: ${printquota{usage}}/${printquota{limit}} ${printquota{percent}}%" style="width: ${printquota{percent_rounded}}%;"> </span> 184 </li> 185 </ul> 186 </td> 187 188 </tr> 189 </table> 190 <!--#else --> 191 <p>Keine Druckquota</p> 192 <!--#endif --> 193 194 195 196 162 197 <hr> 163 198 -
schulkonsole/linuxmuster-schulkonsole/trunk/src/cgi-bin/start.in
r304 r1252 164 164 use Schulkonsole::Info; 165 165 use Schulkonsole::OVPN; 166 use Schulkonsole::Printer; 166 167 use Schulkonsole::Sophomorix; 167 168 … … 565 566 566 567 568 eval { 569 my ($usage, $limit) = Schulkonsole::Printer::own_quota($id, $password); 570 571 my $usage_percent = $usage ? 572 sprintf('%.1f', 100 * $usage / $limit) 573 : 0; 574 575 my $printquota = { 576 usage => $usage, 577 limit => $limit, 578 percent => $usage_percent, 579 percent_rounded => ($usage_percent < 100.0 ? 580 int($usage_percent + 0.5) 581 : 100), 582 }; 583 584 585 $sk_session->set_var('printquota', $printquota); 586 }; 587 if ($@) { 588 warn "$@\n"; 589 } 590 591 592 567 593 my @projects; 568 594 my $projects = Schulkonsole::Info::groups_projects($sk_session->groups()); -
schulkonsole/linuxmuster-schulkonsole/trunk/src/util/wrapper-printer.pl.in
r1247 r1252 253 253 exit 0; 254 254 }; 255 256 =head3 own_print_quota 257 258 numeric constant: C<Schulkonsole::Config::PRINTERGETOWNQUOTAAPP> 259 260 =head4 Description 261 262 Get users own print quota 263 264 =head4 Parameters from standard input 265 266 None 267 268 =cut 269 270 $app_id == Schulkonsole::Config::PRINTERGETOWNQUOTAAPP and do { 271 my $opt_user = "--user \Q$$userdata{uid}\E"; 272 273 274 my $pages = `$Schulkonsole::Config::_cmd_linuxmuster_pk $opt_user -t` 275 or last SWITCH; 276 277 ($pages) = $pages =~ /^(\d+)$/; 278 exit ( Schulkonsole::Error::Printer::WRAPPER_INVALID_PAGES 279 - Schulkonsole::Error::Printer::WRAPPER_ERROR_BASE) 280 unless defined $pages; 281 282 283 284 my $max = `$Schulkonsole::Config::_cmd_linuxmuster_pk $opt_user -m` 285 or last SWITCH; 286 287 ($max) = $max =~ /^(\d+)$/; 288 exit ( Schulkonsole::Error::Printer::WRAPPER_INVALID_MAX_PAGES 289 - Schulkonsole::Error::Printer::WRAPPER_ERROR_BASE) 290 unless defined $max; 291 292 293 294 print "$pages\t$max\n"; 295 296 297 exit 0; 298 }; 255 299 } 256 300
Note: See TracChangeset
for help on using the changeset viewer.
