From c979bcea8e20018c3bdf40048bca4f7040643c51 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 11 Mar 2011 00:12:39 +0100 Subject: [PATCH] renamed frontend.js --- .../javascripts/{frontend.js => wui.js} | 581 ++++++++++-------- 1 file changed, 340 insertions(+), 241 deletions(-) rename htdocs/frontend/javascripts/{frontend.js => wui.js} (63%) diff --git a/htdocs/frontend/javascripts/frontend.js b/htdocs/frontend/javascripts/wui.js similarity index 63% rename from htdocs/frontend/javascripts/frontend.js rename to htdocs/frontend/javascripts/wui.js index 3eb7b93..6c32869 100644 --- a/htdocs/frontend/javascripts/frontend.js +++ b/htdocs/frontend/javascripts/wui.js @@ -33,6 +33,7 @@ vz.wui.init = function() { $(this).next().toggle('fast'); return false; }).next().hide(); + $('#entity-list').show(); // open entity list by default // buttons $('button, input[type=button],[type=image]').button(); @@ -46,7 +47,7 @@ vz.wui.init = function() { '&to=' + vz.options.plot.xaxis.max; vz.entities.each(function(entity, parent) { - if (entity.active) { + if (entity.active && entity.definition.model == 'Volkszaehler\\Model\\Channel') { uuids.push(entity.uuid); } }); @@ -57,19 +58,7 @@ vz.wui.init = function() { window.location = url; }); - $('button[name=entity-add]').click(function() { $('#entity-add').dialog('open'); }); - $('#entity-subscribe input[type=button]').click(function() { - try { - vz.uuids.add($('#entity-subscribe input[type=text]').val()); - vz.uuids.save(); - $('#entity-subscribe input[type=text]').val(''); - $('#entity-add').dialog('close'); - vz.entities.loadDetails(); - } - catch (exception) { - vz.wui.dialogs.exception(exception); - } - }); + $('button[name=entity-add]').click(vz.wui.dialogs.init); // bind plot actions $('#controls button').click(this.handleControls); @@ -111,7 +100,7 @@ vz.wui.init = function() { $('input[name=render][type=radio]').change(function() { if ($(this).attr('checked')) { vz.options.render = $(this).val(); - vz.drawPlot(); + vz.wui.drawPlot(); } }); }; @@ -122,12 +111,95 @@ vz.wui.init = function() { vz.wui.dialogs.init = function() { // initialize dialogs $('#entity-add.dialog').dialog({ - autoOpen: false, title: 'Kanal hinzufügen', width: 530, resizable: false }); $('#entity-add.dialog > div').tabs(); + + // load public entities + vz.load({ + context: 'entity', + success: function(json) { + if (json.entities.length > 0) { + json.entities.each(function(index, entity) { + $('#entity-subscribe-public select#public').append( + $('