From: Thierry Parmentelat Date: Mon, 30 Aug 2010 10:01:17 +0000 (+0000) Subject: newly created node can be declared 'reservable' X-Git-Tag: www-register-wizard-4.3-4~3 X-Git-Url: http://git.onelab.eu/?p=www-register-wizard.git;a=commitdiff_plain;h=882f60e952c36b4ee5ef452df5cb4bae074a1198 newly created node can be declared 'reservable' + various cosmetic --- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a94e47a --- /dev/null +++ b/Makefile @@ -0,0 +1,48 @@ +# refresh tags +tags: + find . '(' -name '*.php' -o -name '*.js' -o -name '*.css' -o -name Makefile ')' | xargs etags + +.PHONY: tags + +########## sync +# 2 forms are supported +# (*) if your plc root context has direct ssh access: +# make sync PLC=boot.planet-lab.eu +# (*) otherwise, entering through the root context +# make sync PLCHOST=testplc.onelab.eu GUEST=vplc03.inria.fr + +PLCHOST ?= testplc.onelab.eu + +ifdef GUEST +SSHURL:=root@$(PLCHOST):/vservers/$(GUEST) +SSHCOMMAND:=ssh root@$(PLCHOST) vserver $(GUEST) +endif +ifdef PLC +SSHURL:=root@$(PLC):/ +SSHCOMMAND:=ssh root@$(PLC) +endif + +LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc' +RSYNC_EXCLUDES := --exclude .svn --exclude .git --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES) +RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,) +RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES) + +sync: +ifeq (,$(SSHURL)) + @echo "sync: You must define, either PLC, or PLCHOST & GUEST, on the command line" + @echo " e.g. make sync PLC=boot.planet-lab.eu" + @echo " or make sync PLCHOST=testplc.onelab.eu GUEST=vplc03.inria.fr" + @exit 1 +else + +$(RSYNC) ./ $(SSHURL)/var/www/html/registerwizard/ +endif + +#################### convenience, for debugging only +# make +foo : prints the value of $(foo) +# make ++foo : idem but verbose, i.e. foo=$(foo) +++%: varname=$(subst +,,$@) +++%: + @echo "$(varname)=$($(varname))" ++%: varname=$(subst +,,$@) ++%: + @echo "$($(varname))" diff --git a/application/controllers/register.php b/application/controllers/register.php index f3b4075..4e15529 100644 --- a/application/controllers/register.php +++ b/application/controllers/register.php @@ -245,8 +245,9 @@ class Register extends Controller { if ( isset($_REQUEST['pcu_proceed']) ) { $rules['hostname'] = ""; + $rules['node_type'] = 'regular'; $rules['model'] = ""; - $rules['method'] = ""; + $rules['method'] = "dhcp"; $rules['ip'] = ""; $rules['netmask'] = ""; $rules['network'] = ""; @@ -256,6 +257,7 @@ class Register extends Controller { $rules['dns2'] = ""; $this->validation->set_rules($rules); $fields['hostname'] = "Hostname"; + $fields['node_type'] = "Node Type"; $fields['model'] = "Model"; $fields['method'] = "Method"; $fields['ip'] = "IP Address"; @@ -325,6 +327,7 @@ class Register extends Controller { { global $api, $plc; $hostname = trim($_REQUEST['hostname']); + $node_type = trim($_REQUEST['node_type']); $model= trim($_REQUEST['model']); $method = trim($_REQUEST['method']); $ip = trim($_REQUEST['ip']); @@ -357,7 +360,7 @@ class Register extends Controller { if( !isset($errors) || count($errors) == 0 ) { // add new node and its network - $optional_vals= array( "hostname"=>$hostname, "model"=>$model ); + $optional_vals= array( 'hostname'=>$hostname, 'node_type'=>$node_type, 'model'=>$model ); $site_id= $data['site_id']; // Try to get node in case this is from an error: @@ -533,6 +536,7 @@ class Register extends Controller { $person = new Person($plc->person); $fields['hostname'] = "Hostname"; + $fields['node_type'] = "Node Type"; $fields['model'] = "Model"; $fields['method'] = "Method"; $fields['ip'] = "IP Address"; @@ -552,8 +556,9 @@ class Register extends Controller { if ( isset($_REQUEST['node_choose']) ) { $rules['node_id'] = "required|intval"; $rules['hostname'] = ""; + $rules['node_type'] = "regular"; $rules['model'] = ""; - $rules['method'] = ""; + $rules['method'] = "dhcp"; $rules['ip'] = ""; $rules['netmask'] = ""; $rules['network'] = ""; @@ -618,10 +623,11 @@ class Register extends Controller { # TODO: RECODE To update values instead of adding them... global $api, $plc; $hostname = trim($_REQUEST['hostname']); - $model= trim($_REQUEST['model']); + $model = trim($_REQUEST['model']); + $node_type = trim($_REQUEST['node_type']); $node_id = intval($this->validation->node_id); - $ret = $api->UpdateNode( $node_id, array('hostname' => $hostname, - 'model' => $model)); + $optional_vals = array('hostname' => $hostname, 'model' => $model, 'node_type' => $node_type ); + $ret = $api->UpdateNode( $node_id, $optional_vals); if( $ret <= 0 ) { $data['error'] = $api->error(); print $data['error']; diff --git a/application/views/header.php b/application/views/header.php index 45ead67..13887dd 100644 --- a/application/views/header.php +++ b/application/views/header.php @@ -4,9 +4,9 @@ - + + diff --git a/application/views/stage3_node_choose.php b/application/views/stage3_node_choose.php index ae443f3..abe54c7 100644 --- a/application/views/stage3_node_choose.php +++ b/application/views/stage3_node_choose.php @@ -4,9 +4,18 @@ if( isset($errors) && count($errors) > 0 ) } ?> diff --git a/application/views/stage4_node_confirm.php b/application/views/stage4_node_confirm.php index b7fd6a4..35c7dd3 100644 --- a/application/views/stage4_node_confirm.php +++ b/application/views/stage4_node_confirm.php @@ -11,9 +11,18 @@ if( isset($errors) && count($errors) > 0 ) } ?> diff --git a/wizard.css b/wizard.css new file mode 100644 index 0000000..dcdd6b9 --- /dev/null +++ b/wizard.css @@ -0,0 +1,3 @@ +tr>td>h3 { + padding: 20; +}