Index: trunk/extensions/ee/ee.pl |
— | — | @@ -24,6 +24,7 @@ |
25 | 25 | $cfgfile=$ENV{HOME}."/.ee-helper/ee.ini"; |
26 | 26 | |
27 | 27 | $DEBUG=0; |
| 28 | +$NOGUIERRORS=0; |
28 | 29 | $LANGUAGE="de"; |
29 | 30 | |
30 | 31 | # Read config |
— | — | @@ -33,7 +34,7 @@ |
34 | 35 | my $args=join(" ",@ARGV); |
35 | 36 | |
36 | 37 | # Where do we store our files? |
37 | | -my $tempdir=$cfg->val("Settings","Temp Path") or die _("notemppath",$cfgfile); |
| 38 | +my $tempdir=$cfg->val("Settings","Temp Path") or vdie (_("notemppath",$cfgfile)); |
38 | 39 | |
39 | 40 | # Remove slash at the end of the directory name, if existing |
40 | 41 | $/="/"; |
— | — | @@ -55,7 +56,7 @@ |
56 | 57 | if(-e $args) { |
57 | 58 | $input = new Config::IniFiles( -file => $args ); |
58 | 59 | } else { |
59 | | - die _("nocontrolfile"); |
| 60 | + vdie (_("nocontrolfile")); |
60 | 61 | } |
61 | 62 | |
62 | 63 | # Initialize the browser as Firefox 1.0 with new cookie jar |
— | — | @@ -99,15 +100,15 @@ |
100 | 101 | } elsif($type eq "Diff text") { |
101 | 102 | $secondurl=$input->val("File 2","URL"); |
102 | 103 | if(!$secondurl) { |
103 | | - die _("twofordiff"); |
| 104 | + vdie (_("twofordiff")); |
104 | 105 | } |
105 | 106 | $diffcommand=$cfg->val("Settings","Diff"); |
106 | 107 | if(!$diffcommand) { |
107 | | - die _("nodifftool"); |
| 108 | + vdie (_("nodifftool")); |
108 | 109 | } |
109 | 110 | } else { |
110 | 111 | # Nothing we know! |
111 | | - die _("unknownprocess"); |
| 112 | + vdie (_("unknownprocess")); |
112 | 113 | } |
113 | 114 | |
114 | 115 | |
— | — | @@ -138,12 +139,15 @@ |
139 | 140 | } |
140 | 141 | |
141 | 142 | # Log into server |
| 143 | +# Note that we also log in for diffs, as the raw text might only be available |
| 144 | +# to logged in users (depending on the wiki security settings), and we may want |
| 145 | +# to offer GUI-based rollback functionality later |
142 | 146 | $response=$browser->post($login_url,@ns_headers, |
143 | 147 | Content=>[wpName=>$username,wpPassword=>$password,wpRemember=>"1",wpLoginAttempt=>"Log in"]); |
144 | 148 | |
145 | 149 | # We expect a redirect after successful login |
146 | 150 | if($response->code!=302 && !$ignore_login_error) { |
147 | | - die _("loginfailed",$login_url,$username,$password); |
| 151 | + vdie (_("loginfailed",$login_url,$username,$password)); |
148 | 152 | } |
149 | 153 | |
150 | 154 | $response=$browser->get($fileurl); |
— | — | @@ -293,7 +297,7 @@ |
294 | 298 | my $summary=$entry->get_text(); |
295 | 299 | # Spam the summary if room is available :-) |
296 | 300 | if(length($summary)<190) { |
297 | | - my $tosummary="using [[Help:External editors|an external editor]]"; |
| 301 | + my $tosummary=_("usingexternal"); |
298 | 302 | if(length($summary)>0) { |
299 | 303 | $tosummary=" [".$tosummary."]"; |
300 | 304 | } |
— | — | @@ -390,6 +394,30 @@ |
391 | 395 | return $msg; |
392 | 396 | } |
393 | 397 | |
| 398 | +sub vdie { |
| 399 | + |
| 400 | +my $errortext=shift; |
| 401 | +if(!$NOGUIERRORS) { |
| 402 | + errorbox($errortext); |
| 403 | +} |
| 404 | +die($errortext); |
| 405 | + |
| 406 | +} |
| 407 | + |
| 408 | +sub errorbox { |
| 409 | + |
| 410 | +my $errortext=shift; |
| 411 | + |
| 412 | +my $dialog = Gtk2::MessageDialog->new ($window, |
| 413 | + [qw/modal destroy-with-parent/], |
| 414 | + 'error', |
| 415 | + 'ok', |
| 416 | + $errortext); |
| 417 | +$dialog->run; |
| 418 | +$dialog->destroy; |
| 419 | + |
| 420 | +} |
| 421 | + |
394 | 422 | sub initmsg { |
395 | 423 | |
396 | 424 | %messages=( |
— | — | @@ -485,6 +513,11 @@ |
486 | 514 | entersummary_de=> |
487 | 515 | "Zusammenfassung eingeben", |
488 | 516 | |
| 517 | +usingexternal=> |
| 518 | +"using [[Help:External editors|an external editor]]", |
| 519 | +usingexternal_de, |
| 520 | +"mit [[Hilfe:Externe Editoren|externem Editor]]", |
| 521 | + |
489 | 522 | ); |
490 | 523 | |
491 | 524 | } |
\ No newline at end of file |