Subversion Repositories CoffeeCatalog

Rev

Rev 4 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4 Rev 6
Line 11... Line 11...
11
my $pageTitle = "CC Roasters";
11
my $pageTitle = "CC Roasters";
12
my $prefscookie = "CCRoastersPrefs";
12
my $prefscookie = "CCRoastersPrefs";
13
our $DBTABLE = 'roasters';
13
our $DBTABLE = 'roasters';
14
my %COLUMNS = (
14
my %COLUMNS = (
15
	roaster   =>  [qw(Roaster     5    text     static)],
15
	roaster   =>  [qw(Roaster     5    text     static)],
16
	url       =>  [qw(URL        10    text     )],
16
	url       =>  [qw(URL        10    text     default)],
17
	location  =>  [qw(Location   15    text     )],
17
	location  =>  [qw(Location   15    text     default)],
18
	notes     =>  [qw(Notes      20    text)]
18
	note      =>  [qw(Notes      20    text)]
19
);
19
);
20
our @defaultFields = (qw(roaster url location));
-
 
21
my $stylesheet = "style.css";
20
my $stylesheet = "style.css";
22
my $homeURL = '/';
21
my $homeURL = '/';
Line 23... Line 22...
23
 
22
 
24
# If we need to modify line item values, create a subroutine named "modify_$columnname"
23
# If we need to modify line item values, create a subroutine named "modify_$columnname"
Line 42... Line 41...
42
 
41
 
43
# Ideally, nothing below this comment needs to change
42
# Ideally, nothing below this comment needs to change
Line 44... Line 43...
44
#-------------------------------------------------------------------------------
43
#-------------------------------------------------------------------------------
45
 
44
 
46
 
45
 
47
our %NAME              = map { $_ => $COLUMNS{$_}->[0] } keys %COLUMNS;
46
our %NAME              = map  { $_ => $COLUMNS{$_}->[0] } keys %COLUMNS;
-
 
47
our %colOrderHash      = map  { $_ => $COLUMNS{$_}->[1] } keys %COLUMNS;
-
 
48
our %colFilterTypeHash = map  { $_ => $COLUMNS{$_}->[2] } keys %COLUMNS;
Line 48... Line 49...
48
our %colOrderHash      = map { $_ => $COLUMNS{$_}->[1] } keys %COLUMNS;
49
our @staticFields      = grep { $COLUMNS{$_}->[3] eq 'static' } keys %COLUMNS;
49
our %colFilterTypeHash = map { $_ => $COLUMNS{$_}->[2] } keys %COLUMNS;
50
our @defaultFields     = grep { defined $COLUMNS{$_}->[3] } keys %COLUMNS;
50
our @staticFields = grep { $COLUMNS{$_}->[3] eq 'static' } keys %COLUMNS;
51
#our @defaultFields     = grep { $COLUMNS{$_}->[3] eq 'default' or inArray ($_, \@staticFields) } keys %COLUMNS;
51
 
52
 
Line 179... Line 180...
179
my $c = 1;
180
my $c = 1;
180
my @hiddencheckboxes;
181
my @hiddencheckboxes;
181
my @hiddenrows;
182
my @hiddenrows;
182
foreach $field (sort { $NAME{$a} cmp $NAME{$b}; } @hideFields) {
183
foreach $field (sort { $NAME{$a} cmp $NAME{$b}; } @hideFields) {
183
  if ($FORM{autoload}) {
184
  if ($FORM{autoload}) {
184
    push @hiddencheckboxes, $h->div ({ class=>'rTableCell quarters', nowrap=>[], onClick=>"Req.$field.click()" }, [ $h->input ({ type=>'checkbox', class=>'accent', name=>$field, value=>'true', onClick=>'submit();' }), $NAME{$field} ]);
185
    push @hiddencheckboxes, $h->div ({ class=>'rTableCell quarters', nowrap=>[], onClick=>"Req.$field.click();" }, [ $h->input ({ type=>'checkbox', class=>'accent', name=>$field, value=>'true', onClick=>"event.stopPropagation(); submit();" }), $NAME{$field} ]);
185
  } else {
186
  } else {
186
    push @hiddencheckboxes, $h->div ({ class=>'rTableCell quarters', nowrap=>[], onClick=>"Req.$field.click()" }, [ $h->input ({ type=>'checkbox', class=>'accent', name=>$field, value=>'true' }), $NAME{$field} ]);
187
    push @hiddencheckboxes, $h->div ({ class=>'rTableCell quarters', nowrap=>[], onClick=>"Req.$field.checked=!Req.$field.checked;" }, [ $h->input ({ type=>'checkbox', class=>'accent', name=>$field, value=>'true', onClick=>"event.stopPropagation();" }), $NAME{$field} ]);
187
  }
188
  }
188
  if (! $c % 4) {
189
  if (! $c % 4) {
189
    push @hiddenrows, $h->div ({ class=>'rTableRow' }, [ @hiddencheckboxes ]);
190
    push @hiddenrows, $h->div ({ class=>'rTableRow' }, [ @hiddencheckboxes ]);
190
    @hiddencheckboxes = [];
191
    @hiddencheckboxes = [];
191
    $c++;
192
    $c++;
Line 214... Line 215...
214
foreach $f (@displayFields)	{  # Print the Column headings
215
foreach $f (@displayFields)	{  # Print the Column headings
215
  if (inArray ($f, \@staticFields)) {
216
  if (inArray ($f, \@staticFields)) {
216
    push @tmptitlerow, $h->div ({ class=>'rTableHead' }, [ $h->input ({ type=>"hidden", name=>$f, value=>"true" }), $NAME{$f} ]);
217
    push @tmptitlerow, $h->div ({ class=>'rTableHead' }, [ $h->input ({ type=>"hidden", name=>$f, value=>"true" }), $NAME{$f} ]);
217
  } else {
218
  } else {
218
    if ($FORM{autoload}) {
219
    if ($FORM{autoload}) {
219
      push @tmptitlerow, $h->div ({ class=>'rTableHead', onClick=>"Req.$f.click()" }, [ $h->input ({ type=>"checkbox", class=>"accent", name=>$f, value=>"true", checked=>[], onClick=>'submit();' }), $NAME{$f} ]);
220
      push @tmptitlerow, $h->div ({ class=>'rTableHead', onClick=>"Req.$f.click();" }, [ $h->input ({ type=>"checkbox", class=>"accent", name=>$f, value=>"true", checked=>[], onClick=>'event.stopPropagation(); submit();' }), $NAME{$f} ]);
220
    } else {
221
    } else {
221
      push @tmptitlerow, $h->div ({ class=>'rTableHead', onClick=>"Req.$f.click()" }, [ $h->input ({ type=>"checkbox", class=>"accent", name=>$f, value=>"true", checked=>[] }), $NAME{$f} ]);      
222
      push @tmptitlerow, $h->div ({ class=>'rTableHead', onClick=>"Req.$f.checked=!Req.$f.checked;" }, [ $h->input ({ type=>"checkbox", class=>"accent", name=>$f, value=>"true", checked=>[], onClick=>"event.stopPropagation();" }), $NAME{$f} ]);      
222
    }
223
    }
223
  }
224
  }
224
}
225
}
Line 225... Line 226...
225
 
226