Merge branch 'master' of git://github.com/svenp/volkszaehler.org

Added form to create new entities (thx to paepke)

Conflicts:
	misc/controller/bash/log_i2c_ds1631_ecmd.sh
This commit is contained in:
Steffen Vogel 2011-03-26 13:19:02 +01:00
commit 60900666ee
3 changed files with 30 additions and 16 deletions

View file

@ -139,7 +139,7 @@
<ul>
<li><a href="#entity-subscribe">Kanal abonnieren</a></li>
<li><a href="#entity-subscribe-public">&ouml;ffentliche Kan&auml;le</a></li>
<!-- <li><a href="#entity-create">Kanal erstellen</a></li> -->
<li><a href="#entity-create">Kanal erstellen</a></li>
</ul>
<div id="entity-subscribe">
<p>Hier k&ouml;nnen Sie einen existierenden Kanal über seine UUID hinzuf&uuml;gen</p>
@ -154,12 +154,22 @@
<p><label for="cookie">Cookie:</label> </td><td><input class="cookie" type="checkbox" /></p>
<input type="button" value="abonnieren" />
</div>
<!-- <div id="entity-create">
<p>Hier können Sie einen neuen Kanal erstellen</p>
<p><label for="type">Typ: </label><select id="type" size="1"></select></p>
<fieldset id="properties"></fieldset>
<input type="button" value="erstellen" />
</div> -->
<div id="entity-create">
<form method="post" target="_blank">
<table>
<tr><td>Middleware URL:</td><td><input type="text" id="entity-create-middlware" /><p style="font-size: small">Bsp: http://volkszaehler.org/demo/middleware.php</p></td></tr>
<tr><td>Typ:</td><td><select name="type" size="1"></select></td></tr>
<tr><td>&Ouml;ffentlich:</td><td><input type="radio" name="public" value="1"> ja<br /><input type="radio" name="public" value="0"> nein</td></tr>
<tr><td>Titel:</td><td><input type="text" name="title" value="K&uuml;hlschrank" /></td></tr>
<tr><td>Aufl&ouml;sung:</td><td><input type="text" name="resolution" value="1000" /></td></tr>
<tr><td>Kosten:<br /><p style="font-size: small">pro Wh</p></td><td><input type="text" name="cost" value="0.00025" /></td></tr>
<tr><td>Beschreibung:</td><td><input type="text" name="description" value="Swissnox 1-phasig" /></td></tr>
</table>
<p><input type="submit" value="erstellen" /></p>
<p>Es wird ein neuer Kanal erstellt. Die Antwort des Backends enthällt dann die UUID.<br />
Diese muss dann im Controller angegeben werden (z.B. AVR Net-IO).</p>
</form>
</div>
</div>
</div>
</body>

View file

@ -36,7 +36,7 @@ vz.wui.init = function() {
$('#entity-list').show(); // open entity list by default
// buttons
$('button, input[type=button],[type=image]').button();
$('button, input[type=button],[type=image],[type=submit]').button();
$('button[name=options-save]').click(vz.options.save);
$('#permalink').click(function() {
var uuids = [];
@ -130,17 +130,20 @@ vz.wui.dialogs.init = function() {
// show available entity types
vz.capabilities.definitions.entities.each(function(index, def) {
$('#entity-create select#type').append(
$('<option>').html(def.translation[vz.options.language]).data('definition', def)
$('#entity-create select[name=type]').append(
$('<option>').html(def.translation[vz.options.language]).data('definition', def).val(def.name)
);
});
$('#entity-create option[value=power]').attr('selected', 'selected');
/*$('#entity-create select#type option:selected').data('definition').required.each(function(index, property) {
/*$('#entity-create select[name=type] option:selected').data('definition').required.each(function(index, property) {
$('#entity-create #properties').append(
vz.capabilities.definitions.get('properties', property).getDOM()
)
});*/
$('#entity-create-middlware').val(vz.options.middlewareUrl);
// actions
$('#entity-subscribe input[type=button]').click(function() {
try {
@ -191,9 +194,10 @@ vz.wui.dialogs.init = function() {
}
});
/*$('#entity-create input[type=button]').click(function() {
});*/
$('#entity-create form').submit(function() {
$(this).attr('action', $('#entity-create-middlware').val() + '/channel.json');
$('#entity-add').dialog('close');
});
// update event handler
$('button[name=entity-add]').unbind('click', this.init);

View file

@ -39,7 +39,7 @@ URL="http://volkszaehler.org/demo/middleware.php"
# sensor settings
# Sensor 0x48 (72) ist bei ds1631 sensorid = 0 warum auch immer?
# folglich ist sensor 0x4d (75) sensorid = 3 usw.
SENSORID=<put your onewire sensors hw id here>
SENSORID=<put your i2c sensors hw id here>
# ip address of the controller board running ethersex
ESEXIP=<put the ip address of your controller board here>
@ -55,7 +55,7 @@ NC=/bin/nc
# ========= do not change anything below this line ==============
echo "ds1631 convert $SENSORID 1" |$NC $ESEXIP 2701 -q 1 2>/dev/null | grep -qie OK || exit 1
echo "ds1631 convert $SENSORID 1" |$NC $ESEXIP 2701 -q 1 2>/dev/null | grep -qe OK || exit 1
TEMPERATURE=`echo ds1631 temp $SENSORID | $NC $ESEXIP 2701 -q 1 2>/dev/null | sed -e 's/Temperatur: //'`
$CURL --data "" "$URL/data/$UUID.json?value=$TEMPERATURE"