#!/usr/bin/env python # coding: utf8 from gluon.html import * from gluon.http import * from gluon.validators import * from gluon.sqlhtml import * from ajaxform import * # request, response, session, cache, T, db(s) # must be passed and cannot be imported! class PoolManageStateForm(AjaxForm): def __init__(self, pool, translator, **attributes): AjaxForm.__init__( self, translator, **attributes) defaultPoolState = 'inactive' defaultAutostart = 'off' if pool.info()[0] == 2: defaultPoolState = 'active' if pool.autostart(): defaultAutostart = 'on' self.form.append( INPUT( _name='pool_uuid', _type='hidden', _value=pool.UUIDString()) ) self.layout.addRow( LABEL( self.T('Pool state:') ), SELECT( OPTION('active'), OPTION('inactive'), _name='pool_state', value=defaultPoolState )) self.layout.addRow( LABEL( self.T('Autostart pool:') ), SELECT( OPTION('on'), OPTION('off'), _name='pool_autostart', value=defaultAutostart )) self.layout.addRow( HR( )) self.layout.addRow( DIV( INPUT( _value=self.T('Apply'), _type='button', _id='manage_pool_apply_button', _class='submit_button' ), INPUT( _value=self.T('Cancel'), _type='button', _id='manage_pool_cancel_button', _class='cancel_button' ), INPUT( _value=self.T('Reset'), _type='button', _id='manage_pool_reset_button', _class='reset_button' ), _class = 'button-group') )