]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
WEBUI JS: General config - split base/imgcache/sat>ip srv
authorJaroslav Kysela <perex@perex.cz>
Thu, 25 Jun 2015 17:30:51 +0000 (19:30 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 26 Jun 2015 09:44:51 +0000 (11:44 +0200)
Makefile
src/api.c
src/api.h
src/api/api_satip.c [new file with mode: 0644]
src/config.c
src/config.h
src/satip/server.c
src/satip/server.h
src/webui/extjs.c
src/webui/static/app/config.js
src/webui/static/app/tvheadend.js

index b17637559bbc81c4579489043db74079dd1a6a15..31bff562a2da9f713d0579bb4cce2d3c7c2b2ca5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -209,7 +209,8 @@ SRCS-2 = \
        src/api/api_caclient.c \
        src/api/api_profile.c \
        src/api/api_bouquet.c \
-       src/api/api_language.c
+       src/api/api_language.c \
+       src/api/api_satip.c
 
 SRCS-2 += \
        src/parsers/parsers.c \
index 89096f4ed60f85ab18d3caa759189c0abd059a3e..73b8f041db7eb31f84c35e77d082c9dbc401a545 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -137,6 +137,7 @@ void api_init ( void )
   api_caclient_init();
   api_profile_init();
   api_language_init();
+  api_satip_server_init();
 }
 
 void api_done ( void )
index 5c2b33eaf40721294cef3c0f3499c8bc6bd6be5a..81a33ab34d65aa4d81a5d136000d21ef2dd4d890 100644 (file)
--- a/src/api.h
+++ b/src/api.h
@@ -77,6 +77,7 @@ void api_dvr_init           ( void );
 void api_caclient_init      ( void );
 void api_profile_init       ( void );
 void api_language_init      ( void );
+void api_satip_server_init  ( void );
 
 /*
  * IDnode
diff --git a/src/api/api_satip.c b/src/api/api_satip.c
new file mode 100644 (file)
index 0000000..81a1112
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ *  API - SAT>IP Server related calls
+ *
+ *  Copyright (C) 2015 Jaroslav Kysela
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; withm even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "tvheadend.h"
+#include "channels.h"
+#include "access.h"
+#include "api.h"
+#include "satip/server.h"
+
+#if ENABLE_SATIP_SERVER
+
+static int
+api_satip_server_load
+  ( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp )
+{
+  htsmsg_t *l;
+  pthread_mutex_lock(&global_lock);
+  *resp = htsmsg_create_map();
+  l     = htsmsg_create_list();
+  htsmsg_add_msg(l, NULL, satip_server_get_config());
+  htsmsg_add_msg(*resp, "entries", l);
+  pthread_mutex_unlock(&global_lock);
+  return 0;
+}
+
+static int
+api_satip_server_save
+  ( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp )
+{
+  pthread_mutex_lock(&global_lock);
+  if (satip_server_set_config(args))
+    satip_server_save();
+  pthread_mutex_unlock(&global_lock);
+  *resp = htsmsg_create_map();
+  htsmsg_add_u32(*resp, "success", 1);
+  return 0;
+}
+
+void
+api_satip_server_init ( void )
+{
+  static api_hook_t ah[] = {
+    { "satips/config/load", ACCESS_ADMIN, api_satip_server_load, NULL },
+    { "satips/config/save", ACCESS_ADMIN, api_satip_server_save, NULL },
+    { NULL },
+  };
+
+  api_register_all(ah);
+}
+
+#else /* ENABLE_SATIP_SERVER */
+
+void 
+api_satip_server_init ( void )
+{
+}
+
+#endif
index c6fb879468b2435436ee7b5ba56ca9ea8fee3794..8f20c108369ab528bf1a94a0bbbfff158dbdf98a 100644 (file)
@@ -1593,9 +1593,37 @@ void config_save ( void )
  * Access / Update routines
  * *************************************************************************/
 
