Index: trunk/wb/upgrade-script.php
===================================================================
--- trunk/wb/upgrade-script.php	(revision 994)
+++ trunk/wb/upgrade-script.php	(revision 995)
@@ -233,76 +233,14 @@
  *  - install droplets
  */
 echo "<br />Install droplets<br />";
-$table = TABLE_PREFIX .'mod_droplets';
-$database->query("DROP TABLE IF EXISTS `$table`");
 
-$database->query("CREATE TABLE `$table` (
-	`id` INT NOT NULL auto_increment,
-	`name` VARCHAR(32) NOT NULL,
-	`code` LONGTEXT NOT NULL ,
-	`description` TEXT NOT NULL,
-	`modified_when` INT NOT NULL default '0',
-	`modified_by` INT NOT NULL default '0',
-	`active` INT NOT NULL default '0',
-	`admin_edit` INT NOT NULL default '0',
-	`admin_view` INT NOT NULL default '0',
-	`show_wysiwyg` INT NOT NULL default '0',
-	`comments` TEXT NOT NULL,
-	PRIMARY KEY ( `id` )
-	)"
-);
+$result = mysql_list_tables( DB_NAME );
+$all_tables = array();
+for($i=0; $i < mysql_num_rows($result); $i++) $all_tables[] = mysql_table_name($result, $i);
 
-//add all droplets from the droplet subdirectory
-$folder=opendir(WB_PATH.'/modules/droplets/example/.'); 
-$names = array();
-while ($file = readdir($folder)) {
-	$ext=strtolower(substr($file,-4));
-	if ($ext==".php"){
-		if ($file<>"index.php" ) {
-			$names[count($names)] = $file; 
-		}
-	}
-}
-closedir($folder);
+ $file_name = (!in_array ( TABLE_PREFIX."mod_droplets", $all_tables)) ? "install.php" : "upgrade.php";
+ require_once (WB_PATH."/modules/droplets/".$file_name);
 
-foreach ($names as $dropfile) {
-	$droplet = addslashes(getDropletCodeFromFile($dropfile));
-	if ($droplet != "") {
-		$description = "Example Droplet";
-		$comments = "Example Droplet";
-		$cArray = explode("\n",$droplet);
-		if (substr($cArray[0],0,3) == "//:") {
-			$description = trim(substr($cArray[0],3));
-			array_shift ( $cArray );
-		}
-		if (substr($cArray[0],0,3) == "//:") {
-			$comments = trim(substr($cArray[0],3));
-			array_shift ( $cArray );
-		}
-		$droplet = implode ( "\n", $cArray );
-		$name = substr($dropfile,0,-4);
-		$modified_when = mktime();
-		$modified_by = method_exists($admin, 'get_user_id') ? $admin->get_user_id() : 1;
-		echo ($database->query("INSERT INTO `$table`  
-			(name, code, description, comments, active, modified_when, modified_by) 
-			VALUES 
-			('$name', '$droplet', '$description', '$comments', '1', '$modified_when', '$modified_by')"))? "$name: $OK<br />" : "$name: $FAIL<br />";
-	}  
-}
-
-
-function getDropletCodeFromFile ( $dropletfile ) {
-	$data = "";
-	$filename = WB_PATH."/modules/droplets/example/".$dropletfile;
-	if (file_exists($filename)) {
-		$filehandle = fopen ($filename, "r");
-		$data = fread ($filehandle, filesize ($filename));
-		fclose($filehandle);
-		// unlink($filename); doesnt work in unix
-	}	
-	return $data;
-}
-
 /**********************************************************
  *  - Reload all addons
  */
Index: trunk/wb/modules/droplets/install.php
===================================================================
--- trunk/wb/modules/droplets/install.php	(revision 994)
+++ trunk/wb/modules/droplets/install.php	(revision 995)
@@ -12,7 +12,7 @@
 */
 
 // prevent this file from being accessed directly
-if(!defined('WB_PATH')) die(header('Location: ../index.php'));
+if(!defined('WB_PATH')) die(header('Location: ../../index.php'));
 
 $table = TABLE_PREFIX .'mod_droplets';
 $database->query("DROP TABLE IF EXISTS `$table`");
@@ -74,7 +74,6 @@
 	}  
 }
 
-
 function getDropletCodeFromFile ( $dropletfile ) {
 	$data = "";
 	$filename = WB_PATH."/modules/droplets/example/".$dropletfile;
Index: trunk/wb/modules/droplets/languages/EN.php
===================================================================
--- trunk/wb/modules/droplets/languages/EN.php	(revision 994)
+++ trunk/wb/modules/droplets/languages/EN.php	(revision 995)
@@ -34,5 +34,6 @@
 $DR_TEXT['ADMIN_VIEW']	= 'View-Only';
 $DR_TEXT['WYSIWYG']		= 'Wysiwyg';
 $DR_TEXT['HELP']		= 'Help / Readme';
+$DR_TEXT['USED']		= 'This droplet is used on the following page(-s):<br />';
 
 ?>
\ No newline at end of file
Index: trunk/wb/modules/droplets/upgrade.php
===================================================================
--- trunk/wb/modules/droplets/upgrade.php	(revision 994)
+++ trunk/wb/modules/droplets/upgrade.php	(revision 995)
@@ -12,6 +12,30 @@
 * 	To call a droplet just use [[dropletname]]. optional parameters for a droplet can be used like [[dropletname?parameter=value&parameter2=value]]
 */
 
-if(!defined('WB_PATH')) { exit("Cannot access this file directly"); }
+if(!defined('WB_PATH')) die(header('Location: ../../index.php'));
 
+$table = TABLE_PREFIX .'mod_droplets';
+
+$info = $database->query("SELECT * from `$table` limit 0,1" );
+$fields = $info->fetchRow();
+if (!array_key_exists("look_for_it", $fields)) {
+	/**
+	 *	Call from the upgrade-script
+	 */
+	
+	if (function_exists('db_add_field')) {
+		db_add_field($table, "admin_edit", "INT NOT NULL default '0'");
+		db_add_field($table, "admin_view", "INT NOT NULL default '0'");
+		db_add_field($table, "show_wysiwyg", "INT NOT NULL default '0'");
+	} else {
+		/**
+		 * Not call by the upgrade-script
+		 */
+		$database->query("ALTER TABLE `$table` (
+			`admin_edit` INT NOT NULL default '0',
+			`admin_view` INT NOT NULL default '0',
+			`show_wysiwyg` INT NOT NULL default '0'
+			)";
+	}
+}
 ?>
\ No newline at end of file
