--- /dev/null
+# 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))"
if ( isset($_REQUEST['pcu_proceed']) ) {
$rules['hostname'] = "";
+ $rules['node_type'] = 'regular';
$rules['model'] = "";
- $rules['method'] = "";
+ $rules['method'] = "dhcp";
$rules['ip'] = "";
$rules['netmask'] = "";
$rules['network'] = "";
$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";
{
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']);
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:
$person = new Person($plc->person);
$fields['hostname'] = "Hostname";
+ $fields['node_type'] = "Node Type";
$fields['model'] = "Model";
$fields['method'] = "Method";
$fields['ip'] = "IP Address";
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'] = "";
# 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'];
<style type="text/css" media="all">@import "https://www.planet-lab.org/misc/drupal.css";</style>
<style type="text/css" media="all">@import "https://www.planet-lab.org/sites/default/themes/chameleon/common.css";</style>
<style type="text/css" media="all">@import "https://www.planet-lab.org/sites/default/themes/chameleon/planetlab/style.css";</style>
- <link rel="shortcut icon"
- href="https://www.planet-lab.org/sites/default/themes/chameleon/planetlab/favicon.ico" type="image/x-icon" />
+ <link rel="shortcut icon" href="/misc/favicon.ico" type="image/x-icon" />
<style type="text/css" media="all">@import "/registerwizard/rounded.css";</style>
+ <style type="text/css" media="all">@import "/registerwizard/wizard.css";</style>
<script src="/registerwizard/rounded.js"></script>
</head>
<body>
}
?>
<script language="javascript">
-function updateStaticFields()
-{
- var is_dhcp= document.fm.method[0].checked;
+function initNodeTypeFields() {
+ var regular=document.getElementById("regular_checked");
+ var reservable=document.getElementById("reservable_checked");
+ if ( regular.checked || reservable.checked) return;
+ regular.checked=true;
+}
+function updateMethodFields() {
+ var dhcp=document.getElementById("dhcp_checked");
+ var static=document.getElementById("static_checked");
+ // set dhcp as default
+ if ( ! dhcp.checked && ! static.checked) dhcp.checked=true;
+ var is_dhcp=dhcp.checked;
document.fm.netmask.disabled= is_dhcp;
document.fm.network.disabled= is_dhcp;
<tr><th>Site: </th><td><?= $site['name'] ?></td>
</tr>
<tr>
- <th width=200>Hostname:</td>
+ <th width=200>Hostname</td>
<td><input type="text" name="hostname" value="<?= $this->validation->hostname ?>"
size="40" maxlength="256">
<?= ( $this->disp_errors ? $this->validation->hostname_error : "") ?>
</td>
</tr>
<tr>
- <th>Model:</td>
+ <th valign='top' width="200">Node Type</th>
+ <td>
+ <input type="radio" name="node_type" value="regular" id="regular_checked"
+ <?= ( $this->validation->node_type == 'regular' ? "checked" : "" ) ?>>regular
+ <input type="radio" name="node_type" value="reservable" id="reservable_checked"
+ <?= ( $this->validation->node_type == 'reservable' ? "checked" : "" ) ?>>reservable
+ </td>
+ </tr>
+ <tr>
+ <th>Model</td>
<td>
<input type="text" name="model" value="<?= $this->validation->model ?>"
size="40" maxlength="256">
<?= ( $this->disp_errors ? $this->validation->model_error : "") ?>
</td>
</tr>
+
+
+
<tr>
- <td> <b>Network Settings</b> </td>
+ <td colspan=2> <h3>Network Settings</h3> </td>
</tr>
<tr>
<th valign='top' width="200">Addressing Method</th>
<td>
- <input type="radio" name="method" value="dhcp" onChange='updateStaticFields()'
+ <input type="radio" name="method" value="dhcp" id="dhcp_checked" onChange='updateMethodFields()'
<?= ( $this->validation->method == 'dhcp' ? "checked" : "" ) ?>>DHCP
- <input type="radio" name="method" value="static" onChange='updateStaticFields()'
+ <input type="radio" name="method" value="static" id='static_checked' onChange='updateMethodFields()'
<?= ( $this->validation->method == 'static' ? "checked" : "" ) ?>>Static
</td>
</tr>
</form>
<script language="javascript">
-updateStaticFields();
+initNodeTypeFields();
+updateMethodFields();
</script>
}
?>
<script language="javascript">
-function updateStaticFields()
-{
- var is_dhcp= document.fm.method[0].checked;
+function initNodeTypeFields() {
+ var regular=document.getElementById("regular_checked");
+ var reservable=document.getElementById("reservable_checked");
+ if ( regular.checked || reservable.checked) return;
+ regular.checked=true;
+}
+function updateMethodFields() {
+ var dhcp=document.getElementById("dhcp_checked");
+ var static=document.getElementById("static_checked");
+ // set dhcp as default
+ if ( ! dhcp.checked && ! static.checked) dhcp.checked=true;
+ var is_dhcp=dhcp.checked;
document.fm.netmask.disabled= is_dhcp;
document.fm.network.disabled= is_dhcp;
</tr>
<?php } ?>
<tr>
- </tr>
<th width=200>Hostname:</td>
<td><input type="text" name="hostname" value="<?= $node->hostname ?>"
size="40" maxlength="256">
<?= ( $this->disp_errors ? $this->validation->hostname_error : "") ?>
</td>
+ </tr>
+ <tr>
+ <th valign='top' width="200">Node Type</th>
+ <td>
+ <input type="radio" name="node_type" value="regular" id="regular_checked"
+ <?= ( $this->validation->node_type == 'regular' ? "checked" : "" ) ?>>regular
+ <input type="radio" name="node_type" value="reservable" id="reservable_checked"
+ <?= ( $this->validation->node_type == 'reservable' ? "checked" : "" ) ?>>reservable
+ </td>
+ </tr>
<tr>
<th>Model:</th>
<td>
<?= ( $this->disp_errors ? $this->validation->model_error : "") ?>
</td>
</tr>
+
<tr>
<th valign='top' width="200">Addressing Method</th>
<td>
- <input type="radio" name="method" value="dhcp" onChange='updateStaticFields()'
- <?= ( $node->method == 'dhcp' ? "checked" : "" ) ?>>DHCP
- <input type="radio" name="method" value="static" onChange='updateStaticFields()'
- <?= ( $node->method == 'static' ? "checked" : "" ) ?>>Static
+ <input type="radio" name="method" value="dhcp" id="dhcp_checked" onChange='updateMethodFields()'
+ <?= ( $this->validation->method == 'dhcp' ? "checked" : "" ) ?>>DHCP
+ <input type="radio" name="method" value="static" id='static_checked' onChange='updateMethodFields()'
+ <?= ( $this->validation->method == 'static' ? "checked" : "" ) ?>>Static
</td>
</tr>
-
- <tr><th valign='top'>IP Address</th>
+ <tr>
+ <th valign='top'>IP Address</th>
<td><input type="text" name="ip" value="<?= $node->ip ?>">
<?= ( $this->disp_errors ? $this->validation->ip_error : "") ?>
</td>
</form>
<script language="javascript">
-updateStaticFields();
+initNodeTypeFields();
+updateMethodFields();
</script>
--- /dev/null
+tr>td>h3 {
+ padding: 20;
+}