-htsmsg_t *config_get_all ( void )
+htsmsg_t *config_get_all ( int satip )
 {
-  return htsmsg_copy(config);
+  htsmsg_field_t *f;
+  htsmsg_t *r;
+  const char *s;
+  int64_t s64;
+  int m, b;
+
+  r = htsmsg_create_map();
+  HTSMSG_FOREACH(f, config) {
+    m = strncmp(f->hmf_name, "satip_", 6);
+    if (satip && m) continue;
+    if (!satip && !m) continue;
+    switch (f->hmf_type) {
+    case HMF_STR:
+      s = htsmsg_field_get_str(f);
+      if (s)
+        htsmsg_add_str(r, f->hmf_name, s);
+      break;
+    case HMF_S64:
+      if (!htsmsg_field_get_s64(f, &s64))
+        htsmsg_add_s64(r, f->hmf_name, s64);
+      break;
+    case HMF_BOOL:
+      if (!htsmsg_field_get_bool(f, &b))
+        htsmsg_add_bool(r, f->hmf_name, b);
+      break;
+    default: abort();
+    }
+  }
+  return r;
 }
 
 const char *
index 5c3c78da55e877ff1567f2468163e5db44c15457..6cfa555e5aa74ac76a7330b39b5d3762f69f88fd 100644 (file)
@@ -29,7 +29,7 @@ void        config_init    ( int backup );
 void        config_done    ( void );
 void        config_save    ( void );
 
-htsmsg_t   *config_get_all ( void );
+htsmsg_t   *config_get_all ( int satip );
 
 const char *config_get_str ( const char *fld );
 int         config_set_str ( const char *fld, const char *val );
index 5ca1152b0100319a8b84c1b5588c950c81d08675..665fa2252bd5146641638b3e34498d4cc0ce1c1a 100644 (file)
@@ -529,10 +529,11 @@ static void satip_server_info(const char *prefix, int descramble, int muxcnf)
 /*
  *
  */
