summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Brachold <vdr07@deltab.de>2008-02-23 14:59:01 +0000
committerAndreas Brachold <vdr07@deltab.de>2008-02-23 14:59:01 +0000
commit8cc206947676df6f2a2923e3fb68f9c9f7730897 (patch)
treed2049addc157c004a98e2324d9e2cac4b72ac1f1 /lib
parent6914bc82846a8e51427f94a0876a89fe1ec2a7a1 (diff)
downloadxxv-8cc206947676df6f2a2923e3fb68f9c9f7730897.tar.gz
xxv-8cc206947676df6f2a2923e3fb68f9c9f7730897.tar.bz2
* Redirect to help template, if command not be understood
* Reformat help page * xstyle move main menu from help.tmpl to mainmenu.inc * program,alist,tlist: add paging support by &start= .. &limit= + ajax: send tables without header + ajax: send present count of rows * CHANNELS: Missing header with TID * search, warn if none text defined
Diffstat (limited to 'lib')
-rw-r--r--lib/XXV/MODULES/AUTOTIMER.pm21
-rw-r--r--lib/XXV/MODULES/CHANNELS.pm29
-rw-r--r--lib/XXV/MODULES/CONFIG.pm12
-rw-r--r--lib/XXV/MODULES/EPG.pm79
-rw-r--r--lib/XXV/MODULES/TIMERS.pm30
-rw-r--r--lib/XXV/OUTPUT/Ajax.pm2
6 files changed, 145 insertions, 28 deletions
diff --git a/lib/XXV/MODULES/AUTOTIMER.pm b/lib/XXV/MODULES/AUTOTIMER.pm
index 297f8c8..3641875 100644
--- a/lib/XXV/MODULES/AUTOTIMER.pm
+++ b/lib/XXV/MODULES/AUTOTIMER.pm
@@ -1194,9 +1194,25 @@ sub list {
$sql .= " desc"
if(exists $params->{desc} && $params->{desc} == 1);
+ my $rows;
+ if($console->{cgi} && $console->{cgi}->param('limit')) {
+ my $rsth = $obj->{dbh}->prepare($sql);
+ $rsth->execute(@{$term})
+ or return error sprintf("Couldn't execute query: %s.",$rsth->errstr);
+ $rows = $rsth->rows;
+
+ if($console->{cgi}->param('start')) {
+ $sql .= " LIMIT " . CORE::int($console->{cgi}->param('start'));
+ $sql .= "," . CORE::int($console->{cgi}->param('limit'));
+ } else {
+ $sql .= " LIMIT " . CORE::int($console->{cgi}->param('limit'));
+ }
+ }
+
my $sth = $obj->{dbh}->prepare($sql);
$sth->execute(@{$term})
or return con_err($console, sprintf("Couldn't execute query: %s.",$sth->errstr));
+ $rows = $sth->rows unless($rows);
my $fields = $sth->{'NAME'};
my $erg = $sth->fetchall_arrayref();
@@ -1205,7 +1221,9 @@ sub list {
$_->[6] = fmttime($_->[6]);
} @$erg;
- unshift(@$erg, $fields);
+ unless($console->typ eq 'AJAX') {
+ unshift(@$erg, $fields);
+ }
my $channels = main::getModule('CHANNELS')->ChannelHash('Id');
my $timers = main::getModule('TIMERS')->getTimersByAutotimer();
@@ -1215,6 +1233,7 @@ sub list {
sortable => 1,
channels => $channels,
timers => $timers,
+ rows => $rows
}
);
}
diff --git a/lib/XXV/MODULES/CHANNELS.pm b/lib/XXV/MODULES/CHANNELS.pm
index 39901a9..f100f47 100644
--- a/lib/XXV/MODULES/CHANNELS.pm
+++ b/lib/XXV/MODULES/CHANNELS.pm
@@ -446,6 +446,7 @@ sub list {
'TPID' => gettext('Teletext PID'),
'CA' => gettext('Conditional access'),
'SID' => gettext('SID'),
+ 'TID' => gettext('TID'),
'NID' => gettext('NID'),
'RID' => gettext('RID'),
'GRP' => gettext('Channel group'),
@@ -493,14 +494,38 @@ ORDER BY
$sql .= " desc"
if(exists $params->{desc} && $params->{desc} == 1);
+ my $rows;
+ if($console->{cgi} && $console->{cgi}->param('limit')) {
+ # Query total count of rows
+ my $rsth = $obj->{dbh}->prepare($sql);
+ $rsth->execute('%'.$id.'%')
+ or return error sprintf("Couldn't execute query: %s.",$rsth->errstr);
+ $rows = $rsth->rows;
+
+ # Add limit query
+ if($console->{cgi}->param('start')) {
+ $sql .= " LIMIT " . CORE::int($console->{cgi}->param('start'));
+ $sql .= "," . CORE::int($console->{cgi}->param('limit'));
+ } else {
+ $sql .= " LIMIT " . CORE::int($console->{cgi}->param('limit'));
+ }
+ }
+
my $sth = $obj->{dbh}->prepare($sql);
$sth->execute('%'.$id.'%')
or return con_err($console, sprintf("Couldn't execute query: %s.",$sth->errstr));
+ $rows = $sth->rows unless($rows);
my $fields = $sth->{'NAME'};
my $erg = $sth->fetchall_arrayref();
- unshift(@$erg, $fields);
- $console->table($erg,{sortable => 1 });
+ unless($console->typ eq 'AJAX') {
+ unshift(@$erg, $fields);
+ }
+
+ $console->table($erg, {
+ sortable => 1,
+ rows => $rows
+ });
}
diff --git a/lib/XXV/MODULES/CONFIG.pm b/lib/XXV/MODULES/CONFIG.pm
index 0662748..33d687e 100644
--- a/lib/XXV/MODULES/CONFIG.pm
+++ b/lib/XXV/MODULES/CONFIG.pm
@@ -311,9 +311,11 @@ sub usage {
}
my $ret;
- push(@$ret, sprintf(gettext("%sThis is the xxv %s server.\nPlease use the following commands:\n"),
- ($hint ? "$hint\n\n" : ''), $console->typ));
-
+ if($console->typ ne 'AJAX') {
+ push(@$ret, sprintf(gettext("%sThis is the xxv %s server.\nPlease use the following commands:\n"),
+ ($hint ? "$hint\n\n" : ''), $console->typ));
+ }
+ $console->setCall('help');
my $mods = main::getModules();
my @realModName;
@@ -329,16 +331,16 @@ sub usage {
foreach my $cmdName (sort keys %{$modCfg->{Commands}}) {
push(@$ret,
[
- (split('::', $modName))[-1],
$modCfg->{Commands}->{$cmdName}->{short},
$cmdName,
+ (split('::', $modName))[-1],
$modCfg->{Commands}->{$cmdName}->{description},
]
) if(! $modCfg->{Commands}->{$cmdName}->{hidden} and ($u->{active} ne 'y') || $u->allowCommand($modCfg, $cmdName, $user, "1"));
}
}
- $console->menu(
+ $console->table(
$ret,
{
periods => $mods->{'XXV::MODULES::EPG'}->{periods},
diff --git a/lib/XXV/MODULES/EPG.pm b/lib/XXV/MODULES/EPG.pm
index a5b8d89..ca45064 100644
--- a/lib/XXV/MODULES/EPG.pm
+++ b/lib/XXV/MODULES/EPG.pm
@@ -604,7 +604,11 @@ sub search {
}
my $erg = [];
- if($search) {
+
+ unless($search) {
+ $console->err(gettext("There none text to search defined!"));
+ return 0;
+ }
# Channelsearch
if($params->{channel}) {
@@ -679,21 +683,43 @@ sub search {
starttime
|;
- my $sth = $obj->{dbh}->prepare($sql);
- $sth->execute(@{$search->{term}})
- or return con_err($console, sprintf("Couldn't execute query: %s.",$sth->errstr));
- my $fields = $sth->{'NAME'};
- $erg = $sth->fetchall_arrayref();
- map {
- $_->[7] = datum($_->[7],'weekday');
- } @$erg;
-
- unshift(@$erg, $fields);
+ my $rows;
+ if($console->{cgi} && $console->{cgi}->param('limit')) {
+ # Query total count of rows
+ my $rsth = $obj->{dbh}->prepare($sql);
+ $rsth->execute(@{$search->{term}})
+ or return error sprintf("Couldn't execute query: %s.",$rsth->errstr);
+ $rows = $rsth->rows;
+
+ # Add limit query
+ if($console->{cgi}->param('start')) {
+ $sql .= " LIMIT " . CORE::int($console->{cgi}->param('start'));
+ $sql .= "," . CORE::int($console->{cgi}->param('limit'));
+ } else {
+ $sql .= " LIMIT " . CORE::int($console->{cgi}->param('limit'));
+ }
+ }
+
+ my $sth = $obj->{dbh}->prepare($sql);
+ $sth->execute(@{$search->{term}})
+ or return con_err($console, sprintf("Couldn't execute query: %s.",$sth->errstr));
+ my $fields = $sth->{'NAME'};
+ $erg = $sth->fetchall_arrayref();
+
+ unless($console->typ eq 'AJAX') {
+ map {
+ $_->[7] = datum($_->[7],'weekday');
+ } @$erg;
+
+ unshift(@$erg, $fields);
}
+
my $modC = main::getModule('CHANNELS');
$console->table($erg, {
channels => $modC->ChannelWithGroup('Name,Pos'),
- });
+ rows => $rows
+ }
+ );
}
# ------------------
@@ -760,21 +786,42 @@ where
order by
starttime
|;
+
+ my $rows;
+ if($console->{cgi} && $console->{cgi}->param('limit')) {
+ # Query total count of rows
+ my $rsth = $obj->{dbh}->prepare($sql);
+ $rsth->execute($cid)
+ or return error sprintf("Couldn't execute query: %s.",$rsth->errstr);
+ $rows = $rsth->rows;
+
+ # Add limit query
+ if($console->{cgi}->param('start')) {
+ $sql .= " LIMIT " . CORE::int($console->{cgi}->param('start'));
+ $sql .= "," . CORE::int($console->{cgi}->param('limit'));
+ } else {
+ $sql .= " LIMIT " . CORE::int($console->{cgi}->param('limit'));
+ }
+ }
+
my $sth = $obj->{dbh}->prepare($sql);
$sth->execute($cid)
or return con_err($console, sprintf("Couldn't execute query: %s.",$sth->errstr));
my $fields = $sth->{'NAME'};
my $erg = $sth->fetchall_arrayref();
- map {
- $_->[5] = datum($_->[5],'weekday');
- } @$erg;
- unshift(@$erg, $fields);
+ unless($console->typ eq 'AJAX') {
+ map {
+ $_->[5] = datum($_->[5],'weekday');
+ } @$erg;
+ unshift(@$erg, $fields);
+ }
$console->table($erg, {
channels => $mod->ChannelWithGroup('Name,POS'),
current => $mod->ChannelToPos($cid),
+ rows => $rows
}
);
}
diff --git a/lib/XXV/MODULES/TIMERS.pm b/lib/XXV/MODULES/TIMERS.pm
index 3b1f3c3..58b4560 100644
--- a/lib/XXV/MODULES/TIMERS.pm
+++ b/lib/XXV/MODULES/TIMERS.pm
@@ -1268,20 +1268,42 @@ ORDER BY
t.starttime
|;
+ my $rows;
+ if($console->{cgi} && $console->{cgi}->param('limit')) {
+ # Query total count of rows
+ my $rsth = $obj->{dbh}->prepare($sql);
+ $rsth->execute(@{$term})
+ or return error sprintf("Couldn't execute query: %s.",$rsth->errstr);
+ $rows = $rsth->rows;
+
+ # Add limit query
+ if($console->{cgi}->param('start')) {
+ $sql .= " LIMIT " . CORE::int($console->{cgi}->param('start'));
+ $sql .= "," . CORE::int($console->{cgi}->param('limit'));
+ } else {
+ $sql .= " LIMIT " . CORE::int($console->{cgi}->param('limit'));
+ }
+ }
+
my $sth = $obj->{dbh}->prepare($sql);
$sth->execute(@{$term})
or return error sprintf("Couldn't execute query: %s.",$sth->errstr);
+ $rows = $sth->rows unless($rows);
+
my $fields = $sth->{'NAME'};
my $erg = $sth->fetchall_arrayref();
- map {
- $_->[4] = datum($_->[4],'weekday');
- } @$erg;
+ unless($console->typ eq 'AJAX') {
+ map {
+ $_->[4] = datum($_->[4],'weekday');
+ } @$erg;
- unshift(@$erg, $fields);
+ unshift(@$erg, $fields);
+ }
$console->table($erg, {
cards => $obj->{DVBCards},
capacity => main::getModule('RECORDS')->{CapacityFree},
+ rows => $rows
});
}
diff --git a/lib/XXV/OUTPUT/Ajax.pm b/lib/XXV/OUTPUT/Ajax.pm
index 0d1b72e..6c5ef41 100644
--- a/lib/XXV/OUTPUT/Ajax.pm
+++ b/lib/XXV/OUTPUT/Ajax.pm
@@ -119,6 +119,8 @@ sub out {
if($type ne 'application/xml') {
$self->{output}->{data} = $data;
+ $self->{output}->{param} = $para
+ if($para);
} else {
$self->{output}->{DATA} = $data;
$self->{output}->{$name}->{data} = $data;