diff --git a/domain-server/resources/describe-settings.json b/domain-server/resources/describe-settings.json index ac775dcee5..a4d6424997 100644 --- a/domain-server/resources/describe-settings.json +++ b/domain-server/resources/describe-settings.json @@ -110,39 +110,48 @@ "name": "id_can_connect", "label": "Connect", "type": "checkbox", + "editable": true, "default": true }, { "name": "id_can_adjust_locks", "label": "Lock/Unlock", "type": "checkbox", + "editable": true, "default": false }, { "name": "id_can_rez", "label": "Rez", "type": "checkbox", + "editable": true, "default": false }, { "name": "id_can_rez_tmp", "label": "Rez Temp", "type": "checkbox", + "editable": true, "default": false }, { "name": "id_can_write_to_asset_server", "label": "Write Assets", "type": "checkbox", + "editable": true, "default": false }, { "name": "id_can_connect_past_max_capacity", "label": "Ignore Max Capacity", "type": "checkbox", + "editable": true, "default": false } - ] + ], + + "non-deletable-row-key": "permissions_id", + "non-deletable-row-values": ["localhost", "anonymous", "logged-in"] } ] }, diff --git a/domain-server/resources/web/settings/js/settings.js b/domain-server/resources/web/settings/js/settings.js index 35e9d64d84..44b2c692d2 100644 --- a/domain-server/resources/web/settings/js/settings.js +++ b/domain-server/resources/web/settings/js/settings.js @@ -234,7 +234,7 @@ $(document).ready(function(){ // Bootstrap switch in table - $('#' + Settings.FORM_ID).on('switchChange.bootstrapSwitch', 'input.toggle-checkbox', function () { + $('#' + Settings.FORM_ID).on('switchChange.bootstrapSwitch', 'input.table-checkbox', function () { // Bootstrap switches in table: set the changed data attribute for all rows. var row = $(this).closest('tr'); row.find('td.' + Settings.DATA_COL_CLASS + ' input').attr('data-changed', true); @@ -919,6 +919,9 @@ function makeTable(setting, keypath, setting_value, isLocked) { html += "" + setting.help + "" } + var nonDeletableRowKey = setting["non-deletable-row-key"]; + var nonDeletableRowValues = setting["non-deletable-row-values"]; + html += ""; @@ -961,6 +964,8 @@ function makeTable(setting, keypath, setting_value, isLocked) { html += "" } + var isNonDeletableRow = false; + _.each(setting.columns, function(col) { if (isArray) { @@ -972,28 +977,17 @@ function makeTable(setting, keypath, setting_value, isLocked) { colName = keypath + "." + rowIndexOrName + "." + col.name; } - if (isArray && col.type === "checkbox") { + isNonDeletableRow = isNonDeletableRow + || (nonDeletableRowKey === col.name && nonDeletableRowValues.indexOf(colValue) !== -1); + if (isArray && col.type === "checkbox" && col.editable) { html += ""; } else { - - // setup the td for this column - html += ""; + // Use a hidden input so that the values are posted. + html += ""; } }) @@ -1004,8 +998,12 @@ function makeTable(setting, keypath, setting_value, isLocked) { "'>" + "" } - html += "" + if (isNonDeletableRow) { + html += ""; + } else { + html += ""; + } } html += "" @@ -1039,12 +1037,8 @@ function makeTableInputs(setting) { _.each(setting.columns, function(col) { if (col.type === "checkbox") { html += ""; } else { html += "
" + rowIndexOrName + "" - html += ""; - - // add the actual value to the td so it is displayed - html += colValue; - - // for values to be posted properly we add a hidden input to this td - html += ""; - - html += "" + + colValue + "
" - html += "\