[ghelda-devel] [8] Changes and modifications in various files (that's a funny commit...)

[ Thread Index | Date Index | More lists.tuxfamily.org/ghelda-devel Archives ]


Revision: 8
Author:   odyx
Date:     2008-11-27 23:08:59 +0100 (Thu, 27 Nov 2008)

Log Message:
-----------
Changes and modifications in various files (that's a funny commit...)

* Doxyfile check
* Simplification in Address.php

Modified Paths:
--------------
    trunk/Doxyfile
    trunk/inc/Plugins_Handler.php
    trunk/inc/g_functions.php
    trunk/inc/g_output.inc.php
    trunk/inc/outputs/xHTML.class.php
    trunk/plugins/Address.php
    trunk/plugins/People.php


Modified: trunk/Doxyfile
===================================================================
--- trunk/Doxyfile	2008-11-26 22:19:41 UTC (rev 7)
+++ trunk/Doxyfile	2008-11-27 22:08:59 UTC (rev 8)
@@ -26,7 +26,7 @@
 DOXYFILE_ENCODING      = UTF-8
 PROJECT_NAME           = Ghelda
 PROJECT_NUMBER         = trunk
-OUTPUT_DIRECTORY       = /home/didier/Loisirs/Scouts/DB/GHELDA/trunk/doc
+OUTPUT_DIRECTORY       = doc
 CREATE_SUBDIRS         = NO
 OUTPUT_LANGUAGE        = English
 BRIEF_MEMBER_DESC      = YES
@@ -45,7 +45,7 @@
 ALWAYS_DETAILED_SEC    = NO
 INLINE_INHERITED_MEMB  = NO
 FULL_PATH_NAMES        = NO
-STRIP_FROM_PATH        = /home/didier/Loisirs/Scouts/DB/GHELDA/trunk/
+STRIP_FROM_PATH        = . 
 STRIP_FROM_INC_PATH    = 
 SHORT_NAMES            = NO
 JAVADOC_AUTOBRIEF      = NO
@@ -113,7 +113,7 @@
 #---------------------------------------------------------------------------
 # configuration options related to the input files
 #---------------------------------------------------------------------------
-INPUT                  = /home/didier/Loisirs/Scouts/DB/GHELDA/trunk/
+INPUT                  = .
 INPUT_ENCODING         = UTF-8
 FILE_PATTERNS          = *.c \
                          *.cc \

Modified: trunk/inc/Plugins_Handler.php
===================================================================
--- trunk/inc/Plugins_Handler.php	2008-11-26 22:19:41 UTC (rev 7)
+++ trunk/inc/Plugins_Handler.php	2008-11-27 22:08:59 UTC (rev 8)
@@ -93,9 +93,6 @@
 		foreach($this->pluginsNamesList as $pluginName) {
 			require_once PLUGINS_DIR."/".$pluginName.".php";
 
-			// Create each instance
-			$this->pluginsList[$pluginName] =& new $pluginName(&$this,$pluginName);
-			
 			unset($confLoc);
 			unset($conf);
 			// Get its eventual configuration
@@ -111,6 +108,10 @@
 				}
 			}
 			g_setDomain($coreDomain);			// ... of the rest of the webapp ;)
+
+			// Create each instance
+			$this->pluginsList[$pluginName] =& new $pluginName(&$this,$pluginName);
+			
 		}
 
 		return true;
@@ -133,9 +134,11 @@
 	public function functionality($funcStr,$funcArgs)
 	{
 		foreach($this->pluginsNamesList as $pluginName) {
-			$result[] = $this->pluginsList[$pluginName]->functionality($funcStr,$funcArgs);
+			$result = $this->pluginsList[$pluginName]->functionality($funcStr,$funcArgs);
+			if( $result !== false )
+				$results[$pluginName] = $result;
 		}
-		return $result;
+		return $results;
 	}
 
 	public function getPermission($premissionString,$arguments)

Modified: trunk/inc/g_functions.php
===================================================================
--- trunk/inc/g_functions.php	2008-11-26 22:19:41 UTC (rev 7)
+++ trunk/inc/g_functions.php	2008-11-27 22:08:59 UTC (rev 8)
@@ -33,7 +33,7 @@
 define('G_DB_PEOPLE_LOCALE','locale');
 define('G_DB_PEOPLE_ID','people_id');
 
