#!/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 * from ajaxselect import * # request, response, session, cache, T, db(s) # must be passed and cannot be imported! class VolumeCloneForm(AjaxForm): def __init__(self, request, current_pool, format, translator, **attributes): AjaxForm.__init__( self, translator, **attributes) self.form.append( INPUT( _name='volume_key', _type='hidden', _value=request.vars['volume_key']) ) self.layout.addRow( LABEL( self.T('Name:') ), INPUT( _name='name', _type='text', requires=IS_NOT_EMPTY(error_message=self.T("Requires a volume name")))) self.layout.addRow( LABEL( self.T('Format:') ), AJAXSELECT( URL(request.application, 'default', 'call/json/getImageFormats/'), 'readwrite/' + format, _name='format' )) self.layout.addRow( LABEL( self.T('Pool:') ), AJAXSELECT( URL(request.application, 'default', 'call/json/getShortStoragePoolList/'), current_pool, _name='target_pool' )) self.layout.addRow( LABEL( self.T('Copy on write:') ), INPUT( _name='cow', _type='checkbox')) self.layout.addRow( HR( )) self.layout.addRow( DIV( INPUT( _value=self.T('Clone'), _type='button', _id='volume_ok_button', _class='submit_button' ), INPUT( _value=self.T('Cancel'), _type='button', _id='volume_cancel_button', _class='cancel_button' ), INPUT( _value=self.T('Reset'), _type='button', _id='volume_reset_button', _class='reset_button' ), _class = 'button-group') )