[Mapbender-commits] r10145 - in trunk/mapbender: http/classes http/php lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Jun 7 06:52:24 PDT 2019


Author: armin11
Date: 2019-06-07 06:52:24 -0700 (Fri, 07 Jun 2019)
New Revision: 10145

Modified:
   trunk/mapbender/http/classes/class_group.php
   trunk/mapbender/http/php/mod_editFilteredGroup.php
   trunk/mapbender/http/php/mod_editGroup.php
   trunk/mapbender/lib/editGroup.php
Log:
New option to edit searchability for mb_group entries to allow filtering of organizations e.g. on mod_showOrganizationList.php

Modified: trunk/mapbender/http/classes/class_group.php
===================================================================
--- trunk/mapbender/http/classes/class_group.php	2019-06-06 16:31:23 UTC (rev 10144)
+++ trunk/mapbender/http/classes/class_group.php	2019-06-07 13:52:24 UTC (rev 10145)
@@ -48,6 +48,7 @@
 	var $timestamp;
 	var $adminCode;
         var $ckanId;
+	var $searchable;
 
     	static $displayName = "Group";
     	static $internalName = "group";
@@ -109,7 +110,8 @@
 	       	 	"logo_path" => $this->logo_path,
 			"homepage" => $this->homepage,
 			"adminCode" => $this->adminCode,
-			"uuid" => $this->uuid
+			"uuid" => $this->uuid,
+			"searchable" => $this->searchable
 			//"ckanId" => $this->ckanId
 		);
 	}
@@ -165,7 +167,7 @@
 		$this->owner = isset($changes->owner) ? $changes->owner : $this->owner;
 		$this->description = isset($changes->description) ? $changes->description : $this->description;
 		$this->id = isset($changes->id) ? $changes->id : $this->id;
-     	$this->title = isset($changes->title) ? $changes->title : $this->title;
+     		$this->title = isset($changes->title) ? $changes->title : $this->title;
 		$this->address = isset($changes->address) ? $changes->address : $this->address;
 		$this->postcode = isset($changes->postcode) ? $changes->postcode : $this->postcode;
 		$this->city = isset($changes->city) ? $changes->city : $this->city;
@@ -177,6 +179,7 @@
 		$this->logo_path = isset($changes->logo_path) ? $changes->logo_path : $this->logo_path;
 		$this->homepage = isset($changes->homepage) ? $changes->homepage : $this->homepage;
 		$this->adminCode = isset($changes->adminCode) ? $changes->adminCode : $this->adminCode;
+		$this->searchable = isset($changes->searchable) ? $changes->searchable : $this->searchable;
 		return true;
 	}
 
@@ -197,8 +200,9 @@
 			"mb_group_email = $12, ".
 			"mb_group_logo_path = $13, ".
 			"mb_group_homepage = $14, ".
-			"mb_group_admin_code = $15 ".
-			"WHERE mb_group_id = $16 ";
+			"mb_group_admin_code = $15, ".
+			"searchable = $16 ".
+			"WHERE mb_group_id = $17 ";
 
 			$v = array(
 				$this->name,
@@ -216,6 +220,7 @@
 				$this->logo_path,
 				$this->homepage,
 				$this->adminCode,
+				$this->searchable,
 				$this->id
 			);
 
@@ -222,7 +227,7 @@
 			$t = array(
 				"s", "i", "s", "s", "s",
 				"i", "s", "s", "s", "s", 
-				"s", "s", "s", "s", "s", "i"
+				"s", "s", "s", "s", "s", "b", "i"
 			);
 
 			$update_result = db_prep_query($sql_update,$v,$t);
@@ -294,6 +299,7 @@
 				$this->adminCode = $row["mb_group_admin_code"];
 				$this->timestamp = $row["timestamp"];
 				$this->ckanId = $row["mb_group_ckan_uuid"];
