فهرست منبع

Deleted old files

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@421 a333f486-631f-4898-b8df-5754b55c2be0
romainq 15 سال پیش
والد
کامیت
89336d0f14

+ 0 - 252
application/dialogstack.class.inc.php

@@ -1,252 +0,0 @@
-<?php
-/**
- * Helper class to allow modal-style dialog box in an html form
- *
- * Possible improvement: do not use _SESSION for the caller's data,
- *  instead set a member variable with caller information
- *  and take the opportunity of the first edit button to place the information
- *  into a hidden field   
- *
- * Usage:
- */
-
-define('DLGSTACK_OK', 1);
-define('DLGSTACK_CANCEL', 2);
-
-//session_name("dialogstack");
-session_start();
-
-
-class dialogstack
-{
-	private static $m_bCurrPageDeclared = false;
-	/**
-	 * Declare the current page as being a dialog issuer, potentially pop...
-	 */
-	static public function DeclareCaller($sTitle)
-	{
-		self::$m_bCurrPageDeclared = false;
-		$_SESSION['dialogstack_calleruri'] = $_SERVER["REQUEST_URI"];
-		$_SESSION['dialogstack_callertitle'] = $sTitle;
-
-		if (isset($_POST["dialogstackpop"]) && ($_POST["dialogstackpop"] == count($_SESSION['dialogstack_currdlg'])))
-		{
-			// Pop !
-			array_pop($_SESSION['dialogstack_currdlg']);
-		} 
-	}
-
-	/**
-	 * True if the current page has been loaded from an "dialog startup button"
-	 */
-	static private function GetRetArgName()
-	{
-		foreach($_REQUEST as $sArgName=>$sArgValue)
-		{
-			if (strstr($sArgName, "dlgstack_go,"))
-			{
-				$aTokens = explode(",", $sArgName);
-				return self::ArgNameDecode($aTokens[1]);
-			}
-		}
-		return "";
-	}
-
-	/**
-	 * Protect against weird effects of PHP interpreting brackets...
-	 */
-	static private function ArgNameEncode($sArgName)
-	{
-		return str_replace(array('[', ']'), array('_bracket_open_', '_bracket_close_'), $sArgName);
-	}
-	static private function ArgNameDecode($sCodedArgName)
-	{
-		return str_replace(array('_bracket_open_', '_bracket_close_'), array('[', ']'), $sCodedArgName);
-	}
-
-	/**
-	 * True if the current page has been loaded from an "dialog startup button"
-	 */
-	static public function IsDialogStartup()
-	{
-		return (strlen(self::GetRetArgName()) > 0);
-	}
-
-
-	/**
-	 * Helper to  
-	 */
-	static private function RemoveArg(&$aValues, $sKey, &$retval = null)
-	{
-		if (isset($aValues[$sKey]))
-		{
-			if (empty($retval))
-			{
-				$retval = $aValues[$sKey];
-			}
-			unset($aValues[$sKey]);
-		}
-	}
-	
-
-	/**
-	 * Record current page args, and returns the initial value for the dialog 
-	 */
-	static public function StartDialog()
-	{
-		if (!isset($_SESSION['dialogstack_currdlg']))
-		{
-			// Init stack
-			$_SESSION['dialogstack_currdlg'] = array();
-		}
-
-		$sRetArgName = self::GetRetArgName();
-		$sCodedArgName = self::ArgNameEncode($sRetArgName);
-
-		$sArgForRetArgName = "dlgstack_init_".$sCodedArgName;
-		$sButtonName = "dlgstack_go,".$sCodedArgName;
-
-		// Do not record utility arguments, neither the current value (stored separately)
-		//
-		$initValue = null;
-		$aPost = $_POST;
-		self::RemoveArg($aPost, $sArgForRetArgName, $initValue);
-		self::RemoveArg($aPost, $sButtonName);
-		self::RemoveArg($aPost, 'dlgstack_onok_page', $sOnOKPage);
-		self::RemoveArg($aPost, 'dlgstack_onok_args', $aOnOKArgs);
-		$aGet = $_GET;
-		self::RemoveArg($aGet, $sArgForRetArgName, $initValue);
-		self::RemoveArg($aGet, $sButtonName);
-		self::RemoveArg($aGet, 'dlgstack_onok_page', $sOnOKPage);
-		self::RemoveArg($aGet, 'dlgstack_onok_args', $aOnOKArgs);
-
-		if (self::$m_bCurrPageDeclared)
-		{
-			throw new Exception("DeclareCaller() must not be called before StartDialog()");
-		}
-
-		$aCall = array(
-				"title"=>$_SESSION['dialogstack_callertitle'],
-				"uri"=>$_SESSION['dialogstack_calleruri'],
-				"post"=>$aPost,
-				"get"=>$aGet,
-				"retarg"=>$sRetArgName,
-				"initval"=>$initValue,
-		);
-		if (isset($sOnOKPage)) $aCall["onok_page"] = $sOnOKPage;
-		if (isset($aOnOKArgs)) $aCall["onok_args"] = $aOnOKArgs;
-
-		array_push($_SESSION['dialogstack_currdlg'], $aCall);
-		return $initValue;
-	}
-	/**
-	 * Render a button to launch a new dialog
-	 */
-	static public function RenderEditableField($sTitle, $sArgName, $sCurrValue, $bAddFieldValue, $sOnOKPage = "", $aOnOKArgs = array())
-	{
-		$sRet = "";
-		$sCodedArgName = self::ArgNameEncode($sArgName);
-		if ($bAddFieldValue)
-		{
-			$sRet .= "<input type=\"hidden\" name=\"$sArgName\" value=\"$sCurrValue\">\n";
-		}
-		$sRet .= "<input type=\"hidden\" name=\"dlgstack_init_$sCodedArgName\" value=\"$sCurrValue\">\n";
-		$sRet .= "<input type=\"submit\" name=\"dlgstack_go,$sCodedArgName\" value=\"$sTitle\">\n";
-		if (!empty($sOnOKPage))
-		{
-			$sRet .= "<input type=\"hidden\" name=\"dlgstack_onok_page\" value=\"$sCurrValue\">\n";
-		}
-		foreach($aOnOKArgs as $sArgName=>$value)
-		{
-			$sRet .= "<input type=\"hidden\" name=\"dlgstack_onok_args[$sArgName]\" value=\"$value\">\n";
-		}
-		return $sRet;
-	}
-	/**
-	 * Render a [set of] hidden field, from a value that may be an array
-	 */
-	static private function RenderHiddenField($sName, $value)
-	{
-		$sRet = "";
-		if (is_array($value))
-		{
-			foreach($value as $sKey=>$subvalue)
-			{
-				$sRet .= self::RenderHiddenField($sName.'['.$sKey.']', $subvalue);
-			}
-		}
-		else
-		{
-			$sRet .= "<input type=\"hidden\" name=\"$sName\" value=\"$value\">\n";
-		}
-		return $sRet;
-	}
-	/**
-	 * Render a form to end the current dialog and return to the caller
-	 */
-	static public function RenderEndDialogForm($iButtonStyle, $sTitle, $sRetValue = null)
-	{
-		$aCall = end($_SESSION['dialogstack_currdlg']);
-		if (!$aCall) return;
-		return self::privRenderEndDialogForm($aCall, $iButtonStyle, $sTitle, $sRetValue);
-	}
-
-	/**
-	 * Returns an array of buttons to get back to upper dialog levels
-	 */
-	static public function GetCurrentStack()
-	{
-		$aRet = array();
-		if (isset($_SESSION['dialogstack_currdlg']))
-		{
-			foreach ($_SESSION['dialogstack_currdlg'] as $aCall)
-			{
-				$aRet[] = self::privRenderEndDialogForm($aCall, DLGSTACK_CANCEL, $aCall["title"]);
-			}
-		}
-		return $aRet;
-	}
-
-	/**
-	 * Render a form to end the current dialog and return to the caller
-	 */
-	static private function privRenderEndDialogForm($aCall, $iButtonStyle, $sTitle, $sRetValue = null)
-	{
-		if (($iButtonStyle == DLGSTACK_OK) && isset($aCall["onok_page"])) $sFormAction = $aCall["onok_page"];
-		else                                                              $sFormAction = $aCall["uri"];  
-
-		$sRet = "<form method=\"post\" action=\"$sFormAction\">\n";
-		foreach ($aCall["post"] as $sName=>$value)
-		{
-			$sRet .= self::RenderHiddenField($sName, $value);
-		}
-		if ($iButtonStyle == DLGSTACK_OK)
-		{
-			if (isset($aCall["onok_args"]))
-			{
-				foreach($aCall["onok_args"] as $sArgName=>$value)
-				{
-					$sRet .= "<input type=\"hidden\" name=\"$sArgName\" value=\"$value\">\n";
-				}
-			}
-			$sRet .= "<input type=\"hidden\" name=\"".$aCall["retarg"]."\" value=\"$sRetValue\">\n";
-			$sRet .= "<input type=\"submit\" name=\"dlgstackOK\" value=\"$sTitle, (OK) Back to ".$aCall["title"]."\">\n";
-		}
-		elseif ($iButtonStyle == DLGSTACK_CANCEL)
-		{
-			if (!is_null($aCall["initval"]))
-			{
-				$sRet .= "<input type=\"hidden\" name=\"".$aCall["retarg"]."\" value=\"".$aCall["initval"]."\">\n";
-			}
-			$sRet .= "<input type=\"submit\" name=\"dlgstackCANCEL\" value=\"$sTitle\">\n";
-		}
-		else
-		{
-			throw new Exception("Wrong value for button style ($iButtonStyle)");		
-		}
-		$sRet .= "<input type=\"hidden\" name=\"dialogstackpop\" value=\"".count($_SESSION['dialogstack_currdlg'])."\">\n";
-		$sRet .= "</form>\n";
-		return $sRet;
-	}
-}
-?>

