").html(d[1]))).append($("").text(d[2]?d[2].join(", "):"none").addClass("desc")).append($(" ").html($("").text("Edit").click(function(){var a=$(this).closest("tr").attr("data-name");UI.navto("Edit external writer",a)})).append($("").text("Remove").click(function(){var a=$(this).closest("tr").attr("data-name");confirm("Are you sure you want to remove the Uploader '"+
-a+"'?")&&mist.send(function(){UI.showTab("General")},{external_writer_remove:a})}))))}}else na.html("None configured.")},{external_writer_list:!0});break;case "Edit external writer":var z=!1;""!=b&&(z=!0);var Ia=function(){z?c.html($("").text("Edit external writer '"+b+"'")):c.html($("").text("New external writer"));var a={};if(mist.data.external_writer_list&&b in mist.data.external_writer_list){var d=mist.data.external_writer_list[b];a.name=d[0];a.cmdline=d[1];a.protocols=d[2]}c.append(UI.buildUI([{type:"str",
+b.append($("").addClass("uploader").attr("data-name",c).html($("").text(d[0])).append($(" ").html($("").html(d[1]))).append($("").text(d[2]?d[2].join(", "):"none").addClass("desc")).append($(" ").html($("").text("Edit").click(function(){var a=$(this).closest("tr").attr("data-name");UI.navto("Edit external writer",a)})).append($("").text("Remove").click(function(){var b=$(this).closest("tr").attr("data-name"),b=a.external_writer_list[b][0];confirm("Are you sure you want to remove the Uploader '"+
+b+"'?")&&mist.send(function(){UI.showTab("General")},{external_writer_remove:b})}))))}}else na.html("None configured.")},{external_writer_list:!0});break;case "Edit external writer":var z=!1;""!=b&&(z=!0);var Ia=function(){z?c.html($("").text("Edit external writer '"+b+"'")):c.html($("").text("New external writer"));var a={};if(mist.data.external_writer_list&&b in mist.data.external_writer_list){var d=mist.data.external_writer_list[b];a.name=d[0];a.cmdline=d[1];a.protocols=d[2]}c.append(UI.buildUI([{type:"str",
label:"Human readable name",help:"A human readable name for the external writer.",validate:["required"],pointer:{main:a,index:"name"}},{type:"str",label:"Command line",help:"Command line for a local command (with optional arguments) which will write media data to the target.",validate:["required"],pointer:{main:a,index:"cmdline"}},{type:"inputlist",label:"URI protocols handled",help:"URI protocols which the external writer will be handling.",validate:["required",function(a){for(var b in a){var c=
-a[b];if(c.match(/^([a-z\d\+\-\.])+?$/)===null)return{classes:["red"],msg:"There was a problem with the protocol URI '"+$("").text(c).html()+"':
A protocol URI may only contain lower case letters, digits, and the following special characters . + and -"}}}],input:{type:"str",unit:"://"},pointer:{main:a,index:"protocols"}},{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("General")}},{type:"save",label:"Save","function":function(){var c={external_writer_add:a};
-if(a.name!=b)c.external_writer_remove=b;mist.send(function(){UI.navto("General")},c)}}]}]))};"external_writer_list"in mist.data?Ia():mist.send(function(){Ia()},{external_writer_list:!0});break;case "Edit variable":z=!1;""!=b&&(z=!0);var Fa=function(a,d){z?c.html($("
").text('Edit Variable "$'+b+'"')):c.html($("").text("New Variable"));var f=$("");c.append(UI.buildUI([{type:"str",maxlength:31,label:"Variable name",prefix:"$",help:"What should the variable be called? A dollar sign will automatically be prepended.",
-pointer:{main:a,index:"name"},validate:["required",function(a){if(a.length&&a[0]=="$")return{msg:"The dollar sign will automatically be prepended. You don't need to type it here.",classes:["red"]};if(a.indexOf("{")!==-1||a.indexOf("}")!==-1||a.indexOf("$")!==-1)return{msg:'The following symbols are not permitted: "$ { }".',classes:["red"]}}]},{type:"select",label:"Type",help:"What kind of variable is this? It can either be a static value that you can enter below, or a dynamic one that is returned by a command.",
+a[b];if(c.match(/^([a-z\d\+\-\.])+?$/)===null)return{classes:["red"],msg:"There was a problem with the protocol URI '"+$("
").text(c).html()+"':
A protocol URI may only contain lower case letters, digits, and the following special characters . + and -"}}}],input:{type:"str",unit:"://"},pointer:{main:a,index:"protocols"}},{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("General")}},{type:"save",label:"Save","function":function(){var c={external_writer_add:a},
+d=null;b!=""&&b in mist.data.external_writer_list&&(d=mist.data.external_writer_list[b][0]);if(d!==null&&a.name!=d)c.external_writer_remove=d;mist.send(function(){UI.navto("General")},c)}}]}]))};"external_writer_list"in mist.data?Ia():mist.send(function(){Ia()},{external_writer_list:!0});break;case "Edit variable":z=!1;""!=b&&(z=!0);var Fa=function(a,d){z?c.html($("
").text('Edit Variable "$'+b+'"')):c.html($("").text("New Variable"));var f=$(" ");c.append(UI.buildUI([{type:"str",maxlength:31,
+label:"Variable name",prefix:"$",help:"What should the variable be called? A dollar sign will automatically be prepended.",pointer:{main:a,index:"name"},validate:["required",function(a){if(a.length&&a[0]=="$")return{msg:"The dollar sign will automatically be prepended. You don't need to type it here.",classes:["red"]};if(a.indexOf("{")!==-1||a.indexOf("}")!==-1||a.indexOf("$")!==-1)return{msg:'The following symbols are not permitted: "$ { }".',classes:["red"]}}]},{type:"select",label:"Type",help:"What kind of variable is this? It can either be a static value that you can enter below, or a dynamic one that is returned by a command.",
select:[["value","Static value"],["command","Dynamic through command"]],value:"value",pointer:{main:d,index:"type"},"function":function(){var a=[$("Invalid variable type")];switch($(this).val()){case "value":a=[{type:"str",label:"Value",pointer:{main:d,index:"value"},help:"The static value that this variable should be replaced with. There is a character limit of 63 characters.",validate:["required"]}];break;case "command":a=[{type:"str",label:"Command",help:"The command that should be executed to retrieve the value for this variable. For example:/usr/bin/date +%A
There is a character limit of 511 characters.",
validate:["required"],pointer:{main:d,index:"target"}},{type:"int",min:0,max:4294967295,"default":0,label:"Checking interval",unit:"s",help:"At what interval, in seconds, MistServer should execute the command and update the value. To execute the command once when MistServer starts up (and then never update), set the interval to 0.",pointer:{main:d,index:"interval"}},{type:"int",min:0,max:4294967295,"default":1,label:"Wait time",unit:"s",help:"Specifies the maximum time, in seconds, MistServer should wait for data when executing the variable target. If set to 0 this variable takes on the same value as the interval. MistServer only updates one variable at a time, so setting this value too high can block other variables from updating.",
pointer:{main:d,index:"waitTime"}}]}f.html(UI.buildUI(a))}},f,{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("General")}},{type:"save",label:"Save","function":function(){var c={variable_add:a};switch(d.type){case "value":a.value=d.value;break;case "command":a.target=d.target;a.interval=d.interval;a.waitTime=d.waitTime}if(a.name!=b)c.variable_remove=b;mist.send(function(){UI.navto("General")},c)}}]}]))};c.html("Loading..");z?mist.send(function(a){if(b in a.variable_list){a=
diff --git a/lsp/mist.js b/lsp/mist.js
index b291be62..aaa1f1bb 100644
--- a/lsp/mist.js
+++ b/lsp/mist.js
@@ -3219,10 +3219,11 @@ var UI = {
).append(
$("").text("Remove").click(function(){
var i = $(this).closest("tr").attr("data-name");
- if (confirm("Are you sure you want to remove the Uploader '"+i+"'?")) {
+ var name = d.external_writer_list[i][0];
+ if (confirm("Are you sure you want to remove the Uploader '"+name+"'?")) {
mist.send(function(){
UI.showTab("General");
- },{external_writer_remove:i});
+ },{external_writer_remove:name});
}
})
)
@@ -3311,9 +3312,13 @@ var UI = {
label: 'Save',
'function': function(){
var o = {external_writer_add:saveas};
+ var prev_name = null;
+ if ((other != "") && (other in mist.data.external_writer_list)) {
+ prev_name = mist.data.external_writer_list[other][0];
+ }
- if (saveas.name != other) {
- o.external_writer_remove = other;
+ if ((prev_name !== null) && (saveas.name != prev_name)) {
+ o.external_writer_remove = prev_name;
}
mist.send(function(){
UI.navto('General');