-void satip_server_config_changed(void)
+void satip_server_save(void)
 {
   int descramble, muxcnf;
 
+  config_save();
   if (!satip_server_rtsp_port_locked) {
     satips_rtsp_port(0);
     if (satip_server_rtsp_port > 0) {
@@ -553,6 +554,41 @@ void satip_server_config_changed(void)
   }
 }
 
+htsmsg_t *satip_server_get_config(void)
+{
+  return config_get_all(1);
+}
+
+static int satip_server_set_int(htsmsg_t *conf, const char *name)
+{
+  const char *str;
+  if ((str = htsmsg_get_str(conf, name)))
+    return config_set_int(name, atoi(str));
+  return 0;
+}
+
+int satip_server_set_config(htsmsg_t *conf)
+{
+  static const char *names[] = {
+    "satip_rtsp",
+    "satip_weight",
+    "satip_descramble",
+    "satip_muxcnf",
+    "satip_dvbs",
+    "satip_dvbs2",
+    "satip_dvbt",
+    "satip_dvbt2",
+    "satip_dvbc",
+    "satip_dvbc2",
+    "satip_atsc",
+    "satip_dvbcb",
+    NULL
+  };
+  int i, save = 0;
+  for (i = 0; i < ARRAY_SIZE(names); i++)
+    save |= satip_server_set_int(conf, names[i]);
+  return save;
+}
 /*
  * Initialization
  */
index 01ba87f209333a58c8d5c35519efc9fae8b5ef41..439bff981891f834e354a637de79568f15e817dd 100644 (file)
@@ -58,7 +58,9 @@ int satip_server_http_page(http_connection_t *hc,
 
 int satip_server_match_uuid(const char *uuid);
 
-void satip_server_config_changed(void);
+void satip_server_save(void);
+htsmsg_t *satip_server_get_config(void);
+int satip_server_set_config(htsmsg_t *conf);
 
 void satip_server_init(int rtsp_port);
 void satip_server_register(void);
index 73a4c5a63951da0e26bcd3092009462525c92a45..af541253187d878392f1f5a88ba00fd105050654 100644 (file)
@@ -467,7 +467,7 @@ extjs_config(http_connection_t *hc, const char *remain, void *opaque)
 
     /* Misc */
     pthread_mutex_lock(&global_lock);
-    m = config_get_all();
+    m = config_get_all(0);
     if (!m) {
       pthread_mutex_unlock(&global_lock);
       return HTTP_STATUS_BAD_REQUEST;
@@ -484,7 +484,7 @@ extjs_config(http_connection_t *hc, const char *remain, void *opaque)
 
   /* Save settings */
   } else if (!strcmp(op, "saveSettings") ) {
-    int save = 0, ssave = 0;
+    int save = 0;
 
     /* Misc settings */
     pthread_mutex_lock(&global_lock);
@@ -500,34 +500,8 @@ extjs_config(http_connection_t *hc, const char *remain, void *opaque)
       save |= config_set_chicon_path(str);
     if ((str = http_arg_get(&hc->hc_req_args, "piconpath")))
       save |= config_set_picon_path(str);
-    if ((str = http_arg_get(&hc->hc_req_args, "satip_rtsp")))
-      ssave |= config_set_int("satip_rtsp", atoi(str));
-    if ((str = http_arg_get(&hc->hc_req_args, "satip_weight")))
-      ssave |= config_set_int("satip_weight", atoi(str));
-    if ((str = http_arg_get(&hc->hc_req_args, "satip_descramble")))
-      ssave |= config_set_int("satip_descramble", atoi(str));
-    if ((str = http_arg_get(&hc->hc_req_args, "satip_muxcnf")))
-      ssave |= config_set_int("satip_muxcnf", atoi(str));
-    if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbs")))
-      ssave |= config_set_int("satip_dvbs", atoi(str));
-    if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbs2")))
-      ssave |= config_set_int("satip_dvbs2", atoi(str));
-    if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbt")))
-      ssave |= config_set_int("satip_dvbt", atoi(str));
-    if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbt2")))
-      ssave |= config_set_int("satip_dvbt2", atoi(str));
-    if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbc")))
-      ssave |= config_set_int("satip_dvbc", atoi(str));
-    if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbc2")))
-      ssave |= config_set_int("satip_dvbc2", atoi(str));
-    if ((str = http_arg_get(&hc->hc_req_args, "satip_atsc")))
-      ssave |= config_set_int("satip_atsc", atoi(str));
-    if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbcb")))
-      ssave |= config_set_int("satip_dvbcb", atoi(str));
-    if (save | ssave)
+    if (save)
       config_save();
-    if (ssave)
-      satip_server_config_changed();
 
     /* Time */
     str = http_arg_get(&hc->hc_req_args, "tvhtime_update_enabled");
index 51fef9850a866221de3a763a1336b1a8ac1c6837..24ea80f8e31086fccb425b97a80c1f1f13a85f95 100644 (file)
@@ -31,10 +31,10 @@ tvheadend.comet.on('config', function(m) {
     }
 });
 
-tvheadend.miscconf = function(panel, index) {
+tvheadend.baseconf = function(panel, index) {
 
     /*
-    * Basic Config
+    * Base Config
     */
 
     var confreader = new Ext.data.JsonReader({
@@ -45,9 +45,6 @@ tvheadend.miscconf = function(panel, index) {
         'tvhtime_update_enabled', 'tvhtime_ntp_enabled',
         'tvhtime_tolerance',
         'prefer_picon', 'chiconpath', 'piconpath',
-        'satip_rtsp', 'satip_weight', 'satip_descramble', 'satip_muxcnf',
-        'satip_dvbs', 'satip_dvbs2', 'satip_dvbt', 'satip_dvbt2',
-        'satip_dvbc', 'satip_dvbc2', 'satip_atsc', 'satip_dvbcb'
     ]);
 
     /* ****************************************************************
@@ -176,129 +173,10 @@ tvheadend.miscconf = function(panel, index) {
         items: [preferPicon, chiconPath, piconPath]
     });
 
-    /*
-    * Image cache
-    */
-
-    if (tvheadend.capabilities.indexOf('imagecache') !== -1) {
-        var imagecache_reader = new Ext.data.JsonReader({
-            root: 'entries'
-        },
-        [
-            'enabled', 'ok_period', 'fail_period', 'ignore_sslcert'
-        ]);
-
-        var imagecacheEnabled = new Ext.ux.form.XCheckbox({
-            name: 'enabled',
-            fieldLabel: _('Enabled')
-        });
-
-        var imagecacheOkPeriod = new Ext.form.NumberField({
-            name: 'ok_period',
-            fieldLabel: _('Re-fetch period (hours)')
-        });
-
-        var imagecacheFailPeriod = new Ext.form.NumberField({
-            name: 'fail_period',
-            fieldLabel: _('Re-try period (hours)')
-        });
-
-        var imagecacheIgnoreSSLCert = new Ext.ux.form.XCheckbox({
-            name: 'ignore_sslcert',
-            fieldLabel: _('Ignore invalid SSL certificate')
-        });
-
-        var imagecachePanel = new Ext.form.FieldSet({
-            title: _('Image Caching'),
-            width: 700,
-            autoHeight: true,
-            collapsible: true,
-            animCollapse: true,
-            items: [imagecacheEnabled, imagecacheOkPeriod, imagecacheFailPeriod,
-                imagecacheIgnoreSSLCert]
-        });
-
-        var imagecache_form = new Ext.form.FormPanel({
-            border: false,
-            labelAlign: 'left',
-            labelWidth: 200,
-            waitMsgTarget: true,
-            reader: imagecache_reader,
-            layout: 'form',
-            defaultType: 'textfield',
-            autoHeight: true,
-            items: [imagecachePanel]
-        });
-    } else {
-        var imagecache_form = null;
-    }
-
     /*
     * SAT>IP server
     */
 
-    var satipPanel = null;
-    if (tvheadend.capabilities.indexOf('satip_server') !== -1) {
-        var rtsp = new Ext.form.NumberField({
-             name: 'satip_rtsp',
-             fieldLabel: _('RTSP Port (554 or 9983), 0 = disable')
-        });
-        var weight = new Ext.form.NumberField({
-             name: 'satip_weight',
-             fieldLabel: _('Subscription Weight')
-        });
-        var descramble = new Ext.form.NumberField({
-             name: 'satip_descramble',
-             fieldLabel: _('Descramble Services (Limit Per Mux)')
-        });
-        var muxcnf = new Ext.form.NumberField({
-             name: 'satip_muxcnf',
-             fieldLabel: _('Muxes Handling (0 = auto, 1 = keep, 2 = reject)')
-        });
-        var dvbs = new Ext.form.NumberField({
-             name: 'satip_dvbs',
-             fieldLabel: _('Exported DVB-S Tuners')
-        });
-        var dvbs2 = new Ext.form.NumberField({
-             name: 'satip_dvbs2',
-             fieldLabel: _('Exported DVB-S2 Tuners')
-        });
-        var dvbt = new Ext.form.NumberField({
-             name: 'satip_dvbt',
-             fieldLabel: _('Exported DVB-T Tuners')
-        });
-        var dvbt2 = new Ext.form.NumberField({
-             name: 'satip_dvbt2',
-             fieldLabel: _('Exported DVB-T2 Tuners')
-        });
-        var dvbc = new Ext.form.NumberField({
-             name: 'satip_dvbc',
-             fieldLabel: _('Exported DVB-C Tuners')
-        });
-        var dvbc2 = new Ext.form.NumberField({
-             name: 'satip_dvbc2',
-             fieldLabel: _('Exported DVB-C2 Tuners')
-        });
-        var atsc = new Ext.form.NumberField({
-             name: 'satip_atsc',
-             fieldLabel: _('Exported ATSC Tuners')
-        });
-        var dvbcb = new Ext.form.NumberField({
-             name: 'satip_dvbcb',
-             fieldLabel: _('Exported DVB-Cable/AnnexB Tuners')
-        });
-
-        satipPanel = new Ext.form.FieldSet({
-            title: _('SAT>IP Server'),
-            width: 700,
-            autoHeight: true,
-            collapsible: true,
-            collapsed: true,
-            animCollapse: true,
-            items: [rtsp, weight, descramble, muxcnf,
-                    dvbs, dvbs2, dvbt, dvbt2, dvbc, dvbc2, atsc, dvbcb]
-        });
-    }
 
     /* ****************************************************************
     * Form
@@ -311,25 +189,6 @@ tvheadend.miscconf = function(panel, index) {
         handler: saveChanges
     });
 
-    var imagecacheButton = new Ext.Button({
-        text: _("Clean image (icon) cache"),
-        tooltip: _('Clean image cache on storage'),
-        iconCls: 'clean',
-        handler: cleanImagecache
-    });
-
-    if (tvheadend.capabilities.indexOf('satip_client') !== -1) {
-        var satipButton = new Ext.Button({
-            text: _("Discover SAT>IP servers"),
-            tooltip: _('Look for new SAT>IP servers'),
-            iconCls: 'find',
-            handler: satipDiscover
-        });
-    } else {
-        var satipButton = null;
-    }
-
-
     var helpButton = new Ext.Button({
         text: _('Help'),
         iconCls: 'help',
@@ -340,9 +199,6 @@ tvheadend.miscconf = function(panel, index) {
 
     var _items = [serverWrap, languageWrap, dvbscanWrap, tvhtimePanel, piconPanel];
 
-    if (satipPanel)
-      _items.push(satipPanel);
-
     var confpanel = new Ext.form.FormPanel({
         labelAlign: 'left',
         labelWidth: 200,
@@ -355,28 +211,15 @@ tvheadend.miscconf = function(panel, index) {
         items: _items
     });
 
-    var _items = [confpanel];
-
-    if (imagecache_form)
-        _items.push(imagecache_form);
-
-    var _tbar = [saveButton, '-', imagecacheButton];
-    if (satipButton) {
-       _tbar.push('-');
-       _tbar.push(satipButton);
-    }
-    _tbar.push('->');
-    _tbar.push(helpButton);
-
     var mpanel = new Ext.Panel({
-        title: _('General'),
-        iconCls: 'general',
+        title: _('Base'),
+        iconCls: 'baseconf',
         border: false,
         autoScroll: true,
         bodyStyle: 'padding:15px',
         layout: 'form',
-        items: _items,
-        tbar: _tbar
+        items: [confpanel],
+        tbar: [saveButton, '->', helpButton]
     });
 
     tvheadend.paneladd(panel, mpanel, index);
@@ -395,46 +238,270 @@ tvheadend.miscconf = function(panel, index) {
                 confpanel.enable();
             }
         });
-        if (imagecache_form)
-            imagecache_form.getForm().load({
-                url: 'api/imagecache/config/load',
-                success: function(form, action) {
-                    imagecache_form.enable();
-                },
-                failure: function(form, action) {
-                    alert("FAILED");
-                }
-            });
     });
 
-    function saveChangesImagecache(params) {
+    function saveChanges() {
+        confpanel.getForm().submit({
+            url: 'config',
+            params: {
+                op: 'saveSettings'
+            },
+            waitMsg: _('Saving Data...'),
+            failure: function(form, action) {
+                Ext.Msg.alert(_('Save failed'), action.result.errormsg);
+            }
+        });
+    }
+};
+
+/*
+ * Imagecache configuration
+ */
+
+tvheadend.imgcacheconf = function(panel, index) {
+
+    if (tvheadend.capabilities.indexOf('imagecache') === -1)
+        return;
+
+    var imagecache_reader = new Ext.data.JsonReader({root: 'entries'},
+        [ 'enabled', 'ok_period', 'fail_period', 'ignore_sslcert' ]);
+
+    var imagecacheEnabled = new Ext.ux.form.XCheckbox({
+        name: 'enabled',
+        fieldLabel: _('Enabled')
+    });
+
+    var imagecacheOkPeriod = new Ext.form.NumberField({
+        name: 'ok_period',
+        fieldLabel: _('Re-fetch period (hours)')
+    });
+
+    var imagecacheFailPeriod = new Ext.form.NumberField({
+        name: 'fail_period',
+        fieldLabel: _('Re-try period (hours)')
+    });
+
+    var imagecacheIgnoreSSLCert = new Ext.ux.form.XCheckbox({
+        name: 'ignore_sslcert',
+        fieldLabel: _('Ignore invalid SSL certificate')
+    });
+
+    var imagecachePanel = new Ext.form.FieldSet({
+        title: _('Image Caching'),
+        width: 700,
+        autoHeight: true,
+        collapsible: true,
+        animCollapse: true,
+        items: [imagecacheEnabled, imagecacheOkPeriod, imagecacheFailPeriod,
+            imagecacheIgnoreSSLCert]
+    });
+
+    var imagecache_form = new Ext.form.FormPanel({
+        border: false,
+        labelAlign: 'left',
+        labelWidth: 300,
+        waitMsgTarget: true,
+        reader: imagecache_reader,
+        layout: 'form',
+        defaultType: 'textfield',
+        autoHeight: true,
+        items: [imagecachePanel]
+    });
+
+    var saveButton = new Ext.Button({
+        text: _("Save configuration"),
+        tooltip: _('Save changes made to configuration below'),
+        iconCls: 'save',
+        handler: saveChanges
+    });
+
+    var imagecacheButton = new Ext.Button({
+        text: _("Clean image (icon) cache"),
+        tooltip: _('Clean image cache on storage'),
+        iconCls: 'clean',
+        handler: cleanImagecache
+    });
+
+    var _tbar = [saveButton, '-', imagecacheButton];
+
+    var mpanel = new Ext.Panel({
+        title: _('Image cache'),
+        iconCls: 'imgcacheconf',
+        border: false,
+        autoScroll: true,
+        bodyStyle: 'padding:15px',
+        layout: 'form',
+        items: [imagecache_form],
+        tbar: _tbar
+    });
+
+    tvheadend.paneladd(panel, mpanel, index);
+
+    mpanel.on('render', function() {
+        imagecache_form.getForm().load({
+            url: 'api/imagecache/config/load',
+            success: function(form, action) {
+                imagecache_form.enable();
+            },
+            failure: function(form, action) {
+                alert(_("FAILED"));
+            }
+        });
+    });
+
+    function saveChanges(params) {
         if (imagecache_form)
             imagecache_form.getForm().submit({
                 url: 'api/imagecache/config/save',
                 params: params || {},
-                waitMsg: 'Saving data...',
+                waitMsg: _('Saving data...'),
                 failure: function(form, action) {
                     Ext.Msg.alert(_('Imagecache save failed'), action.result.errormsg);
                 }
             });
     }
 
-    function saveChanges() {
-        confpanel.getForm().submit({
-            url: 'config',
-            params: {
-                op: 'saveSettings'
+    function cleanImagecache() {
+        saveChanges({'clean': 1});
+    }
+};
+
+/*
+ * SAT>IP server configuration
+ */
+
+tvheadend.satipsrvconf = function(panel, index) {
+
+    if (tvheadend.capabilities.indexOf('satip_server') === -1)
+        return;
+
+    var satipsrv_reader = new Ext.data.JsonReader({root: 'entries'},
+        [ 'satip_rtsp', 'satip_weight', 'satip_descramble', 'satip_muxcnf',
+          'satip_dvbs', 'satip_dvbs2', 'satip_dvbt', 'satip_dvbt2',
+          'satip_dvbc', 'satip_dvbc2', 'satip_atsc', 'satip_dvbcb' ]);
+
+    var rtsp = new Ext.form.NumberField({
+         name: 'satip_rtsp',
+         fieldLabel: _('RTSP Port (554 or 9983), 0 = disable')
+    });
+    var weight = new Ext.form.NumberField({
+         name: 'satip_weight',
+         fieldLabel: _('Subscription Weight')
+    });
+    var descramble = new Ext.form.NumberField({
+         name: 'satip_descramble',
+         fieldLabel: _('Descramble Services (Limit Per Mux)')
+    });
+    var muxcnf = new Ext.form.NumberField({
+         name: 'satip_muxcnf',
+         fieldLabel: _('Muxes Handling (0 = auto, 1 = keep, 2 = reject)')
+    });
+    var dvbs = new Ext.form.NumberField({
+         name: 'satip_dvbs',
+         fieldLabel: _('Exported DVB-S Tuners')
+    });
+    var dvbs2 = new Ext.form.NumberField({
+         name: 'satip_dvbs2',
+         fieldLabel: _('Exported DVB-S2 Tuners')
+    });
+    var dvbt = new Ext.form.NumberField({
+         name: 'satip_dvbt',
+         fieldLabel: _('Exported DVB-T Tuners')
+    });
+    var dvbt2 = new Ext.form.NumberField({
+         name: 'satip_dvbt2',
+         fieldLabel: _('Exported DVB-T2 Tuners')
+    });
+    var dvbc = new Ext.form.NumberField({
+         name: 'satip_dvbc',
+         fieldLabel: _('Exported DVB-C Tuners')
+    });
+    var dvbc2 = new Ext.form.NumberField({
+         name: 'satip_dvbc2',
+         fieldLabel: _('Exported DVB-C2 Tuners')
+    });
+    var atsc = new Ext.form.NumberField({
+         name: 'satip_atsc',
+         fieldLabel: _('Exported ATSC Tuners')
+    });
+    var dvbcb = new Ext.form.NumberField({
+         name: 'satip_dvbcb',
+         fieldLabel: _('Exported DVB-Cable/AnnexB Tuners')
+    });
+
+    satipPanel = new Ext.form.FieldSet({
+        title: _('SAT>IP Server'),
+        width: 700,
+        autoHeight: true,
+        collapsible: true,
+        animCollapse: true,
+        items: [rtsp, weight, descramble, muxcnf,
+                dvbs, dvbs2, dvbt, dvbt2, dvbc, dvbc2, atsc, dvbcb]
+    });
+
+    var satipsrv_form = new Ext.form.FormPanel({
+        border: false,
+        labelAlign: 'left',
+        labelWidth: 300,
+        waitMsgTarget: true,
+        reader: satipsrv_reader,
+        layout: 'form',
+        defaultType: 'textfield',
+        autoHeight: true,
+        items: [satipPanel]
+    });
+
+    var saveButton = new Ext.Button({
+        text: _("Save configuration"),
+        tooltip: _('Save changes made to configuration below'),
+        iconCls: 'save',
+        handler: saveChanges
+    });
+
+    var satipButton = new Ext.Button({
+        text: _("Discover SAT>IP servers"),
+        tooltip: _('Look for new SAT>IP servers'),
+        iconCls: 'find',
+        handler: satipDiscover
+    });
+
+    var _tbar = [saveButton, '-', satipButton];
+
+    var mpanel = new Ext.Panel({
+        title: _('SAT>IP Server'),
+        iconCls: 'satipsrvconf',
+        border: false,
+        autoScroll: true,
+        bodyStyle: 'padding:15px',
+        layout: 'form',
+        items: [satipsrv_form],
+        tbar: _tbar
+    });
+
+    tvheadend.paneladd(panel, mpanel, index);
+
+    mpanel.on('render', function() {
+        satipsrv_form.getForm().load({
+            url: 'api/satips/config/load',
+            success: function(form, action) {
+                satipsrv_form.enable();
             },
-            waitMsg: _('Saving Data...'),
             failure: function(form, action) {
-                Ext.Msg.alert(_('Save failed'), action.result.errormsg);
+                alert(_("FAILED"));
             }
         });
-        saveChangesImagecache();
-    }
+    });
 
-    function cleanImagecache() {
-        saveChangesImagecache({'clean': 1});
+    function saveChanges(params) {
+        if (satipsrv_form)
+            satipsrv_form.getForm().submit({
+                url: 'api/satips/config/save',
+                params: params || {},
+                waitMsg: _('Saving data...'),
+                failure: function(form, action) {
+                    Ext.Msg.alert(_('SAT>IP Server configuration save failed'), action.result.errormsg);
+                }
+            });
     }
 
     function satipDiscover() {
index 0768e26b06a1f1b7d1a8c5fead70403253efc1aa..b6d16adfe8e90403d893164418e5b6c19ff1cc38 100644 (file)
@@ -375,7 +375,21 @@ function accessUpdate(o) {
             items: []
         });
 
-        tvheadend.miscconf(cp);
+        /* General */
+        var general = new Ext.TabPanel({
+            activeTab: 0,
+            autoScroll: true,
+            title: _('General'),
+            iconCls: 'general',
+            items: []
+        });
+
+
+        tvheadend.baseconf(general);
+        tvheadend.imgcacheconf(general);
+        tvheadend.satipsrvconf(general);
+        
+        cp.add(general);
 
         tvheadend.acleditor(cp);
         tvheadend.passwdeditor(cp);
@@ -389,8 +403,6 @@ function accessUpdate(o) {
             items: []
         });
 
-        var idx = 0;
-
         if (tvheadend.capabilities.indexOf('tvadapters') !== -1)
             tvheadend.tvadapters(dvbin);
         tvheadend.networks(dvbin);