+ 0 - 32
business/Changes-04-Sep-2007.php

@@ -1,32 +0,0 @@
-Changements principaux:
-- la classe AbstractObject est sortie du biz model
-- join_type remplacé par is_null_allowed (placé à la fin pour être + facile à retrouver)
-- j'ai enlevé toute la classe logLocatedObject qui était en commentaire
-- Enlevé 'address' de l'advanced search sur une location car ce n'est plus un critère de recherche possible (remplacé par country)
-- Ajouté des critères de recherche sur bizCircuit
-- Ajouté les ZList sur bizCircuit
-- Ajouté les Zlist pour bizInterface
-- Ajouté les Zlist pour lnkInfraInfra
-- Ajouté les Zlist pour lnkInfraTicket
-
-Dans AbstractObject: désactivé l'affichage des contacts liés qui ne marche pas pour les tickets.
-
-Bug fix ?
-- J'ai rajouté un blindage if (is_object($proposedValue) &&... dans AttributeDate::MakeRealValue mais je ne comprends pas d'où sort la classe DateTime... et pourtant il y en a...
-
-Améliorations:
-- Ajouter une vérification des ZList (les attributs/critèresde recherche déclarés dans la liste existent-ils pour cet objet)
-
-Ne marche pas:
-- Objets avec des clefs externes vides
-- Enums !!!!
-
-Data Generator:
-Organization '1' updated.
-5 Location objects created.
-19 PC objects created.
-19 Network Device objects created.
-42 Person objects created.
-6 Incident objects created.
-17 Infra Group objects created.
-34 Infra Infra objects created.