+				$this->searchable = $row["searchable"];
 				
 			} else {
 			 	throw new Exception("Group with ID " . $this->id . " does not exist.");

Modified: trunk/mapbender/http/php/mod_editFilteredGroup.php
===================================================================
--- trunk/mapbender/http/php/mod_editFilteredGroup.php	2019-06-06 16:31:23 UTC (rev 10144)
+++ trunk/mapbender/http/php/mod_editFilteredGroup.php	2019-06-07 13:52:24 UTC (rev 10145)
@@ -40,6 +40,7 @@
 $email = $_POST["email"];
 $logo_path = $_POST["logo_path"];
 $action = $_POST["action"];
+$searchable = $_POST["searchable"];
 
 require_once(dirname(__FILE__)."/../classes/class_user.php");
 require_once(dirname(__FILE__)."/../classes/class_group.php");

Modified: trunk/mapbender/http/php/mod_editGroup.php
===================================================================
--- trunk/mapbender/http/php/mod_editGroup.php	2019-06-06 16:31:23 UTC (rev 10144)
+++ trunk/mapbender/http/php/mod_editGroup.php	2019-06-07 13:52:24 UTC (rev 10145)
@@ -26,7 +26,7 @@
 //security_patch_log(__FILE__,__LINE__);
 //import_request_variables("PG");
 
-$postvars = explode(",", "selected_group,name,title,owner_name,owner_id,description,address,postcode,city,stateorprovince,country,voicetelephone,facsimiletelephone,email,logo_path,homepage,adminCode,action");
+$postvars = explode(",", "selected_group,name,title,owner_name,owner_id,description,address,postcode,city,stateorprovince,country,voicetelephone,facsimiletelephone,email,logo_path,homepage,adminCode,action,searchable");
 foreach ($postvars as $value) {
    ${$value} = $_POST[$value];
 }

Modified: trunk/mapbender/lib/editGroup.php
===================================================================
--- trunk/mapbender/lib/editGroup.php	2019-06-06 16:31:23 UTC (rev 10144)
+++ trunk/mapbender/lib/editGroup.php	2019-06-07 13:52:24 UTC (rev 10145)
@@ -76,6 +76,17 @@
 		$changes->logo_path = $logo_path;
 		$changes->homepage = $homepage;
 		$changes->adminCode = $adminCode;
+		switch ($searchable) {
+			case "on":
+				$changes->searchable = 't';
+				break;
+			case "off":
+				$changes->searchable = 'f';
+				break;
+			default: 
+				$changes->searchable = 'f';
+				break;
+		}
 		$group->change($changes);	
 		
 		$group->create();	
@@ -108,6 +119,17 @@
 		$changes->logo_path = $logo_path;
 		$changes->homepage = $homepage;
 		$changes->adminCode = $adminCode;
+		switch ($searchable) {
+			case "on":
+				$changes->searchable = 't';
+				break;
+			case "off":
+				$changes->searchable = 'f';
+				break;
+			default: 
+				$changes->searchable = 'f';
+				break;
+		}
 		$group->change($changes);		
 
 		$group->commit();	
@@ -132,6 +154,7 @@
 	$logo_path = "";
 	$homepage = "";
 	$adminCode = "";
+	$searchable = "t";
 }
 
 /*HTML*****************************************************************************************************/
@@ -186,6 +209,7 @@
 		$logo_path = $data["logo_path"];
 		$homepage = $data["homepage"];
 		$adminCode = $data["adminCode"];
+		$searchable = $data["searchable"];
 	}
 	$owner = new User(intval($owner_id));
 	if ($owner->isValid()) {
@@ -330,6 +354,16 @@
    echo "</td>";
 echo "</tr>";
 
+#searchable - boolean
+echo "<tr>";
+   echo "<td>"._mb("Searchable").": </td>";
+   echo "<td>";
+   echo "<input type='checkbox' id='searchable' name='searchable' ";	
+   if($searchable == 't'){ echo " checked ";  };
+   echo ">";
+   echo "</td>";
+echo "</tr>";
+
 # blank row
 echo "<tr>";
    echo "<td colspan='2'> </td>";



More information about the Mapbender_commits mailing list