commit 4914ad30a7a97a4d9b1e5f783db46ef49070ee2d Author: Ryan McCabe rmccabe@redhat.com Date: Tue Jul 27 17:32:17 2010 -0400
Do not allow editing of global resources from the service create and edit dialogs (rhbz#618633)
luci/public/js/service.js | 1 + luci/templates/resource_list.html | 378 +++++++++++++++----------- luci/widget_validators/validate_resource.py | 10 +- 3 files changed, 227 insertions(+), 162 deletions(-) --- diff --git a/luci/public/js/service.js b/luci/public/js/service.js index 39aceac..9976a90 100644 --- a/luci/public/js/service.js +++ b/luci/public/js/service.js @@ -77,6 +77,7 @@ function insert_resource(res_id, container_id, form, parent_id) {
if (is_global) { $('<input type="hidden" name="global" value="1"/>').appendTo($(form_jelem)); + $(':input', form_jelem).attr('disabled', 'disabled'); }
var cur_resid_elem = $('input[name="form_id"]', form_jelem); diff --git a/luci/templates/resource_list.html b/luci/templates/resource_list.html index 610849b..ebb06f0 100644 --- a/luci/templates/resource_list.html +++ b/luci/templates/resource_list.html @@ -3,8 +3,9 @@ py:strip="">
<div py:def="ip_resource(res, form_id, parent_id, isref)" name="IP" id="ip_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -16,29 +17,30 @@ <td>IP address</td> <td> <input name="address" type="text" class="text" - py:attrs="res and {'value': res.getAttribute('address')} or {}" /> + py:attrs="res and {'value': res.getAttribute('address'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Monitor link</td> <td> <input type="checkbox" class="checkbox" name="monitor_link" - py:attrs="res and res.getAttribute('monitor_link') and {'checked':'checked'} or {}" /> + py:attrs="res and {'checked': res.getAttribute('monitor_link') and 'checked' or None, 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Amount of time to sleep after removing an IP address</td> <td> <input name="sleeptime" type="text" class="text" - py:attrs="res and {'value': res.getAttribute('sleeptime')} or {}" /> + py:attrs="res and {'value': res.getAttribute('sleeptime'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
<div py:def="fs_resource(res, form_id, parent_id, isref)" name="FS" id="fs_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -50,13 +52,14 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Filesystem type</td> <td> - <select name="fstype" class="serviceformselect"> + <select name="fstype" class="serviceformselect" + py:attrs="{'disabled':global_resource and 'disabled' or None}"> <option value="" py:attrs="(not res or not res.getAttribute('fstype')) and {'selected':'selected'} or {}">Autodetect</option> <option name="ext4" value="ext4" @@ -84,57 +87,58 @@ <td>Mount point</td> <td> <input type="text" class="text" name="mountpoint" - py:attrs="res and {'value':res.getAttribute('mountpoint')} or {}" /> + py:attrs="res and {'value':res.getAttribute('mountpoint'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Device, FS label, or UUID</td> <td> <input type="text" class="text" name="device" - py:attrs="res and {'value':res.getAttribute('device')} or {}" /> + py:attrs="res and {'value':res.getAttribute('device'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Mount options</td> <td> <input type="text" class="text" name="options" - py:attrs="res and {'value':res.getAttribute('options')} or {}" /> + py:attrs="res and {'value':res.getAttribute('options'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Filesystem ID (optional)</td> <td> <input type="text" class="text" name="fsid" - py:attrs="res and {'value':res.getAttribute('fsid')} or {}" /> + py:attrs="res and {'value':res.getAttribute('fsid'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Force fsck</td> <td> <input type="checkbox" class="checkbox" name="force_fsck" - py:attrs="res and res.getAttribute('force_fsck') and {'checked':'checked'} or {}" /> + py:attrs="{'checked':(res and res.getAttribute('force_fsck')) and 'checked' or None, 'disabled':global_resource and 'disabled' or None}" /> </td> </tr> <tr> <td>Use quick status checks</td> <td> <input type="checkbox" class="checkbox" name="quick_status" - py:attrs="res and res.getAttribute('quick_status') and {'checked':'checked'} or {}" /> + py:attrs="{'checked':(res and res.getAttribute('quick_status')) and 'checked' or None, 'disabled':global_resource and 'disabled' or None}" /> </td> </tr> <tr> <td>Reboot host node if unmount fails</td> <td> <input type="checkbox" class="checkbox" name="self_fence" - py:attrs="res and res.getAttribute('self_fence') and {'checked':'checked'} or {}" /> + py:attrs="{'checked':(res and res.getAttribute('self_fence')) and 'checked' or None, 'disabled':global_resource and 'disabled' or None}" /> </td> </tr> </table> </div>
<div py:def="clusterfs_resource(res, form_id, parent_id, isref)" name="CLUSTERFS" id="clusterfs_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -146,27 +150,28 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Mount point</td> <td> <input type="text" class="text" name="mountpoint" - py:attrs="res and {'value':res.getAttribute('mountpoint')} or {}" /> + py:attrs="res and {'value':res.getAttribute('mountpoint'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Device, FS label, or UUID</td> <td> <input type="text" class="text" name="device" - py:attrs="res and {'value':res.getAttribute('device')} or {}" /> + py:attrs="res and {'value':res.getAttribute('device'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Filesystem type</td> <td> - <select name="fstype" class="serviceformselect"> + <select name="fstype" class="serviceformselect" + py:attrs="{'disabled':global_resource and 'disabled' or None}"> <py:choose test="tmpl_context.cluster_version"> <py:when test="3"> <option value="gfs2" @@ -186,36 +191,37 @@ <td>Mount options</td> <td> <input type="text" class="text" name="options" - py:attrs="res and {'value':res.getAttribute('options')} or {}" /> + py:attrs="res and {'value':res.getAttribute('options'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Filesystem ID (optional)</td> <td> <input type="text" class="text" name="fsid" - py:attrs="res and {'value':res.getAttribute('fsid')} or {}" /> + py:attrs="res and {'value':res.getAttribute('fsid'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Force unmount</td> <td> <input type="checkbox" class="checkbox" name="force_unmount" - py:attrs="res and res.getAttribute('force_unmount') and {'checked':'checked'} or {}" /> + py:attrs="{'checked':(res and res.getAttribute('force_unmount')) and 'checked' or None, 'disabled':global_resource and 'disabled' or None}" /> </td> </tr> <tr> <td>Reboot host node if unmount fails</td> <td> <input type="checkbox" class="checkbox" name="self_fence" - py:attrs="res and res.getAttribute('self_fence') and {'checked':'checked'} or {}" /> + py:attrs="{'checked':(res and res.getAttribute('self_fence')) and 'checked' or None, 'disabled':global_resource and 'disabled' or None}" /> </td> </tr> </table> </div>
<div py:def="netfs_resource(res, form_id, parent_id, isref)" name="NETFS" id="netfs_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -227,34 +233,35 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Mount point</td> <td> <input type="text" class="text" name="mountpoint" - py:attrs="res and {'value':res.getAttribute('mountpoint')} or {}" /> + py:attrs="res and {'value':res.getAttribute('mountpoint'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Host</td> <td> <input type="text" class="text" name="host" - py:attrs="res and {'value':res.getAttribute('host')} or {}" /> + py:attrs="res and {'value':res.getAttribute('host'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>NFS Export directory name or CIFS share</td> <td> <input type="text" class="text" name="export" - py:attrs="res and {'value':res.getAttribute('export')} or {}" /> + py:attrs="res and {'value':res.getAttribute('export'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Filesystem type</td> <td> - <select name="fstype" class="serviceformselect"> + <select name="fstype" class="serviceformselect" + py:attrs="{'disabled':global_resource and 'disabled' or None}"> <option value="">Default</option> <option value="nfs" py:attrs="res and res.getAttribute('fstype') == 'nfs' and {'selected':'selected'} or {}">NFS</option> @@ -269,29 +276,30 @@ <td>Do not unmount the filesystem during a stop or relocation operation</td> <td> <input type="checkbox" class="checkbox" name="no_unmount" - py:attrs="res and res.getAttribute('no_unmount') and {'checked':'checked'} or {}" /> + py:attrs="{'checked':(res and res.getAttribute('no_unmount')) and 'checked' or None, 'disabled':global_resource and 'disabled' or None}" /> </td> </tr> <tr> <td>Force unmount</td> <td> <input type="checkbox" class="checkbox" name="force_unmount" - py:attrs="res and res.getAttribute('force_unmount') and {'checked':'checked'} or {}" /> + py:attrs="{'checked':(res and res.getAttribute('force_unmount')) and 'checked' or None, 'disabled':global_resource and 'disabled' or None}" /> </td> </tr> <tr> <td>Options</td> <td> <input type="text" class="text" name="options" - py:attrs="res and {'value':res.getAttribute('options')} or {}" /> + py:attrs="res and {'value':res.getAttribute('options'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
<div py:def="nfsexport_resource(res, form_id, parent_id, isref)" name="NFSEXPORT" id="nfsexport_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -303,15 +311,16 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
<div py:def="nfsserver_resource(res, form_id, parent_id, isref)" name="NFSSERVER" id="nfsserver_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -323,22 +332,23 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>NFS recovery path</td> <td> <input type="text" class="text" name="nfspath" - py:attrs="res and {'value':res.getAttribute('nfspath')} or {'value':'.clumanager/nfs'}"/> + py:attrs="res and {'value':res.getAttribute('nfspath'), 'disabled':global_resource and 'disabled' or None} or {'value':'.clumanager/nfs', 'disabled':global_resource and 'disabled' or None}"/> </td> </tr> </table> </div>
<div py:def="nfsclient_resource(res, form_id, parent_id, isref)" name="NFSCLIENT" id="nfsclient_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -350,36 +360,37 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Target Hostname, Wildcard, or Netgroup</td> <td> <input type="text" class="text" name="target" - py:attrs="res and {'value':res.getAttribute('target')} or {}" /> + py:attrs="res and {'value':res.getAttribute('target'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Allow recovery of this NFS client</td> <td> <input type="checkbox" class="checkbox" name="allow_recover" - py:attrs="res and res.getAttribute('allow_recover') and {'checked':'checked'} or {}" /> + py:attrs="{'checked':(res and res.getAttribute('allow_recover')) and 'checked' or None, 'disabled':global_resource and 'disabled' or None}" /> </td> </tr> <tr> <td>Options</td> <td> <input type="text" class="text" name="options" - py:attrs="res and {'value':res.getAttribute('options')} or {}" /> + py:attrs="res and {'value':res.getAttribute('options'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
<div py:def="smb_resource(res, form_id, parent_id, isref)" name="SMB" id="smb_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -391,50 +402,51 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Workgroup</td> <td> <input type="text" class="text" name="workgroup" - py:attrs="res and {'value':res.getAttribute('workgroup')} or {}" /> + py:attrs="res and {'value':res.getAttribute('workgroup'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Config file</td> <td> <input type="text" class="text" name="config_file" - py:attrs="res and {'value':res.getAttribute('config_file')} or {}" /> + py:attrs="res and {'value':res.getAttribute('config_file'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Other command-line options for smbd</td> <td> <input type="text" class="text" name="smbd_options" - py:attrs="res and {'value':res.getAttribute('smbd_options')} or {}" /> + py:attrs="res and {'value':res.getAttribute('smbd_options'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Other command-line options for nmbd</td> <td> <input type="text" class="text" name="nmbd_options" - py:attrs="res and {'value':res.getAttribute('nmbd_options')} or {}" /> + py:attrs="res and {'value':res.getAttribute('nmbd_options'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Shutdown wait (seconds)</td> <td> <input type="text" class="text" name="shutdown_wait" value="0" - py:attrs="res and {'value':res.getAttribute('shutdown_wait')} or {}" /> + py:attrs="res and {'value':res.getAttribute('shutdown_wait'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
<div py:def="script_resource(res, form_id, parent_id, isref)" name="SCRIPT" id="script_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -446,22 +458,23 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Full path to script file</td> <td> <input type="text" class="text" name="file" - py:attrs="res and {'value':res.getAttribute('file')} or {}" /> + py:attrs="res and {'value':res.getAttribute('file'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
<div py:def="apache_resource(res, form_id, parent_id, isref)" name="APACHE" id="apache_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -473,14 +486,15 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Server root</td> <td> <input type="text" class="text" name="server_root" - py:attrs="res and {'value':res.getAttribute('server_root')} or {'value':'/etc/httpd'}" /> + value="/etc/httpd" + py:attrs="res and {'value':res.getAttribute('server_root'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr>
@@ -488,29 +502,31 @@ <td>Config file</td> <td> <input type="text" class="text" name="config_file" - py:attrs="res and {'value':res.getAttribute('config_file')} or {'value':'conf/httpd.conf'}" /> + value="conf/httpd.conf" + py:attrs="res and {'value':res.getAttribute('config_file'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>httpd options</td> <td> <input type="text" class="text" name="httpd_options" - py:attrs="res and {'value':res.getAttribute('httpd_options')} or {}" /> + py:attrs="res and {'value':res.getAttribute('httpd_options'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Shutdown wait (seconds)</td> <td> <input type="text" class="text" name="shutdown_wait" value="0" - py:attrs="res and {'value':res.getAttribute('shutdown_wait')} or {}" /> + py:attrs="res and {'value':res.getAttribute('shutdown_wait'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
<div py:def="mysql_resource(res, form_id, parent_id, isref)" name="MYSQL" id="mysql_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -522,50 +538,52 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Config file</td> <td> <input type="text" class="text" name="config_file" - py:attrs="res and {'value':res.getAttribute('config_file')} or {'value':'/etc/my.cnf'}" /> + value="/etc/my.cnf" + py:attrs="res and {'value':res.getAttribute('config_file'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Listen address</td> <td> <input type="text" class="text" name="listen_address" - py:attrs="res and {'value':res.getAttribute('listen_address')} or {}" /> + py:attrs="res and {'value':res.getAttribute('listen_address'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>mysqld options</td> <td> <input type="text" class="text" name="mysqld_options" - py:attrs="res and {'value':res.getAttribute('mysqld_options')} or {}" /> + py:attrs="res and {'value':res.getAttribute('mysqld_options'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Startup wait (seconds)</td> <td> <input type="text" class="text" name="startup_wait" value="0" - py:attrs="res and {'value':res.getAttribute('startup_wait')} or {}" /> + py:attrs="res and {'value':res.getAttribute('startup_wait'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Shutdown wait (seconds)</td> <td> <input type="text" class="text" name="shutdown_wait" value="0" - py:attrs="res and {'value':res.getAttribute('shutdown_wait')} or {}" /> + py:attrs="res and {'value':res.getAttribute('shutdown_wait'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
<div py:def="lvm_resource(res, form_id, parent_id, isref)" name="LVM" id="lvm_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -577,36 +595,37 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Volume group name</td> <td> <input type="text" class="text" name="vg_name" - py:attrs="res and {'value':res.getAttribute('vg_name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('vg_name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Logical volume name</td> <td> <input type="text" class="text" name="lv_name" - py:attrs="res and {'value':res.getAttribute('lv_name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('lv_name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Fence the node if it is unable to clean up LVM tags</td> <td> <input type="checkbox" class="checkbox" name="self_fence" - py:attrs="res and res.getAttribute('self_fence') and {'checked':'checked'} or {}" /> + py:attrs="{'checked':(res and res.getAttribute('self_fence')) and 'checked' or None, 'disabled':global_resource and 'disabled' or None}" /> </td> </tr> </table> </div>
<div py:def="openldap_resource(res, form_id, parent_id, isref)" name="OPENLDAP" id="openldap_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -618,43 +637,46 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Config file</td> <td> <input type="text" class="text" name="config_file" - py:attrs="res and {'value':res.getAttribute('config_file')} or {'value':'/etc/openldap/slapd.conf'}" /> + value="/etc/openldap/slapd.conf" + py:attrs="res and {'value':res.getAttribute('config_file'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>URL list</td> <td> <input type="text" class="text" name="url_list" - py:attrs="res and {'value':res.getAttribute('url_list')} or {'value':'ldap:///'}" /> + value="ldap:///" + py:attrs="res and {'value':res.getAttribute('url_list'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>slapd options</td> <td> <input type="text" class="text" name="slapd_options" - py:attrs="res and {'value':res.getAttribute('slapd_options')} or {}" /> + py:attrs="res and {'value':res.getAttribute('slapd_options'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Shutdown wait (seconds)</td> <td> <input type="text" class="text" name="shutdown_wait" value="0" - py:attrs="res and {'value':res.getAttribute('shutdown_wait')} or {}" /> + py:attrs="res and {'value':res.getAttribute('shutdown_wait'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
<div py:def="postgres8_resource(res, form_id, parent_id, isref)" name="POSTGRES-8" id="postgres8_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -666,43 +688,46 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Config file</td> <td> <input type="text" class="text" name="config_file" - py:attrs="res and {'value':res.getAttribute('config_file')} or {'value':'/var/lib/pgsql/data/postgresql.conf'}" /> + value="/var/lib/pgsql/data/postgresql.conf" + py:attrs="res and {'value':res.getAttribute('config_file'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Postmaster user</td> <td> <input type="text" class="text" name="postmaster_user" - py:attrs="res and {'value':res.getAttribute('postmaster_user')} or {'value':'postgres'}" /> + value="postgres" + py:attrs="res and {'value':res.getAttribute('postmaster_user'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Postmaster options</td> <td> <input type="text" class="text" name="postmaster_options" - py:attrs="res and {'value':res.getAttribute('postmaster_options')} or {}" /> + py:attrs="res and {'value':res.getAttribute('postmaster_options'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Shutdown wait (seconds)</td> <td> <input type="text" class="text" name="shutdown_wait" value="0" - py:attrs="res and {'value':res.getAttribute('shutdown_wait')} or {}" /> + py:attrs="res and {'value':res.getAttribute('shutdown_wait'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
<div py:def="tomcat5_resource(res, form_id, parent_id, isref)" name="TOMCAT-5" id="tomcat5_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -714,54 +739,58 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Config file</td> <td> <input type="text" class="text" name="config_file" - py:attrs="res and {'value':res.getAttribute('config_file')} or {'value':'/etc/tomcat5/tomcat5.conf'}" /> + value="/etc/tomcat5/tomcat5.conf" + py:attrs="res and {'value':res.getAttribute('config_file'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Tomcat user</td> <td> <input type="text" class="text" name="tomcat_user" - py:attrs="res and {'value':res.getAttribute('tomcat_user')} or {'value':'tomcat'}" /> + value="tomcat" + py:attrs="res and {'value':res.getAttribute('tomcat_user'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Catalina options</td> <td> <input type="text" class="text" name="catalina_options" - py:attrs="res and {'value':res.getAttribute('catalina_options')} or {}" /> + py:attrs="res and {'value':res.getAttribute('catalina_options'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Catalina base</td> <td> <input type="text" class="text" name="catalina_base" - py:attrs="res and {'value':res.getAttribute('catalina_base')} or {'value':'/usr/share/tomcat5'}" /> + value="/usr/share/tomcat5" + py:attrs="res and {'value':res.getAttribute('catalina_base'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Shutdown wait (seconds)</td> <td> <input type="text" class="text" name="shutdown_wait" value="30" - py:attrs="res and {'value':res.getAttribute('shutdown_wait')} or {}" /> + py:attrs="res and {'value':res.getAttribute('shutdown_wait'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
-<div py:def="sapinstance_resource(res, form_id, parent_id, isref)" name="SAPInstance" id="sapinstance_resource" class="row rescfg" +<div py:def="SAPInstance_resource(res, form_id, parent_id, isref)" name="SAPInstance" id="SAPInstance_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('InstanceName')} or {}" /> <input name="type" type="hidden" value="SAPInstance" />
<table class="formtable"> @@ -769,7 +798,7 @@ <td>SAP instance name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('InstanceName'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -778,7 +807,7 @@ </td> <td> <input type="text" class="text" name="DIR_EXECUTABLE" - py:attrs="res and {'value':res.getAttribute('DIR_EXECUTABLE')} or {}" /> + py:attrs="res and {'value':res.getAttribute('DIR_EXECUTABLE'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -787,14 +816,14 @@ </td> <td> <input type="text" class="text" name="DIR_PROFILE" - py:attrs="res and {'value':res.getAttribute('DIR_PROFILE')} or {}" /> + py:attrs="res and {'value':res.getAttribute('DIR_PROFILE'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Name of the SAP START profile</td> <td> <input type="text" class="text" name="START_PROFILE" - py:attrs="res and {'value':res.getAttribute('START_PROFILE')} or {}" /> + py:attrs="res and {'value':res.getAttribute('START_PROFILE'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -803,7 +832,7 @@ </td> <td> <input type="text" class="text" name="START_WAITTIME" - py:attrs="res and {'value':res.getAttribute('START_WAITTIME')} or {}" /> + py:attrs="res and {'value':res.getAttribute('START_WAITTIME'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -812,7 +841,7 @@ </td> <td> <input type="checkbox" class="checkbox" name="AUTOMATIC_RECOVER" - py:attrs="res and res.getAttribute('AUTOMATIC_RECOVER') and {'checked':'checked'} or {}" /> + py:attrs="{'checked':(res and res.getAttribute('AUTOMATIC_RECOVER')) and 'checked' or None, 'disabled':global_resource and 'disabled' or None}" /> </td> </tr> <tr> @@ -821,7 +850,7 @@ </td> <td> <input type="text" class="text" name="PRE_START_USEREXIT" - py:attrs="res and {'value':res.getAttribute('PRE_START_USEREXIT')} or {}" /> + py:attrs="res and {'value':res.getAttribute('PRE_START_USEREXIT'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -830,7 +859,7 @@ </td> <td> <input type="text" class="text" name="POST_START_USEREXIT" - py:attrs="res and {'value':res.getAttribute('POST_START_USEREXIT')} or {}" /> + py:attrs="res and {'value':res.getAttribute('POST_START_USEREXIT'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -839,7 +868,7 @@ </td> <td> <input type="text" class="text" name="PRE_STOP_USEREXIT" - py:attrs="res and {'value':res.getAttribute('PRE_STOP_USEREXIT')} or {}" /> + py:attrs="res and {'value':res.getAttribute('PRE_STOP_USEREXIT'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -848,19 +877,20 @@ </td> <td> <input type="text" class="text" name="POST_STOP_USEREXIT" - py:attrs="res and {'value':res.getAttribute('POST_STOP_USEREXIT')} or {}" /> + py:attrs="res and {'value':res.getAttribute('POST_STOP_USEREXIT'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
-<div py:def="sapdatabase_resource(res, form_id, parent_id, isref)" name="SAPDatabase" id="sapdatabase_resource" class="row rescfg" +<div py:def="SAPDatabase_resource(res, form_id, parent_id, isref)" name="SAPDatabase" id="SAPDatabase_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('SID')} or {}" /> <input name="type" type="hidden" value="SAPDatabase" />
<table class="formtable"> @@ -868,7 +898,7 @@ <td>SAP Database name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('SID'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -877,13 +907,14 @@ </td> <td> <input type="text" class="text" name="DIR_EXECUTABLE" - py:attrs="res and {'value':res.getAttribute('DIR_EXECUTABLE')} or {}" /> + py:attrs="res and {'value':res.getAttribute('DIR_EXECUTABLE'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Database type</td> <td> - <select name="DBTYPE" class="serviceformselect"> + <select name="DBTYPE" class="serviceformselect" + py:attrs="{'disabled':global_resource and 'disabled' or None}"> <option value="" py:attrs="(not res or not res.getAttribute('DBTYPE')) and {'selected':'selected'} or {}">Select SAP database type</option> <option value="ORA" @@ -899,28 +930,28 @@ <td>Oracle listener name</td> <td> <input type="text" class="text" name="NETSERVICENAME" - py:attrs="res and {'value':res.getAttribute('NETSERVICENAME')} or {}" /> + py:attrs="res and {'value':res.getAttribute('NETSERVICENAME'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>ABAP stack is not installed, only Java stack is installed</td> <td> <input type="checkbox" class="checkbox" name="DBJ2EE_ONLY" - py:attrs="res and res.getAttribute('DBJ2EE_ONLY') and {'checked':'checked'} or {}" /> + py:attrs="{'checked':(res and res.getAttribute('DBJ2EE_ONLY')) and 'checked' or None, 'disabled':global_resource and 'disabled' or None}" /> </td> </tr> <tr> <td>Application level monitoring</td> <td> <input type="checkbox" class="checkbox" name="STRICT_MONITORING" - py:attrs="res and res.getAttribute('STRICT_MONITORING') and {'checked':'checked'} or {}" /> + py:attrs="{'checked':(res and res.getAttribute('STRICT_MONITORING')) and 'checked' or None, 'disabled':global_resource and 'disabled' or None}" /> </td> </tr> <tr> <td>Automatic startup recovery</td> <td> <input type="checkbox" class="checkbox" name="AUTOMATIC_RECOVER" - py:attrs="res and res.getAttribute('AUTOMATIC_RECOVER') and {'checked':'checked'} or {}" /> + py:attrs="{'checked':(res and res.getAttribute('AUTOMATIC_RECOVER')) and 'checked' or None, 'disabled':global_resource and 'disabled' or None}" /> </td> </tr> <tr> @@ -929,7 +960,7 @@ </td> <td> <input type="text" class="text" name="JAVA_HOME" - py:attrs="res and {'value':res.getAttribute('JAVA_HOME')} or {}" /> + py:attrs="res and {'value':res.getAttribute('JAVA_HOME'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -938,7 +969,7 @@ </td> <td> <input type="text" class="text" name="DB_JARS" - py:attrs="res and {'value':res.getAttribute('DB_JARS')} or {}" /> + py:attrs="res and {'value':res.getAttribute('DB_JARS'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -947,7 +978,7 @@ </td> <td> <input type="text" class="text" name="PRE_START_USEREXIT" - py:attrs="res and {'value':res.getAttribute('PRE_START_USEREXIT')} or {}" /> + py:attrs="res and {'value':res.getAttribute('PRE_START_USEREXIT'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -956,7 +987,7 @@ </td> <td> <input type="text" class="text" name="POST_START_USEREXIT" - py:attrs="res and {'value':res.getAttribute('POST_START_USEREXIT')} or {}" /> + py:attrs="res and {'value':res.getAttribute('POST_START_USEREXIT'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -965,7 +996,7 @@ </td> <td> <input type="text" class="text" name="PRE_STOP_USEREXIT" - py:attrs="res and {'value':res.getAttribute('PRE_STOP_USEREXIT')} or {}" /> + py:attrs="res and {'value':res.getAttribute('PRE_STOP_USEREXIT'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -974,7 +1005,7 @@ </td> <td> <input type="text" class="text" name="POST_STOP_USEREXIT" - py:attrs="res and {'value':res.getAttribute('POST_STOP_USEREXIT')} or {}" /> + py:attrs="res and {'value':res.getAttribute('POST_STOP_USEREXIT'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -983,7 +1014,7 @@ </td> <td> <input type="text" class="text" name="DIR_BOOTSTRAP" - py:attrs="res and {'value':res.getAttribute('DIR_BOOTSTRAP')} or {}" /> + py:attrs="res and {'value':res.getAttribute('DIR_BOOTSTRAP'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -992,15 +1023,16 @@ </td> <td> <input type="text" class="text" name="DIR_SECSTORE" - py:attrs="res and {'value':res.getAttribute('DIR_SECSTORE')} or {}" /> + py:attrs="res and {'value':res.getAttribute('DIR_SECSTORE'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
-<div py:def="asehaagent_resource(res, form_id, parent_id, isref)" name="ASEHAagent" id="asehaagent_resource" class="row rescfg" +<div py:def="ASEHAagent_resource(res, form_id, parent_id, isref)" name="ASEHAagent" id="ASEHAagent_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -1012,14 +1044,14 @@ <td>Instance Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td><span title="">ASE server name</span></td> <td> <input type="text" class="text" name="server_name" - py:attrs="res and {'value':res.getAttribute('server_name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('server_name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -1028,7 +1060,7 @@ </td> <td> <input type="text" class="text" name="sybase_home" - py:attrs="res and {'value':res.getAttribute('sybase_home')} or {}" /> + py:attrs="res and {'value':res.getAttribute('sybase_home'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> @@ -1037,50 +1069,71 @@ </td> <td> <input type="text" class="text" name="login_file" - py:attrs="res and {'value':res.getAttribute('login_file')} or {}" /> + py:attrs="res and {'value':res.getAttribute('login_file'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Interfaces file</td> <td> <input type="text" class="text" name="interfaces_file" - py:attrs="res and {'value':res.getAttribute('interfaces_file')} or {}" /> + py:attrs="res and {'value':res.getAttribute('interfaces_file'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>SYBASE_ASE directory name</td> <td> <input type="text" class="text" name="sybase_ase" - py:attrs="res and {'value':res.getAttribute('sybase_ase')} or {}" /> + value="ASE-15_0" + py:attrs="res and {'value':res.getAttribute('sybase_ase'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>SYBASE_OCS directory name</td> <td> <input type="text" class="text" name="sybase_ocs" - py:attrs="res and {'value':res.getAttribute('sybase_ocs')} or {}" /> + value="OCS-15_0" + py:attrs="res and {'value':res.getAttribute('sybase_ocs'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Sybase user</td> <td> <input type="text" class="text" name="sybase_user" - py:attrs="res and {'value':res.getAttribute('sybase_user')} or {}" /> + value="sybase" + py:attrs="res and {'value':res.getAttribute('sybase_user'), 'disabled':global_resource and 'disabled' or None} or {}" /> + </td> + </tr> + <tr> + <td>Start timeout (seconds)</td> + <td> + <input type="text" class="text" name="start_timeout" + value="0" + py:attrs="res and {'value':res.getAttribute('start_timeout'), 'disabled':global_resource and 'disabled' or None} or {}" /> + </td> + </tr> + <tr> + <td>Shutdown timeout (seconds)</td> + <td> + <input type="text" class="text" name="shutdown_timeout" + value="0" + py:attrs="res and {'value':res.getAttribute('shutdown_timeout'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> - <td>Deep probe timeout</td> + <td>Deep probe timeout (seconds)</td> <td> <input type="text" class="text" name="deep_probe_timeout" - py:attrs="res and {'value':res.getAttribute('deep_probe_timeout')} or {}" /> + value="0" + py:attrs="res and {'value':res.getAttribute('deep_probe_timeout'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
<div py:def="oracledb_resource(res, form_id, parent_id, isref)" name="oracledb" id="oracledb_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -1092,42 +1145,43 @@ <td>Instance name (SID) of Oracle instance</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Oracle listener instance name</td> <td> <input type="text" class="text" name="listener_name" - py:attrs="res and {'value':res.getAttribute('listener_name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('listener_name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Oracle user name</td> <td> <input type="text" class="text" name="user" - py:attrs="res and {'value':res.getAttribute('user')} or {}" /> + py:attrs="res and {'value':res.getAttribute('user'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Oracle application home directory</td> <td> <input type="text" class="text" name="home" - py:attrs="res and {'value':res.getAttribute('home')} or {}" /> + py:attrs="res and {'value':res.getAttribute('home'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Oracle installation type</td> <td> - <select name="type" class="serviceformselect"> + <select name="oracletype" class="serviceformselect" + py:attrs="{'disabled':global_resource and 'disabled' or None}"> <option value="" - py:attrs="(not res or not res.getAttribute('type')) and {'selected':'selected'} or {}">Default</option> + py:attrs="(not res or not res.getAttribute('oracletype')) and {'selected':'selected'} or {}">Default</option> <option value="base" - py:attrs="res and res.getAttribute('type') == 'base' and {'selected':'selected'} or {}">Database Instance and Listener only</option> + py:attrs="res and res.getAttribute('oracletype') == 'base' and {'selected':'selected'} or {}">Database Instance and Listener only</option> <option value="base-em" - py:attrs="res and res.getAttribute('type') == 'base-em' and {'selected':'selected'} or {}">Database, Listener, Enterprise Manager, and iSQL*Plus</option> + py:attrs="res and res.getAttribute('oracletype') == 'base-em' and {'selected':'selected'} or {}">Database, Listener, Enterprise Manager, and iSQL*Plus</option> <option value="ias" - py:attrs="res and res.getAttribute('type') == 'ias' and {'selected':'selected'} or {}">Internet Application Server (Infrastructure)</option> + py:attrs="res and res.getAttribute('oracletype') == 'ias' and {'selected':'selected'} or {}">Internet Application Server (Infrastructure)</option> </select> </td> </tr> @@ -1135,15 +1189,16 @@ <td>Virtual hostname (optional)</td> <td> <input type="text" class="text" name="vhost" - py:attrs="res and {'value':res.getAttribute('vhost')} or {}" /> + py:attrs="res and {'value':res.getAttribute('vhost'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
<div py:def="named_resource(res, form_id, parent_id, isref)" name="NAMED" id="named_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -1155,7 +1210,7 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr>
@@ -1163,36 +1218,38 @@ <td>Full path to config file</td> <td> <input type="text" class="text" name="config_file" - py:attrs="res and {'value':res.getAttribute('config_file')} or {}" /> + py:attrs="res and {'value':res.getAttribute('config_file'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Named working directory</td> <td> <input type="text" class="text" name="named_working_dir" - py:attrs="res and {'value':res.getAttribute('named_working_dir')} or {'value':'/var/named'}" /> + value="/var/named" + py:attrs="res and {'value':res.getAttribute('named_working_dir'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Other command line options</td> <td> <input type="text" class="text" name="named_options" - py:attrs="res and {'value':res.getAttribute('named_options')} or {}" /> + py:attrs="res and {'value':res.getAttribute('named_options'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Shutdown Wait (seconds)</td> <td> <input type="text" class="text" name="shutdown_wait" value="5" - py:attrs="res and {'value':res.getAttribute('shutdown_wait')} or {}" /> + py:attrs="res and {'value':res.getAttribute('shutdown_wait'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
<div py:def="drbd_resource(res, form_id, parent_id, isref)" name="DRBD" id="drbd_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -1204,29 +1261,30 @@ <td>Name</td> <td> <input type="text" class="text" name="resourcename" - py:attrs="res and {'value':res.getAttribute('name')} or {}" /> + py:attrs="res and {'value':res.getAttribute('name'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>Full path to config file</td> <td> <input type="text" class="text" name="config_file" - py:attrs="res and {'value':res.getAttribute('config_file')} or {}" /> + py:attrs="res and {'value':res.getAttribute('config_file'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> <tr> <td>DRBD resource name, as specified in /etc/drbd.conf</td> <td> <input type="text" class="text" name="resource" - py:attrs="res and {'value':res.getAttribute('resource')} or {}" /> + py:attrs="res and {'value':res.getAttribute('resource'), 'disabled':global_resource and 'disabled' or None} or {}" /> </td> </tr> </table> </div>
<div py:def="vm_resource(res, form_id, parent_id, isref)" name="VM" id="vm_resource" class="row rescfg" + py:with="global_resource = res and isref != 0" py:attrs="res and {'id': 'global_res_%s' % res.getName(), 'name': res.getName()}"> - <input name="global" type="hidden" value="1" py:if="res and isref != 0"/> + <input name="global" type="hidden" value="1" py:if="global_resource"/> <input name="parent_id" type="hidden" value="${parent_id}"/> <input name="form_id" type="hidden" value="${form_id}"/> <input name="oldname" type="hidden" @@ -1314,9 +1372,9 @@ ${lvm_resource(None,None,None,0)} ${openldap_resource(None,None,None,0)} ${postgres8_resource(None,None,None,0)} ${tomcat5_resource(None,None,None,0)} -${sapinstance_resource(None,None,None,0)} -${sapdatabase_resource(None,None,None,0)} -${asehaagent_resource(None,None,None,0)} +${SAPInstance_resource(None,None,None,0)} +${SAPDatabase_resource(None,None,None,0)} +${ASEHAagent_resource(None,None,None,0)} ${oracledb_resource(None,None,None,0)} ${named_resource(None,None,None,0)} ${drbd_resource(None,None,None,0)} @@ -1371,11 +1429,11 @@ ${vm_resource(None,None,None,0)} <option name="oracledb_resource" value="oracledb_resource">Oracle 10g/11g Failover Instance</option> <option name="openldap_resource" value="openldap_resource">Open LDAP</option> <option name="postgres8_resource" value="postgres8_resource">PostgreSQL 8</option> - <option name="sapdatabase_resource" value="sapdatabase_resource">SAP Database</option> - <option name="sapinstance_resource" value="sapinstance_resource">SAP Instance</option> + <option name="SAPDatabase_resource" value="SAPDatabase_resource">SAP Database</option> + <option name="SAPInstance_resource" value="SAPInstance_resource">SAP Instance</option> <option name="smb_resource" value="smb_resource">Samba Server</option> <option name="script_resource" value="script_resource">Script</option> - <option name="asehaagent_resource" value="asehaagent_resource">Sybase ASE Failover Instance</option> + <option name="ASEHAagent_resource" value="ASEHAagent_resource">Sybase ASE Failover Instance</option> <option name="tomcat5_resource" value="tomcat5_resource">Tomcat</option> <option name="vm_resource" value="vm_resource" py:if="model">Virtual machine</option> </select> diff --git a/luci/widget_validators/validate_resource.py b/luci/widget_validators/validate_resource.py index faed469..ea683a2 100644 --- a/luci/widget_validators/validate_resource.py +++ b/luci/widget_validators/validate_resource.py @@ -302,6 +302,9 @@ def addSAPDatabase(res, rname, model, **kw): res.addAttribute('SID', rname)
dbtype = res.getAttribute('DBTYPE') + if not dbtype: + dbtype = 'ORA' + res.addAttribute('DBTYPE', 'ORA') if not dbtype.upper() in ( 'ORA', 'DB6', 'ADA' ): errors.append(_('Invalid database type: %s') % dbtype) return errors @@ -345,13 +348,16 @@ def addOracleDB(res, rname, model, **kw): ('user', _('Oracle User Name'), True, None), ('home', _('Oracle Home Directory'), True, None), ('listener_name', '', False, None), - ('type', _('Oracle Installation Type'), True, '10g'), + ('oracletype', _('Oracle Installation Type'), True, '10g'), ('vhost', _('Virtual Hostname'), False, None) ) errors = config_resource(params, res, rname, **kw) - dbtype = res.getAttribute('type') + dbtype = res.getAttribute('oracletype') if not dbtype.lower() in ('base', 'base-em', 'ias', '10g', '10g-ias'): errors.append(_('Invalid Oracle database type "%s"') % dbtype) + if dbtype: + res.removeAttribute('oracletype') + res.addAttribute('type', dbtype) return errors
def addNamed(res, rname, model, **kw):
luci-commits@lists.fedorahosted.org