# HG changeset patch # User fknauft # Date 1322743736 -3600 # Node ID 3a10287447b170cd8422fcf74dc73d843baccea2 # Parent 6613b9204bdaa8b0eb77fd969b3fe8f68d0be308 Integration von Europeana4D UserInterface diff -r 6613b9204bda -r 3a10287447b1 RestDbGisApi.py --- a/RestDbGisApi.py Tue Nov 01 18:04:26 2011 +0100 +++ b/RestDbGisApi.py Thu Dec 01 13:48:56 2011 +0100 @@ -16,7 +16,6 @@ from RestDbInterface import * - def kmlEncode(s): """returns string encoded for displaying in KML attribute""" res = s.replace("'","__Apostroph__") @@ -55,7 +54,9 @@ "gis_id": "text", "coord_lat": "numeric", "coord_lon": "numeric", - "the_geom": "the_geom" + "the_geom": "the_geom", + "from_year":"text", + "until_year":"text" } def getTableOwner(self,schema,table): @@ -242,6 +243,7 @@ lonField = 'y_coord' else: logging.error("getKMLdata unable to find position fields") + self.REQUEST.RESPONSE.write("Please define Position field") return None @@ -315,6 +317,16 @@ timestring = '' beg_yr = '' end_yr = '' + from_year = '' + until_year = '' + sql = "SELECT field_name FROM public.gis_table_meta_rows WHERE table_name = %s and gis_type = %s" + # from_year and until_year in metadata first + res = self.executeSQL(sql, (table,'from_year')) + if len(res['rows']) > 0: + from_year = res['rows'][0][0] + res = self.executeSQL(sql, (table,'until_year')) + if len(res['rows']) > 0: + until_year = res['rows'][0][0] for i in range (len(dataset)): value = dataset[i] @@ -331,9 +343,9 @@ val = "%s: %s"%(name, value) value=unicode(value) - if name == 'beg_yr': + if name == from_year: beg_yr= value - if name == 'end_yr': + if name == until_year: end_yr=value # If there is a link within the description data, create a valid href if value.find('http://')>-1: @@ -361,9 +373,10 @@ if beg_yr!='': if end_yr!='': - kmlPlace['TimeSpan'] = '%s%s'%(beg_yr,end_yr) + kmlPlace['TimeSpan0'] = '%s'%beg_yr + kmlPlace['TimeSpan1'] = '%s'%end_yr else: - kmlPlace['TimeStamp'] = '%s'%beg_yr + kmlPlace['TimeStamp'] = '%s'%beg_yr if geomField=='point': kmlPlace['description'] = ""%desc diff -r 6613b9204bda -r 3a10287447b1 RestDbInterface.py --- a/RestDbInterface.py Tue Nov 01 18:04:26 2011 +0100 +++ b/RestDbInterface.py Thu Dec 01 13:48:56 2011 +0100 @@ -647,6 +647,11 @@ else: val = None + if val!=None: + a=val.rfind('.0') + b=len(val) + if a==b-2: + val=val.rpartition('.')[0] data.append(val) if not hasData: diff -r 6613b9204bda -r 3a10287447b1 gis_gui/blocks/layer.html.pt --- a/gis_gui/blocks/layer.html.pt Tue Nov 01 18:04:26 2011 +0100 +++ b/gis_gui/blocks/layer.html.pt Thu Dec 01 13:48:56 2011 +0100 @@ -41,9 +41,10 @@ Sort by connect points with a line Label - Color - Size - Shape + Point-/Line-Color + Polygon-Fill-Color + Point-Size by + Point-Shape by
diff -r 6613b9204bda -r 3a10287447b1 gis_gui/blocks/table.html.pt --- a/gis_gui/blocks/table.html.pt Tue Nov 01 18:04:26 2011 +0100 +++ b/gis_gui/blocks/table.html.pt Thu Dec 01 13:48:56 2011 +0100 @@ -27,6 +27,8 @@
+
+ diff -r 6613b9204bda -r 3a10287447b1 gis_gui/blocks/tablestructure.js --- a/gis_gui/blocks/tablestructure.js Tue Nov 01 18:04:26 2011 +0100 +++ b/gis_gui/blocks/tablestructure.js Thu Dec 01 13:48:56 2011 +0100 @@ -27,7 +27,7 @@ var row = []; for (var i = 0; i < fields.length; i++) { colheads.push({'sTitle': fields[i].name}); - row.push(getHtmlSelectFromList(['text','number','gis_id','coord_lat','coord_lon','the_geom','id'],fields[i].type,'class="type_'+fields[i].name+'"')); + row.push(getHtmlSelectFromList(['text','number','gis_id','coord_lat','coord_lon','the_geom','id','from_year','until_year'],fields[i].type,'class="type_'+fields[i].name+'"')); } // Add DataTables functionality $(tbl).dataTable({ diff -r 6613b9204bda -r 3a10287447b1 gis_gui/lib/blocks.js --- a/gis_gui/lib/blocks.js Tue Nov 01 18:04:26 2011 +0100 +++ b/gis_gui/lib/blocks.js Thu Dec 01 13:48:56 2011 +0100 @@ -26,6 +26,7 @@ } + /* * guiBlocks base */ @@ -108,6 +109,27 @@ jQuery.getJSON(url,callback); }; +guiBlocks.prototype.e4DOpen = function(titel,table){ + var e4D_URL="http://mappit.mpiwg-berlin.mpg.de:8080/e4D"; + var paramstr = "format=KML"; +// var layer_URL = "http://chinagis-develop.mpiwg-berlin.mpg.de:9080/db/RESTdb/db/public/" + escape(table) + "?" + paramstr; + var layer_URL = "http://mappit.mpiwg-berlin.mpg.de/db/RESTdb/db/public/" + escape(table) + "?" + paramstr; + var kml_URL = ""; + /* jQuery.get(layerurl, function (data, textStatus, XMLHttpRequest) { + // function after load kml url finished + console.debug("kml url loaded! this=", this ); + console.debug(" data=", data ); + console.debug(" data type=", typeof(data)); + if (typeof(data) == "string") { + kml_URL = data; + }*/ + e4D_URL=e4D_URL+"?kml1="+layer_URL+"&source1=1"; + console.debug(" e4D_URL=", e4D_URL ); + var newwindow=window.open(e4D_URL,"Mappit@Europeana4D","height=800,width=900"); + if (window.focus) {newwindow.focus();} + return false; + /* });*/ +}; guiBlocks.Block.prototype.storeBlock = function(storeTag) { var storeType = this.params.type; diff -r 6613b9204bda -r 3a10287447b1 zpt/KML_schema_table.zpt --- a/zpt/KML_schema_table.zpt Tue Nov 01 18:04:26 2011 +0100 +++ b/zpt/KML_schema_table.zpt Thu Dec 01 13:48:56 2011 +0100 @@ -179,9 +179,9 @@ ERD-0815: ERD-0815 - + - + #marker_icon_red