Reverted menu-left-example.png back to original and cleaned up menu-top-example to...
[freeside.git] / httemplate / browse / saved_search.html
1 <& elements/browse.html,
2   'title'       => 'My saved searches',
3   'name'        => 'saved searches',
4   'query'       => { 'table'     => 'saved_search',
5                      'hashref'   => { usernum => $curuser->usernum },
6                    },
7   'count_query' => $count_query,
8   'header'      => [ '#',
9                      'Name',
10                      'Subscription',
11                      'Last sent',
12                      'Format',
13                      'Path',
14                      'Parameters',
15                    ],
16   'sort_fields' => [ 'searchnum',
17                      'searchname',
18                      'freq',
19                      'last_sent',
20                      'format',
21                      "path || '?' || 'params'",
22                      '',
23                    ],
24   'fields'      => [ 'searchnum',
25                      'searchname',
26                      'freq',
27                      sub { my $date = shift->get('last_sent');
28                            $date ? time2str('%b %o, %Y', $date) : '';
29                      },
30                      sub { $format_label{ shift->get('format') }
31                      },
32                      'path',
33                      sub { join('<BR>',
34                              sort
35                              map { encode_entities(uri_unescape($_)) }
36                              split(/[;&]/, shift->get('params') )
37                            )
38                      },
39                    ],
40   'size'        => [ '',
41                      '',
42                      '',
43                      '',
44                      '',
45                      '',
46                      '-1',
47                    ],
48   'links'                   => [ '', '' ],
49   'link_onclicks'           => [ '', $edit_popup ],
50 #  'disableable'             => 1, # currrently unused
51 #  'disabled_statuspos'      => 2,
52   'really_disable_download' => 1
53 &>
54 <%init>
55
56 my $curuser = $FS::CurrentUser::CurrentUser;
57
58 my $query = {
59   'table'   => 'saved_search',
60   'hashref' => { 'usernum' => $curuser->usernum },
61 };
62 my $count_query = "SELECT COUNT(*) FROM saved_search WHERE usernum = ".
63   $curuser->usernum;
64
65 my %format_label = (
66   'html' => 'webpage',
67   'csv'  => 'CSV',
68   'xls'  => 'spreadsheet',
69 );
70
71 my $edit_popup = sub {
72   my $searchnum = shift->searchnum;
73   include('/elements/popup_link_onclick.html',
74     'action'        => $fsurl.'/edit/saved_search.html?'.$searchnum,
75     'actionlabel'   => 'Save this search',
76     'width'         => 650,
77     'height'        => 500,
78   );
79 };
80
81 </%init>