aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/cache/driver/redis.php
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2017-04-16 10:21:14 +0200
committerTristan Darricau <github@nicofuma.fr>2017-04-16 10:21:14 +0200
commit3bddf0279920cfbe0c0ec4f2a6473f4249b36e41 (patch)
tree8118a7bf0b8e7f23d864b400f06e2f8debfe393b /phpBB/phpbb/cache/driver/redis.php
parent269150ed40d8cf42c2b8d755191b15229dc170c2 (diff)
parente7dfdbffb50d8f88d9a5a4c064a853f50d92acf0 (diff)
downloadforums-3bddf0279920cfbe0c0ec4f2a6473f4249b36e41.tar
forums-3bddf0279920cfbe0c0ec4f2a6473f4249b36e41.tar.gz
forums-3bddf0279920cfbe0c0ec4f2a6473f4249b36e41.tar.bz2
forums-3bddf0279920cfbe0c0ec4f2a6473f4249b36e41.tar.xz
forums-3bddf0279920cfbe0c0ec4f2a6473f4249b36e41.zip
Merge pull request #4793 from marc1706/ticket/15090
[ticket/15090] Ensure send stats module exists before removing * github.com:phpbb/phpbb: [ticket/15090] Ensure send stats module exists before removing
Diffstat (limited to 'phpBB/phpbb/cache/driver/redis.php')
0 files changed, 0 insertions, 0 deletions
ref='#n40'>40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
package interactive_gtk;

use diagnostics;
use strict;
use vars qw(@ISA);

@ISA = qw(interactive);

use interactive;
use common qw(:common :functional);
use my_gtk qw(:helpers :wrappers);

1;

## redefine ask_warn
#sub ask_warn {
#    my $o = shift;
#    local $my_gtk::grab = 1;
#    $o->SUPER::ask_warn(@_);
#}

sub ask_from_entryW {
    my ($o, $title, $messages, $def) = @_;
    my $w = my_gtk->new($title, %$o);
    $w->_ask_from_entry(@$messages);
    $w->main;
}
sub ask_from_listW {
    my ($o, $title, $messages, $l, $def) = @_;

    if (@$l < 5 && sum(map { length $_ } @$l) < 70) {
	my $defW;
	my $w = my_gtk->new($title, %$o);
	my $f = sub { $w->{retval} = $_[1]; Gtk->main_quit };
	gtkadd($w->{window},
	       gtkpack(create_box_with_title($w, @$messages),
		       gtkadd((@$l < 3 ? create_hbox() : create_vbox()),
			      map {
				  my $b = new Gtk::Button($_);
				  $b->signal_connect(clicked => [ $f, $_ ]);
				  $_ eq $def and $defW = $b;
				  $b;
			      } @$l),
		       ),
	       );
	$defW->grab_focus if $defW;
	$w->main;
    } else {
	my $w = my_gtk->new($title);
	$w->_ask_from_list($messages, $l, $def);
	$w->main;
    }
}

sub ask_many_from_list_refW($$$$$) {
    my ($o, $title, $messages, $list, $val) = @_;
    my $n = 0;
    my $w = my_gtk->new('', %$o);
    gtkadd($w->{window}, 
	   gtkpack(create_box_with_title($w, @$messages),
		   gtkpack(new Gtk::VBox(0,0),
			   map { 
			       my $nn = $n++; 
			       my $o = Gtk::CheckButton->new($_);
			       $o->set_active(${$val->[$nn]});
			       $o->signal_connect(clicked => sub { ${$val->[$nn]} = !${$val->[$nn]} });
			       $o;
			   } @$list),
		   $w->create_okcancel,
		  )
	  );
    $w->{ok}->grab_focus;
    $w->main && $val;
}


sub ask_from_entries_refW {
    my ($o, $title, $messages, $l, $val, %hcallback) = @_;
    my $num_fields = @{$l};
    my $ignore = 0; #to handle recursivity 

    my $w       = my_gtk->new($title, %$o);
    #the widgets
    my @entries = map { 
	if ($_->{type} eq "list") {
	    my $depth_combo = new Gtk::Combo;
	    $depth_combo->set_use_arrows_always(1);
	    $depth_combo->entry->set_editable(!$_->{not_edit});
	    $depth_combo->set_popdown_strings(@{$_->{list}});
	    $depth_combo->disable_activate;
	    $depth_combo;
	} else {
	    new Gtk::Entry;
	}
    } @{$val};
    my $ok      = $w->create_okcancel;
    sub comb_entry {
	my ($entry, $ref) = @_;
	($ref->{type} eq "list" && @{$ref->{list}}) ? $entry->entry : $entry
    }

    my @updates = mapn { 
	my ($entry, $ref) = @_;
	sub { ${$ref->{val}} = comb_entry($entry, $ref)->get_text };
    } \@entries, $val;

    my @updates_inv = mapn { 
	my ($entry, $ref) = @_;
	sub { comb_entry($entry, $ref)->set_text(${$ref->{val}})
	};
    } \@entries, $val;


    for (my $i = 0; $i < $num_fields; $i++) {
	my $ind = $i; #cos lexical bindings pb !!
	my $entry = $entries[$i];
	#changed callback
	my $callback = sub {
	    return if $ignore; #handle recursive deadlock
	    &{$updates[$ind]};
	    if ($hcallback{changed}) {
		&{$hcallback{changed}}($ind);
		#update all the value
		$ignore = 1;
		&$_ foreach @updates_inv;
		$ignore = 0;
	    };
	};
	if ($hcallback{focus_out}) {
	    my $callfocusout = sub {
		return if $ignore;
		&{$hcallback{focus_out}}($ind);
		#update all the value
		$ignore = 1;
		foreach (@updates_inv) { &{$_};}
		$ignore = 0;
	    };
	    comb_entry($entry,$val->[$i])->signal_connect(focus_out_event => $callfocusout);
	}
	comb_entry($entry,$val->[$i])->signal_connect(changed => $callback);
	comb_entry($entry,$val->[$i])->signal_connect(activate => sub {
				   ($ind == ($num_fields -1)) ?
				     ($w->{ok}->grab_focus(), ) : (comb_entry($entries[$ind+1],$val->[$ind+1])->grab_focus(),$_[0]->signal_emit_stop("activate")) ;
			       });
	comb_entry($entry,$val->[$i])->set_text(${$val->[$i]{val}})  if ${$val->[$i]{val}};
	comb_entry($entry,$val->[$i])->set_visibility(0) if $l->[$i] =~ /password/i;
#	&{$updates[$i]};
    }

    my @entry_list = mapn { [($_[0], $_[1])]} $l, \@entries;

    gtkadd($w->{window}, 
	   gtkpack(
		   create_box_with_title($w, @$messages),
		   create_packtable({}, @entry_list),
		   $ok
		   ));

    comb_entry($entries[0],$val->[0])->grab_focus();
    if ($hcallback{complete}) {
	my $callback = sub {
	    my ($error, $focus) = &{$hcallback{complete}};
	    #update all the value
	    $ignore = 1;
	    foreach (@updates_inv) { &{$_};}
	    $ignore = 0;
	    if ($error) {