]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
add persistent flag to properties
authorJaroslav Kysela <perex@perex.cz>
Mon, 18 Jan 2016 09:05:14 +0000 (10:05 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 19 Jan 2016 14:14:15 +0000 (15:14 +0100)
src/prop.c
src/prop.h
src/webui/static/app/idnode.js
src/wizard.c

index d17891446e62d33bbcd40d0458a6ee972d60dee3..64c0be815a80ddfe09b4720c6e66b2057c537c4d 100644 (file)
@@ -489,6 +489,8 @@ prop_serialize_value
     htsmsg_add_bool(m, "lorder", 1);
   if (opts & PO_MULTILINE)
     htsmsg_add_bool(m, "multiline", 1);
+  if (opts & PO_PERSIST)
+    htsmsg_add_bool(m, "persistent", 1);
 
   /* Enum list */
   if (pl->list) {
index 5227f4a00b9177f6d27df49d3e364dc5ed5f389e..a3f95f47c669da9c19e63d2f3e9768862a24ee43 100644 (file)
@@ -61,6 +61,7 @@ typedef enum {
 #define PO_LOCALE    (1<<14) // Call tvh_locale_lang on string
 #define PO_LORDER    (1<<15) // Manage order in lists
 #define PO_MULTILINE (1<<16) // Multiline string
+#define PO_PERSIST   (1<<17) // Persistent value (return back on save)
 
 /*
  * Property definition
index 680706cf98bb5da74568a15cd3080865114144c5..9efa427966f4afaa87123cbeadad960a590c49ed 100644 (file)
@@ -252,6 +252,7 @@ tvheadend.IdNodeField = function(conf)
     this.group = conf.group;
     this.lorder = conf.lorder;
     this.multiline = conf.multiline;
+    this.persistent = conf.persistent;
     this['enum'] = conf['enum'];
     this.store = null;
     if (this['enum'])
@@ -1056,6 +1057,18 @@ tvheadend.idnode_editor = function(_uilevel, item, conf)
         tvheadend.idnode_editor_form(uilevel, item.props || item.params, item.meta, panel, c);
     }
 
+    function values(form) {
+        var node = form.getFieldValues();
+        var props = item.props || item.params;
+        node.uuid = conf.uuids ? conf.uuids : item.uuid;
+        for (var i = 0; i < props.length; i++) {
+            var p = props[i];
+            if (p.persistent)
+                node[p.name] = p.value;
+        }
+        return node;
+    }
+
     /* Buttons */
     if (!conf.noButtons) {
         if (conf.cancel) {
@@ -1073,10 +1086,10 @@ tvheadend.idnode_editor = function(_uilevel, item, conf)
             text: conf.saveText || _('Save'),
             iconCls: conf.saveIconCls || 'save',
             handler: function() {
+                var form = panel.getForm();
                 var node = null;
-                if (panel.getForm().isDirty() || conf.alwaysDirty) {
-                    node = panel.getForm().getFieldValues();
-                    node.uuid = conf.uuids ? conf.uuids : item.uuid;
+                if (form.isDirty() || conf.alwaysDirty) {
+                    node = values(form);
                     tvheadend.Ajax({
                         url: conf.saveURL || 'api/idnode/save',
                         params: {
@@ -1104,10 +1117,9 @@ tvheadend.idnode_editor = function(_uilevel, item, conf)
                 text: _('Apply'),
                 iconCls: 'apply',
                 handler: function() {
-                    if (panel.getForm().isDirty()) {
-                        var form = panel.getForm();
-                        var node = form.getFieldValues();
-                        node.uuid = conf.uuids ? conf.uuids : item.uuid;
+                    var form = panel.getForm();
+                    if (form.isDirty()) {
+                        var node = values(form);
                         tvheadend.Ajax({
                             url: conf.saveURL || 'api/idnode/save',
                             params: {
index 1dce07402fe9a5f5ca08d2671703d08326bab2bd..ef693ca9df072cb93f461a86714fb58545932543 100644 (file)
@@ -543,10 +543,10 @@ static void network_save(idnode_t *in)
   .group = num, \
 }, { \
   .type = PT_STR, \
-  .id   = "hidden_tunerid" STRINGIFY(num), \
+  .id   = "tunerid" STRINGIFY(num), \
   .name = "Tuner", \
   .get  = network_get_tidvalue##num, \
-  .opts = PO_RDONLY | PO_NOUI, \
+  .opts = PO_RDONLY | PO_PERSIST | PO_NOUI, \
 }, { \
   .type = PT_STR, \
   .id   = "network" STRINGIFY(num), \