-function g_getFormattedField($ArrayVals,$type,$fieldName,$fieldsSpec) {
+function g_getFormattedField($ArrayVals,$type,$fieldName,$fieldName_,$fieldsSpec) {
 	// For dates
 	if(stripos($type,'date') !== false) {
 		// It's a date
@@ -42,13 +42,13 @@
 		} elseif(checkdate((int)$ArrayVals[$fieldName.'_month'],(int)$ArrayVals[$fieldName.'_day'],(int)$ArrayVals[$fieldName.'_year'])) {
 			return $ArrayVals[$fieldName.'_year'].'-'.$ArrayVals[$fieldName.'_month'].'-'.$ArrayVals[$fieldName.'_day'];
 		}
-	} elseif(array_key_exists('ereg',$fieldsSpec[$fieldName])) { // for fields which have a verification pattern
-		if(ereg($fieldsSpec[$fieldName]['ereg'],$ArrayVals[$fieldName]) || empty($ArrayVals[$fieldName])) {
+	} elseif(array_key_exists('ereg',$fieldsSpec[$fieldName_])) { // for fields which have a verification pattern
+		if(ereg($fieldsSpec[$fieldName_]['ereg'],$ArrayVals[$fieldName]) || empty($ArrayVals[$fieldName])) {
 			return $ArrayVals[$fieldName];
 		}
 		return false;
-	} elseif(array_key_exists('preg',$fieldsSpec[$fieldName])) { // for fields which have a verification pattern
-		if(preg_match($fieldsSpec[$fieldName]['preg'],$ArrayVals[$fieldName])|| empty($ArrayVals[$fieldName])) {
+	} elseif(array_key_exists('preg',$fieldsSpec[$fieldName_])) { // for fields which have a verification pattern
+		if(preg_match($fieldsSpec[$fieldName_]['preg'],$ArrayVals[$fieldName])|| empty($ArrayVals[$fieldName])) {
 			return $ArrayVals[$fieldName];
 		} 
 	} else {
@@ -62,4 +62,9 @@
 	trigger_error($text.var_export($var,true),G_E_LOG);
 }
 
+
+function concat_to_each(&$item, $key, $prefix) {
+	$item = $prefix.$item;
+}
+
 ?>
\ No newline at end of file

Modified: trunk/inc/g_output.inc.php
===================================================================
--- trunk/inc/g_output.inc.php	2008-11-26 22:19:41 UTC (rev 7)
+++ trunk/inc/g_output.inc.php	2008-11-27 22:08:59 UTC (rev 8)
@@ -53,7 +53,7 @@
 	public function login_box(){}
 	public function error_box($errors_array = array()){}
 	public function languages_box(){}
-	public function displayFields($fields,$fieldsContents,$type = 'view',$options = array()){}
+	public function displayFields($fullFieldsSpec,$fieldsContents,$type = 'view',$options = array()){}
 
 	public function stats($timeStart)
 	{

Modified: trunk/inc/outputs/xHTML.class.php
===================================================================
--- trunk/inc/outputs/xHTML.class.php	2008-11-26 22:19:41 UTC (rev 7)
+++ trunk/inc/outputs/xHTML.class.php	2008-11-27 22:08:59 UTC (rev 8)
@@ -286,7 +286,7 @@
 		return $this->mark('table',$table,array('id' => $options['id']),true);
 	}
 	
-	public function displayFields($fieldsSpec,$fieldsContents,$options = array())
+	public function displayFields($fullFieldsSpec,$fieldsContents,$options = array())
 	{
 		// Ensure that the translation is correctly handled in the core.
 		$oldDomain = g_setDomain('g_core');
@@ -307,125 +307,132 @@
 		// Initialise the $formKey
 		$formKey = array('name' => 'ERROR', 'value' => 'ERROR');
 
-		foreach($fieldsSpec as $fieldName => $fieldProperties) {
-			// Jump the complete 'id' fields
-			if($fieldProperties['restricted'] == 'key') {	/* == 'id' */
-				$formKey = array('name' => $fieldName, 'value' => $fieldsContents[$fieldName]);
-				continue;
-			}
-			// Jump the "no-show" fields
-			if($fieldProperties['noShow'] === true) continue;
-			// Initialize the parameters
-			$paramsArray = array();
-			// Get the maximum length
-			unset($regs);	ereg("\([[:space:]]*([0-9]*)[[:space:]]*\)", $fieldProperties['type'], $regs);
-			$maxlength = $regs[1];
-			if(!empty($maxlength)) $paramsArray['maxlength'] = $maxlength;
-			// Treat the eventual error (TODO: rise a corresponding error).
-			if($fieldProperties['error']) $paramsArray['class'] = 'input_error';
+		foreach($fullFieldsSpec as $pluginName => $fieldsSpec) {
+			foreach($fieldsSpec as $fieldName_ => $fieldProperties) {
 
-			if($fieldName == 'password') {
-				$label = $this->tag('label',$fieldProperties['name'][0],array('for'=>$fieldName));
-				// Standard parameters
-				$paramsArray['type'] = "password";
-				$paramsArray['name'] = $fieldName;
-				$paramsArray['id']   = $fieldName;
-				$paramsArray['value']= $fieldsContents[$fieldName];
+				// Particularize the $fieldName to the plugin
+				$fieldName = $pluginName.'_'.$fieldName_;
 
-				// Put the field
-				$field= $this->stag('input',$paramsArray);
+				// Jump the complete 'id' fields
+				if($fieldProperties['restricted'] == 'key') {	/* == 'id' */
+					$formKey = array('name' => $fieldName, 'value' => $fieldsContents[$fieldName_]);
+					continue;
+				}
+				// Jump the "no-show" fields
+				if($fieldProperties['noShow'] === true) continue;
+				// Initialize the parameters
+				$paramsArray = array();
+				// Get the maximum length
+				unset($regs);	ereg("\([[:space:]]*([0-9]*)[[:space:]]*\)", $fieldProperties['type'], $regs);
+				$maxlength = $regs[1];
 
-
-				// Add the "_old" hidden stag
-				$paramsArray['type'] = 'hidden';
-				$paramsArray['name'] = $fieldName.'_old';
-				$paramsArray['id'] = $fieldName.'_old';
-				$field .= $this->stag('input',$paramsArray);
-
-
-				// Stack the fields
-				$fields .= $this->mark('p',$label.$field);
-
-			// //// ////
-				// Repeat the field
-				$fieldName = 'password_repeat';
-				$label = $this->tag('label',$fieldProperties['name'][1],array('for'=>$fieldName));
-				// Standard parameters
-				$paramsArray['type'] = "password";
-				$paramsArray['name'] = $fieldName;
-				$paramsArray['id']   = $fieldName;
-
-				// Put the field
-				$field = $this->stag('input',$paramsArray);
-
-				// Stack the fields
-				$fields .= $this->mark('p',$label.$field);
-				// 
-			} elseif(stripos($fieldProperties['type'],'varchar') !== false ||
-					 stripos($fieldProperties['type'],'int') !== false) {
-				$label = $this->tag('label',$fieldProperties['name'],array('for'=>$fieldName));
-				// Standard parameters
-				$paramsArray['type'] = "text";
-				$paramsArray['name'] = $fieldName;
-				$paramsArray['id']   = $fieldName;
-				$paramsArray['value']= !empty($fieldsContents[$fieldName]) ? $fieldsContents[$fieldName] : $fieldProperties['default'];
-
-				// Additional parameters
-				if($fieldProperties['restricted'] == 'key')	$paramsArray['disabled'] = 'disabled'; 
-				if($fieldProperties['restricted'] == 'unique')	$paramsArray['disabled'] = 'disabled';
-				
-				// Put the field
-				$field = $this->stag('input',$paramsArray);
-				// Add the "_old" hidden stag
-				$paramsArray['type'] = 'hidden';
-				$paramsArray['name'] = $fieldName.'_old';
-				$paramsArray['id'] = $fieldName.'_old';
-				unset($paramsArray['maxlength']);
-				$field .= LB.$this->stag('input',$paramsArray);
-
-				// Stack the fields
-				$fields .= $this->mark('p',$label.LB.$field);
-			} elseif(stripos($fieldProperties['type'],'text') !== false) {
-				$label = $this->tag('label',$fieldProperties['name'],array('for'=>$fieldName));
-				// Standard parameters
-				$paramsArray['type'] = "text";
-				$paramsArray['name'] = $fieldName;
-				$paramsArray['id']   = $fieldName;
-				$value = !empty($fieldsContents[$fieldName]) ? $fieldsContents[$fieldName] : $fieldProperties['default'];
-
-				// Avoids the linereturn and so it's good
-				$value = str_replace("\n",'',$value);
-
-				$field = $this->textarea($value,$paramsArray);
-
-				// Stack the fields
-				$fields .= $this->mark('p',$label.LB.$field);
-
-			} elseif(stripos($fieldProperties['type'],'date') !== false) {
-				$fields .= $this->xdate($fieldProperties,$fieldsContents[$fieldName],$fieldName,$paramsArray);
-			} elseif(stripos($fieldProperties['type'],'enum') !== false) {
-				$label = $this->tag('legend',$fieldProperties['name'],array('for'=>$fieldName));
-				// Standard parameters
-				$paramsArray['type'] = "radio";
-				$paramsArray['name'] = $fieldName;
-				$field = '';
-				foreach($fieldProperties['values'] as $codeName => $codeTranslation) {
-					$paramsArray['id']		= $fieldName.'_'.$codeName;
-					$paramsArray['value']	= $codeName;
-
-					if( $fieldsContents[$fieldName] == $codeName ) {
-						$paramsArray['checked'] = 'checked';
-					} else {
-						unset($paramsArray['checked']);
+				if(!empty($maxlength)) $paramsArray['maxlength'] = $maxlength;
+				// Treat the eventual error (TODO: rise a corresponding error).
+				if($fieldProperties['error']) $paramsArray['class'] = 'input_error';
+	
+				if($fieldName_ == 'password') {
+					$label = $this->tag('label',$fieldProperties['name'][0],array('for'=>$fieldName));
+					// Standard parameters
+					$paramsArray['type'] = "password";
+					$paramsArray['name'] = $fieldName;
+					$paramsArray['id']   = $fieldName;
+					$paramsArray['value']= $fieldsContents[$fieldName_];
+	
+					// Put the field
+					$field= $this->stag('input',$paramsArray);
+	
+	
+					// Add the "_old" hidden stag
+					$paramsArray['type'] = 'hidden';
+					$paramsArray['name'] = $fieldName.'_old';
+					$paramsArray['id'] = $fieldName.'_old';
+					$field .= $this->stag('input',$paramsArray);
+	
+	
+					// Stack the fields
+					$fields .= $this->mark('p',$label.$field);
+	
+				// //// ////
+					// Repeat the field
+					$fieldName = 'password_repeat';
+					$label = $this->tag('label',$fieldProperties['name'][1],array('for'=>$fieldName));
+					// Standard parameters
+					$paramsArray['type'] = "password";
+					$paramsArray['name'] = $fieldName;
+					$paramsArray['id']   = $fieldName;
+	
+					// Put the field
+					$field = $this->stag('input',$paramsArray);
+	
+					// Stack the fields
+					$fields .= $this->mark('p',$label.$field);
+					// 
+				} elseif(stripos($fieldProperties['type'],'varchar') !== false ||
+						stripos($fieldProperties['type'],'int') !== false) {
+					$label = $this->tag('label',$fieldProperties['name'],array('for'=>$fieldName));
+					// Standard parameters
+					$paramsArray['type'] = "text";
+					$paramsArray['name'] = $fieldName;
+					$paramsArray['id']   = $fieldName;
+					$paramsArray['value']= !empty($fieldsContents[$fieldName_]) ? $fieldsContents[$fieldName_] : $fieldProperties['default'];
+	
+					// Additional parameters
+					if($fieldProperties['restricted'] == 'key')	$paramsArray['disabled'] = 'disabled'; 
+					if($fieldProperties['restricted'] == 'unique')	$paramsArray['disabled'] = 'disabled';
+					
+					// Put the field
+					$field = $this->stag('input',$paramsArray);
+					// Add the "_old" hidden stag
+					$paramsArray['type'] = 'hidden';
+					$paramsArray['name'] = $fieldName.'_old';
+					$paramsArray['id'] = $fieldName.'_old';
+					unset($paramsArray['maxlength']);
+					$field .= LB.$this->stag('input',$paramsArray);
+	
+					// Stack the fields
+					$fields .= $this->mark('p',$label.LB.$field);
+				} elseif(stripos($fieldProperties['type'],'text') !== false) {
+					$label = $this->tag('label',$fieldProperties['name'],array('for'=>$fieldName));
+					// Standard parameters
+					$paramsArray['type'] = "text";
+					$paramsArray['name'] = $fieldName;
+					$paramsArray['id']   = $fieldName;
+					$value = !empty($fieldsContents[$fieldName_]) ? $fieldsContents[$fieldName_] : $fieldProperties['default'];
+	
+					// Avoids the linereturn and so it's good
+					$value = str_replace("\n",'',$value);
+	
+					$field = $this->textarea($value,$paramsArray);
+	
+					// Stack the fields
+					$fields .= $this->mark('p',$label.LB.$field);
+	
+				} elseif(stripos($fieldProperties['type'],'date') !== false) {
+					$fields .= $this->xdate($fieldProperties,$fieldsContents[$fieldName_],$fieldName,$paramsArray);
+				} elseif(stripos($fieldProperties['type'],'enum') !== false) {
+					$label = $this->tag('legend',$fieldProperties['name'],array('for'=>$fieldName));
+					// Standard parameters
+					$paramsArray['type'] = "radio";
+					$paramsArray['name'] = $fieldName;
+					$field = '';
+					foreach($fieldProperties['values'] as $codeName => $codeTranslation) {
+						$paramsArray['id']		= $fieldName.'_'.$codeName;
+						$paramsArray['value']	= $codeName;
+	
+						if( $fieldsContents[$fieldName_] == $codeName ) {
+							$paramsArray['checked'] = 'checked';
+						} else {
+							unset($paramsArray['checked']);
+						}
+	
+						$sub_label = $this->tag('label',$codeTranslation,array('for'=>$paramsArray['id']));
+						$field .= LB.$sub_label . $this->stag('input',$paramsArray);
 					}
-
-					$sub_label = $this->tag('label',$codeTranslation,array('for'=>$paramsArray['id']));
-					$field .= LB.$sub_label . $this->stag('input',$paramsArray);
+					// Stack the fields
+					$fields .= $this->mark('fieldset',$label.$field);
 				}
-				// Stack the fields
-				$fields .= $this->mark('fieldset',$label.$field);
+				// maxlength and various types...
 			}
-			// maxlength and various types...
 		}
 		$submit  = $this->stag('input',array('type'=>'submit',	'value'=>$options['command']));
 		// Display the 'key' with its values

Modified: trunk/plugins/Address.php
===================================================================
--- trunk/plugins/Address.php	2008-11-26 22:19:41 UTC (rev 7)
+++ trunk/plugins/Address.php	2008-11-27 22:08:59 UTC (rev 8)
@@ -31,23 +31,26 @@
 	private $mode;
 	// List of the fields
 	private $fields = array();
-	// List of the fields
-	private $fieldsCore = array();
-	// List of the fields
-	private $fieldsAll = array();
+	// Formatted list of fields
+	private $formattedFields;
 	// Name of the table
 	private $tableName;
 	// Name of the link table
 	private $linkPeopleTableName;
 	
 	//! Constructor
-	public function __construct(&$parentRef,$name)
+	function __construct(&$parentRef,$name)
 	{
 		$to_return = parent::__construct(&$parentRef,$name);
 
+		$this->fields = $this->configH[$this->name]['fields'];
+		// Seek the data
+		$this->formattedFields = array_keys($this->fields);
+		$this->formattedFields = implode($this->formattedFields,'`,`');
+
 		$this->tableName = $this->configH['DB']['prefix'].'address';
 		$this->linkPeopleTableName = $this->configH['DB']['prefix'].'people_address';
-	
+
 		return $to_return;
 	}
 
@@ -73,8 +76,6 @@
 			return false;
 		}
 
-		$this->fields		= $this->configH[$this->name]['fields'];
-
 		$i = 0;
 		// Sort the fields in descending Order 
 		foreach( $this->fields as $fieldName => $field ) {
@@ -89,8 +90,8 @@
 			$address_id = array_key_exists(G_ADDRESS_ID,$_GET) ? $_GET[G_ADDRESS_ID] : G_ADDRESS_ID_NEW;
 
 			switch($this->mode) {
-				case 'edit':		$this->m_edit($address_id,$this->fields);					break;
-				case 'list':		$this->m_list();										break;
+				case 'edit':		$this->m_edit($address_id,$this->fields);			break;
+				case 'list':		$this->m_list();									break;
 				case 'new':			$this->m_edit(G_ADDRESS_ID_NEW,$this->fields);		break;
 				case 'del':			$this->m_del($address_id);	break;
 			}
@@ -101,19 +102,19 @@
 	function functionality($funcStr,$funcArgs)
 	{
 		switch($funcStr) {
-			case "main":	$this->main();		break;
+			case "main":
+				$this->main();
+				break;
+			case "People.edit.bottom":
+				return $this->People_edit_bottom($funcArgs);
+				break;
 		}
 	}
 
 	private function m_list()
 	{
-		// Get the formatted fields list and Add 'id' (mandatory)
-		$desiredFields = array_keys($this->fields);
-		
-		// Prepare it for MySQL
-		$formattedFields = implode($desiredFields,'`,`');
 		$query = sprintf("SELECT `%s` FROM `%s` ORDER BY `%s` ASC LIMIT 0 , 30",	// FIXME: No limit and no Selection of Columns
-			$formattedFields,
+			$this->formattedFields,
 			$this->tableName,
 			end($desiredFields));
 
@@ -141,7 +142,8 @@
 			$fields = array_keys($fieldsSpec);
 
 			// Go along the fields
-			foreach($fields as $fieldName) {
+			foreach($fields as $fieldName_) {
+				$fieldName = $this->name.'_'.$fieldName_;
 				// Jump the non-modified ones (and if we are creating a new user)
 				if(	$id != G_ADDRESS_ID_NEW &&
 					isset($_POST[$fieldName]) &&
@@ -149,29 +151,29 @@
 					continue;
 				}
 				// Get the type of the field and store its value
-				$type = $fieldsSpec[$fieldName]['type'];
+				$type = $fieldsSpec[$fieldName_]['type'];
 				$fieldValue = $_POST[$fieldName];
 
 				// Jump id (No insert nor check)
-				if($fieldName == G_ADDRESS_ID ) {
+				if($fieldName_ == G_ADDRESS_ID ) {
 					continue;
 				}
 
-				$fieldContent = g_getFormattedField($_POST,$type,$fieldName,$fieldsSpec);
+				$fieldContent = g_getFormattedField($_POST,$type,$fieldName,$fieldName_,$fieldsSpec);
 				if( $fieldContent === false ) { // The given date is false
-					$fieldsSpec[$fieldName]['error'] = true;
+					$fieldsSpec[$fieldName_]['error'] = true;
 					$newError = true;
 					continue;
 				}
-				$fieldsContents[$fieldName] = $fieldContent;
-				$formattedFields .= "`$fieldName` = '".$fieldContent."', ";
+				$fieldsContents[$fieldName_] = $fieldContent;
+				$formattedFields .= "`$fieldName_` = '".$fieldContent."', ";
 			}
 			// Strip the two last characters (border issue)
 			$formattedFields = substr($formattedFields,0,-2);
 			// If we are updating (thus not making a new entry)
 			if($id <> G_ADDRESS_ID_NEW) {
 				$query = sprintf("UPDATE `%s` SET %s WHERE `%s` = '%s' LIMIT 1",
-					$this->authH->storage_options['table'],
+					$this->tableName,
 					$formattedFields,
 					G_ADDRESS_ID,
 					$id);
@@ -229,7 +231,9 @@
 		$displayOptions['target']	= $this->url->getURL();
 		$displayOptions['action']	= 'change';
 
-		$this->output->displayFields($fieldsSpec,$fieldsContents,$displayOptions);
+		$fullFieldsSpec[$this->name] = $fieldsSpec;
+
+		$this->output->displayFields($fullFieldsSpec,$fieldsContents,$displayOptions);
 	}
 
 	private function m_del($id)
@@ -247,9 +251,6 @@
 				return false;
 			$this->m_list();
 		} else {
-			// Seek the data
-			$formattedFields = array_keys($this->fields);
-			$formattedFields = implode($formattedFields,'`,`');
 			$query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
 				$formattedFields,
 				$this->tableName,
@@ -264,5 +265,36 @@
 			$this->output->displayFields($this->fields,$fieldsContents,array('id'=>'Address_view','command'=>T_('Confirm deletion'),'target'=>$this->url->getURL(),'action'=>'confirm','title'=>T_('Do you really want to delete the following entry?')));
 		}
 	}
+
+	private function People_edit_bottom($funcArgs) {
+		// Modification asked
+		if($_POST[$this->configH['URL']['action']] == 'change') {
+		}
+
+		$fields = array_keys($this->fields);
+		array_walk($fields, 'concat_to_each', $this->tableName.'`.`');
+
+		$fields = implode($fields,'`,`');
+
+		$query = sprintf("SELECT `%s` FROM `%s` , `%s` WHERE `%s`.`%s` = `%s`.`%s` AND `%s`.`%s` = '%s' LIMIT 1",
+			$fields,
+			$this->tableName,
+			$this->authH->storage_options['table'],
+			$this->tableName,
+			G_ADDRESS_ID,
+			$this->authH->storage_options['table'],
+			G_ADDRESS_ID,
+			$this->authH->storage_options['table'],
+			G_DB_PEOPLE_ID,
+			$funcArgs[G_DB_PEOPLE_ID]);
+		$queryR =& $this->db->query($query);
+
+		if(PEAR::isError($queryR))
+			return false;
+
+		$fieldsContents =& $queryR->fetchRow();
+
+		return $fieldsContents;
+	}
 }
 ?>
\ No newline at end of file

Modified: trunk/plugins/People.php
===================================================================
--- trunk/plugins/People.php	2008-11-26 22:19:41 UTC (rev 7)
+++ trunk/plugins/People.php	2008-11-27 22:08:59 UTC (rev 8)
@@ -95,13 +95,14 @@
 		switch($funcStr) {
 			case "main":	$this->main();		break;
 		}
+		return false;
 	}
 
 	private function m_list()
 	{
 		// Get the formatted fields list and Add 'id' (mandatory)
 		$desiredFields = array_keys($this->fieldsAll);
-		
+
 		// Prepare it for MySQL
 		$formattedFields = implode($desiredFields,'`,`');
 		$query = sprintf("SELECT `%s` FROM `%s` WHERE `username` IS NOT NULL ORDER BY `%s` ASC LIMIT 0 , 30",	// FIXME: No limit and no Selection of Columns
@@ -140,7 +141,8 @@
 			$fields = array_keys($fieldsSpec);
 
 			// Go along the fields
-			foreach($fields as $fieldName) {
+			foreach($fields as $fieldName_) {
+				$fieldName = $this->name.'_'.$fieldName_;
 				// Jump the non-modified ones (and if we are creating a new user)
 				if(	$id != G_PEOPLE_ID_NEW &&
 					array_key_exists($fieldName.'_old',$_POST) && 
@@ -148,16 +150,16 @@
 					continue;
 				}
 				// Get the type of the field and store its value
-				$type = $fieldsSpec[$fieldName]['type'];
+				$type = $fieldsSpec[$fieldName_]['type'];
 				$fieldValue = $_POST[$fieldName];
 
 				// Jump id (No insert nor check)
-				if($fieldName == G_DB_PEOPLE_ID ) {
+				if($fieldName_ == G_DB_PEOPLE_ID ) {
 					continue;
 				}
 
 				// For the username
-				if( $fieldName == G_DB_PEOPLE_USERNAME ) {
+				if( $fieldName_ == G_DB_PEOPLE_USERNAME ) {
 					// If we are creating a new user
 					if( $id == G_PEOPLE_ID_NEW || $editBase ) { // We are creating a new one or editing an existing one
 						if( empty( $fieldValue ) ) {
@@ -181,7 +183,7 @@
 							$result =& $queryR->fetchRow();
 							if(current($result) <> 0) {	// If the only result (the counting) is different from zero, we already have something
 								// Error
-								$fieldsSpec[$fieldName]['error'] = true;
+								$fieldsSpec[$fieldName_]['error'] = true;
 								// Warning
 								trigger_error(T_('The provided username is already defined.'), G_E_DISPLAY);
 								// Allow rewriting to it
@@ -194,12 +196,12 @@
 							$fieldContent = $fieldValue;
 						}
 					} else 	continue;
-				} elseif ($fieldName == G_DB_PEOPLE_PASSWORD) { // If we have one password entry, we have two
+				} elseif ($fieldName_ == G_DB_PEOPLE_PASSWORD) { // If we have one password entry, we have two
 					if($id == G_PEOPLE_ID_NEW || $editBase) { // We are creating a new one or editing an existing one
 						if( empty( $fieldValue ) ) {	// Provided password is empty
-							$fieldsSpec[$fieldName]['error'] = true;
+							$fieldsSpec[$fieldName_]['error'] = true;
 							trigger_error(T_('The provided password is empty (a random one has been provided).'), G_E_DISPLAY);
-							unset($fieldsSpec[$fieldName]['noShow']);
+							unset($fieldsSpec[$fieldName_]['noShow']);
 							$newError = true;
 							$fieldsContents[G_DB_PEOPLE_PASSWORD] = md5(microtime());
 							continue;
@@ -208,9 +210,9 @@
 							$hash = $this->configH['Auth']['cryptType'];
 							$fieldContent = $hash($_POST[$fieldName]);
 						} else { // Both passwords are differents
-							$fieldsSpec[$fieldName]['error'] = true;
+							$fieldsSpec[$fieldName_]['error'] = true;
 							trigger_error(T_('The two provided passwords are different.'), G_E_DISPLAY);
-							unset($fieldsSpec[$fieldName]['noShow']);
+							unset($fieldsSpec[$fieldName_]['noShow']);
 							$newError = true;
 							// Empty password (no leaks)
 							unset($fieldsContents[G_DB_PEOPLE_PASSWORD]);
@@ -218,15 +220,15 @@
 						}
 					} else continue;
 				} else {
-					$fieldContent = g_getFormattedField($_POST,$type,$fieldName,$fieldsSpec);
+					$fieldContent = g_getFormattedField($_POST,$type,$fieldName,$fieldName_,$fieldsSpec);
 					if( $fieldContent === false ) { // The given date is false
 						$fieldsSpec[$fieldName]['error'] = true;
 						$newError = true;
 						continue;
 					}
 				}
-				$fieldsContents[$fieldName] = $fieldContent;
-				$formattedFields .= "`$fieldName` = '".$fieldContent."', ";
+				$fieldsContents[$fieldName_] = $fieldContent;
+				$formattedFields .= "`$fieldName_` = '".$fieldContent."', ";
 			}
 			// Strip the two last characters (border issue)
 			$formattedFields = substr($formattedFields,0,-2);
@@ -294,7 +296,14 @@
 		$displayOptions['target']	= $this->url->getURL();
 		$displayOptions['action']	= 'change';
 
-		$this->output->displayFields($fieldsSpec,$fieldsContents,$displayOptions);
+		$fullFieldsSpec[$this->name] = $fieldsSpec;
+
+		// Call the functionality
+        $functionalityResult = $this->_parent->functionality('People.edit.bottom',$fieldsContents);
+
+		// TODO !
+
+		$this->output->displayFields($fullFieldsSpec,$fieldsContents,$displayOptions);
 	}
 
 	private function m_del($id)


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/