(no commit message)
authorp.roca <p.roca@localhost>
Fri, 21 Nov 2008 11:57:04 +0000 (11:57 +0000)
committerp.roca <p.roca@localhost>
Fri, 21 Nov 2008 11:57:04 +0000 (11:57 +0000)
.gitattributes
mapviewer/edit_geo/prototype/js_code/symbology_form.js [new file with mode: 0644]

index 5e59147d22dbe8ba49242045c94ec85a4fe716b3..76c5c1c0d232ba1e605680a8c8fc19c75121ccce 100644 (file)
@@ -1249,6 +1249,7 @@ mapviewer/edit_geo/prototype/js_code/old_stuff/symbology_sld_ie.js -text
 mapviewer/edit_geo/prototype/js_code/remote_wms.js -text
 mapviewer/edit_geo/prototype/js_code/remote_wms2.js -text
 mapviewer/edit_geo/prototype/js_code/select_formulari.html -text
+mapviewer/edit_geo/prototype/js_code/symbology_form.js -text
 mapviewer/edit_geo/prototype/json/edit_layers.json -text
 mapviewer/edit_geo/prototype/web_WMS/GetFeatureInfo.js -text
 mapviewer/edit_geo/prototype/web_WMS/config-country-earth.xml -text
diff --git a/mapviewer/edit_geo/prototype/js_code/symbology_form.js b/mapviewer/edit_geo/prototype/js_code/symbology_form.js
new file mode 100644 (file)
index 0000000..6aef78f
--- /dev/null
@@ -0,0 +1,22 @@
+(function($){
+       
+$.fn.selectChain=function(options,param){
+//     console.warn("executing selectChain");
+       var defaults={key:"id",value:"nose"};var settings=$.extend({},options,defaults);if(!(settings.target instanceof $))settings.target=$(settings.target);if(param="load"){return this.each(function(){var $$=$(this);$$.ready(function(){var data=null;if(typeof settings.data=='string'){data=settings.data+'&'+this.name+'='+$$.val()}else if(typeof settings.data=='object'){
+               data=settings.data;data[this.name]=$$.val();}settings.target.empty();$.ajax({url:settings.url,data:data,type:(settings.type||'get'),dataType:'json',success:function(j){var options=[],i=0;for(i=0;i<j.length;i++){if(typeof j[i]=='object'){
+    
+options.push('<option value="'+j[i][settings.key]+'">'+j[i][settings.value]+'</option>')}else if(typeof j[i]=='string'){
+         options.push('<option value="'+i+'">'+j[i]+'</option>')}}settings.target.html(options.join(''));setTimeout(function(){settings.target.find('option:first').attr('selected','selected').parent('select').trigger('change')},0)},error:function(xhr,desc,er){alert("an error occurred")}})})})}else{alert("no paraaam")}};
+
+$.fn.selects=function(options,param){
+       var defaults={key:"id",value:"nose"};
+       var settings=$.extend({},options,defaults);
+       if(!(settings.target instanceof $))settings.target=$(settings.target); 
+//this=$('#categorySelect  option:selected');
+return this.each(function(){var $$=$(this);
+//console.log($$);
+$$.change(function(){var data=null;if(typeof settings.data=='string'){data=settings.data+'&'+this.name+'='+$$.val()}else if(typeof settings.data=='object'){//console.info("dealing with objects");
+data=settings.data; 
+data[this.name]=$('#categorySelect  option:selected').text();
+//data[genus]="Copris"
+}settings.target.empty();$.ajax({url:settings.url,data:data,type:(settings.type||'get'),dataType:'json',success:function(j){var options=[],i=0;for(i=0;i<j.length;i++){if(typeof j[i]=='object'){    options.push('<option value="'+j[i][settings.key]+'">'+j[i][settings.value]+'</option>')}else if(typeof j[i]=='string'){options.push('<option value="'+j[i]+'">'+j[i]+'</option>')}}settings.target.html(options.join(''));setTimeout(function(){settings.target.find('option:first').attr('selected','selected').parent('select').trigger('change')},0)},error:function(xhr,desc,er){alert("an error occurred")}})})})}})(jQuery);
\ No newline at end of file