[Mapbender-commits] r4745 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Sun Sep 27 03:55:01 EDT 2009
Author: kmq
Date: 2009-09-27 03:55:01 -0400 (Sun, 27 Sep 2009)
New Revision: 4745
Modified:
trunk/mapbender/http/javascripts/ConfEditor.js
trunk/mapbender/http/javascripts/mod_AdminTabs.js
trunk/mapbender/http/javascripts/mod_group.js
trunk/mapbender/http/javascripts/mod_gui.js
trunk/mapbender/http/javascripts/mod_user.js
Log:
updates to Admin interface
Modified: trunk/mapbender/http/javascripts/ConfEditor.js
===================================================================
--- trunk/mapbender/http/javascripts/ConfEditor.js 2009-09-27 07:46:29 UTC (rev 4744)
+++ trunk/mapbender/http/javascripts/ConfEditor.js 2009-09-27 07:55:01 UTC (rev 4745)
@@ -1,3 +1,6 @@
+
+$.getScript("../extensions/jquery.listeditor.js",null);
+
var ConfEditor = function(){
};
@@ -49,34 +52,8 @@
if(this.confObject.name){
try{
-
- for(field in this.confObject.fields)
- {
- switch(this.confObject.fields[field].type)
- {
- case 'text':
- try{
- this.confObject.fields[field].value = $('#' + this.options.id + this.confObject.fields[field].name ).val();
- }catch(E){
- alert("Error trying to set " +E);
- }
- break;
-
- case 'bool':
- var selector = '#' + this.options.id + this.confObject.fields[field].name + ':checked '
- var el = $(selector);
- //FIXME: need the value of the checkbox
- this.confObject.fields[field].value = $('#' + this.options.id + this.confObject.fields[field].name ).is('checked');
-
- break;
- }
- }
-
-
+ this.getValues();
this.confObject.update();
-
-
-
}catch(E){
alert("ConfEditor: unable to Commit : ("+ E +")");
}
@@ -87,15 +64,8 @@
};
ConfEditor.prototype.create = function(){
- //see comments in display
- for(field in this.confObject.fields)
- {
- try{
- this.confObject.fields[field].value = $('#' + this.options.id + this.confObject.fields[field].name).val();
- }catch(E){
- alert("Error trying to read fieldvalue " +E);
- }
- }
+
+ this.getValues();
try{
this.confObject.create();
}catch(E){
@@ -122,24 +92,38 @@
//FIXME: this needs to differentiate between the different possible fieldtypes
for(field in this.confObject.fields)
{
- switch(this.confObject.fields[field].type)
+ field = this.confObject.fields[field];
+ switch(field.type)
{
case 'text':
try{
- $('#' + this.options.id + this.confObject.fields[field].name).val(this.confObject.fields[field].value);
+ $('#' + this.options.id + field.name).val(field.value);
}catch(E){
alert("Error trying to set " +E);
}
break;
case 'bool':
- if(this.confObject.fields[field].value === true)
+ if(field.value === true)
{
- $('#' + this.options.id + this.confObject.fields[field].name).val(true);
+ $('#' + this.options.id + field.name).val(true);
}else{
- $('#' + this.options.id + this.confObject.fields[field].name).val(false);
+ $('#' + this.options.id + field.name).val(false);
+ }
+ break;
+ case 'select':
+ $('#' + this.options.id + field.name +' > [value='+field.value +']').selected();
+ break;
+
+ case 'multiselect':
+ var element = $('#' + this.options.id + field.name);
+ for(i in field.value)
+ {
+ element.listeditor().addEntry(i); alert('success');
}
+ break;
+
}
}
};
@@ -158,6 +142,42 @@
}
};
+ConfEditor.prototype.getValues = function(){
+ for(field in this.confObject.fields)
+ {
+ field = this.confObject.fields[field];
+ switch(field.type)
+ {
+ case 'text':
+ try{
+ field.value = $('#' + this.options.id + field.name ).val();
+ }catch(E){
+ alert("Error trying to set " +E);
+ }
+ break;
+
+ case 'bool':
+ var selector = '#' + this.options.id + field.name + ':checked '
+ var el = $(selector);
+ //FIXME: need the value of the checkbox
+ field.value = $('#' + this.options.id + field.name ).is('checked');
+
+ break;
+ case 'select':
+ field.value = $('#' + this.options.id + field.name).val();
+ break;
+
+ case 'multiselect':
+ var test = $('#' + this.options.id + field.name);
+ var values = test.listeedit('val');
+ field.value = values;
+ break;
+ }
+ }
+
+}
+
ConfEditor.prototype.setList = function(newList) {
this.list = newList || null;
};
+
Modified: trunk/mapbender/http/javascripts/mod_AdminTabs.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_AdminTabs.js 2009-09-27 07:46:29 UTC (rev 4744)
+++ trunk/mapbender/http/javascripts/mod_AdminTabs.js 2009-09-27 07:55:01 UTC (rev 4745)
@@ -163,9 +163,12 @@
};
- $.getScript("../extensions/jquery-ui-1.7.1.w.o.effects.min.js",(function(){
- $('#' + options.id).tabs();
- }));
+// $.getScript("../extensions/jquery-ui-1.7.1.w.o.effects.min.js",(function(){
+// WHEN jquery.ui.js is included directly, calling this without a timeout, creates a racecondition
+// which is dependent on the interface elemens being loaded, we give it a timweout here and think about something
+// better,later
+ setTimeout(function(){ $('#' + options.id).tabs();},1000);
+// }));
};
Modified: trunk/mapbender/http/javascripts/mod_group.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_group.js 2009-09-27 07:46:29 UTC (rev 4744)
+++ trunk/mapbender/http/javascripts/mod_group.js 2009-09-27 07:55:01 UTC (rev 4745)
@@ -10,7 +10,7 @@
<ul>\n\
<li><label for="'+ options.id +'name">Name</label><input id="'+ options.id +'name" type="text" /></li>\n\
<li><label for="'+ options.id +'description">Description</label><input id="'+ options.id +'description" type="text" /></li>\n\
- <li><label for="'+ options.id +'owner">Owner</label><input id="'+ options.id +'owner" type="text" /></li>\n\
+ <li><label for="'+ options.id +'owner">Owner</label><select id="'+ options.id +'owner" type="text"> </select></li>\n\
</ul>\n\
<p>\n\
<input id="'+options.id +'save" type="button" value="save" onclick="Mapbender.modules[\''+ options.id +'\'].save(); return false;" />\n\
@@ -21,7 +21,7 @@
this.defaultFields = {};
this.defaultFields.name = { name: "name", defaultValue : "New Group", value: "", display: "Group Name", type: "text"};
- this.defaultFields.owner = { name: "owner", defaultValue : "", value:"", display: "Owner", type: "text"};
+ this.defaultFields.owner = { name: "owner", defaultValue : "", value:"", display: "Owner", type: "select"};
this.defaultFields.description = { name: "description", defaultValue : "", value:"", display: "Description", type: "text"};
this.name = this.defaultFields.name.value;
@@ -29,6 +29,7 @@
this.options = options;
this.caption = "Groups";
+
$(me).replaceWith(this.form);
me = this.form;
@@ -36,6 +37,8 @@
};
+
+
GroupEditor.prototype = new ConfEditor();
GroupEditor.prototype.constructor = GroupEditor;
Modified: trunk/mapbender/http/javascripts/mod_gui.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_gui.js 2009-09-27 07:46:29 UTC (rev 4744)
+++ trunk/mapbender/http/javascripts/mod_gui.js 2009-09-27 07:55:01 UTC (rev 4745)
@@ -11,6 +11,12 @@
<li><label for="'+ options.id +'name">Name</label><input id="'+ options.id +'name" type="text" /></li>\n\
<li><label for="'+ options.id +'description">Description</label><input id="'+ options.id +'description" type="text" /></li>\n\
<li><label for="'+ options.id +'public">Public</label><input id="'+ options.id +'public" name="public" type="checkbox" /></li>\n\
+ <li>\n\
+ <label for="'+ options.id +'owners">Owners</label><input type="hidden" id="'+ options.id +'owners" name="owners" />\n\
+ </li>\n\
+ <li>\n\
+ <label for="'+ options.id +'groups">Groups</label><input type="hidden" id="'+ options.id +'groups" name="owners" />\n\
+ </li>\n\
</ul>\n\
<p>\n\
<input id="'+options.id +'save" type="button" value="save" onclick="Mapbender.modules[\''+ options.id +'\'].save(); return false;" />\n\
@@ -18,11 +24,17 @@
</p>\n\
</form>\n\
</div>');
+
+ var meGuiEditor = this;
+
this.defaultFields = {};
this.defaultFields.name = { name: "name", defaultValue: "New Gui", value: "", display: "User Name", type: "text"};
this.defaultFields.description = { name: "description", defaultValue: "", value: "", display: "Description", type: "text"};
this.defaultFields.public= { name: "public", defaultValue: true, value: "", display: "Public", type: "bool"};
+ this.defaultFields.owners= { name: "owners", defaultValue: [], value: [], display: "Owners", type: "multiselect"};
+ this.defaultFields.groups= { name: "groups", defaultValue: [], value: [], display: "Groups", type: "multiselect"};
+
this.name = this.defaultFields.name.value;
@@ -31,12 +43,18 @@
this.caption = "GUI";
+ $('#'+ options.id +'owners',this.form).tableedit({url: "../javascripts/user.php",editor: this});
+ $('#'+ options.id +'groups',this.form).listeditor("../javascripts/group.php",{editor: this});
+
+
$(me).replaceWith(this.form);
+
me = this.form;
this.reset();
};
+
GuiEditor.prototype = new ConfEditor();
GuiEditor.prototype.constructor = GuiEditor;
Modified: trunk/mapbender/http/javascripts/mod_user.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_user.js 2009-09-27 07:46:29 UTC (rev 4744)
+++ trunk/mapbender/http/javascripts/mod_user.js 2009-09-27 07:55:01 UTC (rev 4745)
@@ -11,7 +11,7 @@
<li><label for="'+ options.id +'Name">Username</label><input id="'+ options.id +'name" type="text" /></li>\n\
<li><label for="'+ options.id +'Password">Password</label><input id="'+ options.id +'password" type="password" /></li>\n\
<li><label for="'+ options.id +'Description">Description</label><input id="'+ options.id +'description" type="text" /></li>\n\
- <li><label for="'+ options.id +'Owner">Owner</label><input id="'+ options.id +'owner" type="text" /></li>\n\
+ <li><label for="'+ options.id +'Owner">Owner</label><select id="'+ options.id +'owner"/></select></li>\n\
<li><label for="'+ options.id +'LoginCount">Number of Logins</label><input id="'+ options.id +'loginCount" type="text" /></li>\n\
<li><label for="'+ options.id +'Email">Email</label><input id="'+ options.id +'email" type="text" /></li>\n\
<li><label for="'+ options.id +'Phone">Phone</label><input id="'+ options.id +'phone" type="text" /></li>\n\
@@ -28,7 +28,7 @@
this.defaultFields.name = { name: "name", defaultValue: "New User", value: "", display: "User Name", type: "text"};
this.defaultFields.password = { name: "password", defaultValue: "********", value: "", display: "Password", type: "text"};
this.defaultFields.description = { name: "description", defaultValue: "", value: "", display: "Description", type: "text"};
- this.defaultFields.owner = { name: "owner", defaultValue: "", value: "", display: "Owner", type: "text"};
+ this.defaultFields.owner = { name: "owner", defaultValue: "", value: "", display: "Owner", type: "select"};
this.defaultFields.loginCount = { name: "loginCount", defaultValue: "", value: "", display: "Login Count", type: "text"};
this.defaultFields.email= { name: "email", defaultValue: "", value: "", display: "Email", type: "text"};
this.defaultFields.phone= { name: "phone", defaultValue: "", value: "", display: "Phone", type: "text"};
@@ -49,6 +49,7 @@
this.rpcEndpoint = "../javascripts/user.php";
this.options = options;
this.caption = "Users";
+
$(me).replaceWith(this.form);
me = this.form;
More information about the Mapbender_commits
mailing list