+ 0 - 230
business/business_itopbegins.class.inc.php

@@ -1,230 +0,0 @@
-<?php
-
-require_once('../core/MyHelpers.class.inc.php');
-require_once('../core/cmdbobject.class.inc.php');
-
-/**
- * business_itopbegins.class.inc.php
- * User defined objects, for unit testing 
- *
- * @package     iTopUnitTests
- * @author      Romain Quetiez <romainquetiez@yahoo.fr>
- * @author      Denis Flaven <denisflave@free.fr>
- * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link        www.itop.com
- * @since       1.0
- * @version     1.1.1.1 $
- */
-
-
-///////////////////////////////////////////////////////////////////////////////
-// Business implementation demo
-///////////////////////////////////////////////////////////////////////////////
-
-
-/**
- * blah blah 
- *
- * @package     iTopUnitTests
- * @author      Romain Quetiez <romainquetiez@yahoo.fr>
- * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link        www.itop.com
- * @since       1.0
- * @version     1.1.1.1 $
- */
-class cmdbContact extends CMDBObject
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "blah",
-			"key_type" => "autoincrement",
-			"key_label" => "",
-			"name_attcode" => "att_contact_name",
-			"state_attcode" => "",
-			"reconc_keys" => array("att_contact_name"),
-			"db_table" => "contact",
-			"db_key_field" => "contactid",
-			"db_finalclass_field" => "actualclass",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-		MetaModel::Init_AddAttribute(new AttributeString("att_contact_name", array("allowed_values"=>null, "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array(), "sql"=>"name")));
-		MetaModel::Init_AddAttribute(new AttributeInteger("att_contact_availability", array("allowed_values"=>null, "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array(), "sql"=>"availability")));
-		MetaModel::Init_AddAttribute(new AttributeDate("start_date", array("allowed_values"=>null, "sql"=>"start_date", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
-	}
-}
-
-/**
- * blah blah 
- *
- * @package     iTopUnitTests
- * @author      Romain Quetiez <romainquetiez@yahoo.fr>
- * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link        www.itop.com
- * @since       1.0
- * @version     1.1.1.1 $
- */
-class cmdbPerson extends cmdbContact
-{
-	public static function Init()
-	{
-		$oValsDunsNumber = new ValueSetObjects("cmdbCompany: att_company_dunsnumber Begins with '$[duns_prm::]'", "att_company_dunsnumber", array("att_company_dunsnumber"=>true));
-
-		$aParams = array
-		(
-			"category" => "blah",
-			"key_type" => "autoincrement",
-			"key_label" => "",
-			"name_attcode" => "att_contact_name",
-			"state_attcode" => "",
-			"reconc_keys" => array("att_contact_name"),
-			"db_table" => "person",
-			"db_key_field" => "personid",
-			"db_finalclass_field" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-		MetaModel::Init_AddAttribute(new AttributeString("att_person_email", array("allowed_values"=>$oValsDunsNumber, "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array(), "sql"=>"email")));
-		MetaModel::Init_AddAttribute(new AttributeString("att_person_name", array("allowed_values"=>new ValueSetEnum(array("nom1", "nom2", "nom10", "no", "noms", "")), "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array(), "sql"=>"name")));
-	}
-}
-
-/**
- * blah blah 
- *
- * @package     iTopUnitTests
- * @author      Romain Quetiez <romainquetiez@yahoo.fr>
- * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link        www.itop.com
- * @since       1.0
- * @version     1.1.1.1 $
- */
-class cmdbSubcontractor extends cmdbPerson
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "blah",
-			"key_type" => "autoincrement",
-			"key_label" => "",
-			"name_attcode" => "att_contact_name",
-			"state_attcode" => "",
-			"reconc_keys" => array("att_contact_name"),
-			"db_table" => "subcontractor",
-			"db_key_field" => "subcontractorid",
-			"db_finalclass_field" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-		MetaModel::Init_AddAttribute(new AttributeString("att_contractinfo", array("allowed_values"=>null, "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array(), "sql"=>"contractinfo")));
-
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("ext_subcontractor_provider", array("allowed_values"=>null, "sql"=>"provider", "targetclass"=>"cmdbProvider", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("extatt_subcontractor_provider_ref", array("allowed_values"=>null, "extkey_attcode"=>"ext_subcontractor_provider", "target_attcode"=>"att_provider_ref")));
-
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("ext_subcontractor_tutor", array("allowed_values"=>null, "sql"=>"tutor", "targetclass"=>"cmdbPerson", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("extatt_subcontractor_tutor_email", array("allowed_values"=>null, "extkey_attcode"=>"ext_subcontractor_tutor", "target_attcode"=>"att_person_email")));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("extatt_subcontractor_tutor_secondname", array("allowed_values"=>null, "extkey_attcode"=>"ext_subcontractor_tutor", "target_attcode"=>"att_person_name")));
-	}
-}
-
-/**
- * blah blah 
- *
- * @package     iTopUnitTests
- * @author      Romain Quetiez <romainquetiez@yahoo.fr>
- * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link        www.itop.com
- * @since       1.0
- * @version     1.1.1.1 $
- */
-class cmdbCrowd extends cmdbObject
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "blah",
-			"key_type" => "autoincrement",
-			"key_label" => "",
-			"name_attcode" => "att_crowd_peoplecount",
-			"state_attcode" => "",
-			"reconc_keys" => array("att_crowd_peoplecount"),
-			"db_table" => "crowd",
-			"db_key_field" => "crowdid",
-			"db_finalclass_field" => "crowdclass",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-		MetaModel::Init_AddAttribute(new AttributeInteger("att_crowd_peoplecount", array("allowed_values"=>null, "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array(), "sql"=>"peoplecount")));
-	}
-}
-
-/**
- * blah blah 
- *
- * @package     iTopUnitTests
- * @author      Romain Quetiez <romainquetiez@yahoo.fr>
- * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link        www.itop.com
- * @since       1.0
- * @version     1.1.1.1 $
- */
-class cmdbCompany extends cmdbCrowd
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "blah",
-			"key_type" => "autoincrement",
-			"key_label" => "",
-			"name_attcode" => "att_company_dunsnumber",
-			"state_attcode" => "",
-			"reconc_keys" => array("att_company_dunsnumber"),
-			"db_table" => "company",
-			"db_key_field" => "companyid",
-			"db_finalclass_field" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-		MetaModel::Init_AddAttribute(new AttributeString("att_company_dunsnumber", array("allowed_values"=>null, "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array(), "sql"=>"dunsnumber")));
-	}
-}
-
-/**
- * blah blah 
- *
- * @package     iTopUnitTests
- * @author      Romain Quetiez <romainquetiez@yahoo.fr>
- * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link        www.itop.com
- * @since       1.0
- * @version     1.1.1.1 $
- */
-class cmdbProvider extends cmdbCompany
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "blah",
-			"key_type" => "autoincrement",
-			"key_label" => "",
-			"name_attcode" => "att_provider_ref",
-			"state_attcode" => "",
-			"reconc_keys" => array("att_provider_ref"),
-			"db_table" => "provider",
-			"db_key_field" => "providerid",
-			"db_finalclass_field" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-		MetaModel::Init_AddAttribute(new AttributeInteger("att_provider_ref", array("allowed_values"=>null, "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array(), "sql"=>"providerref")));
-	}
-}
-
-
-?>

+ 0 - 337
business/business_test.class.inc.php

@@ -1,337 +0,0 @@
-<?php
-
-require_once('../core/MyHelpers.class.inc.php');
-require_once('../core/cmdbobject.class.inc.php');
-
-/**
- * business_test.class.inc.php
- * User defined objects, for unit testing 
- *
- * @package     iTopUnitTests
- * @author      Romain Quetiez <romainquetiez@yahoo.fr>
- * @author      Denis Flaven <denisflave@free.fr>
- * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link        www.itop.com
- * @since       1.0
- * @version     1.1.1.1 $
- */
-
-///////////////////////////////////////////////////////////////////////////////
-// Business implementation demo
-///////////////////////////////////////////////////////////////////////////////
-
-MetaModel::RegisterRelation("Potes", array("description"=>"ceux dont l'email ressemble au mien", "verb_down"=>"est pote de", "verb_up"=>"est pote de"));
-
-
-MetaModel::RegisterZList("list1", array("description"=>"une premiere list, just for fun", "type"=>"attributes"));
-MetaModel::RegisterZList("list2", array("description"=>"la secunda e meliora", "type"=>"attributes"));
-MetaModel::RegisterZList("list3", array("description"=>"la variante qui tue", "type"=>"filters"));
-
-
-/**
- * blah blah 
- *
- * @package     iTopUnitTests
- * @author      Romain Quetiez <romainquetiez@yahoo.fr>
- * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link        www.itop.com
- * @since       1.0
- * @version     1.1.1.1 $
- */
-class cmdbObjectHomeMade extends cmdbObject
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "blah",
-			"key_type" => "autoincrement",
-			"key_label" => "",
-			"name_attcode" => "",
-			"state_attcode" => "",
-			"reconc_keys" => array(""),
-			"db_table" => "",
-			"db_key_field" => "",
-			"db_finalclass_field" => "",
-		);
-		MetaModel::Init_Params($aParams);
-	}
-
-	public static function GetRelationQueries($sRelCode)
-	{
-		//trigger_error("GetRelationQueries: cmdbObjectHomeMade");
-		switch ($sRelCode)
-		{
-		case "Potes":
-			$aRels = array("xxxx" => array("sQuery"=>"SELECT cmdbContact AS c WHERE c.id = 40", "bPropagate"=>true, "iDistance"=>3));
-			return $aRels;
-		}
-	}
-}
-
-
-/**
- * blah blah 
- *
- * @package     iTopUnitTests
- * @author      Romain Quetiez <romainquetiez@yahoo.fr>
- * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link        www.itop.com
- * @since       1.0
- * @version     1.1.1.1 $
- */
-class cmdbContact extends cmdbObjectHomeMade
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "blah",
-			"key_type" => "autoincrement",
-			"key_label" => "",
-			"name_attcode" => "name",
-			"state_attcode" => "etat",
-			"reconc_keys" => array("name"),
-			"db_table" => "contact",
-			"db_key_field" => "contactid",
-			"db_finalclass_field" => "actualclass",
-		);
-		MetaModel::Init_Params($aParams);
-		//MetaModel::Init_InheritAttributes();
-		MetaModel::Init_AddAttribute(new AttributeString("etat", array("allowed_values"=>new ValueSetEnum('justborn, 15, 21'), "sql"=>"etat", "default_value"=>"justborn", "is_null_allowed"=>false, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>"XXXX", "is_null_allowed"=>false, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("email", array("allowed_values"=>null, "sql"=>"email", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("owner", array("allowed_values"=>null, "sql"=>"ownerorg", "targetclass"=>"cmdbOrga", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("ownername", array("allowed_values"=>null, "extkey_attcode"=>"owner", "target_attcode"=>"_name_")));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("ownertnut", array("allowed_values"=>null, "extkey_attcode"=>"owner", "target_attcode"=>"_dunsnumber_")));
-
-		MetaModel::Init_AddAttribute(new AttributeLinkedSet("myworkshops", array("depends_on"=>array(), "linked_class"=>"cmdbLiens", "ext_key_to_me"=>"tocontact", "count_min"=>1, "count_max"=>10, "allowed_values"=>null)));
-
-		MetaModel::Init_SetZListItems("list1", array("name", "email"));
-		MetaModel::Init_SetZListItems("list2", array());
-		MetaModel::Init_SetZListItems("list3", array("ownername"));
-
-		MetaModel::Init_DefineState("justborn", array("attribute_inherit"=>null, "attribute_list"=>array("owner"=>OPT_ATT_MANDATORY)));
-		MetaModel::Init_DefineState("15", array("attribute_inherit"=>"justborn", "attribute_list"=>array("owner"=>OPT_ATT_MUSTPROMPT, "email"=>OPT_ATT_MUSTPROMPT)));
-		MetaModel::Init_DefineState("21", array("attribute_inherit"=>"15", "attribute_list"=>array("email"=>OPT_ATT_READONLY|OPT_ATT_MUSTCHANGE)));
-
-		MetaModel::Init_DefineStimulus(new StimulusUserAction("toschool", array()));
-		MetaModel::Init_DefineStimulus(new StimulusUserAction("raise", array()));
-
-		MetaModel::Init_DefineTransition("justborn", "toschool", array("target_state"=>"15", "actions"=>array('MyLifecycleHandler', 'MyLifecycleHandler2'), "user_restriction"=>null));
-		MetaModel::Init_DefineTransition("15", "raise", array("target_state"=>"21", "actions"=>null, "user_restriction"=>null));
-	}
-
-	public static function GetRelationQueries($sRelCode)
-	{
-		//trigger_error("GetRelationQueries: cmdbContact");
-		switch ($sRelCode)
-		{
-		case "Potes":
-			$aRels = array(
-				"zz1" => array("sQuery"=>"SELECT cmdbContact AS c WHERE c.name = '\$[this.name::]'", "bPropagate"=>false, "iDistance"=>3),
-				"zz2" => array("sQuery"=>"SELECT cmdbContact AS c WHERE c.owner = \$[this.owner::] AND c.owner != 2", "bPropagate"=>false, "iDistance"=>3),
-			);
-			return array_merge($aRels, parent::GetRelationQueries($sRelCode));
-		}
-	}
-
-	public function MyLifecycleHandler($sStimulusCode)
-	{
-		echo "<p>youhou!</p>";
-		return true;
-	}
-	public function MyLifecycleHandler2($sStimulusCode)
-	{
-		echo "<p>... les papous...</p>";
-		return true;
-	}
-}
-
-/**
- * blah blah 
- *
- * @package     iTopUnitTests
- * @author      Romain Quetiez <romainquetiez@yahoo.fr>
- * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link        www.itop.com
- * @since       1.0
- * @version     1.1.1.1 $
- */
-class cmdbTeam extends cmdbContact
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "blah",
-			"key_type" => "autoincrement",
-			"key_label" => "",
-			"name_attcode" => "email",
-			"state_attcode" => "",
-			"reconc_keys" => array("email"),
-			"db_table" => "team",
-			"db_key_field" => "teamid",
-			"db_finalclass_field" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-		MetaModel::Init_OverloadAttributeParams("email", array());
-		MetaModel::Init_AddAttribute(new AttributeInteger("headcount", array("allowed_values"=>null, "sql"=>"headcount", "default_value"=>654321, "is_null_allowed"=>false, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems("noneditable", array("name"));
-	}
-
-	public function ComputeValues()
-	{
-		//echo "Set(), function ComputeValues has been found for ".get_class($this)."<br/>\n";
-		$this->Set("name", $this->Get("email")." and ".$this->Get("headcount"));
-	}
-
-	public static function GetRelationQueries($sRelCode)
-	{
-		//trigger_error("GetRelationQueries: cmdbTeam");
-		switch ($sRelCode)
-		{
-		case "Potes":
-			//$aRels = array("Relies on" => array("sQuery"=>"cmdbContact: name Begins with 'Louis'", "bPropagate"=>false, "iDistance"=>3));
-			return array_merge(array(), parent::GetRelationQueries($sRelCode));
-		}
-	}
-}
-
-
-/**
- * blah blah 
- *
- * @package     iTopUnitTests
- * @author      Romain Quetiez <romainquetiez@yahoo.fr>
- * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link        www.itop.com
- * @since       1.0
- * @version     1.1.1.1 $
- */
-class cmdbOrga extends cmdbObjectHomeMade
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "blah",
-			"key_type" => "",
-			"key_label" => "",
-			"name_attcode" => "_name_",
-			"state_attcode" => "",
-			"reconc_keys" => array("_name_"),
-			"db_table" => "organization",
-			"db_key_field" => "orgid",
-			"db_finalclass_field" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		//MetaModel::Init_InheritAttributes();
-		MetaModel::Init_AddAttribute(new AttributeString("_name_", array("allowed_values"=>null, "sql"=>"name", "default_value"=>"XXXX", "is_null_allowed"=>false, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeEnum("_status_", array("allowed_values"=>null, "sql"=>"status", "default_value"=>"XXXX", "is_null_allowed"=>false, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeInteger("_dunsnumber_", array("allowed_values"=>null, "sql"=>"dunsnumber", "default_value"=>99007, "is_null_allowed"=>false, "depends_on"=>array())));
-// not yet allowed		MetaModel::Init_AddAttribute(new AttributeInteger("_dunsnumberBY2_", array("allowed_values"=>null, "sql"=>"dunsnumber * 3.141592654")));
-
-		MetaModel::Init_SetZListItems("list1", array("_status_"));
-		MetaModel::Init_SetZListItems("list2", array());
-		MetaModel::Init_SetZListItems("list3", array("_name_"));
-	}
-
-}
-
-/**
- * blah blah 
- *
- * @package     iTopUnitTests
- * @author      Romain Quetiez <romainquetiez@yahoo.fr>
- * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link        www.itop.com
- * @since       1.0
- * @version     1.1.1.1 $
- */
-class cmdbLiens extends cmdbObjectHomeMade
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "blah",
-			"key_type" => "autoincrement",
-			"key_label" => "",
-			"name_attcode" => "function",
-			"state_attcode" => "",
-			"reconc_keys" => array("function"),
-			"db_table" => "role_ws",
-			"db_key_field" => "linkid",
-			"db_finalclass_field" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		//MetaModel::Init_InheritAttributes();
-		MetaModel::Init_AddAttribute(new AttributeString("function", array("allowed_values"=>null, "sql"=>"function", "default_value"=>"XXXX", "is_null_allowed"=>false, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("a1", array("allowed_values"=>null, "sql"=>"a1", "default_value"=>"XXXX", "is_null_allowed"=>false, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("a2", array("allowed_values"=>null, "sql"=>"a2", "default_value"=>"XXXX", "is_null_allowed"=>true, "depends_on"=>array())));
-
-		// What makes it being a link...
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("toworkshop", array("allowed_values"=>null, "sql"=>"ws_id", "targetclass"=>"cmdbWorkshop", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("ws_info", array("allowed_values"=>null, "extkey_attcode"=>"toworkshop", "target_attcode"=>"namitus")));
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("tocontact", array("allowed_values"=>null, "sql"=>"contactid", "targetclass"=>"cmdbContact", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("contact_info", array("allowed_values"=>null, "extkey_attcode"=>"tocontact", "target_attcode"=>"name")));
-
-		MetaModel::Init_SetZListItems("list1", array("toworkshop", "contact_info"));
-		MetaModel::Init_SetZListItems("list2", array("function"));
-		MetaModel::Init_SetZListItems("list3", array("function"));
-	}
-
-	public static function GetRelationQueries($sRelCode)
-	{
-		throw new CoreException("GetRelationQueries: cmdbLiens");
-		return array("Relies on" => array("sQuery"=>"", "bPropagate"=>true, "iDistance"=>3));
-	}
-}
-
-/**
- * blah blah 
- *
- * @package     iTopUnitTests
- * @author      Romain Quetiez <romainquetiez@yahoo.fr>
- * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link        www.itop.com
- * @since       1.0
- * @version     1.1.1.1 $
- */
-class cmdbWorkshop extends cmdbObjectHomeMade
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "blah",
-			"key_type" => "autoincrement",
-			"key_label" => "",
-			"name_attcode" => "namitus",
-			"state_attcode" => "",
-			"reconc_keys" => array("namitus"),
-			"db_table" => "workshop",
-			"db_key_field" => "ws_id",
-			"db_finalclass_field" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		//MetaModel::Init_InheritAttributes();
-		MetaModel::Init_AddAttribute(new AttributeString("namitus", array("allowed_values"=>null, "sql"=>"name", "default_value"=>"XXXX", "is_null_allowed"=>false, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems("list1", array("namitus"));
-		MetaModel::Init_SetZListItems("list2", array());
-		MetaModel::Init_SetZListItems("list3", array("namitus"));
-	}
-
-	public static function GetRelationQueries($sRelCode)
-	{
-		throw new CoreException("GetRelationQueries: cmdbWorkshop");
-		return array("Relies on" => array("sQuery"=>"", "bPropagate"=>true, "iDistance"=>3));
-	}
-}
-
-
-?>

+ 0 - 36
config-test-mymodel.php

@@ -1,36 +0,0 @@
-<?php
-
-//
-// phpMyORM configuration file
-//
-// To be manually edited (or generated by the configuration wizard)
-//
-// The file is used in MetaModel::LoadConfig() which does all the necessary initialization job
-//
-
-
-$MySettings = array(
-	'db_host' => 'localhost',
-	'db_user' => 'itop',
-	'db_pwd' => '1T0p',
-	'db_name' => 'TestBizModelGenericItop',
-	'db_subname' => 'tribute2itop', // use it to differentiate two applications instances running on the same DB
-);
-
-// Modules: file names should be specified as a absolute paths
-
-$MyModules = array(
-	'application' => array (
-		// to be continued...
-	),
-	'business' => array (
-		'../business/business_test.class.inc.php'
-		// to be continued...
-	),
-	'addons' => array (
-		// other modules to come later
-	)
-);
-
-
-?>