Add built-in help support in tvheadend web user interface.

This commit is contained in:
Andreas Öman 2008-10-11 11:00:11 +00:00
parent e6045fdd14
commit 99d1dd5e5c
12 changed files with 129 additions and 9 deletions

View file

@ -68,5 +68,7 @@ tvheadend.acleditor = function() {
UserRecord,
[enabledColumn, streamingColumn,
dvrColumn, webuiColumn,
adminColumn]);
adminColumn],
null,
'config_access.html');
}

View file

@ -224,6 +224,12 @@ tvheadend.channeldetails = function(chid, chname) {
iconCls:'save',
text: "Save configuration",
handler: saveChanges
}, '->', {
text: 'Help',
handler: function() {
new tvheadend.help('Channel configuration',
'config_channels.html');
}
}],
defaults: {
border:false,

View file

@ -54,5 +54,7 @@ tvheadend.cteditor = function() {
return new tvheadend.tableEditor('Channel Tags', 'channeltags', cm,
ChannelTagRecord,
[enabledColumn, internalColumn,
titledIconColumn]);
titledIconColumn],
null,
'config_tags.html');
}

View file

@ -45,5 +45,6 @@ tvheadend.cwceditor = function() {
]);
return new tvheadend.tableEditor('Code Word Client', 'cwc', cm, rec,
[enabledColumn]);
[enabledColumn], null,
'config_cwc.html');
}

View file

@ -215,6 +215,12 @@ tvheadend.dvb = function() {
border: false,
title:'DVB Adapters',
layout:'border',
tbar: ['->', {
text: 'Help',
handler: function() {
new tvheadend.help('DVB', 'config_dvb.html');
}
}],
items: [tree, details]
});

View file

@ -150,7 +150,17 @@ tvheadend.dvrlog = function() {
store: tvheadend.dvrStore,
cm: dvrCm,
viewConfig: {forceFit:true},
tbar: [
'->',
{
text: 'Help',
handler: function() {
new tvheadend.help('Digital Video Recorder',
'dvrlog.html');
}
}
],
bbar: new Ext.PagingToolbar({
store: tvheadend.dvrStore,
pageSize: 20,
@ -241,7 +251,8 @@ tvheadend.autoreceditor = function() {
return new tvheadend.tableEditor('Automatic Recorder',
'autorec', cm, tvheadend.autorecRecord,
[enabledColumn], tvheadend.autorecStore);
[enabledColumn], tvheadend.autorecStore,
'autorec.html');
}
/**
*
@ -354,6 +365,12 @@ tvheadend.dvrsettings = function() {
iconCls:'save',
text: "Save configuration",
handler: saveChanges
}, '->', {
text: 'Help',
handler: function() {
new tvheadend.help('DVR configuration',
'config_dvr.html');
}
}],
});

View file

@ -275,6 +275,13 @@ tvheadend.epg = function() {
'record all future programmes that matches ' +
'the current query.',
handler: createAutoRec
},
'-',
{
text: 'Help',
handler: function() {
new tvheadend.help('Electronic Program Guide', 'epg.html');
}
}
],

View file

@ -125,3 +125,28 @@
.x-epg-meta {
margin: 5px;
}
.hts-doc-text {
font:normal 11px verdana;
}
.hts-doc-text dt {
padding-top: 10px;
font-weight: bold;
}
.hts-doc-text dl {
padding-bottom: 10px;
}
.hts-doc-text li {
padding-top: 5px;
padding-bottom: 5px;
}
.hts-doc-text img {
padding: 10px;
}

View file

@ -1,4 +1,5 @@
tvheadend.tableEditor = function(title, dtable, cm, rec, plugins, store) {
tvheadend.tableEditor = function(title, dtable, cm, rec, plugins, store,
helpContent) {
cm.defaultSortable = true;
if(store == null) {
@ -107,6 +108,11 @@ tvheadend.tableEditor = function(title, dtable, cm, rec, plugins, store) {
iconCls:'save',
text: "Save changes",
handler: saveChanges
}, '->', {
text: 'Help',
handler: function() {
new tvheadend.help(title, helpContent);
}
}
]
});

View file

@ -1,4 +1,35 @@
/**
* This function creates top level tabs based on access so users without
* access to subsystems won't see them.
*
* Obviosuly, access is verified in the server too.
*/
tvheadend.help = function(title, pagename) {
Ext.Ajax.request({
url: '/docs/' + pagename,
success: function(result, request) {
var content = new Ext.Panel({
autoScroll:true,
border: false,
layout:'fit',
html: result.responseText
});
var win = new Ext.Window({
title: 'Help for ' + title,
layout: 'fit',
width: 900,
height: 400,
constrainHeader: true,
items: [content]
});
win.show();
}});
}
/**
* This function creates top level tabs based on access so users without

View file

@ -125,6 +125,12 @@ tvheadend.xmltv = function() {
iconCls:'save',
text: "Save configuration",
handler: saveChanges
}, '->', {
text: 'Help',
handler: function() {
new tvheadend.help('XMLTV configuration',
'config_xmltv.html');
}
}],
});

View file

@ -75,7 +75,7 @@ page_root(http_connection_t *hc, const char *remain, void *opaque)
static int
page_static(http_connection_t *hc, const char *remain, void *opaque)
{
extern char *contentpath;
const char *base = opaque;
int fd;
char path[500];
@ -92,7 +92,7 @@ page_static(http_connection_t *hc, const char *remain, void *opaque)
content = "text/javascript; charset=UTF-8";
}
snprintf(path, sizeof(path), "%s/webui/static/%s", contentpath, remain);
snprintf(path, sizeof(path), "%s/%s", base, remain);
if((fd = open(path, O_RDONLY)) < 0)
return 404;
@ -178,11 +178,22 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque)
void
webui_init(void)
{
extern char *contentpath;
char buf[300];
http_path_add("/", NULL, page_root, ACCESS_WEB_INTERFACE);
http_path_add("/static", NULL, page_static, ACCESS_WEB_INTERFACE);
http_path_add("/dvrfile", NULL, page_dvrfile, ACCESS_WEB_INTERFACE);
snprintf(buf, sizeof(buf), "%s/webui/static", contentpath);
http_path_add("/static", strdup(buf), page_static, ACCESS_WEB_INTERFACE);
snprintf(buf, sizeof(buf), "%s/docs/html", contentpath);
http_path_add("/docs", strdup(buf), page_static, ACCESS_WEB_INTERFACE);
snprintf(buf, sizeof(buf), "%s/docs/docresources", contentpath);
http_path_add("/docresources", strdup(buf), page_static, ACCESS_WEB_INTERFACE);
// simpleui_start();
extjs_start();
comet_init();