Userbase-programmers
Threads by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
February 2011
- 1 participants
- 5 discussions
r20 - bin core core/db core/itembase domains/mcs modules/core modules/identity www/css www/tpl/admin/custom_fields www/tpl/common/items www/tpl/common/misc www/tpl/common/misc/list_controls www/tpl/nodes/identity www/tpl/nodes/identity/ajax
by cwalker@mcs.anl.gov 25 Feb '11
by cwalker@mcs.anl.gov 25 Feb '11
25 Feb '11
Author: cwalker
Date: 2011-02-25 16:45:07 -0600 (Fri, 25 Feb 2011)
New Revision: 20
Added:
www/tpl/admin/custom_fields/field_item.tpl
www/tpl/admin/custom_fields/section_item_close.tpl
www/tpl/admin/custom_fields/section_item_open.tpl
www/tpl/common/items/identity_domain_items.tpl
Modified:
bin/import.php
core/clsHtmlTag.php
core/db/clsDBItem.php
core/db/clsDBParsedCollection.php
core/db/clsDBParsedItem.php
core/db/clsMysqlActionHandler.php
core/itembase/clsParsedItemBase.php
domains/mcs/account.php
modules/core/clsDomainBase.php
modules/core/clsDomainSysTags.php
modules/identity/identity.php
www/css/list.css
www/tpl/common/items/identity.tpl
www/tpl/common/misc/list_controls.tpl
www/tpl/common/misc/list_controls/identity_main.tpl
www/tpl/nodes/identity/account.tpl
www/tpl/nodes/identity/address.tpl
www/tpl/nodes/identity/ajax/account_list.tpl
www/tpl/nodes/identity/ajax/address_list.tpl
www/tpl/nodes/identity/ajax/resource_list.tpl
www/tpl/nodes/identity/credential.tpl
www/tpl/nodes/identity/email.tpl
Log:
Displaying identity information without a domain selected has been a problem, this update fixes that. Now, when viewing an idenity with no domain, you'll see the identity's address data, email, and credentials. This is step 1 to providing a multi-domain view of a person's data, which is forthcoming. This required restructering how related objects are mapped, but it is much improved this way..
Also cleaned up some issues with the lists, ie address list couldn't be sorted.. Moved some tags associated with relationships from clsParsedItemBase to clsDBParsedItemBase, since I'm assuming relationships will be handled differently in LDAP backends
Modified: bin/import.php
===================================================================
--- bin/import.php 2011-02-24 18:11:16 UTC (rev 19)
+++ bin/import.php 2011-02-25 22:45:07 UTC (rev 20)
@@ -183,6 +183,7 @@
if(strlen($old_user["home_line_1"]) || strlen($old_user["home_phone"]) || strlen($old_user["home_city"]))
{
$home_address = array();
+ $home_address["name"] = "Home";
$home_address["street"] = $old_user["home_line_1"];
$home_address["street2"] = $old_user["home_line_2"];
$home_address["city"] = $old_user["home_city"];
@@ -198,6 +199,7 @@
if(strlen($old_user["mail_line_1"]) || strlen($old_user["mail_city"]))
{
$address = array();
+ $address["name"] = "Work";
$address["street"] = $old_user["mail_line_1"];
$address["street2"] = $old_user["mail_line_2"];
$address["city"] = $old_user["mail_city"];
@@ -313,6 +315,8 @@
echo "Adding Unix Group ".$grp["group_name"]."\n";
$r = $d->getDomainObject("Resource");
$r->set("name",$grp['group_name']);
+ $r->set("gid",$grp['gid']);
+ $r->set('accessibility',$grp['accessibility']);
$r->commit();
$rg->AddResource($r);
}
Modified: core/clsHtmlTag.php
===================================================================
--- core/clsHtmlTag.php 2011-02-24 18:11:16 UTC (rev 19)
+++ core/clsHtmlTag.php 2011-02-25 22:45:07 UTC (rev 20)
@@ -209,7 +209,7 @@
$tagparts = explode(" ",$html,2);
$tagname = $tagparts[0];
$attribs = array();
- if(count($tagparts)>0)
+ if(count($tagparts)>1)
{
$attribs = $this->ParseAttributes($tagparts[1]);
}
Modified: core/db/clsDBItem.php
===================================================================
--- core/db/clsDBItem.php 2011-02-24 18:11:16 UTC (rev 19)
+++ core/db/clsDBItem.php 2011-02-25 22:45:07 UTC (rev 20)
@@ -917,21 +917,15 @@
function NamedRelationListClass($RelName)
{
$Rel = $this->GetNamedRelation($RelName);
- if(!array_key_exists($RelName,$this->ItemCache))
+
+ if(is_object($Rel))
{
- if(is_object($Rel))
+ $classname = $Rel->ListClass;
+ if(strlen($classname)>0 && class_exists($classname))
{
- $classname = $Rel->ListClass;
- if(strlen($classname)>0 && class_exists($classname))
- {
- return new $classname();
- }
- }
- }
- else
- {
- $obj = $this->ItemCache[$RelName];
- }
+ return new $classname();
+ }
+ }
return false;
}
@@ -978,20 +972,24 @@
$this->CustomFields = array();
if($this->bEnableCustomFields)
{
- if(strlen($this->GetContextName())>0)
- {
- $d = $objDomains->getCurrentDomain();
- if(is_object($d))
- {
+ if(is_object($objDomains))
+ {
+ $d = $objDomains->getCurrentDomain(false);
+ if(strlen($this->GetContextName())>0 && is_object($d))
+ {
$ContextClassName = $d->getDomainClassName($this->GetContextName());
- }
- $sql = "select * FROM custom_fields WHERE ((classname='".$this->className."' AND item_id=0) OR ";
- $sql .=" (classname='$ContextClassName' AND child_classname='{$this->className}' AND item_id={$this->GetContextValue()})";
- }
- else
- {
- $sql = "select * FROM custom_fields WHERE ((classname='".$this->className."' AND item_id=0)";
- }
+ $sql = "select * FROM custom_fields WHERE ((classname='".$this->className."' AND item_id=0) OR ";
+ $sql .=" (classname='$ContextClassName' AND child_classname='{$this->className}' AND item_id={$this->GetContextValue()})";
+ }
+ else
+ {
+ $sql = "select * FROM custom_fields WHERE ((classname='".$this->className."' AND item_id=0)";
+ }
+ }
+ else
+ {
+ $sql = "select * FROM custom_fields WHERE ((classname='".$this->className."' AND item_id=0)";
+ }
if($this->getPK())
{
for($x=0;$x<count($this->Relations);$x++)
@@ -1064,6 +1062,14 @@
'section'=>$cf->get("section"),
'display_order'=>$cf->get("display_order")
));
+ if(strlen($cf->get("values")))
+ {
+ $f->values = explode("\n",$cf->get("values"));
+ }
+ elseif($cf->get("datatype")==BOOL)
+ {
+ $f->values = array("No","Yes");
+ }
}
return $f;
}
Modified: core/db/clsDBParsedCollection.php
===================================================================
--- core/db/clsDBParsedCollection.php 2011-02-24 18:11:16 UTC (rev 19)
+++ core/db/clsDBParsedCollection.php 2011-02-25 22:45:07 UTC (rev 20)
@@ -4,7 +4,7 @@
{
public $table;
protected $SearchFields;
- protected $LastFetchQuery;
+ public $LastFetchQuery;
public $PresetSQL;
protected $DB;
Modified: core/db/clsDBParsedItem.php
===================================================================
--- core/db/clsDBParsedItem.php 2011-02-24 18:11:16 UTC (rev 19)
+++ core/db/clsDBParsedItem.php 2011-02-25 22:45:07 UTC (rev 20)
@@ -429,6 +429,19 @@
return $ret;
}
+ protected function _rel_item_template($attributes,$extra_attribs="")
+ {
+ $ret = "";
+ $t = $attributes["_template"];
+ if(strlen($t))
+ {
+ $obj = $this->NewRelationObject($attributes["_relateditem"],$this->className,$this->get("id"));
+ if(is_object($obj))
+ $ret = $obj->ParseTemplate($t);
+ }
+ return $ret;
+ }
+
protected function _list_relation_customfields($attribs,$extra_attribs="")
{
global $objItemDelegates;
Modified: core/db/clsMysqlActionHandler.php
===================================================================
--- core/db/clsMysqlActionHandler.php 2011-02-24 18:11:16 UTC (rev 19)
+++ core/db/clsMysqlActionHandler.php 2011-02-25 22:45:07 UTC (rev 20)
@@ -329,17 +329,18 @@
}
else
{
+ $this->handlefileUploads($item);
+ $this->handleItemCustomFields($item,GetArrayValue($_POST,"field",array()));
if($ItemId)
{
setUserFeedback($this->ItemName." \"".$item->GetDefaultText()."\" Updated.");
+ $org->LogChanges($item,"edit");
}
else
{
setUserFeedback($this->ItemName." \"".$item->GetDefaultText()."\" Added.");
- }
- $this->handlefileUploads($item);
- $this->handleItemCustomFields($item,GetArrayValue($_POST,"field",array()));
- $org->LogChanges($item,"edit");
+ $item->LogChanges(null,"add");
+ }
}
}
}
Modified: core/itembase/clsParsedItemBase.php
===================================================================
--- core/itembase/clsParsedItemBase.php 2011-02-24 18:11:16 UTC (rev 19)
+++ core/itembase/clsParsedItemBase.php 2011-02-25 22:45:07 UTC (rev 20)
@@ -59,11 +59,19 @@
{
global $objItemLog;
- $diffs = $this->FieldDiffs($NewObj);
- if(count($diffs)>0)
+ $diffs = array();
+ if($EntryType=="add")
{
- $objItemLog->AddEntry($this->get("id"),$this->className,$EntryType,implode("\n",$diffs),$user_id);
+ $objItemLog->AddEntry($this->get("id"),$this->className,$EntryType,"Item Created",$user_id);
}
+ else
+ {
+ $diffs = $this->FieldDiffs($NewObj);
+ if(count($diffs)>0)
+ {
+ $objItemLog->AddEntry($this->get("id"),$this->className,$EntryType,implode("\n",$diffs),$user_id);
+ }
+ }
return $diffs;
}
@@ -374,20 +382,8 @@
}
return $ret;
}
+
- protected function _rel_item_template($attributes,$extra_attribs="")
- {
- $ret = "";
- $t = $attributes["_template"];
- if(strlen($t))
- {
- $obj = $this->NewRelationObject($attributes["_relateditem"],$this->className,$this->get("id"));
- if(is_object($obj))
- $ret = $obj->ParseTemplate($t);
- }
- return $ret;
- }
-
protected function _context_type($attributes,$extra_attribs="")
{
return $this->GetContextName();
Modified: domains/mcs/account.php
===================================================================
--- domains/mcs/account.php 2011-02-24 18:11:16 UTC (rev 19)
+++ domains/mcs/account.php 2011-02-25 22:45:07 UTC (rev 20)
@@ -171,6 +171,12 @@
$this->SearchFields["admin"] = array();
}
+ public function IdentityAccounts($ListType,$IdentityId)
+ {
+ $this->AddFilter("identity_id",$IdentityId);
+ $this->LoadListItems("identity_".$ListType);
+ }
+
function BuildListCountSQL($ListName)
{
switch(strtolower($ListName))
Modified: modules/core/clsDomainBase.php
===================================================================
--- modules/core/clsDomainBase.php 2011-02-24 18:11:16 UTC (rev 19)
+++ modules/core/clsDomainBase.php 2011-02-25 22:45:07 UTC (rev 20)
@@ -256,6 +256,19 @@
$this->fetchBySelect($this->BuildListSQL("all"));
}
+ private function DomainInitialized($d)
+ {
+ if(is_object($d))
+ {
+ $res_class = $d->get("obj_prefix")."_Resource";
+ if(class_exists($res_class))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
private function DoDomainInit($d)
{
if(is_object($d))
@@ -314,14 +327,15 @@
return false;
}
- function getCurrentDomain()
+ function getCurrentDomain($bAutoInit = true)
{
$c = getCurrentCategory();
$d = $this->ItemByField("category_id",$c);
if(is_object($d))
{
+ if($bAutoInit)
$this->DoDomainInit($d);
- return $d;
+ return $d;
}
return false;
}
Modified: modules/core/clsDomainSysTags.php
===================================================================
--- modules/core/clsDomainSysTags.php 2011-02-24 18:11:16 UTC (rev 19)
+++ modules/core/clsDomainSysTags.php 2011-02-25 22:45:07 UTC (rev 20)
@@ -6,6 +6,65 @@
parent::__construct("dsys");
}
+ function _domain_selected($attribs)
+ {
+ global $objDomains;
+
+ $ret = "";
+ if(!strlen(GetArrayValue($attribs,"_truetext",GetArrayValue($attribs,"_falsetext"))))
+ $attribs["truetext"] = "true";
+
+ $d = $objDomains->getCurrentDomain();
+ if(is_object($d))
+ {
+ $domain = GetArrayValue($attribs,"_domain","");
+ if(!strlen($domain))
+ {
+ $ret = GetArrayValue($attribs,"_truetext","");
+ }
+ else
+ {
+ if(strtolower($domain)==strtolower($d->get("name")))
+ {
+ $ret = GetArrayValue($attribs,"_truetext","");
+ }
+ else
+ $ret = GetArrayValue($attribs,"_falsetext","");
+ }
+ }
+ else
+ $ret = GetArrayValue($attribs,"_falsetext","");
+
+ return $ret;
+ }
+
+ function _domain_include($attribs)
+ {
+ global $objDomains, $objTemplate;
+
+ $ret = "";
+ $tpl = "";
+ $d = $objDomains->getCurrentDomain();
+ if(is_object($d))
+ {
+ $domain = GetArrayValue($attribs,"_domain","");
+ if(!strlen($domain))
+ {
+ $tpl = GetArrayValue($attribs,"_template","");
+ }
+ else
+ {
+ if(strtolower($domain)==strtolower($d->get("name")))
+ {
+ $tpl = GetArrayValue($attribs,"_template","");
+ }
+ }
+ }
+ $ret = $objTemplate->ParseTemplate($tpl);
+
+ return $ret;
+ }
+
function _item_include($attribs)
{
global $objCurrentItem, $objCurrentObject, $objDomains;
Modified: modules/identity/identity.php
===================================================================
--- modules/identity/identity.php 2011-02-24 18:11:16 UTC (rev 19)
+++ modules/identity/identity.php 2011-02-25 22:45:07 UTC (rev 20)
@@ -5,6 +5,7 @@
private $ResourceLists;
private $Affiliations;
private $Credentials;
+ private $accounts;
function __construct($id=null)
{
@@ -106,10 +107,10 @@
$this->Relations = array (
new clsRelation("IdentityAddress","id","identity_id","Address","clsIdentityAddressList"),
new clsRelation("IdentityEmail","id","identity_id","Email","clsIdentityEmailList"),
- new clsRelation("IdentityAffiliation","id","identity_id","Affiliation","clsIdentityAffiliationList"),
- new clsRelation("Account","id","identity_id","Account","clsAccountList"),
+ //new clsRelation("IdentityAffiliation","id","identity_id","Affiliation","clsIdentityAffiliationList"),
+ //new clsRelation("Account","id","identity_id","Account","clsAccountList"),
//new clsRelation("Account","id","identity_id","Sponsored","clsAccountList","sponsor","identity_id","account_id"),
- new clsRelation("IdentityGroup","id","group_id","IdentityGroup","clsIdentityGroupList"),
+ //new clsRelation("IdentityGroup","id","group_id","IdentityGroup","clsIdentityGroupList"),
new clsRelation("IdentityCredential","id","identity_id","IdentityCredential","clsIdentityCredentialList")
);
@@ -155,7 +156,7 @@
$this->fetch($id);
}
$this->ResourceLists = array();
-
+ $this->accounts = null;
}
@@ -310,6 +311,28 @@
}
return $ret;
}
+
+ public function Accounts($list_type="all")
+ {
+ global $objDomains;
+
+ if(!is_object($this->accounts))
+ {
+ $d = $objDomains->getCurrentDomain();
+ if(is_object($d))
+ {
+ $lst = $d->getDomainObjectList("Account");
+ $lst->IdentityAccounts($list_type,$this->get("id"));
+ $lst->SetObjectContext("Identity",$this->get("id"));
+ $this->accounts = $lst;
+ }
+ else
+ {
+ $this->accounts = null;
+ }
+ }
+ return $this->accounts;
+ }
public function Affiliations($list_type="all")
{
@@ -412,10 +435,38 @@
$ret = "";
$lst = $this->Affiliations(GetArrayValue($attribs,"_listtype","all"));
if(is_object($lst))
- $ret = $list->_pagenav($attribs);
+ $ret = $lst->_pagenav($attribs);
return $ret;
}
+ protected function _accounts($attribs,$extra_attribs="")
+ {
+ $ret = "";
+ $lst = $this->Accounts(GetArrayValue($attribs,"_listtype","all"));
+ if(is_object($lst))
+ $ret = $lst->ParseListTemplate($attribs);
+ return $ret;
+ }
+
+ protected function _num_accounts($attribs,$extra_attribs="")
+ {
+ $ret = "";
+ $lst = $this->Accounts(GetArrayValue($attribs,"_listtype","all"));
+ if(is_object($lst))
+ $ret = (int)$lst->ListCount;
+ return $ret;
+ }
+
+ protected function _accounts_pagenav($attribs,$extra_attribs="")
+ {
+ $ret = "";
+ $lst = $this->Accounts(GetArrayValue($attribs,"_listtype","all"));
+ if(is_object($lst))
+ $ret = $lst->_pagenav($attribs);
+ return $ret;
+ }
+
+
protected function _credentials($attribs,$extra_attribs="")
{
$ret = "";
@@ -439,7 +490,7 @@
$ret = "";
$lst = $this->Credentials(GetArrayValue($attribs,"_listtype","all"));
if(is_object($lst))
- $ret = $list->_pagenav($attribs);
+ $ret = $lst->_pagenav($attribs);
return $ret;
}
@@ -484,6 +535,33 @@
return $ret;
}
+ protected function _domain_include($attribs)
+ {
+ global $objDomains, $objTemplate;
+
+ $ret = "";
+ $tpl = "";
+ $d = $objDomains->getCurrentDomain();
+ if(is_object($d))
+ {
+ $domain = GetArrayValue($attribs,"_domain","");
+ if(!strlen($domain))
+ {
+ $tpl = GetArrayValue($attribs,"_template","");
+ }
+ else
+ {
+ if(strtolower($domain)==strtolower($d->get("name")))
+ {
+ $tpl = GetArrayValue($attribs,"_template","");
+ }
+ }
+ }
+ $ret = $this->ParseTemplate($tpl);
+
+ return $ret;
+ }
+
function GetDefaultText()
{
return $this->get("firstname")." ".$this->get("lastname");
@@ -509,6 +587,8 @@
}
}
+ else
+ $obj = parent::NewRelationObject($RelName,$ContextName,$ContextValue);
return $obj;
}
@@ -565,15 +645,14 @@
global $objDomains;
$d = $objDomains->getCurrentDomain();
- if(is_object($d))
- {
- $Rel = $this->GetNamedRelation($RelName);
- if(is_object($Rel))
- {
- $classname = $Rel->ClassName;
- $classname = $d->getDomainClassName($classname);
- }
- }
+
+ $Rel = $this->GetNamedRelation($RelName);
+ if(is_object($Rel))
+ {
+ $classname = $Rel->ClassName;
+ if(is_object($d))
+ $classname = $d->getDomainClassName($classname);
+ }
return $classname;
}
Modified: www/css/list.css
===================================================================
--- www/css/list.css 2011-02-24 18:11:16 UTC (rev 19)
+++ www/css/list.css 2011-02-25 22:45:07 UTC (rev 20)
@@ -115,6 +115,16 @@
padding-top: 3px;
}
+.list-node_search, .list-node_sort
+{
+ padding-right: 15px;
+}
+
+.list-node_paging
+{
+ padding-right: 30px;
+}
+
.list-node_buttons
{
float:none;
@@ -137,8 +147,46 @@
margin-left: 3px;
margin-bottom: 0;
padding: 0;
-}
+}
+.list-node_paging_left
+{
+ height: 16px;
+ width: 8px;
+ display: inline;
+
+
+}
+
+.list-node_paging_right
+{
+ height: 16px;
+ width: 8px;
+ display: inline;
+
+}
+
+.list-node_paging_center
+{
+ height: 16px;
+ display: inline;
+}
+.list-node_paging_center a
+{
+ padding-top: 4px;
+ padding-bottom: 4px;
+ padding-left: 2px;
+ padding-right: 2px;
+ line-height: 15px;
+ color: #222;
+ text-decoration: none;
+}
+
+.list-node_paging_center .current-page
+{
+ font-weight: bold;
+}
+
.list-node_items
{
/*margin-left: 20px;*/
Added: www/tpl/admin/custom_fields/field_item.tpl
===================================================================
--- www/tpl/admin/custom_fields/field_item.tpl (rev 0)
+++ www/tpl/admin/custom_fields/field_item.tpl 2011-02-25 22:45:07 UTC (rev 20)
@@ -0,0 +1,49 @@
+ <tr class="autoCustomFieldFormRow">
+ <td>
+ <a href="#" class="autoCustomFieldEditLink"><img src="images/pencil.png" /></a>
+ <a href="#" class="autoCustomFieldDeleteLink"><img src="images/delete.png" /></a>
+ <input type="hidden" name="field[<item:field _Field="name" />][childclass]" value="<item:field _Field="object_name" />" />
+ <input type="hidden" name="field[<item:field _Field="name" />][category_id]" value="<item:field _Field="category_id" />" />
+ </td>
+ <td>
+ <span class="autoCustomFieldView"><item:field _Field="name" /></span>
+ <span class="autoCustomFieldEdit">
+ <input type="text" name="field[<item:field _Field="name" />][name]" value="<item:field _Field="name" />" />
+ </span>
+ </td>
+
+ <td>
+ <span class="autoCustomFieldView"><item:field _Field="label" /></span>
+ <span class="autoCustomFieldEdit">
+ <input type="text" name="field[<item:field _Field="name" />][label]" value="<item:field _Field="label" />" />
+ </span>
+ </td>
+ <td>
+ <span class="autoCustomFieldView"><item:field _field="field_type_string" /></span>
+ <span class="autoCustomFieldEdit">
+ <select class="autoCustomFieldTypeSelect" name="field[<item:field _Field="name" />][datatype]">
+ <item:field _Field="field_type_options" />
+ </select>
+ <div class="autoCustomFieldDataSizeVarChar" style="<item:field _Field="is_varchar" _FalseText="display: none;" />">
+ Length:
+ <input type="text" size="4" name="field[<item:field _Field="name" />][datasize]" value="<item:field _Field="datasize" />" />
+ </div>
+ <div class="autoCustomFieldDataSizeEnum" style="<item:field _Field="is_enum" _FalseText="display: none;" />">
+ Values (one per line):<br />
+ <textarea class="autoCustomFieldDataSizeEnumTextArea" name="field[<item:field _Field="name" />][values]" rows="3" cols="10"><item:field _Field="enum_values" /></textarea>
+ </div>
+ </span>
+ </td>
+ <td>
+ <span class="autoCustomFieldView"><item:field _Field="section" /></span>
+ <span class="autoCustomFieldEdit">
+ <input type="text" name="field[<item:field _Field="name" />][section]" value="<item:field _Field="section" />" />
+ </span>
+ </td>
+ <td>
+ <span class="autoCustomFieldView"><item:field _Field="display_order" /></span>
+ <span class="autoCustomFieldEdit">
+ <input type="text" size="3" name="field[<item:field _Field="name" />][display_order]" value="<item:field _Field="display_order" />" />
+ </span>
+ </td>
+ </tr>
\ No newline at end of file
Added: www/tpl/admin/custom_fields/section_item_close.tpl
===================================================================
--- www/tpl/admin/custom_fields/section_item_close.tpl (rev 0)
+++ www/tpl/admin/custom_fields/section_item_close.tpl 2011-02-25 22:45:07 UTC (rev 20)
@@ -0,0 +1,2 @@
+</table>
+</div>
Added: www/tpl/admin/custom_fields/section_item_open.tpl
===================================================================
--- www/tpl/admin/custom_fields/section_item_open.tpl (rev 0)
+++ www/tpl/admin/custom_fields/section_item_open.tpl 2011-02-25 22:45:07 UTC (rev 20)
@@ -0,0 +1,19 @@
+<div class="item_customfield_container">
+ <table class="item_customfields_master" style="display: none;">
+ <item:this _Field="field_template" _Template="common/misc/dialog_customfields/field_item.tpl" />
+ </table>
+ <table class="item_cutomfields">
+ <tr class="autoCustomFieldsHeader autoFormSectionHeader">
+ <td colspan="6">
+ <span style="float: right;margin-right: 4px;"><a href="#" ClassName="<item:this _Field="classname" />" class="autoCustomFieldAddLink">add new field</a></span>
+ Custom Field Definitions - <item:this _Field="itemname" />
+ </td>
+ </tr>
+ <tr class="autoCustomFieldsColumnHeader">
+ <td></td>
+ <td>Field Name</td>
+ <td>Field Label</td>
+ <td>Field Type</td>
+ <td>Dialog Section</td>
+ <td>Display Order</td>
+ </tr>
\ No newline at end of file
Modified: www/tpl/common/items/identity.tpl
===================================================================
--- www/tpl/common/items/identity.tpl 2011-02-24 18:11:16 UTC (rev 19)
+++ www/tpl/common/items/identity.tpl 2011-02-25 22:45:07 UTC (rev 20)
@@ -16,13 +16,9 @@
<div class="list-node" ajaxTemplate="<item:this _Field="link" _Parser="item.php" _Template="nodes/identity/address.tpl" />"></div>
<div class="list-node" ajaxTemplate="<item:this _Field="link" _Parser="item.php" _Template="nodes/identity/email.tpl" />"></div>
-
- <div class="list-node" ajaxTemplate="<item:this _Field="link" _Parser="item.php" _Template="nodes/identity/affiliation.tpl" />"></div>
<div class="list-node" ajaxTemplate="<item:this _Field="link" _Parser="item.php" _Template="nodes/identity/credential.tpl" />"></div>
- <div class="list-node" ajaxTemplate="<item:this _Field="link" _Parser="item.php" _Template="nodes/identity/resources.tpl" />"></div>
-
- <div class="list-node" ajaxTemplate="<item:this _Field="link" _Parser="item.php" _Template="nodes/identity/account.tpl" />"></div>
+ <item:this _Field="domain_include" _Template="common/items/identity_domain_items.tpl" />
</div>
</div>
\ No newline at end of file
Added: www/tpl/common/items/identity_domain_items.tpl
===================================================================
--- www/tpl/common/items/identity_domain_items.tpl (rev 0)
+++ www/tpl/common/items/identity_domain_items.tpl 2011-02-25 22:45:07 UTC (rev 20)
@@ -0,0 +1,5 @@
+ <div class="list-node" ajaxTemplate="<item:this _Field="link" _Parser="item.php" _Template="nodes/identity/affiliation.tpl" />"></div>
+
+ <div class="list-node" ajaxTemplate="<item:this _Field="link" _Parser="item.php" _Template="nodes/identity/resources.tpl" />"></div>
+
+ <div class="list-node" ajaxTemplate="<item:this _Field="link" _Parser="item.php" _Template="nodes/identity/account.tpl" />"></div>
Modified: www/tpl/common/misc/list_controls/identity_main.tpl
===================================================================
--- www/tpl/common/misc/list_controls/identity_main.tpl 2011-02-24 18:11:16 UTC (rev 19)
+++ www/tpl/common/misc/list_controls/identity_main.tpl 2011-02-25 22:45:07 UTC (rev 20)
@@ -25,6 +25,8 @@
<a href="<sys:thispage _Template="common/misc/ajax_feedback.tpl" _Params="List[List]=Identity_main&action=list:vars" />" CurrentOrder="<list:var _Var="SortOrder" _Item="Identity" _ListType="main" />" class="list-node_sort_order"><img src="images/list_sort_toggle.png" /></a>
</div>
<div class="list-node_paging">
- Page: <dlist:pagenav _Item="Identity" _ListType="main" _HideEmpty="true" />
+ <div class="list-node_paging_left"> </div>
+ <div class="list-node_paging_center">Page: <list:pagenav _Item="Identity" _ListType="main" _HideEmpty="true" /></div>
+ <div class="list-node_paging_right"> </div>
</div>
</div>
\ No newline at end of file
Modified: www/tpl/common/misc/list_controls.tpl
===================================================================
--- www/tpl/common/misc/list_controls.tpl 2011-02-24 18:11:16 UTC (rev 19)
+++ www/tpl/common/misc/list_controls.tpl 2011-02-25 22:45:07 UTC (rev 20)
@@ -18,6 +18,8 @@
</select>
</div>
<div class="list-node_paging">
- Page: <dlist:pagenav _ListType="main" _HideEmpty="true" />
+ <div class="list-node_paging_left"></div>
+ <div class="list-node_paging_center">Page: <dlist:pagenav _ListType="main" _HideEmpty="true" /></div>
+ <div class="list-node_paging_right"></div>
</div>
</div>
\ No newline at end of file
Modified: www/tpl/nodes/identity/account.tpl
===================================================================
--- www/tpl/nodes/identity/account.tpl 2011-02-24 18:11:16 UTC (rev 19)
+++ www/tpl/nodes/identity/account.tpl 2011-02-25 22:45:07 UTC (rev 20)
@@ -1,6 +1,6 @@
<!-- template: nodes/identity/account.tpl -->
<div class="list-node_header" AddAction="account">
- <h2>Account</h2> (<item:this _Field="+rel:num_items" _Relation="Account" _ListType="main" />)
+ <h2>Account</h2> (<item:this _Field="num_accounts" _ListType="main" />)
<item:this _Field="rel_item_template" _Template="common/misc/list_node_buttons.tpl" _RelatedItem="Account" />
<div class="list-node_controls">
<div class="list-node_search">
@@ -32,7 +32,7 @@
</a>
</div>
<div class="list-node_paging">
- Page: <item:this _Field="+rel:pagenav" _Relation="Account" _ListType="main" _HideEmpty="true" />
+ Page: <item:this _Field="accounts_pagenav" _Relation="Account" _ListType="main" _HideEmpty="true" />
</div>
</div>
</div>
Modified: www/tpl/nodes/identity/address.tpl
===================================================================
--- www/tpl/nodes/identity/address.tpl 2011-02-24 18:11:16 UTC (rev 19)
+++ www/tpl/nodes/identity/address.tpl 2011-02-25 22:45:07 UTC (rev 20)
@@ -25,14 +25,16 @@
<item:this _Object="Address" _Field="sort_option_list" _ListType="main" />
</select>
</form>
- <a href="<sys:thispage _Template="common/misc/ajax_feedback.tpl" _Params="List[List]=Address_main&action=list:vars" />"
+ <a href="<sys:thispage _Template="common/misc/ajax_feedback.tpl" _Params="List[List]=IdentityAddress_main&action=list:vars" />"
CurrentOrder="<item:this _Object="Address" _Field="list_var_value" _Var="SortOrder" _Item="Address" _ListType="main" />"
class="list-node_sort_order">
<img src="images/list_sort_toggle.png" />
</a>
</div>
<div class="list-node_paging">
- Page: <item:this _Field="+rel:pagenav" _Relation="Address" _ListType="main" _HideEmpty="true" />
+ <div class="list-node_paging_left"> </div>
+ <div class="list-node_paging_center">Page: <item:this _Field="+rel:pagenav" _Relation="Address" _ListType="main" _HideEmpty="true" /></div>
+ <div class="list-node_paging_right"> </div>
</div>
</div>
</div>
Modified: www/tpl/nodes/identity/ajax/account_list.tpl
===================================================================
--- www/tpl/nodes/identity/ajax/account_list.tpl 2011-02-24 18:11:16 UTC (rev 19)
+++ www/tpl/nodes/identity/ajax/account_list.tpl 2011-02-25 22:45:07 UTC (rev 20)
@@ -1,3 +1,3 @@
<!-- template: nodes/identity/ajax/account_list.tpl -->
-<item:this _Field="+rel:items" _Relation="Account" _ListType="main" _ItemTemplate="common/items/account.tpl" />
+<item:this _Field="accounts" _ListType="main" _ItemTemplate="common/items/account.tpl" />
<!-- end: nodes/identity/ajax/account_list.tpl -->
\ No newline at end of file
Modified: www/tpl/nodes/identity/ajax/address_list.tpl
===================================================================
--- www/tpl/nodes/identity/ajax/address_list.tpl 2011-02-24 18:11:16 UTC (rev 19)
+++ www/tpl/nodes/identity/ajax/address_list.tpl 2011-02-25 22:45:07 UTC (rev 20)
@@ -1,2 +1,3 @@
-<!-- Template: nodes/identity/ajax/address_list.tpl -->
-<item:this _Field="+rel:items" _Relation="Address" _ListType="main" _ItemTemplate="common/items/identity_address.tpl" />
\ No newline at end of file
+<!-- template: nodes/identity/ajax/address_list.tpl -->
+<item:this _Field="+rel:items" _Relation="Address" _ListType="main" _ItemTemplate="common/items/identity_address.tpl" />
+<!-- end: nodes/identity/ajax/address_list.tpl -->
\ No newline at end of file
Modified: www/tpl/nodes/identity/ajax/resource_list.tpl
===================================================================
--- www/tpl/nodes/identity/ajax/resource_list.tpl 2011-02-24 18:11:16 UTC (rev 19)
+++ www/tpl/nodes/identity/ajax/resource_list.tpl 2011-02-25 22:45:07 UTC (rev 20)
@@ -1 +1,3 @@
+<!-- template: nodes/identity/ajax/resource_list.tpl -->
<item:this _Field="resources" _ListType="main" _ItemTemplate="common/items/resource.tpl" />
+<!-- end: nodes/identity/ajax/resource_list.tpl -->
\ No newline at end of file
Modified: www/tpl/nodes/identity/credential.tpl
===================================================================
--- www/tpl/nodes/identity/credential.tpl 2011-02-24 18:11:16 UTC (rev 19)
+++ www/tpl/nodes/identity/credential.tpl 2011-02-25 22:45:07 UTC (rev 20)
@@ -29,7 +29,7 @@
<input type=hidden name="action" value="list:vars" />
<select class="list-sort_select" name="List[SortCol]">
<option value=""></option>
- <item:this _Object="Account" _Field="sort_option_list" _ListType="main" />
+ <item:this _Object="IdentityCredential" _Field="sort_option_list" _ListType="main" />
</select>
</form>
<a href="<sys:thispage _Template="common/misc/ajax_feedback.tpl" _Params="List[List]=IdentityCredential_main&action=list:vars" />"
Modified: www/tpl/nodes/identity/email.tpl
===================================================================
--- www/tpl/nodes/identity/email.tpl 2011-02-24 18:11:16 UTC (rev 19)
+++ www/tpl/nodes/identity/email.tpl 2011-02-25 22:45:07 UTC (rev 20)
@@ -1,8 +1,7 @@
<!-- Template: nodes/identity/email.tpl -->
<div class="list-node_header" AddAction="email">
<h2>Email</h2> (<item:this _Field="+rel:num_items" _Relation="Email" _ListType="main" />)
- <item:this _Field="rel_item_template" _Template="common/misc/list_node_buttons.tpl" _RelatedItem="Email" />
-
+ <item:this _Field="rel_item_template" _Template="common/misc/list_node_buttons.tpl" _RelatedItem="Email" />
<div class="list-node_controls">
<div class="list-node_search">
<form name="identity_searchlist" id="<item:this _Object="Email" _Field="classname" />_searchlist" method="POST" style="display:inline" action="<item:this _Field="link" _Template="nodes/identity/address.tpl" />">
@@ -26,7 +25,7 @@
<item:this _Object="Email" _Field="sort_option_list" _ListType="main" />
</select>
</form>
- <a href="<sys:thispage _Template="common/misc/ajax_feedback.tpl" _Params="List[List]=Address_main&action=list:vars" />"
+ <a href="<sys:thispage _Template="common/misc/ajax_feedback.tpl" _Params="List[List]=Email_main&action=list:vars" />"
CurrentOrder="<item:this _Field="list_var_value" _Var="SortOrder" _Item="Email" _ListType="main" />"
class="list-node_sort_order">
<img src="images/list_sort_toggle.png" />
1
0
r19 - bin core core/db core/itembase domains/mcs modules/identity modules/mysql www www/js/events www/tpl/admin/custom_fields www/tpl/common/misc www/tpl/common/misc/dialog_customfields
by cwalker@mcs.anl.gov 24 Feb '11
by cwalker@mcs.anl.gov 24 Feb '11
24 Feb '11
Author: cwalker
Date: 2011-02-24 12:11:16 -0600 (Thu, 24 Feb 2011)
New Revision: 19
Modified:
bin/import.php
core/db/clsDBItem.php
core/db/clsDBParsedItem.php
core/db/clsMysqlActionHandler.php
core/helpers.php
core/itembase/clsParsedItemBase.php
domains/mcs/resource_group.php
modules/identity/identity.php
modules/mysql/resource_group.php
www/item.php
www/js/events/dialog_boxes.js
www/tpl/admin/custom_fields/object_fields.tpl
www/tpl/common/misc/dialog_customfields/section_item_close.tpl
www/tpl/common/misc/dialog_customfields/section_item_open.tpl
www/tpl/common/misc/dialog_form.tpl
Log:
Custom field definitions and custom field values are kept in the userbase core database, and the item classes needed to use the core's database object to load and save custom fields and values instead of its own DB object, since it may or may not be a domain object. $objDB is an instance of the core's database connection object, so it can be used by any object in the system.
Additionally, since the list of custom fields that belong to an object vary depending on the context, it's important to pass the context name & value along when submitting the edit dialog. This wasn't happening, and as such context custom fields were not being loaded or saved. Moving forward, it will be especially good to pay attention to the context settings (which are on the query string as Context and ContextValue).
All this was discovered when context custom fields were enabled for the ResourceGroup->Resource relationship. The UI for editing custom fields also had a minor issue when there were multiple custom field lists on a page, that was corrected too
Modified: bin/import.php
===================================================================
--- bin/import.php 2011-02-24 00:42:09 UTC (rev 18)
+++ bin/import.php 2011-02-24 18:11:16 UTC (rev 19)
@@ -290,7 +290,7 @@
$objID->AddRelatedObject("Account",$anl_acct);
$ad = array();
$ad["authority"] = "ANL";
- //$anl_acct->AddCredential($anlpw,$ad);
+ $anl_acct->AddCredential($anlpw,$ad);
}
}
}
Modified: core/db/clsDBItem.php
===================================================================
--- core/db/clsDBItem.php 2011-02-24 00:42:09 UTC (rev 18)
+++ core/db/clsDBItem.php 2011-02-24 18:11:16 UTC (rev 19)
@@ -973,14 +973,20 @@
function LoadCustomFields()
{
- global $objCurrentCategory;
+ global $objCurrentCategory, $objDomains, $objDB;
+
$this->CustomFields = array();
if($this->bEnableCustomFields)
{
if(strlen($this->GetContextName())>0)
{
- $sql = "select * FROM custom_fields WHERE ((classname='".$this->className."' AND item_id=0) OR ";
- $sql .=" (classname='{$this->GetContextName()}' AND child_classname='{$this->className}' AND item_id={$this->GetContextValue()})";
+ $d = $objDomains->getCurrentDomain();
+ if(is_object($d))
+ {
+ $ContextClassName = $d->getDomainClassName($this->GetContextName());
+ }
+ $sql = "select * FROM custom_fields WHERE ((classname='".$this->className."' AND item_id=0) OR ";
+ $sql .=" (classname='$ContextClassName' AND child_classname='{$this->className}' AND item_id={$this->GetContextValue()})";
}
else
{
@@ -993,7 +999,9 @@
$r = $this->Relations[$x];
$obj = $this->NamedRelationObject($r->RelationName);
if(is_object($obj))
- $sql .= " OR (classname='{$r->ClassName}' AND child_classname='{$this->className}' AND item_id={$obj->get($r->ForeignField)})";
+ {
+ $sql .= " OR (classname='{$r->ClassName}' AND child_classname='{$this->className}' AND item_id='{$obj->get($r->ForeignField)}')";
+ }
}
}
if(is_object($objCurrentCategory))
@@ -1008,7 +1016,8 @@
else
$sql .= ") AND category_id=0";
//echo $sql."<br>\n";
- $rs = $this->doSelectSQL($sql);
+ $rs = $objDB->doSelectSQL($sql);
+
foreach($rs as $r)
{
$c = new clsCustomField();
@@ -1049,7 +1058,7 @@
{
$f = $this->NewFieldObject($field_name,array(
'value'=>$this->get($field_name),
- 'dataype'=>$cf->get("datatype"),
+ 'datatype'=>$cf->get("datatype"),
'datasize'=>$cf->get("datasize"),
'label'=>$cf->get("label"),
'section'=>$cf->get("section"),
@@ -1093,16 +1102,7 @@
function CustomDataExists($field_name)
{
- if(array_key_exists($field_name,$this->CustomData))
- {
-
- return true;
- }
- else
- {
- //echo $field_name." not found in ".implode(",",array_keys($this->CustomData))."<br>\n";
- return false;
- }
+ return (array_key_exists($field_name,$this->CustomData));
}
function PrintCustomValues()
@@ -1113,37 +1113,24 @@
}
}
- function fetchByCustomDataValue($field,$value)
- {
- $t = $this->table;
- $sql = "select $t.* FROM custom_values INNER JOIN custom_fields ON (custom_values.custom_field_id=custom_fields.id) ";
- $sql .="INNER JOIN $t ON ($t.".$this->primaryKey."=custom_values.item_id) ".
- $sql .="WHERE custom_fields.classname='".$this->className." AND custom_fields.name='$field' custom_values.value='$value'";
- return $this->fetchBySQL($sql);
- }
-
function LoadCustomData()
{
+ global $objDB;
+
//echo "Load custom data:<br>\n";
if(count($this->CustomData)==0 && $this->HasCustomFields())
{
+ $ids = array();
+ foreach($this->CustomFields as $name=>$f)
+ {
+ $ids[] = $f->get("id");
+ }
$sql = "select custom_values.*,custom_fields.name as custom_name,custom_fields.id as field_id FROM custom_values ";
$sql .= "INNER JOIN custom_fields ON ";
- $sql .="(custom_values.custom_field_id=custom_fields.id) WHERE custom_values.item_id='".$this->get($this->primaryKey)."' AND";
- $sql .="((custom_fields.classname='".$this->className."' AND custom_fields.item_id=0)";
- if($this->getPK())
- {
- for($x=0;$x<count($this->Relations);$x++)
- {
- $r = $this->Relations[$x];
- $obj = $this->NamedRelationObject($r->RelationName);
- if(is_object($obj))
- $sql .= " OR (custom_fields.classname='{$r->ClassName}' AND custom_fields.child_classname='{$this->className}' AND custom_fields.item_id={$obj->get($r->ForeignField)})";
- }
- }
- $sql .= ")";
+ $sql .="(custom_values.custom_field_id=custom_fields.id) WHERE custom_values.item_id='".$this->get($this->primaryKey)."' AND ";
+ $sql .="custom_fields.id IN (".implode(",",$ids).")";
//echo $sql;
- $rs = $this->doSelectSQL($sql);
+ $rs = $objDB->doSelectSQL($sql);
foreach($rs as $r)
{
$custom_data = new clsCustomData();
@@ -1239,13 +1226,14 @@
function DeleteCustomData($name)
{
+ global $objDB;
if($this->HasCustomFields())
{
$field = $this->CustomFields[$name];
if(is_object($field))
{
$sql = "DELETE FROM custom_values WHERE custom_field_id=".$field->get("id")." AND item_id=".$this->get($this->primaryKey);
- $this->doDeleteSQL($sql);
+ $objDB->doDeleteSQL($sql);
}
unset($this->CustomData[$name]);
}
Modified: core/db/clsDBParsedItem.php
===================================================================
--- core/db/clsDBParsedItem.php 2011-02-24 00:42:09 UTC (rev 18)
+++ core/db/clsDBParsedItem.php 2011-02-24 18:11:16 UTC (rev 19)
@@ -429,6 +429,23 @@
return $ret;
}
+ protected function _list_relation_customfields($attribs,$extra_attribs="")
+ {
+ global $objItemDelegates;
+
+ $ret = "";
+ foreach($this->Relations as $rel)
+ {
+ if($rel->CustomFieldsEnabled())
+ {
+ $attribs["_relation"] = $rel->RelationName;
+ $ItemRel = $objItemDelegates->GetDelegateObject("+rel",$this);
+ $ret .= $ItemRel->_list_customfields($attribs);
+ }
+ }
+ return $ret;
+ }
+
protected function _list_customfields($attributes)
{
$header_tpl = GetArrayValue($attributes,"_headertemplate","");
Modified: core/db/clsMysqlActionHandler.php
===================================================================
--- core/db/clsMysqlActionHandler.php 2011-02-24 00:42:09 UTC (rev 18)
+++ core/db/clsMysqlActionHandler.php 2011-02-24 18:11:16 UTC (rev 19)
@@ -311,9 +311,16 @@
}
if(is_array($data))
{
- $item = new $this->ItemClassName($ItemId);
- $org = new $this->ItemClassName($ItemId);
+ $item = new $this->ItemClassName();
+ if(pageHasContext())
+ $item->SetContext(GetArrayValue($_GET,"Context",""),GetArrayValue($_GET,"ContextValue",0));
+ $item->fetch($ItemId);
+ $org = new $this->ItemClassName();
+ if(pageHasContext())
+ $org->SetContext(GetArrayValue($_GET,"Context",""),GetArrayValue($_GET,"ContextValue",0));
+ $org->fetch($ItemId);
+
$item->fillFromArray($data);
$id = $item->commit();
if(!$id)
@@ -331,7 +338,7 @@
setUserFeedback($this->ItemName." \"".$item->GetDefaultText()."\" Added.");
}
$this->handlefileUploads($item);
- $this->handleItemCustomFields($item,GetArrayValue($_POST,"fields",array()));
+ $this->handleItemCustomFields($item,GetArrayValue($_POST,"field",array()));
$org->LogChanges($item,"edit");
}
}
Modified: core/helpers.php
===================================================================
--- core/helpers.php 2011-02-24 00:42:09 UTC (rev 18)
+++ core/helpers.php 2011-02-24 18:11:16 UTC (rev 19)
@@ -23,6 +23,12 @@
return false;
}
+function pageHasContext()
+{
+ $c = GetArrayValue($_GET,"Context","");
+ return (strlen($c)>0);
+}
+
function file_upload_error_message($error_code) {
switch ($error_code) {
case UPLOAD_ERR_INI_SIZE:
Modified: core/itembase/clsParsedItemBase.php
===================================================================
--- core/itembase/clsParsedItemBase.php 2011-02-24 00:42:09 UTC (rev 18)
+++ core/itembase/clsParsedItemBase.php 2011-02-24 18:11:16 UTC (rev 19)
@@ -560,23 +560,6 @@
return $ret;
}
- protected function _list_relation_customfields($attribs,$extra_attribs="")
- {
- global $objItemDelegates;
-
- $ret = "";
- foreach($this->Relations as $rel)
- {
- if($rel->CustomFieldsEnabled())
- {
- $attribs["_relation"] = $rel->RelationName;
- $ItemRel = $objItemDelegates->GetDelegateObject("+rel",$this);
- $ret .= $ItemRel->_list_customfields($attribs);
- }
- }
- return $ret;
- }
-
protected function _relation_toolbar($attribs,$extra_attribs="")
{
return $this->GetRelationToolbar();
Modified: domains/mcs/resource_group.php
===================================================================
--- domains/mcs/resource_group.php 2011-02-24 00:42:09 UTC (rev 18)
+++ domains/mcs/resource_group.php 2011-02-24 18:11:16 UTC (rev 19)
@@ -14,7 +14,7 @@
'name'=>array('datatype'=>VARCHAR,'datasize'=>255,'label'=>"name",'section'=>"General",'display_order'=>1),
'parent_id'=>array('datatype'=>INTEGER,'datasize'=>4,'label'=>"Parent Group",'section'=>"General",'display_order'=>2),
'updated'=>array('datatype'=>BOOL,'datasize'=>array('No','Yes')),
- 'gid'=>array('datatype'=>INTEGER,'datasize'=>4,'label'=>"gid",'section'=>"General",'display_order'=>5),
+ //'gid'=>array('datatype'=>INTEGER,'datasize'=>4,'label'=>"gid",'section'=>"General",'display_order'=>5),
'state'=>array('datatype'=>ENUM,'datasize'=>array('requested','denied','approved','active','suspended','inactive','deleted'),'label'=>"State",'section'=>"General",'display_order'=>4),
'description'=>array('datatype'=>TEXT,'datasize'=>0,'label'=>"Description",'section'=>"General",'display_order'=>6)
);
@@ -27,6 +27,7 @@
new clsRelation("MCS_ResourceGroup","parent_id","id","ParentGroup"),
new clsRelation("MCS_ResourceGroup","id","parent_id","Children","MCS_clsResourceGroupList")
);
+ $this->EnableRelationCustomFields("Resource");
parent::__construct($id);
$this->SetFieldDefaultValue("state","inactive");
$this->SetFieldExtraDef("id","AUTO_INCREMENT");
Modified: modules/identity/identity.php
===================================================================
--- modules/identity/identity.php 2011-02-24 00:42:09 UTC (rev 18)
+++ modules/identity/identity.php 2011-02-24 18:11:16 UTC (rev 19)
@@ -42,7 +42,7 @@
'label'=>"Preferred Name",
'section'=>"General",
'display_order'=>5),
- 'us_citizen'=>array('datatype'=>BOOL,
+/* 'us_citizen'=>array('datatype'=>BOOL,
'datasize'=>array('No','Yes'),
'label'=>"US Citizen",
'section'=>"General",
@@ -51,7 +51,7 @@
'datasize'=>4,
'label'=>"Badge Number",
'section'=>"Argonne",
- 'display_order'=>7),
+ 'display_order'=>7),*/
'anl_contact'=> array('datatype'=>INTEGER,
'datasize'=>4,
'label'=>"ANL Contact",
Modified: modules/mysql/resource_group.php
===================================================================
--- modules/mysql/resource_group.php 2011-02-24 00:42:09 UTC (rev 18)
+++ modules/mysql/resource_group.php 2011-02-24 18:11:16 UTC (rev 19)
@@ -11,7 +11,7 @@
function __construct($id=null)
{
- $this->InitResourceList();
+ $this->InitResourceList();
parent::__construct($id);
}
Modified: www/item.php
===================================================================
--- www/item.php 2011-02-24 00:42:09 UTC (rev 18)
+++ www/item.php 2011-02-24 18:11:16 UTC (rev 19)
@@ -28,11 +28,12 @@
if(is_object($d))
{
$objCurrentObject = $d->getDomainObject($obj,0);
- $objCurrentItem = $d->getDomainObject($obj,$id);
+ $objCurrentItem = $d->getDomainObject($obj);
if(is_object($objCurrentItem))
{
$objCurrentItem->SetContext(GetArrayValue($_GET,"Context",""),GetArrayValue($_GET,"ContextValue",""));
+ $objCurrentItem->fetch($id);
if((int)$objCurrentItem->getPK() != $id)
{
if(GetArrayValue($_GET,"response_type","")!="xml")
@@ -45,7 +46,9 @@
}
elseif(class_exists($obj))
{
- $objCurrentItem = new $obj($id);
+ $objCurrentItem = new $obj();
+ $objCurrentItem->SetContext(GetArrayValue($_GET,"Context",""),GetArrayValue($_GET,"ContextValue",""));
+ $objCurrentItem->fetch($id);
if((int)$objCurrentItem->get("id") != (int)$id)
{
if(GetArrayValue($_GET,"response_type","")!="xml")
Modified: www/js/events/dialog_boxes.js
===================================================================
--- www/js/events/dialog_boxes.js 2011-02-24 00:42:09 UTC (rev 18)
+++ www/js/events/dialog_boxes.js 2011-02-24 18:11:16 UTC (rev 19)
@@ -10,11 +10,11 @@
return s;
}
-function addNewCustomField(table)
+function addNewCustomField(table,master_table)
{
var d = new Date();
var field_num = d.getHours().toString()+d.getMinutes().toString()+d.getSeconds().toString()+d.getMilliseconds().toString();
- var h = $('#item_customfields_master').html();
+ var h = master_table.html();
h = h.replace(/^\s+|\s+$/g,"");
h = h.replace(/\[_new_\]/g,'['+field_num+']');
h=h.replace('<tbody>','');
@@ -166,8 +166,7 @@
$('.autoCustomFieldAddLink').live('click',function(event) {
event.preventDefault();
- addNewCustomField($(this).closest('table.item_cutomfields'));
- //alert('No Implmented! Custom field must be added through the database');
+ addNewCustomField($(this).closest('table.item_cutomfields'),$(this).closest('div.item_customfield_container').children('table.item_customfields_master'));
});
$('.autoCustomFieldDeleteLink').live('click',function(event) {
Modified: www/tpl/admin/custom_fields/object_fields.tpl
===================================================================
--- www/tpl/admin/custom_fields/object_fields.tpl 2011-02-24 00:42:09 UTC (rev 18)
+++ www/tpl/admin/custom_fields/object_fields.tpl 2011-02-24 18:11:16 UTC (rev 19)
@@ -1,13 +1,8 @@
<item:this _Field="custom_fields_enabled">
- <div class="custom_field_list">
- <table id="item_customfields_master" style="display: none;">
- <item:this _Field="field_template" _Template="common/misc/dialog_customfields/field_item.tpl" />
- </table>
- <table class="item_cutomfields">
- <item:this _Field="list_customfields"
- _FieldTemplate="common/misc/dialog_customfields/field_item.tpl"
- _headertemplate="common/misc/dialog_customfields/section_item_open.tpl"
- _footertemplate="common/misc/dialog_customfields/section_item_close.tpl" />
- </table>
+ <div class="custom_field_list">
+ <item:this _Field="list_customfields"
+ _FieldTemplate="admin/custom_fields/field_item.tpl"
+ _headertemplate="admin/custom_fields/section_item_open.tpl"
+ _footertemplate="admin/custom_fields/section_item_close.tpl" />
</div>
</item:this>
\ No newline at end of file
Modified: www/tpl/common/misc/dialog_customfields/section_item_close.tpl
===================================================================
--- www/tpl/common/misc/dialog_customfields/section_item_close.tpl 2011-02-24 00:42:09 UTC (rev 18)
+++ www/tpl/common/misc/dialog_customfields/section_item_close.tpl 2011-02-24 18:11:16 UTC (rev 19)
@@ -1,2 +1,2 @@
</table>
-
+</div>
Modified: www/tpl/common/misc/dialog_customfields/section_item_open.tpl
===================================================================
--- www/tpl/common/misc/dialog_customfields/section_item_open.tpl 2011-02-24 00:42:09 UTC (rev 18)
+++ www/tpl/common/misc/dialog_customfields/section_item_open.tpl 2011-02-24 18:11:16 UTC (rev 19)
@@ -1,14 +1,19 @@
-<tr class="autoCustomFieldsHeader autoFormSectionHeader">
- <td colspan="6">
- <span style="float: right;margin-right: 4px;"><a href="#" ClassName="<item:this _Field="classname" />" class="autoCustomFieldAddLink">add new field</a></span>
- Custom Field Definitions - <item:this _Field="itemname" />
- </td>
-</tr>
-<tr class="autoCustomFieldsColumnHeader">
- <td></td>
- <td>Field Name</td>
- <td>Field Label</td>
- <td>Field Type</td>
- <td>Dialog Section</td>
- <td>Display Order</td>
-</tr>
\ No newline at end of file
+<div class="item_customfield_container">
+ <table class="item_customfields_master" style="display: none;">
+ <item:this _Field="field_template" _Template="common/misc/dialog_customfields/field_item.tpl" />
+ </table>
+ <table class="item_cutomfields">
+ <tr class="autoCustomFieldsHeader autoFormSectionHeader">
+ <td colspan="6">
+ <span style="float: right;margin-right: 4px;"><a href="#" ClassName="<item:this _Field="classname" />" class="autoCustomFieldAddLink">add new field</a></span>
+ Custom Field Definitions - <item:this _Field="itemname" />
+ </td>
+ </tr>
+ <tr class="autoCustomFieldsColumnHeader">
+ <td></td>
+ <td>Field Name</td>
+ <td>Field Label</td>
+ <td>Field Type</td>
+ <td>Dialog Section</td>
+ <td>Display Order</td>
+ </tr>
\ No newline at end of file
Modified: www/tpl/common/misc/dialog_form.tpl
===================================================================
--- www/tpl/common/misc/dialog_form.tpl 2011-02-24 00:42:09 UTC (rev 18)
+++ www/tpl/common/misc/dialog_form.tpl 2011-02-24 18:11:16 UTC (rev 19)
@@ -1,20 +1,15 @@
<div class="adminFeedback"><sys:user_feedback /></div>
-<!-- <h2>Manage <autoform:objectplural />: Add/Edit <autoform:objectname /></h2> -->
- <form method="post" Validate="true" name="frmListDialog" id="frmListDialog" enctype="multipart/form-data" action="<item:this _Object="parent" _field="link" _Template="common/misc/ajax_feedback.tpl" />">
+ <form method="post" Validate="true" name="frmListDialog" id="frmListDialog" enctype="multipart/form-data" action="<item:this _Object="parent" _field="link" _Template="common/misc/ajax_feedback.tpl" />&Context=<sys:get_var _Var="Context" />&ContextValue=<sys:get_var _Var="ContextValue" />">
<input type="hidden" name="action" id="frmListDialogAction" value="" />
<input type="hidden" name="form[id]" value="<sys:current_item_detail _Field="id" />" />
<div id="tab_general" class="autoform_tab">
<autoform:render_section _FieldTemplate="admin/item/field_item.tpl" _SectionOpenTemplate="admin/item/section_item_open.tpl" _SectionCloseTemplate="admin/item/section_item_close.tpl" />
</div>
- <div id="tab_fields" class="autoform_tab">
- <table id="item_customfields_master" style="display: none;">
- <sys:current_item_detail _Field="field_template" _Template="common/misc/dialog_customfields/field_item.tpl" />
- </table>
- <table class="item_cutomfields">
- <sys:current_item_detail _Field="list_relation_customfields"
- _FieldTemplate="common/misc/dialog_customfields/field_item.tpl"
- _headertemplate="common/misc/dialog_customfields/section_item_open.tpl"
- _footertemplate="common/misc/dialog_customfields/section_item_close.tpl" />
- </table>
+ <div id="tab_fields" class="autoform_tab">
+ <sys:current_item_detail _Field="list_relation_customfields"
+ _FieldTemplate="common/misc/dialog_customfields/field_item.tpl"
+ _headertemplate="common/misc/dialog_customfields/section_item_open.tpl"
+ _footertemplate="common/misc/dialog_customfields/section_item_close.tpl" />
+
</div>
</form>
\ No newline at end of file
1
0
Author: cwalker
Date: 2011-02-23 18:42:09 -0600 (Wed, 23 Feb 2011)
New Revision: 18
Modified:
domains/mcs/account.php
domains/mcs/account_resource_credential.php
domains/mcs/affiliation.php
domains/mcs/identity_affiliation.php
domains/mcs/resource.php
domains/mcs/resource_group.php
modules/mysql/account.php
modules/mysql/account_resource_credential.php
modules/mysql/affiliation.php
modules/mysql/clsMysqlDomainItem.php
modules/mysql/identity_affiliation.php
modules/mysql/resource.php
modules/mysql/resource_group.php
modules/resource/module_init.php
Log:
Began structuring the API and class structure for MySQL-based domains. All core-related functionality (ie, domain objects interfacing with core objects) are moved to the MySQL_* base classes, and anything domain specific remains in the domain object. The interfaces for the objects have been deemed useless and removed, and instead class integrity is maintained by making the MySQL_* classes abstract, and declaring all required methods there.
It's worth noting that relationships between domain objects and core objects (ie, the resource object's relationship to IdentityCredential) is declared in the base class, while the domain specific ones (such as the account relationship) are declared in the domain object.
Additionally, the public action handlers are moved to the base, as there is nothing in them that can't be abstracted by the domain object. These action handler classes are subclassed by the domain, and must implement the corresponding interface (to ensure everything is declared properly).
Modified: domains/mcs/account.php
===================================================================
--- domains/mcs/account.php 2011-02-23 21:47:12 UTC (rev 17)
+++ domains/mcs/account.php 2011-02-24 00:42:09 UTC (rev 18)
@@ -1,6 +1,6 @@
<?php
-class MCS_Account extends Mysql_Account implements iAccount
+class MCS_Account extends Mysql_Account
{
private $credentials;
private $resource_credentials;
@@ -28,12 +28,10 @@
$this->Relations = array (
new clsRelation("MCS_Resource","id","id","Resource","clsResourceList","account_resource","account_id","resource_id"),
- new clsRelation("MCS_ResourceGroup","id","id","ResourceGroup","clsResourceGroupList","account_resourcegroup","account_id","resourcegroup_id"),
- new clsRelation("Identity","identity_id","id","Identity"),
- new clsRelation("MCS_AccountResourceCredential","id","account_id","AccountResourceCredential","MCS_clsAccountResourceCredentialList"),
+ new clsRelation("MCS_ResourceGroup","id","id","ResourceGroup","clsResourceGroupList","account_resourcegroup","account_id","resourcegroup_id"),
+ new clsRelation("MCS_AccountResourceCredential","id","account_id","AccountResourceCredential","MCS_clsAccountResourceCredentialList")
//new clsRelation("Identity","identity_id","id","Sponsor","clsIdentityList","sponsor","account_id","identity_id"),
- new clsRelation("IdentityCredential","id","id","Credential","clsIdentityCredentialList","account_credentials","account_id","identity_credential_id")
- );
+ );
$this->FieldDisplayTags = array();
@@ -56,57 +54,12 @@
return $this->get("username");
}
- /* methods required by iDomainItem */
- public function GetItem($id)
- {
- return $this->fetch($id);
- }
- public function SaveItem($data=array())
- {
- $this->fillFromArray($data);
- $this->commit();
- }
-
/* accepts a single credential or an array of credentials. Credentials can either be a credential object, or just an ID
* Not that we are not checking to see if the credential is already assigned to this resource, as we're relying on DB
* contstraints to take care of that..
* */
- public function AddIdentityCredential($c)
- {
- if(is_array($c))
- {
- foreach($c as $cred)
- {
- $this->AddResourceCredential($cred);
- }
- }
- if(is_object($c))
- {
- $this->AddRelatedObject("IdentityCredential",$c);
- }
- else
- {
- $cred = $this->NewRelationObject("IdentityCredential");
- $cred->fetch($c);
- $this->AddRelatedObject("IdentityCredential",$cred);
- }
- }
- public function RemoveIdentityCredential($c)
- {
- if(is_object($c))
- {
- $this->DeleteJoinRelation("IdentityCredential",$c);
- $credential_id = $c->get("id");
- }
- else
- {
- $cred = $this->NewRelationObject("IdentityCredential");
- $cred->fetch($c);
- $this->DeleteJoinRelation("IdentityCredential",$cred);
- }
- }
public function AssignCredential($objResource, $objIdentityCredential)
{
@@ -195,17 +148,6 @@
return $ret;
}
- /* methods required by iAccount */
- public function AddCredential($objIdentityCredential)
- {
- $this->AddRelatedObject("Credential",$objIdentityCredential);
- }
-
- public function RemoveCredential($objIdentityCredential)
- {
- $this->DeleteJoinRelation("Credential",$objIdentityCredential);
- }
-
/* checks to see if the account has at least one identity credential that the resource can accept */
public function HasAcceptedCredentials($objResource)
{
@@ -218,82 +160,7 @@
$this->commit();
}
- protected function _list_credentials($attribs)
- {
- $ret = "";
- $cl = $this->Credentials();
- if($cl->NumItems()>0)
- {
- $cl->SetObjectContext("Account",$this->get("id"));
- $ret = $cl->ParseListTemplate($attribs);
- }
- return $ret;
- }
-
- protected function _num_credentials($attribs)
- {
- $cl = $this->Credentials();
- return $cl->NumItems();
- }
-
- protected function _credential_pagenav($attribs)
- {
- $cl = $this->Credentials();
- return $cl->_pagenav($attribs);
- }
- protected function _resource_credentials($attribs)
- {
- $ret = "";
- if($this->IsContextType("Resource") && $this->GetContextValue()>0)
- {
- $cl = $this->ResourceCredentials($this->GetContextValue(),GetArrayValue($attribs,"_listtype","all"));
- if($cl->NumItems()>0)
- {
- $ret = $cl->ParseListTemplate($attribs);
- }
- }
- return $ret;
- }
-
- protected function _available_resource_credentials($attribs)
- {
- $ret = "";
- if($this->IsContextType("Resource") && $this->GetContextValue()>0)
- {
- $cl = $this->AvailableResourceCredentials($this->GetContextValue());
- if($cl->NumItems()>0)
- {
- $ret = $cl->ParseListTemplate($attribs);
- }
- }
- return $ret;
- }
-
- protected function _list_unassigned_credentials($attribs)
- {
- $ret = "";
- $cl = $this->Credentials();
- $rlist = new clsIdentityCredentialList();
- $objID = $this->NamedRelationObject("Identity");
- $idCredentials = $objID->Credentials();
- if($idCredentials->NumItems()>0)
- {
- foreach($idCredentials->Items as $idc)
- {
- if(!$cl->ItemExists("id",$idc->get("id")))
- {
- $rlist->AddObject($idc);
- }
- }
- }
- if($rlist->NumItems()>0)
- {
- $rlist->SetObjectContext("Account",$this->get("id"));
- $ret = $rlist->ParseListTemplate($attribs);
- }
- return $ret;
- }
}
class MCS_clsAccountList extends MySQL_clsAccountList
@@ -330,88 +197,13 @@
}
-class MCS_clsAccountActions extends clsUserbaseMysqlActionHandler
+class MCS_clsAccountActions extends MySQL_clsAccountActions
{
function __construct()
{
parent::__construct("MCS_clsAccountList","MCS_Account","Account","Accounts");
}
- function credential($AccountId=null,$CredentialId=null)
- {
- global $objDomains;
-
- if(is_null($AccountId) || (int)$AccountId==0)
- {
- $AccountId = getItemId();
- }
- if(!$CredentialId)
- {
- $data = $this->getFormData();
- $CredentialId = $data["credential_id"];
- }
- if((int)$AccountId>0 && (int)$CredentialId>0)
- {
- $d = $objDomains->getCurrentDomain();
- $acct = $d->getDomainObject("Account",$AccountId);
- $ic = $d->getDomainObject("IdentityCredential",$CredentialId);
- $acct->AddCredential($ic);
- }
- }
-
- function credential_remove($AccountId=null,$CredentialId=null)
- {
- global $objDomains;
-
- if(is_null($AccountId) || (int)$AccountId==0)
- {
- $AccountId = getItemId();
- }
- if(!is_array($data))
- {
- $data = $this->getFormData();
- }
- if((int)$AccountId>0)
- {
- if(count($data)>0)
- {
- $ItemId = GetArrayValue($data,"id",GetArrayValue($_GET,"CredentialId",0));
- $d = $objDomains->getCurrentDomain();
- $acct = $d->getDomainObject("Account",$AccountId);
- $ic = $d->getDomainObject("IdentityCredential",$ItemId);
- $acct->RemoveCredential($ic);
- }
- }
- }
-
- function identity_resource_credential_assign($AccountId=null,$ResourceId=null,$CredentialId=null)
- {
- global $objDomains;
-
- $d = $objDomains->getCurrentDomain();
- if(is_null($AccountId) || (int)$AccountId==0)
- {
- $AccountId = getItemId();
- }
- $data = $this->getFormData();
- if((is_null($ResourceId) || (int)$ResourceId==0))
- {
- $ResourceId = $data["resource_id"];
- }
- if(is_null($CredentialId))
- {
- $CredentialId = $data["credential_id"];
- }
-
- if($AccountId && $ResourceId && $CredentialId)
- {
- $acct = $d->getDomainObject("Account",$AccountId);
- $res = $d->getDomainObject("Resource",$ResourceId);
- $cred = $d->getDomainObject("IdentityCredential",$CredentialId);
- $acct->AssignCredential($res,$cred);
- setUserFeedback("Credential {$cred->getDefaultText()} assigned to resource {$res->getDefaultText()}");
- }
- }
}
?>
\ No newline at end of file
Modified: domains/mcs/account_resource_credential.php
===================================================================
--- domains/mcs/account_resource_credential.php 2011-02-23 21:47:12 UTC (rev 17)
+++ domains/mcs/account_resource_credential.php 2011-02-24 00:42:09 UTC (rev 18)
@@ -16,8 +16,7 @@
$this->className="MCS_AccountResourceCredential";
$this->Relations = array (
new clsRelation("MCS_Account","account_id","id","Account"),
- new clsRelation("MCS_Resource","resource_id","id","Resource"),
- new clsRelation("IdentityCredential","identity_credential_id","id","IdentityCredential")
+ new clsRelation("MCS_Resource","resource_id","id","Resource")
);
parent::__construct($id);
$this->SetFieldExtraDef("id","AUTO_INCREMENT");
@@ -32,10 +31,6 @@
return $this->get("id");
}
- function fetchByName($name)
- {
- return $this->fetchByValue(array("name"=>$name));
- }
}
class MCS_clsAccountResourceCredentialList extends MySQL_clsAccountResourceCredentialList
Modified: domains/mcs/affiliation.php
===================================================================
--- domains/mcs/affiliation.php 2011-02-23 21:47:12 UTC (rev 17)
+++ domains/mcs/affiliation.php 2011-02-24 00:42:09 UTC (rev 18)
@@ -5,10 +5,23 @@
function __construct($id=null)
{
$this->className="MCS_Affiliation";
+ $this->primaryKey = 'id';
+ $this->fieldDefs = array(
+ 'id' => array('datatype'=>INTEGER,'datasize'=>4),
+ 'name'=>array('datatype'=>VARCHAR,'datasize'=>255,'label'=>"Name",'section'=>"General",'display_order'=>1),
+ 'category'=>array('datatype'=>VARCHAR,'datasize'=>128,'label'=>"Category",'section'=>"General",'display_order'=>2)
+ );
+
$this->Relations = array (
new clsRelation("MCS_IdentityAffiliation","id","affiliation_id","AffiliationMember","MCS_clsIdentityAffliliationList"),
);
parent::__construct($id);
+ $this->SetFieldExtraDef("id","AUTO_INCREMENT");
+ $this->bClassFilePath = true; //include the class name & id in file paths
+ if($id)
+ {
+ $this->fetch($id);
+ }
}
function GetDefaultText()
@@ -16,10 +29,7 @@
return $this->get("name");
}
- function fetchByName($name)
- {
- return $this->fetchByValue(array("name"=>$name));
- }
+
}
class MCS_clsAffiliationList extends MySQL_clsAffiliationList
Modified: domains/mcs/identity_affiliation.php
===================================================================
--- domains/mcs/identity_affiliation.php 2011-02-23 21:47:12 UTC (rev 17)
+++ domains/mcs/identity_affiliation.php 2011-02-24 00:42:09 UTC (rev 18)
@@ -5,9 +5,27 @@
function __construct($id=null)
{
$this->className="MCS_IdentityAffiliation";
-
+ $this->primaryKey = 'id';
+ $this->fieldDefs = array(
+ 'id' => array('datatype'=>INTEGER,'datasize'=>4),
+ 'identity_id' => array('datatype'=>INTEGER,'datasize'=>4),
+ 'affiliation_id' => array('datatype'=>INTEGER,
+ 'datasize'=>4,
+ 'label'=>"Affiliation",
+ 'section'=>"General",
+ 'display_order'=>1),
+ 'title' => array('datatype'=>VARCHAR,
+ 'datasize'=>255,
+ 'label'=>"Title",
+ 'section'=>"General",
+ 'display_order'=>2),
+ 'primary'=>array('datatype'=>BOOL,
+ 'datasize'=>array('No','Yes'),
+ 'label'=>"Primary Affiliation",
+ 'section'=>"General",
+ 'display_order'=>3)
+ );
$this->Relations = array (
- new clsRelation("Identity","identity_id","id","Identity"),
new clsRelation("MCS_Affiliation","affiliation_id","id","Affiliation","MCS_clsAffiliationList")
);
@@ -15,6 +33,14 @@
"main"=>array("title")
);
parent::__construct($id);
+ $this->SetFieldExtraDef("id","AUTO_INCREMENT");
+ $a = $this->GetNamedRelation("Affiliation");
+ $this->fields["affiliation_id"]->form_element = new clsFormElement("select",null,"","","","MCS_clsAffiliationList","GetSelectList");
+ $this->bClassFilePath = true; //include the class name & id in file paths
+ if($id)
+ {
+ $this->fetch($id);
+ }
}
function GetDefaultText()
Modified: domains/mcs/resource.php
===================================================================
--- domains/mcs/resource.php 2011-02-23 21:47:12 UTC (rev 17)
+++ domains/mcs/resource.php 2011-02-24 00:42:09 UTC (rev 18)
@@ -1,6 +1,6 @@
<?php
-class MCS_Resource extends Mysql_Resource implements iResource
+class MCS_Resource extends Mysql_Resource
{
function __construct($id=null)
{
@@ -24,11 +24,7 @@
$this->Relations = array (
new clsRelation("MCS_ResourceGroup","id","id","ResourceGroup","MCS_clsResourceGroupList","group_resources","resource_id","group_id"),
- new clsRelation("MCS_Account","id","id","Account","MCS_clsAccountList","account_resource","resource_id","account_id"),
- new clsRelation("Credential","id","id","Credential","clsCredentialList","resource_credential","resource_id","credential_id"),
- new clsRelation("Identity","id","id","Identity","clsIdentityList","identity_resource","resource_id","identity_id"),
- new clsRelation("IdentityCredential","id","id","IdentityCredential","clsIdentityCredentialList","resource_identity_credentials","resource_id","identity_credential_id")
-
+ new clsRelation("MCS_Account","id","id","Account","MCS_clsAccountList","account_resource","resource_id","account_id")
);
$this->AllowedExportFields = array("name","id","url","public","needs_approval","state","description","full_name","brief_description","resource_info","requires_accounts","accepts_domain_pw");
parent::__construct($id);
@@ -40,97 +36,13 @@
$this->SetFieldExtraDef("id","AUTO_INCREMENT");
$this->bClassFilePath = true; //include the class name & id in file paths
$this->EnableRelationCustomFields("Account");
- }
-
- protected function _credentials($attribs,$extra_attribs)
- {
- $c = $this->Credentials(GetArrayValue($attribs,"_listtype","all"));
- return $c->ParseListTemplate($attribs);
- }
-
- protected function _num_credentials($attribs,$extra_attribs="")
- {
- $ret = "";
- $lst = $this->Credentials(GetArrayValue($attribs,"_listtype","all"));
- $ret = $lst->ListCount;
- return $ret;
- }
-
- protected function _identity_accounts($attribs,$extra_attribs="")
- {
- $ret ="";
- if($this->GetContextName()=="Identity" && $this->GetContextValue()>0)
+ if($id)
{
- $del = $this->GetItemDelegate("rel");
- $filter = array();
- $filter["identity_id"] = $this->GetContextValue();
- $attribs["_relation"] = "Account";
- $ret = $del->_items($attribs,$filter);
- }
- return $ret;
+ $this->fetch($id);
+ }
+
}
- protected function _identity_credentials($attribs,$extra_attribs="")
- {
- $ret ="";
- if($this->GetContextName()=="Identity" && $this->GetContextValue()>0)
- {
- $del = $this->GetItemDelegate("rel");
- $filter = array();
- $filter["identity_id"] = $this->GetContextValue();
- $attribs["_relation"] = "IdentityCredential";
- $ret = $del->_items($attribs,$filter);
- }
- return $ret;
- }
-
- protected function _identity_compatible_accounts($attribs,$extra_attribs="")
- {
- $ret ="";
- if($this->GetContextName()=="Identity" && $this->GetContextValue()>0)
- {
- $accounts = $this->CompatibleAccounts(GetArrayValue($attribs,"_Listtype","all"),$this->GetContextValue());
- $ret = $accounts->ParseListTemplate($attribs);
- }
- return $ret;
- }
-
- protected function _num_identity_accounts($attribs,$extra_attribs="")
- {
- $ret = "";
- if($this->GetContextName()=="Identity" && $this->GetContextValue()>0)
- {
- $del = $this->GetItemDelegate("rel");
- $filter = array();
- $filter["identity_id"] = $this->GetContextValue();
- $attribs["_relation"] = "Account";
- $ret = $del->_num_items($attribs,$filter);
- }
- return $ret;
- }
-
- protected function _accounts($attribs,$extra_attribs="")
- {
- $ret ="";
- if($this->GetContextName()!="Identity")
- {
- $accounts = $this->Accounts(GetArrayValue($attribs,"_listtype","all"));
- $ret = $accounts->ParseListTemplate($attribs);
- }
- return $ret;
- }
-
- protected function _num_accounts($attribs,$extra_attribs="")
- {
- $ret = "";
- if($this->GetContextName()!="Identity")
- {
- $accounts = $this->Accounts(GetArrayValue($attribs,"_Listtype","all"));
- $ret = $accounts->ListCount;
- }
- return $ret;
- }
-
public function GetDefaultText()
{
return $this->get("name");
@@ -171,6 +83,8 @@
$this->doSQL($sql);
}
+
+
public function AddAccount($a)
{
if(is_array($a))
@@ -205,48 +119,8 @@
$acct->fetch($a);
$this->DeleteJoinRelation("Account",$acct);
}
- }
-
- /* accepts a single credential or an array of credentials. Credentials can either be a credential object, or just an ID
- * Not that we are not checking to see if the credential is already assigned to this resource, as we're relying on DB
- * contstraints to take care of that..
- * */
- public function AddCredential($c)
- {
- if(is_array($c))
- {
- foreach($c as $cred)
- {
- $this->AddCredential($cred);
- }
- }
- if(is_object($c))
- {
- $this->AddRelatedObject("Credential",$c);
- }
- else
- {
- $cred = $this->NewRelationObject("Credential");
- $cred->fetch($c);
- $this->AddRelatedObject("Credential",$cred);
- }
}
- public function RemoveCredential($c)
- {
- if(is_object($c))
- {
- $this->DeleteJoinRelation("Credential",$c);
- $credential_id = $c->get("id");
- }
- else
- {
- $cred = $this->NewRelationObject("Credential");
- $cred->fetch($c);
- $this->DeleteJoinRelation("Credential",$cred);
- }
- }
-
@@ -346,7 +220,7 @@
}
}
-class MCS_clsResourceList extends MySQL_clsResourceList implements iResourceList
+class MCS_clsResourceList extends MySQL_clsResourceList
{
var $objDataList;
@@ -453,155 +327,12 @@
}
-class MCS_clsResourceActions extends clsUserbaseMysqlActionHandler
+class MCS_clsResourceActions extends MySQL_clsResourceActions implements iResourceAPI
{
function __construct()
{
parent::__construct("MCS_clsResourceList","MCS_Resource","MCS_Resource","MCS_Resources");
}
-
- public function add($GroupId=null,$data=null)
- {
- if(is_null($GroupId) && getArrayValue($_GET,"Context","")=="MCS_ResourceGroup")
- {
- $GroupId = getArrayValue($_GET,"ContextValue",0);
- }
- if(is_null($data))
- {
- $data = $this->getFormData();
- }
- if(is_array($data))
- {
- global $objDomains;
- $d = $objDomains->getCurrentDomain();
- if(is_object($d))
- {
- $r = $d->getDomainObject("Resource");
- $r->fillFromArray($data);
- $id = $r->commit();
- if($id)
- {
- setUserFeedback($this->ItemName." \"".$item->GetDefaultText()."\" Added.");
- $this->handlefileUploads($item);
- if($GroupId)
- {
- $grp = $d->getDomainObject("ResourceGroup",$GroupId);
- $grp->AddResource($r);
- }
- }
- }
- }
- }
-
- public function edit($ResourceId=null,$data=null)
- {
- parent::edit($ResourceId,$data);
- }
-
- public function identity_remove($IdentityId=null,$ResourceId=null)
- {
- if(is_null($IdentityId) && GetArrayValue($_GET,"Context","")=="Identity")
- {
- $IdentityId = GetArrayValue($_GET,"ContextValue",0);
- }
- if(is_null($ResourceId))
- {
- $ResourceId = getItemId();
- }
- if($IdentityId && $ResourceId)
- {
- global $objDomains;
- $d = $objDomains->getCurrentDomain();
- if(is_object($d))
- {
- $r = $d->getDomainObject("Resource",$ResourceId);
- $r->RemoveFromIdentity($IdentityId);
- $objID = new Identity($IdentityId);
- setUserFeedback("Resource {$r->getDefaultText()} removed from Identity {$objID->getDefaultText()}");
- }
- }
- }
-
- public function assign_credentials($ResourceId=null,$credentials=null)
- {
- global $objDomains;
- if(is_null($ResourceId))
- {
- $ResourceId = getItemId();
- }
- if($ResourceId>0)
- {
- if(is_null($credentials))
- {
- $form = $this->getFormData();
- $credentials = array_keys(getArrayValue($form,"credentials",array()));
- }
- elseif(!is_array($credentials))
- {
- $t = $credentials;
- $credentials[] = $t;
- }
-
- $d = $objDomains->getCurrentDomain();
- $res = $d->getDomainObject("Resource",$ResourceId);
- foreach($credentials as $c)
- {
- if(is_object($c)) //a resource object was passed in
- {
- $res->AddCredential($c);
- $count++;
- setUserFeedback("Assigned credential \"{$c->getDefaultText()}\" to {$res->GetDefaultText()}");
- }
- else
- {
- $d = $objDomains->getCurrentDomain();
- $r = $d->getDomainObject("Credential",$c);
- $res->AddCredential($r);
- setUserFeedback("Assigned credential \"{$r->getDefaultText()}\" to {$res->GetDefaultText()}");
- }
- }
- }
- }
-
- protected function resource_wizard()
- {
- global $objDomains,$objItemDelegates;
- $ResourceId = getItemId();
-
- $data = GetArrayValue($_POST,"form",array());
- $fields = GetArrayValue($_POST,"field",array());
- $scripts = GetArrayValue($_POST,"script",array());
- //echo "<pre>";print_r($scripts); echo "</pre>";
- $credentials = GetArrayValue($data,"credentials",array());
-
- $d = $objDomains->getCurrentDomain();
- $res = $d->getDomainObject("Resource",$ResourceId);
-
- $res->fillFromArray($data);
- $res->commit();
-
- if(count($credentials)>0)
- $res->AddCredential(array_keys($credentials));
- $this->handleItemCustomFields($res,$fields);
-
- $script_ids = array();
- $script_count = count(GetArrayValue($scripts,"name",array()));
- if($script_count>0)
- {
- $objScriptDelegate = $objItemDelegates->GetDelegateObject("script",$res);
- for($x=0;$x<$script_count;$x++)
- {
- $s = array();
- foreach(array_keys($scripts) as $f)
- {
- $s[$f] = $scripts[$f][$x];
- }
- $script_ids[] = $objScriptDelegate->SaveScript($s);
- }
- }
- $objScriptDelegate->ClearDeletedScripts($script_ids);
- }
-
}
?>
\ No newline at end of file
Modified: domains/mcs/resource_group.php
===================================================================
--- domains/mcs/resource_group.php 2011-02-23 21:47:12 UTC (rev 17)
+++ domains/mcs/resource_group.php 2011-02-24 00:42:09 UTC (rev 18)
@@ -1,9 +1,9 @@
<?php
-class MCS_ResourceGroup extends Mysql_ResourceGroup implements iResourceGroup
+class MCS_ResourceGroup extends Mysql_ResourceGroup
{
- private $ResourceList;
+
function __construct($id=null)
{
$this->className="MCS_ResourceGroup";
@@ -20,12 +20,7 @@
);
$this->table = $this->className;
-
$this->FieldDisplayTags = array();
-
- $this->uiListColumns = array(
- "resource_resourcegroup"=>array("group_id","gid","state")
- );
$this->Relations = array (
new clsRelation("MCS_Resource","id","id","Resource","MCS_clsResourceList","group_resources","group_id","resource_id"),
@@ -41,7 +36,6 @@
{
$this->fetch($id);
}
- $this->InitResourceList();
}
public function fetchByName($n)
@@ -49,72 +43,6 @@
return $this->fetchByValue(array("name"=>$n));
}
- private function InitResourceList()
- {
- global $objDomains;
- $d = $objDomains->getCurrentDomain();
-
- $this->ResourceList = new MCS_clsResourceList(); // $d->getDomainObjectList("Resource");
- }
-
- protected function _children($attribs,$extra_attribs)
- {
- $c = $this->Children(GetArrayValue($attribs,"_listtype","all"));
- return $c->ParseListTemplate($attribs);
- }
-
- protected function _num_children($attribs,$extra_attribs="")
- {
- $ret = "";
- $lst = $this->Children(GetArrayValue($attribs,"_listtype","all"));
- $ret = $lst->ListCount;
- return $ret;
- }
-
- protected function _resources($attribs,$extra_attribs)
- {
- $doPaging = (GetArrayValue($attribs,"_paging","true") != "false");
- if($this->ResourceList->PagingEnabled() != $doPaging)
- {
- $this->InitResourceList();
- }
- $this->ResourceList->SetPaging($doPaging);
- $c = $this->Resources(GetArrayValue($attribs,"_listtype","all"));
- return $c->ParseListTemplate($attribs);
- }
-
- protected function _num_resources($attribs,$extra_attribs="")
- {
- $ret = "";
- $doPaging = (GetArrayValue($attribs,"_paging","true") != "false");
- if($this->ResourceList->PagingEnabled() != $doPaging)
- {
- $this->InitResourceList();
- }
- $this->ResourceList->SetPaging($doPaging);
- $this->Resources(GetArrayValue($attribs,"_listtype","all"));
- $ret = $this->ResourceList->ListCount;
- return $ret;
- }
-
- function GetDefaultText()
- {
- return $this->get("name");
- }
-
-
- /* methods required by iDomainItem */
- public function GetItem($id)
- {
- return $this->fetch($id);
- }
-
- public function SaveItem($data=array())
- {
- $this->fillFromArray($data);
- $this->commit();
- }
-
/* methods required by iResourceGroup */
public function AddResource($r)
{
Modified: modules/mysql/account.php
===================================================================
--- modules/mysql/account.php 2011-02-23 21:47:12 UTC (rev 17)
+++ modules/mysql/account.php 2011-02-24 00:42:09 UTC (rev 18)
@@ -1,12 +1,233 @@
<?php
-class Mysql_Account extends clsMysqlDomainItem
+abstract class Mysql_Account extends clsMysqlDomainItem
{
+ abstract public function Credentials();
+ abstract public function AvailableResourceCredentials($ResourceId);
+ abstract public function ResourceCredentials($ResourceId,$ListName="all",$filter=array());
+ abstract public function AssignToIdentity($identity_id);
+ abstract public function AssignCredential($objResource, $objIdentityCredential);
+ abstract public function HasAcceptedCredentials($objResource);
+
+ public function __construct($id=null)
+ {
+ $this->AddRelation("Identity","identity_id","id","Identity");
+ $this->AddRelation("IdentityCredential","id","id","Credential",
+ "clsIdentityCredentialList","account_credentials","account_id","identity_credential_id");
+
+ parent::__construct($id);
+ }
+
+ public function AddCredential($objIdentityCredential)
+ {
+ $this->AddRelatedObject("Credential",$objIdentityCredential);
+ }
+
+ public function RemoveCredential($objIdentityCredential)
+ {
+ $this->DeleteJoinRelation("Credential",$objIdentityCredential);
+ }
+
+ public function AddIdentityCredential($c)
+ {
+ if(is_array($c))
+ {
+ foreach($c as $cred)
+ {
+ $this->AddResourceCredential($cred);
+ }
+ }
+ if(is_object($c))
+ {
+ $this->AddRelatedObject("IdentityCredential",$c);
+ }
+ else
+ {
+ $cred = $this->NewRelationObject("IdentityCredential");
+ $cred->fetch($c);
+ $this->AddRelatedObject("IdentityCredential",$cred);
+ }
+ }
+
+ public function RemoveIdentityCredential($c)
+ {
+ if(is_object($c))
+ {
+ $this->DeleteJoinRelation("IdentityCredential",$c);
+ $credential_id = $c->get("id");
+ }
+ else
+ {
+ $cred = $this->NewRelationObject("IdentityCredential");
+ $cred->fetch($c);
+ $this->DeleteJoinRelation("IdentityCredential",$cred);
+ }
+ }
+
+ protected function _list_credentials($attribs)
+ {
+ $ret = "";
+ $cl = $this->Credentials();
+ if($cl->NumItems()>0)
+ {
+ $cl->SetObjectContext("Account",$this->get("id"));
+ $ret = $cl->ParseListTemplate($attribs);
+ }
+ return $ret;
+ }
+
+ protected function _num_credentials($attribs)
+ {
+ $cl = $this->Credentials();
+ return $cl->NumItems();
+ }
+
+ protected function _credential_pagenav($attribs)
+ {
+ $cl = $this->Credentials();
+ return $cl->_pagenav($attribs);
+ }
+ protected function _resource_credentials($attribs)
+ {
+ $ret = "";
+ if($this->IsContextType("Resource") && $this->GetContextValue()>0)
+ {
+ $cl = $this->ResourceCredentials($this->GetContextValue(),GetArrayValue($attribs,"_listtype","all"));
+ if($cl->NumItems()>0)
+ {
+ $ret = $cl->ParseListTemplate($attribs);
+ }
+ }
+ return $ret;
+ }
+
+ protected function _available_resource_credentials($attribs)
+ {
+ $ret = "";
+ if($this->IsContextType("Resource") && $this->GetContextValue()>0)
+ {
+ $cl = $this->AvailableResourceCredentials($this->GetContextValue());
+ if($cl->NumItems()>0)
+ {
+ $ret = $cl->ParseListTemplate($attribs);
+ }
+ }
+ return $ret;
+ }
+
+ protected function _list_unassigned_credentials($attribs)
+ {
+ $ret = "";
+ $cl = $this->Credentials();
+ $rlist = new clsIdentityCredentialList();
+ $objID = $this->NamedRelationObject("Identity");
+ $idCredentials = $objID->Credentials();
+ if($idCredentials->NumItems()>0)
+ {
+ foreach($idCredentials->Items as $idc)
+ {
+ if(!$cl->ItemExists("id",$idc->get("id")))
+ {
+ $rlist->AddObject($idc);
+ }
+ }
+ }
+ if($rlist->NumItems()>0)
+ {
+ $rlist->SetObjectContext("Account",$this->get("id"));
+ $ret = $rlist->ParseListTemplate($attribs);
+ }
+ return $ret;
+ }
}
class MySQL_clsAccountList extends clsMysqlDomainCollection
{
}
+
+class MySQL_clsAccountActions extends clsUserbaseMysqlActionHandler implements iAccountAPI
+{
+ function __construct()
+ {
+ parent::__construct("MCS_clsAccountList","MCS_Account","Account","Accounts");
+ }
+
+ function credential($AccountId=null,$CredentialId=null)
+ {
+ global $objDomains;
+
+ if(is_null($AccountId) || (int)$AccountId==0)
+ {
+ $AccountId = getItemId();
+ }
+ if(!$CredentialId)
+ {
+ $data = $this->getFormData();
+ $CredentialId = $data["credential_id"];
+ }
+ if((int)$AccountId>0 && (int)$CredentialId>0)
+ {
+ $d = $objDomains->getCurrentDomain();
+ $acct = $d->getDomainObject("Account",$AccountId);
+ $ic = $d->getDomainObject("IdentityCredential",$CredentialId);
+ $acct->AddCredential($ic);
+ }
+ }
+
+ function credential_remove($AccountId=null,$CredentialId=null)
+ {
+ global $objDomains;
+
+ if(is_null($AccountId) || (int)$AccountId==0)
+ {
+ $AccountId = getItemId();
+ }
+ if(!is_array($data))
+ {
+ $data = $this->getFormData();
+ }
+ if((int)$AccountId>0)
+ {
+ if(count($data)>0)
+ {
+ $ItemId = GetArrayValue($data,"id",GetArrayValue($_GET,"CredentialId",0));
+ $d = $objDomains->getCurrentDomain();
+ $acct = $d->getDomainObject("Account",$AccountId);
+ $ic = $d->getDomainObject("IdentityCredential",$ItemId);
+ $acct->RemoveCredential($ic);
+ }
+ }
+ }
+
+ function identity_resource_credential_assign($AccountId=null,$ResourceId=null,$CredentialId=null)
+ {
+ global $objDomains;
+
+ $d = $objDomains->getCurrentDomain();
+ if(is_null($AccountId) || (int)$AccountId==0)
+ {
+ $AccountId = getItemId();
+ }
+ $data = $this->getFormData();
+ if((is_null($ResourceId) || (int)$ResourceId==0))
+ {
+ $ResourceId = $data["resource_id"];
+ }
+ if(is_null($CredentialId))
+ {
+ $CredentialId = $data["credential_id"];
+ }
+
+ if($AccountId && $ResourceId && $CredentialId)
+ {
+ $acct = $d->getDomainObject("Account",$AccountId);
+ $res = $d->getDomainObject("Resource",$ResourceId);
+ $cred = $d->getDomainObject("IdentityCredential",$CredentialId);
+ $acct->AssignCredential($res,$cred);
+ setUserFeedback("Credential {$cred->getDefaultText()} assigned to resource {$res->getDefaultText()}");
+ }
+ }
+}
?>
\ No newline at end of file
Modified: modules/mysql/account_resource_credential.php
===================================================================
--- modules/mysql/account_resource_credential.php 2011-02-23 21:47:12 UTC (rev 17)
+++ modules/mysql/account_resource_credential.php 2011-02-24 00:42:09 UTC (rev 18)
@@ -4,6 +4,7 @@
{
function __construct($id=null)
{
+ $this->AddRelation("IdentityCredential","identity_credential_id","id","IdentityCredential");
parent::__construct($id);
}
Modified: modules/mysql/affiliation.php
===================================================================
--- modules/mysql/affiliation.php 2011-02-23 21:47:12 UTC (rev 17)
+++ modules/mysql/affiliation.php 2011-02-24 00:42:09 UTC (rev 18)
@@ -4,31 +4,23 @@
{
function __construct($id=null)
{
- $this->tagPrefix = "";
- $this->primaryKey = 'id';
- $this->fieldDefs = array(
- 'id' => array('datatype'=>INTEGER,'datasize'=>4),
- 'name'=>array('datatype'=>VARCHAR,'datasize'=>255,'label'=>"Name",'section'=>"General",'display_order'=>1),
- 'category'=>array('datatype'=>VARCHAR,'datasize'=>128,'label'=>"Category",'section'=>"General",'display_order'=>2)
- );
-
- $this->table = $this->className;
+
$this->FieldDisplayTags = array();
- parent::__construct();
- $this->SetFieldExtraDef("id","AUTO_INCREMENT");
- $this->bClassFilePath = true; //include the class name & id in file paths
- if($id)
- {
- $this->fetch($id);
- }
+ parent::__construct($id);
+
}
function GetDefaultText()
{
return $this->get("name");
}
+
+ function fetchByName($name)
+ {
+ return $this->fetchByValue(array("name"=>$name));
+ }
}
class MySQL_clsAffiliationList extends clsMysqlDomainCollection
Modified: modules/mysql/clsMysqlDomainItem.php
===================================================================
--- modules/mysql/clsMysqlDomainItem.php 2011-02-23 21:47:12 UTC (rev 17)
+++ modules/mysql/clsMysqlDomainItem.php 2011-02-24 00:42:09 UTC (rev 18)
@@ -16,6 +16,17 @@
}
+ public function GetItem($id)
+ {
+ return $this->fetch($id);
+ }
+
+ public function SaveItem($data=array())
+ {
+ $this->fillFromArray($data);
+ $this->commit();
+ }
+
protected function IsContextType($context_name)
{
global $objDomains;
Modified: modules/mysql/identity_affiliation.php
===================================================================
--- modules/mysql/identity_affiliation.php 2011-02-23 21:47:12 UTC (rev 17)
+++ modules/mysql/identity_affiliation.php 2011-02-24 00:42:09 UTC (rev 18)
@@ -3,42 +3,11 @@
class MySQL_IdentityAffiliation extends clsMysqlDomainItem
{
function __construct($id=null)
- {
- $this->tagPrefix = "";
- $this->primaryKey = 'id';
- $this->fieldDefs = array(
- 'id' => array('datatype'=>INTEGER,'datasize'=>4),
- 'identity_id' => array('datatype'=>INTEGER,'datasize'=>4),
- 'affiliation_id' => array('datatype'=>INTEGER,
- 'datasize'=>4,
- 'label'=>"Affiliation",
- 'section'=>"General",
- 'display_order'=>1),
- 'title' => array('datatype'=>VARCHAR,
- 'datasize'=>255,
- 'label'=>"Title",
- 'section'=>"General",
- 'display_order'=>2),
- 'primary'=>array('datatype'=>BOOL,
- 'datasize'=>array('No','Yes'),
- 'label'=>"Primary Affiliation",
- 'section'=>"General",
- 'display_order'=>3)
- );
-
- $this->table = $this->className;
+ {
+ $this->AddRelation("Identity","identity_id","id","Identity");
- $this->FieldDisplayTags = array();
+ parent::__construct($id);
- parent::__construct();
- $this->SetFieldExtraDef("id","AUTO_INCREMENT");
- $a = $this->GetNamedRelation("Affiliation");
- $this->fields["affiliation_id"]->form_element = new clsFormElement("select",null,"","","","MCS_clsAffiliationList","GetSelectList");
- $this->bClassFilePath = true; //include the class name & id in file paths
- if($id)
- {
- $this->fetch($id);
- }
}
function GetDefaultText()
Modified: modules/mysql/resource.php
===================================================================
--- modules/mysql/resource.php 2011-02-23 21:47:12 UTC (rev 17)
+++ modules/mysql/resource.php 2011-02-24 00:42:09 UTC (rev 18)
@@ -1,64 +1,312 @@
<?php
-class Mysql_Resource extends clsMysqlDomainItem
+abstract class Mysql_Resource extends clsMysqlDomainItem
{
+ abstract public function AddToIdentity($IdentityId);
+ abstract public function RemoveFromIdentity($IdentityId);
+ abstract public function AddAccount($a);
+ abstract public function RemoveAccount($a);
+ abstract public function CompatibleAccounts($ListType="",$IdentityId="");
+ abstract public function Accounts($ListType="",$IdentityId="");
+ abstract public function Credentials($ListType="all");
+ abstract public function ResourceGroups();
+ abstract public function AddToResourceGroup($r);
+ abstract public function RemoveFromResourceGroup($r);
+
function __construct($id=null)
+ {
+ /* here we define the relationships with the core objects */
+ $this->AddRelation("Credential","id","id","Credential","clsCredentialList","resource_credential","resource_id","credential_id");
+ $this->AddRelation("Identity","id","id","Identity","clsIdentityList","identity_resource","resource_id","identity_id");
+ $this->AddRelation("IdentityCredential","id","id","IdentityCredential","clsIdentityCredentialList","resource_identity_credentials","resource_id","identity_credential_id");
+
+ parent::__construct($id);
+ }
+
+ /* accepts a single credential or an array of credentials. Credentials can either be a credential object, or just an ID
+ * Note that we are not checking to see if the credential is already assigned to this resource, as we're relying on DB
+ * contstraints to take care of that..
+ * */
+ public function AddCredential($c)
{
-// $this->className="Resource";
-
- if(!strlen($this->table))
- $this->table = $this->className;
-
- $this->uiListColumns = array(
- "admin"=>array("name","brief_description","domain","state","needs_approval","public","url")
- );
-
- $this->uiRelations = array(
- "ResourceGroup"=> array("layout"=>"list",
- "tabButtonUrl"=>"images/admin/toolbar_resource_group.png",
- "addButtonUrl"=>"/images/admin/toolbar_list_add.png",
- "delButtonUrl"=>"/images/admin/toolbar_delete.png"),
- "Account"=> array("layout"=>"list",
- "tabButtonUrl"=>"images/admin/toolbar_person.png",
- "addButtonUrl"=>"/images/admin/toolbar_list_add.png",
- "delButtonUrl"=>"/images/admin/toolbar_delete.png"),
- "Credential" => array("layout"=>"list",
- "tabButtonUrl"=>"images/admin/toolbar_person.png",
- "addButtonUrl"=>"/images/admin/toolbar_list_add.png",
- "delButtonUrl"=>"/images/admin/toolbar_delete.png")
- );
-
- $this->FieldDisplayTags = array();
-
- parent::__construct();
-
- if($id)
+ if(is_array($c))
{
- $this->fetch($id);
+ foreach($c as $cred)
+ {
+ $this->AddCredential($cred);
+ }
}
+ if(is_object($c))
+ {
+ $this->AddRelatedObject("Credential",$c);
+ }
+ else
+ {
+ $cred = $this->NewRelationObject("Credential");
+ $cred->fetch($c);
+ $this->AddRelatedObject("Credential",$cred);
+ }
}
-
- public function GetDefaultText()
+
+ public function RemoveCredential($c)
{
- return $this->get("name");
+ if(is_object($c))
+ {
+ $this->DeleteJoinRelation("Credential",$c);
+ $credential_id = $c->get("id");
+ }
+ else
+ {
+ $cred = $this->NewRelationObject("Credential");
+ $cred->fetch($c);
+ $this->DeleteJoinRelation("Credential",$cred);
+ }
}
- /* methods required by iDomainItem */
- public function GetItem($id)
+ protected function _credentials($attribs,$extra_attribs)
{
- return $this->fetch($id);
+ $c = $this->Credentials(GetArrayValue($attribs,"_listtype","all"));
+ return $c->ParseListTemplate($attribs);
}
- public function SaveItem($data=array())
+ protected function _num_credentials($attribs,$extra_attribs="")
{
- $this->fillFromArray($data);
- return $this->commit();
+ $ret = "";
+ $lst = $this->Credentials(GetArrayValue($attribs,"_listtype","all"));
+ $ret = $lst->ListCount;
+ return $ret;
+ }
+
+ protected function _identity_accounts($attribs,$extra_attribs="")
+ {
+ $ret ="";
+ if($this->GetContextName()=="Identity" && $this->GetContextValue()>0)
+ {
+ $del = $this->GetItemDelegate("rel");
+ $filter = array();
+ $filter["identity_id"] = $this->GetContextValue();
+ $attribs["_relation"] = "Account";
+ $ret = $del->_items($attribs,$filter);
+ }
+ return $ret;
+ }
+
+ protected function _identity_credentials($attribs,$extra_attribs="")
+ {
+ $ret ="";
+ if($this->GetContextName()=="Identity" && $this->GetContextValue()>0)
+ {
+ $del = $this->GetItemDelegate("rel");
+ $filter = array();
+ $filter["identity_id"] = $this->GetContextValue();
+ $attribs["_relation"] = "IdentityCredential";
+ $ret = $del->_items($attribs,$filter);
+ }
+ return $ret;
}
+ protected function _identity_compatible_accounts($attribs,$extra_attribs="")
+ {
+ $ret ="";
+ if($this->GetContextName()=="Identity" && $this->GetContextValue()>0)
+ {
+ $accounts = $this->CompatibleAccounts(GetArrayValue($attribs,"_Listtype","all"),$this->GetContextValue());
+ $ret = $accounts->ParseListTemplate($attribs);
+ }
+ return $ret;
+ }
+
+ protected function _num_identity_accounts($attribs,$extra_attribs="")
+ {
+ $ret = "";
+ if($this->GetContextName()=="Identity" && $this->GetContextValue()>0)
+ {
+ $del = $this->GetItemDelegate("rel");
+ $filter = array();
+ $filter["identity_id"] = $this->GetContextValue();
+ $attribs["_relation"] = "Account";
+ $ret = $del->_num_items($attribs,$filter);
+ }
+ return $ret;
+ }
+
+ protected function _accounts($attribs,$extra_attribs="")
+ {
+ $ret ="";
+ if($this->GetContextName()!="Identity")
+ {
+ $accounts = $this->Accounts(GetArrayValue($attribs,"_listtype","all"));
+ $ret = $accounts->ParseListTemplate($attribs);
+ }
+ return $ret;
+ }
+
+ protected function _num_accounts($attribs,$extra_attribs="")
+ {
+ $ret = "";
+ if($this->GetContextName()!="Identity")
+ {
+ $accounts = $this->Accounts(GetArrayValue($attribs,"_Listtype","all"));
+ $ret = $accounts->ListCount;
+ }
+ return $ret;
+ }
}
abstract class MySQL_clsResourceList extends clsMysqlDomainCollection
{
}
+
+class MySQL_clsResourceActions extends clsUserbaseMysqlActionHandler
+{
+ function __construct()
+ {
+ parent::__construct("MCS_clsResourceList","MCS_Resource","MCS_Resource","MCS_Resources");
+ }
+
+ public function add($GroupId=null,$data=null)
+ {
+ if(is_null($GroupId) && getArrayValue($_GET,"Context","")=="MCS_ResourceGroup")
+ {
+ $GroupId = getArrayValue($_GET,"ContextValue",0);
+ }
+ if(is_null($data))
+ {
+ $data = $this->getFormData();
+ }
+ if(is_array($data))
+ {
+ global $objDomains;
+ $d = $objDomains->getCurrentDomain();
+ if(is_object($d))
+ {
+ $r = $d->getDomainObject("Resource");
+ $r->fillFromArray($data);
+ $id = $r->commit();
+ if($id)
+ {
+ setUserFeedback($this->ItemName." \"".$item->GetDefaultText()."\" Added.");
+ $this->handlefileUploads($item);
+ if($GroupId)
+ {
+ $grp = $d->getDomainObject("ResourceGroup",$GroupId);
+ $grp->AddResource($r);
+ }
+ }
+ }
+ }
+ }
+
+ public function edit($ResourceId=null,$data=null)
+ {
+ parent::edit($ResourceId,$data);
+ }
+
+ public function identity_remove($IdentityId=null,$ResourceId=null)
+ {
+ if(is_null($IdentityId) && GetArrayValue($_GET,"Context","")=="Identity")
+ {
+ $IdentityId = GetArrayValue($_GET,"ContextValue",0);
+ }
+ if(is_null($ResourceId))
+ {
+ $ResourceId = getItemId();
+ }
+ if($IdentityId && $ResourceId)
+ {
+ global $objDomains;
+ $d = $objDomains->getCurrentDomain();
+ if(is_object($d))
+ {
+ $r = $d->getDomainObject("Resource",$ResourceId);
+ $r->RemoveFromIdentity($IdentityId);
+ $objID = new Identity($IdentityId);
+ setUserFeedback("Resource {$r->getDefaultText()} removed from Identity {$objID->getDefaultText()}");
+ }
+ }
+ }
+
+ public function assign_credentials($ResourceId=null,$credentials=null)
+ {
+ global $objDomains;
+
+ if(is_null($ResourceId))
+ {
+ $ResourceId = getItemId();
+ }
+ if($ResourceId>0)
+ {
+ if(is_null($credentials))
+ {
+ $form = $this->getFormData();
+ $credentials = array_keys(getArrayValue($form,"credentials",array()));
+ }
+ elseif(!is_array($credentials))
+ {
+ $t = $credentials;
+ $credentials[] = $t;
+ }
+
+ $d = $objDomains->getCurrentDomain();
+ $res = $d->getDomainObject("Resource",$ResourceId);
+ foreach($credentials as $c)
+ {
+ if(is_object($c)) //a resource object was passed in
+ {
+ $res->AddCredential($c);
+ $count++;
+ setUserFeedback("Assigned credential \"{$c->getDefaultText()}\" to {$res->GetDefaultText()}");
+ }
+ else
+ {
+ $d = $objDomains->getCurrentDomain();
+ $r = $d->getDomainObject("Credential",$c);
+ $res->AddCredential($r);
+ setUserFeedback("Assigned credential \"{$r->getDefaultText()}\" to {$res->GetDefaultText()}");
+ }
+ }
+ }
+ }
+
+ protected function resource_wizard()
+ {
+ global $objDomains,$objItemDelegates;
+ $ResourceId = getItemId();
+
+ $data = GetArrayValue($_POST,"form",array());
+ $fields = GetArrayValue($_POST,"field",array());
+ $scripts = GetArrayValue($_POST,"script",array());
+ //echo "<pre>";print_r($scripts); echo "</pre>";
+ $credentials = GetArrayValue($data,"credentials",array());
+
+ $d = $objDomains->getCurrentDomain();
+ $res = $d->getDomainObject("Resource",$ResourceId);
+
+ $res->fillFromArray($data);
+ $res->commit();
+
+ if(count($credentials)>0)
+ $res->AddCredential(array_keys($credentials));
+ $this->handleItemCustomFields($res,$fields);
+
+ $script_ids = array();
+ $script_count = count(GetArrayValue($scripts,"name",array()));
+ if($script_count>0)
+ {
+ $objScriptDelegate = $objItemDelegates->GetDelegateObject("script",$res);
+ for($x=0;$x<$script_count;$x++)
+ {
+ $s = array();
+ foreach(array_keys($scripts) as $f)
+ {
+ $s[$f] = $scripts[$f][$x];
+ }
+ $script_ids[] = $objScriptDelegate->SaveScript($s);
+ }
+ }
+ $objScriptDelegate->ClearDeletedScripts($script_ids);
+ }
+}
+
?>
\ No newline at end of file
Modified: modules/mysql/resource_group.php
===================================================================
--- modules/mysql/resource_group.php 2011-02-23 21:47:12 UTC (rev 17)
+++ modules/mysql/resource_group.php 2011-02-24 00:42:09 UTC (rev 18)
@@ -1,21 +1,75 @@
<?php
-class Mysql_ResourceGroup extends clsMysqlDomainItem
+abstract class Mysql_ResourceGroup extends clsMysqlDomainItem
{
+ protected $ResourceList;
+ abstract public function AddResource($r);
+ abstract public function RemoveResource($r);
+ abstract public function RemoveAllResources();
+ abstract public function Children($ListType="");
+ abstract public function Resources($ListType="");
+
function __construct($id=null)
{
-// $this->className="ResourceGroup";
-
+ $this->InitResourceList();
parent::__construct($id);
+ }
+
+ protected function InitResourceList()
+ {
+ global $objDomains;
+ $d = $objDomains->getCurrentDomain();
+
+ //$this->ResourceList = new MCS_clsResourceList(); //
+ $this->ResourceList = $d->getDomainObjectList("Resource");
+ }
+
+ protected function _children($attribs,$extra_attribs)
+ {
+ $c = $this->Children(GetArrayValue($attribs,"_listtype","all"));
+ return $c->ParseListTemplate($attribs);
+ }
+
+ protected function _num_children($attribs,$extra_attribs="")
+ {
+ $ret = "";
+ $lst = $this->Children(GetArrayValue($attribs,"_listtype","all"));
+ $ret = $lst->ListCount;
+ return $ret;
+ }
+ protected function _resources($attribs,$extra_attribs)
+ {
+ $doPaging = (GetArrayValue($attribs,"_paging","true") != "false");
+ if($this->ResourceList->PagingEnabled() != $doPaging)
+ {
+ $this->InitResourceList();
+ }
+ $this->ResourceList->SetPaging($doPaging);
+ $c = $this->Resources(GetArrayValue($attribs,"_listtype","all"));
+ return $c->ParseListTemplate($attribs);
}
+ protected function _num_resources($attribs,$extra_attribs="")
+ {
+ $ret = "";
+ $doPaging = (GetArrayValue($attribs,"_paging","true") != "false");
+ if($this->ResourceList->PagingEnabled() != $doPaging)
+ {
+ $this->InitResourceList();
+ }
+ $this->ResourceList->SetPaging($doPaging);
+ $this->Resources(GetArrayValue($attribs,"_listtype","all"));
+ $ret = $this->ResourceList->ListCount;
+ return $ret;
+ }
+
protected function _list_name($attribs)
{
return "LISTNAME";
}
- function GetDefaultText()
+ public function GetDefaultText()
{
return $this->get("name");
}
Modified: modules/resource/module_init.php
===================================================================
--- modules/resource/module_init.php 2011-02-23 21:47:12 UTC (rev 17)
+++ modules/resource/module_init.php 2011-02-24 00:42:09 UTC (rev 18)
@@ -1,48 +1,21 @@
<?php
-interface iAccount extends iDomainItem
+
+interface iAccountAPI
{
- public function AddCredential($objIdentityCredential);
- public function RemoveCredential($objIdentityCredential);
+ function credential($AccountId=null,$CredentialId=null);
+ function credential_remove($AccountId=null,$CredentialId=null);
+ function identity_resource_credential_assign($AccountId=null,$ResourceId=null,$CredentialId=null);
}
-interface iResource extends iDomainItem
+interface iResourceAPI
{
- public function AddToResourceGroup($r);
- public function RemoveFromResourceGroup($r);
-
- public function AddToIdentity($IdentityId);
-
- public function AddAccount($a);
- public function RemoveAccount($a);
-
- public function AddCredential($c);
- public function RemoveCredential($c);
-
- public function ResourceGroups();
- public function Accounts($ListType="",$IdentityId="");
- public function Credentials($ListType="all");
+ function add($GroupId=null,$data=null);
+ function identity_remove($IdentityId=null,$ResourceId=null);
+ function assign_credentials($ResourceId=null,$credentials=null);
}
-interface iResourceTags
-{
- function _credentials($attribs,$extra_attribs);
- function _num_credentials($attribs,$extra_attribs="");
- function _identity_accounts($attribs,$extra_attribs="");
- function _num_identity_accounts($attribs,$extra_attribs="");
- function _accounts($attribs,$extra_attribs="");
- function _num_accounts($attribs,$extra_attribs="");
-}
interface iResourceList
{
public function IdentityResources($list_type,$identity_id);
}
-
-interface iResourceGroup extends iDomainItem
-{
- public function AddResource($r);
- public function RemoveResource($r);
-
- public function Children($ListType="");
- public function Resources($ListType="");
-}
1
0
r17 - core core/db core/delegates core/itembase core/logs core/objects core/tags core/user domains/mcs modules/core modules/identity modules/mysql system www www/css www/js www/js/events
by cwalker@mcs.anl.gov 23 Feb '11
by cwalker@mcs.anl.gov 23 Feb '11
23 Feb '11
Author: cwalker
Date: 2011-02-23 15:47:12 -0600 (Wed, 23 Feb 2011)
New Revision: 17
Added:
core/clsTemplateLogger.php
domains/mcs/account_resource_credential.php
modules/mysql/account_resource_credential.php
Modified:
core/clsCategoryBase.php
core/clsFormElement.php
core/clsTagLib.php
core/clsTemplate.php
core/db/CustomFields.php
core/db/clsDBField.php
core/db/clsDBItem.php
core/db/clsDBParsedItem.php
core/db/clsMysqlActionHandler.php
core/delegates/clsItemDelegateReg.php
core/delegates/item_autoform.php
core/delegates/item_relations.php
core/helpers.php
core/itembase/clsCollection.php
core/itembase/clsField.php
core/itembase/clsFieldParser.php
core/itembase/clsParsedItemBase.php
core/itembase/clsParser.php
core/loader.php
core/logs/clsLogEntry.php
core/objects/category.php
core/objects/configure.php
core/sessions.php
core/tags/system.php
core/user/group_base.php
core/user/permission_base.php
core/user/user_base.php
domains/mcs/account.php
domains/mcs/domain_init.php
domains/mcs/resource.php
modules/core/clsDomainBase.php
modules/core/clsItemEventActions.php
modules/core/event_script.php
modules/core/module_init.php
modules/identity/identity.php
modules/mysql/clsMysqlDomainItem.php
modules/mysql/module_init.php
system/loader.php
www/css/admin.css
www/css/auto_admin.css
www/item.php
www/js/common.js
www/js/events/dialog_boxes.js
www/js/events/node_lists.js
www/js/events/wizard.js
www/js/events/wizard_callbacks.js
Log:
This commit bring together many features which have been in progress for quite awhile:
- wizard dialogs have been created to add new resources, create identity credentials, assign resources to an identity, manage credentials for an account on a resource.
- wizards now support action scripts for any object which wants to use them
- admin to manage domains has been created. Note this just handles the database portion of creating a domain - the code must still be deployed, etc.
- Implemented an admin to manage custom fields at the object level, on a per-domain basis. (ie, it is possible to create a custom field for the Resouce object within the MCS domain.) It is also possible to create custom fields at the root level, effectively putting that field in all domains. This differs from context custom fields, which are defined for a given instance of an object (ie the 'Workstation' Resource.)
- Created an AccountResourceCredential object, which establishes the relationship between the Account, Resource, and IdentityCredential objects. This is the object that defines what credentials are assign to a resource for a given account.
- Created a generic AJAX template to export an item via XML. This will provide the basis for an access method for external consumers, but for now is only available to userbase itself.
- Deployed the DDL manager to system objects within the platform (ie clsCustomField, clsSession, etc) for consistency with domain objects
- Imported a template parser logging class, which allows for a tracing of the parsing engine
- Added a new system tag (<sys:list_objects />) which accepts a template attribute which is parsed by a generic instance of each object registered with the platform. This tag will be enhanced further to dynamicly build child nodes, allowing modules to create previously unknown associated objects.
Modified: core/clsCategoryBase.php
===================================================================
--- core/clsCategoryBase.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/clsCategoryBase.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -4,6 +4,7 @@
function __construct($id=null)
{
parent::__construct();
+ clsDDLManager::RegisterObject($this);
}
function setAsCurrent()
Modified: core/clsFormElement.php
===================================================================
--- core/clsFormElement.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/clsFormElement.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -63,7 +63,7 @@
return $p[0];
}
- function RenderElement($attribs="",$disabled = false,$no_id=false)
+ function RenderElement($attribs="",$disabled = false,$no_id=false,$random_id=false)
{
if($disabled)
{
@@ -75,12 +75,16 @@
{
$exp_name = str_replace("[","_",$this->name);
$exp_name = str_replace("]","",$exp_name);
-
- $this->id = "auto_".$this->type."_".$exp_name;
+
+ $this->id = GetArrayValue($attribs,"_idprefix","")."auto_".$this->type."_".$exp_name;
+ if($random_id)
+ {
+ $this->id .= "_".randomString(32);
+ }
}
if(!$no_id)
{
- $id_attr = "id=\"".GetArrayValue($attribs,"_idprefix","").$this->id."\"";
+ $id_attr = "id=\"".$this->id."\"";
}
else
$id_attr="";
@@ -91,6 +95,7 @@
$tag = "<input type=\"".$this->type."\" name=\"".$this->name."\" $dis_attr $id_attr value=\"".$this->value."\" $attribs />";
break;
case "checkbox":
+ $checked="";
if($this->value==$this->value_list)
{
$checked = " CHECKED";
@@ -111,6 +116,7 @@
$checked = " CHECKED";
}
$this->id .= "_".$this->GetValueValue($value);
+ $id_attr = "id=\"".$this->id."\"";
$span_id = "span_".$this->id;
$tag .= "<span class=\"element_radio_item\" $dis_attr id=\"$span_id\"><input type=\"".$this->type."\" name=\"".$this->name."\" $id_attr value=\"".$this->GetValueValue($value)."\" $checked $attribs />".$this->GetValueLabel($value)."</span>";
}
Modified: core/clsTagLib.php
===================================================================
--- core/clsTagLib.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/clsTagLib.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -26,6 +26,11 @@
if($replace || !array_key_exists($ObjectName,$this->ListObjects))
$this->ListObjects[$ObjectName] = $ClassName;
}
+
+ function GetListObjects()
+ {
+ return $this->ListObjects;
+ }
function GetObjectClass($ObjectName)
{
Modified: core/clsTemplate.php
===================================================================
--- core/clsTemplate.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/clsTemplate.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -412,6 +412,8 @@
}
function ParseTemplateText($text)
{
+ global $objParserLogger;
+
$html = $text;
//$search = "<inp:";
$next_tag = $this->next_tag_pos($html,0); // strpos($html,$search);
@@ -432,7 +434,9 @@
$tagtext = substr($html,$next_tag,($end_tag - $next_tag)+2);
$pre = substr($html,0,$next_tag);
$post = substr($html,$end_tag+2);
+ $objParserLogger->StartClosedTag($tagtext);
$inner = $this->ParseTag($tagtext);
+ $objParserLogger->EndClosedTag($tagtext);
$html = $pre.$inner.$post;
}
else
@@ -470,7 +474,9 @@
$pre = substr($html,0,$next_tag);
$inner = substr($html,$end_tag+1,$closer-($end_tag+1));
$post = substr($html,$end_tag+1+strlen($inner) + strlen($CloserTag));
+ $objParserLogger->StartOpenTag($tagtext);
$parsed = trim($this->ParseTag($tagtext));
+ $objParserLogger->EndOpenTag($tagtext);
if(strlen($parsed))
{
@@ -490,8 +496,11 @@
function ParseTemplate($tname, $NoCache=0, $NoStack=0,$SupressError=FALSE)
{
+ global $objParserLogger;
+
$html = "";
-
+
+ $objParserLogger->StartTemplate($tname);
$t = $this->GetTemplate($tname,$SupressError);
if(is_object($t))
@@ -517,6 +526,7 @@
$html = "<!-- ".$this->ErrorStr." -->".$html;
$this->ErrorStr = "";
}
+ $objParserLogger->EndTemplate($tname);
return $html;
}
Added: core/clsTemplateLogger.php
===================================================================
--- core/clsTemplateLogger.php (rev 0)
+++ core/clsTemplateLogger.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -0,0 +1,103 @@
+<?php
+class clsParserLogger
+{
+ private $filename;
+ private $enabled;
+ private $level;
+ private $current_tpl;
+ private $current_tag;
+
+ function __construct()
+ {
+ global $Config;
+
+ $this->enabled = GetArrayValue($Config,"logparser","false")=="true";
+ if($this->enabled)
+ {
+ $this->filename = $Config["parserlogfile"];
+ }
+ $this->level = 0;
+ $this->current_tpl = "";
+ $this->current_tag = "";
+ }
+
+ private function WriteLog($s)
+ {
+ if($this->enabled)
+ {
+ $o = date('h:i:s')."\t";
+ for($x=0;$x<$this->level;$x++)
+ {
+ $s = "\t".$s;
+ }
+
+ $fp = fopen($this->filename,"a");
+ if($fp)
+ {
+ fputs($fp,$o.$s."\n");
+ fclose($fp);
+ }
+ }
+ }
+
+ private function IncLevel()
+ {
+ $this->level++;
+ }
+
+ private function DecLevel()
+ {
+ $this->level--;
+ if($this->level<0)
+ $this->level = 0;
+ }
+
+ public function StartTemplate($tpl,$obj=null)
+ {
+ if(!is_null($obj))
+ {
+ $this->WriteLog("Object {$obj->className} ({$obj->getPK()}) Parsing Template $tpl");
+ }
+ else
+ $this->WriteLog("Parsing Template $tpl");
+ $this->IncLevel();
+ }
+
+ public function StartClosedTag($tag,$obj=null)
+ {
+ if(!is_null($obj))
+ {
+ $this->WriteLog("Object {$obj->className} ({$obj->getPK()}) Parsing Tag $tag");
+ }
+ else
+ $this->WriteLog("Parsing Tag $tag");
+ }
+
+ public function EndClosedTag($tag,$obj=null)
+ {
+ $this->WriteLog("End Tag $tag");
+ }
+
+ public function StartOpenTag($tag,$obj=null)
+ {
+ if(!is_null($obj))
+ {
+ $this->WriteLog("Object {$obj->className} ({$obj->getPK()}) Parsing Open Tag $tag");
+ }
+ else
+ $this->WriteLog("Parsing Open Tag $tag");
+ $this->IncLevel();
+ }
+
+ public function EndOpenTag($tag,$obj=null)
+ {
+ $this->DecLevel();
+ $this->WriteLog("End open Tag $tag");
+ }
+
+ public function EndTemplate($tpl,$obj=null)
+ {
+ $this->DecLevel();
+ $this->WriteLog("End Template $tpl");
+ }
+}
\ No newline at end of file
Modified: core/db/CustomFields.php
===================================================================
--- core/db/CustomFields.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/db/CustomFields.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -18,9 +18,11 @@
'label' => array('datatype'=>VARCHAR,'datasize'=>255),
'section'=>array('datatype'=>VARCHAR,'datasize'=>255),
'display_order'=>array('datatype'=>INTEGER,'datasize'=>4),
+ 'category_id'=>array('datatype'=>INTEGER,'datasize'=>4),
'empty_value' => array('datatype'=>VARCHAR, 'datasize'=>255),
'values' => array('datatype'=>TEXT, 'datasize'=>0)
);
+ $this->bEnableCustomFields = false;
parent::__construct();
$this->SetFieldExtraDef("id","AUTO_INCREMENT");
$this->SetFieldDefaultValue('item_id',0);
Modified: core/db/clsDBField.php
===================================================================
--- core/db/clsDBField.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/db/clsDBField.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -142,9 +142,9 @@
}
- function getFormElement($field_prefix="form")
+ function getFormElement($field_prefix="form", $form_suffix = "")
{
- $name = $field_prefix."[".$this->name."]";
+ $name = $field_prefix."[".$this->name."]".$form_suffix;
if(is_null($this->form_element))
{
switch($this->datatype)
@@ -160,7 +160,7 @@
$value_list="";
break;
case BOOL:
- $type="radio";
+ $type="radio";
$value_list = $this->convertValueList();
break;
case ENUM:
Modified: core/db/clsDBItem.php
===================================================================
--- core/db/clsDBItem.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/db/clsDBItem.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -973,17 +973,18 @@
function LoadCustomFields()
{
+ global $objCurrentCategory;
$this->CustomFields = array();
if($this->bEnableCustomFields)
{
if(strlen($this->GetContextName())>0)
{
- $sql = "select * FROM custom_fields WHERE (classname='".$this->className."' AND item_id=0) OR ";
+ $sql = "select * FROM custom_fields WHERE ((classname='".$this->className."' AND item_id=0) OR ";
$sql .=" (classname='{$this->GetContextName()}' AND child_classname='{$this->className}' AND item_id={$this->GetContextValue()})";
}
else
{
- $sql = "select * FROM custom_fields WHERE (classname='".$this->className."' AND item_id=0)";
+ $sql = "select * FROM custom_fields WHERE ((classname='".$this->className."' AND item_id=0)";
}
if($this->getPK())
{
@@ -995,6 +996,18 @@
$sql .= " OR (classname='{$r->ClassName}' AND child_classname='{$this->className}' AND item_id={$obj->get($r->ForeignField)})";
}
}
+ if(is_object($objCurrentCategory))
+ {
+ $ids = $objCurrentCategory->ParentIdList();
+ if(count($ids)>0)
+ {
+ $ids[] = 0;
+ $sql .= ") AND category_id IN (".implode(",",$ids).")";
+ }
+ }
+ else
+ $sql .= ") AND category_id=0";
+ //echo $sql."<br>\n";
$rs = $this->doSelectSQL($sql);
foreach($rs as $r)
{
@@ -1008,7 +1021,6 @@
}
}
}
-
public function GetCustomFieldList()
{
@@ -1049,6 +1061,8 @@
function GetCustomFieldByName($field_name)
{
+ if(!$this->HasCustomFields())
+ $this->LoadCustomFields();
foreach($this->CustomFields as $c)
{
if($c->get("name")==$field_name)
Modified: core/db/clsDBParsedItem.php
===================================================================
--- core/db/clsDBParsedItem.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/db/clsDBParsedItem.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -429,6 +429,44 @@
return $ret;
}
+ protected function _list_customfields($attributes)
+ {
+ $header_tpl = GetArrayValue($attributes,"_headertemplate","");
+ $footer_tpl = GetArrayValue($attributes,"_footertemplate","");
+ $item_tpl = GetArrayValue($attributes,"_fieldtemplate");
+ $ret = "";
+ $fields = $this->GetCustomFieldList();
+ if(strlen($header_tpl)>0)
+ $ret = $this->ParseTemplate($header_tpl);
+ if(count($fields)>0)
+ {
+ foreach($fields as $cf)
+ {
+ if($cf->get("classname")==$this->className && $cf->get("child_classname")=='')
+ {
+ $objField = $this->ConvertCustomFieldObject($cf->get("name"));
+ $p = new clsFieldParser($objField,null,$this->className);
+ $ret .= $p->ParseTemplate($item_tpl);
+ }
+ }
+ }
+ if(strlen($ret)>0 && strlen($footer_tpl)>0)
+ $ret .= $this->ParseTemplate($footer_tpl);
+ return $ret;
+ }
+
+ protected function _custom_fields_enabled($attributes)
+ {
+ if(!strlen(GetArrayValue($attributes,"truetext",GetArrayValue($attributes,"falsetext"))))
+ $attributes["_truetext"] = "true";
+
+ if($this->bEnableCustomFields)
+ {
+ return GetArrayValue($attributes,"_truetext","");
+ }
+ return GetArrayValue($attributes,"_falsetext","");
+ }
+
public function ParseMyField($field,$attributes,$extra_attribs="")
{
if(strpos($field,"::"))
Modified: core/db/clsMysqlActionHandler.php
===================================================================
--- core/db/clsMysqlActionHandler.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/db/clsMysqlActionHandler.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -6,10 +6,10 @@
return true;
}
- private function SaveCustomField($item,$cf,$field)
+ protected function SaveCustomField($item,$cf,$field)
{
$cf->set("classname",$item->className);
- $cf->set("name",GetArrayValue($field,"name",$name));
+ $cf->set("name",$field["name"]);
$cf->set("child_classname",GetArrayValue($field,"childclass"));
$cf->set("item_id",$item->getPK());
$cf->set("datatype",GetArrayValue($field,"datatype",VARCHAR));
@@ -36,6 +36,7 @@
$cf->set("label",GetArrayValue($field,"label",$cf->get("name")));
$cf->set("section",GetArrayValue($field,"section","General"));
$cf->set("display_order",GetArrayValue($field,"display_order",999));
+ $cf->set("category_id",GetArrayValue($field,"category_id",getCurrentCategory()));
$cf->commit();
}
@@ -54,7 +55,7 @@
}
elseif($item->CustomFieldExists($name))
{
- $cf = $item->GetCustomFieldByName($name);
+ $cf = $item->GetCustomFieldByName($name,getCurrentCategory());
$this->SaveCustomField($item,$cf,$field);
}
}
Modified: core/delegates/clsItemDelegateReg.php
===================================================================
--- core/delegates/clsItemDelegateReg.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/delegates/clsItemDelegateReg.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -16,6 +16,8 @@
function GetDelegateObject($field_name, $obj)
{
+ if(substr($field_name,0,1)!="+")
+ $field_name = "+".$field_name;
$c = $this->delegates[$field_name];
if(strlen($c)>0 && class_exists($c))
{
Modified: core/delegates/item_autoform.php
===================================================================
--- core/delegates/item_autoform.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/delegates/item_autoform.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -7,6 +7,9 @@
}
+ /* returns a list of fields, in an array, of the fields assigned to the passed in section.
+ * an empty value for $section will return all displayed fields.
+ */
public function getDisplayedFields($section="")
{
$ret = "";
@@ -28,7 +31,7 @@
{
foreach($custom_fields as $c)
{
- if(strlen($c->get("section"))>0 && strlen($c->get("label"))>0)
+ if(($c->get("section")==$section || $section="") && strlen($c->get("label"))>0)
{
$fields[$c->get("name")] = $c->get("display_order");
}
@@ -49,6 +52,41 @@
return $fields;
}
+ /* this tag is used to parse one field and return the form element. If a template is provided,
+ * the field parser will parse that template, otheriwse this tag returns the form element for the
+ * field
+ */
+ function _parse_field($attribs=array(),$extra_attribs="")
+ {
+ $ret = "";
+ $obj = $this->getItemObject();
+ $item_tpl = GetArrayValue($attribs,"_template");
+ $field_name = $attribs["_srcfield"];
+ $fo = null;
+ if($obj->IsDefinedField($field_name))
+ {
+ $fo = $obj->GetFieldObject($field_name);
+ }
+ elseif($obj->CustomFieldExists($field_name))
+ {
+ $fo = $obj->ConvertCustomFieldObject($field_name);
+ }
+ if(is_object($fo))
+ {
+ $p = new clsFieldParser($fo,null,$obj->className);
+ if(strlen($item_tpl))
+ {
+ $ret = $p->ParseTemplate($item_tpl);
+ }
+ else
+ {
+ $ret = $p->ParseMyField("form_element",$attribs,$extra_attribs);
+ }
+ }
+ return $ret;
+ }
+
+ /*lists all fields in a section. */
function _field_list($attribs = array(), $extra_attribs="")
{
$fields = $this->getDisplayedFields(getArrayValue($attribs,"_section",""));
Modified: core/delegates/item_relations.php
===================================================================
--- core/delegates/item_relations.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/delegates/item_relations.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -85,7 +85,7 @@
$filter["$jt.{$rel->LocalJoinField}"] = $this->getField($rel->Field);
$lst->LoadListItems($ListName,$filter);
$lst->SetObjectContext($this->getItemObject()->className,$this->getItemObject()->getPK());
- echo "$sql<br>\n";
+ //echo "$sql<br>\n";
$where = $lst->CompleteWhereClause($ListName);
$csql = "select count(*) FROM $ft INNER JOIN $jt ON ($ft.{$rel->ForeignField}=$jt.{$rel->ForeignJoinField}) WHERE $where";
$lst->ListCount = $lst->countBySelect($csql);
@@ -120,12 +120,12 @@
return $ret;
}
- function _items($attribs)
+ function _items($attribs,$filter=array())
{
$ret = "";
if($this->IsMany($attribs["_relation"]))
{
- $this->LoadRelationList($attribs["_relation"],$attribs["_listtype"]);
+ $this->LoadRelationList($attribs["_relation"],$attribs["_listtype"],$filter);
$obj = @$this->ListClasses[$attribs["_relation"]];
if(is_object($obj))
{
Modified: core/helpers.php
===================================================================
--- core/helpers.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/helpers.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -427,6 +427,7 @@
}
}
}
+
return $p;
}
Modified: core/itembase/clsCollection.php
===================================================================
--- core/itembase/clsCollection.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/itembase/clsCollection.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -24,9 +24,9 @@
}
- public function NewObject()
+ public function NewObject($id=null)
{
- return new $this->className();
+ return new $this->className($id);
}
public function NumItems()
Modified: core/itembase/clsField.php
===================================================================
--- core/itembase/clsField.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/itembase/clsField.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -70,9 +70,16 @@
protected function convertValueList()
{
$a = array();
+ $index = 0;
foreach($this->values as $v)
{
- $a[] = "$v=$v";
+ if($this->datatype==BOOL)
+ {
+ $a[] = "$index=$v";
+ $index++;
+ }
+ else
+ $a[] = "$v=$v";
}
return implode(",",$a);
}
Modified: core/itembase/clsFieldParser.php
===================================================================
--- core/itembase/clsFieldParser.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/itembase/clsFieldParser.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -30,7 +30,7 @@
);
}
$this->FieldDisplayTags = array();
-
+ $this->bEnableCustomFields = false;
parent::__construct();
$this->bClassFilePath = false; //include the class name & id in file paths
$this->set("name",$objField->name);
@@ -45,8 +45,10 @@
protected function _form_element($attributes,$extra_attribs="")
{
- $f = $this->field->getFormElement(GetArrayValue($attributes,"_formvar",$this->objectName),$extra_attribs);
- $ret = $f->RenderElement($extra_attribs,GetArrayValue($attributes,"_disabled","false")=="true",GetArrayValue($attributes,"_noid","false")=="true");
+ $f = $this->field->getFormElement(GetArrayValue($attributes,"_formvar",$this->objectName),GetArrayValue($attributes,"_formsuffix"));
+ $ret = $f->RenderElement($extra_attribs,GetArrayValue($attributes,"_disabled","false")=="true",
+ GetArrayValue($attributes,"_noid","false")=="true",
+ (GetArrayValue($attributes,"_idprefix","")=="random"));
return $ret;
}
Modified: core/itembase/clsParsedItemBase.php
===================================================================
--- core/itembase/clsParsedItemBase.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/itembase/clsParsedItemBase.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -67,6 +67,13 @@
return $diffs;
}
+ protected function GetItemDelegate($del_name)
+ {
+ global $objItemDelegates;
+ $del = $objItemDelegates->GetDelegateObject($del_name,$this);
+ return $del;
+ }
+
public function getItemName()
{
if(strlen($this->ItemName))
@@ -125,6 +132,17 @@
$sections[$fld->section] = $fld->display_order;
}
}
+ $custom_fields = $this->GetCustomFieldList();
+ if(count($custom_fields)>0)
+ {
+ foreach($custom_fields as $c)
+ {
+ if(strlen($c->get("section"))>0)
+ {
+ $sections[$c->get("section")] = $c->get("display_order");
+ }
+ }
+ }
asort($sections);
return $sections;
}
@@ -380,12 +398,33 @@
return $this->GetContextValue();
}
+ protected function IsContextType($context_name)
+ {
+ if(strtolower($context_name)==strtolower($this->GetContextName()))
+ {
+ return true;
+ }
+ }
+
protected function _is_context_type($attributes,$extra_attribs="")
{
$context = GetArrayValue($attributes,"_context","");
$context_list = explode(",",$context);
- if(in_array(strtolower($this->GetContextName()),$context_list) || strlen($context)==0)
+ $bMatched = false;
+ if(strlen($context)>0)
{
+ foreach($context_list as $c)
+ {
+ $bMatched = $this->IsContextType($context);
+ if($bMatched)
+ break;
+ }
+ }
+ else
+ $bMatched = true;
+
+ if($bMatched)
+ {
$ret = GetArrayValue($attributes,"_truetext","");
}
else
@@ -398,8 +437,21 @@
$ret = "";
$context = GetArrayValue($attributes,"_context","");
$context_list = explode(",",strtolower($context));
- if(in_array(strtolower($this->GetContextName()),$context_list) || strlen($context)==0)
+ $bMatched = false;
+ if(strlen($context)>0)
{
+ foreach($context_list as $c)
+ {
+ $bMatched = $this->IsContextType($context);
+ if($bMatched)
+ break;
+ }
+ }
+ else
+ $bMatched = true;
+
+ if($bMatched)
+ {
if(array_key_exists("_truetemplate",$attributes))
$ret = $this->ParseTemplate($attributes["_truetemplate"]);
}
@@ -415,7 +467,20 @@
{
$ret = "";
$context = GetArrayValue($attributes,"_context","");
- if($context==$this->GetContextName() || strlen($context)==0)
+ $bMatched = false;
+ if(strlen($context)>0)
+ {
+ foreach($context_list as $c)
+ {
+ $bMatched = $this->IsContextType($context);
+ if($bMatched)
+ break;
+ }
+ }
+ else
+ $bMatched = true;
+
+ if($bMatched)
{
if(class_exists($context))
{
@@ -431,8 +496,21 @@
{
$ret = "";
$context = GetArrayValue($attributes,"_context","");
- if($context==$this->GetContextName() || strlen($context)==0)
- {
+ $bMatched = false;
+ if(strlen($context)>0)
+ {
+ foreach($context_list as $c)
+ {
+ $bMatched = $this->IsContextType($context);
+ if($bMatched)
+ break;
+ }
+ }
+ else
+ $bMatched = true;
+
+ if($bMatched)
+ {
if(class_exists($context))
{
$val = $this->GetContextValue();
@@ -446,6 +524,7 @@
protected function _list_fields($attribs,$extra_attribs="")
{
+ $ret = "";
$listname = GetArrayValue($attribs,"_listtype","");
if(strlen($listname)>0)
{
Modified: core/itembase/clsParser.php
===================================================================
--- core/itembase/clsParser.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/itembase/clsParser.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -227,6 +227,8 @@
public function ParseTemplateText($text)
{
+ global $objParserLogger;
+
$html = $text;
$next_tag = $this->NextTag($html);
while($next_tag !==false)
@@ -238,7 +240,9 @@
$tagtext = substr($html,$next_tag,($end_tag - $next_tag)+2);
$pre = substr($html,0,$next_tag);
$post = substr($html,$end_tag+2);
+ $objParserLogger->StartOpenTag($tagtext,$this);
$inner = $this->ParseElement($tagtext);
+ $objParserLogger->EndOpenTag($tagtext,$this);
$html = $pre.$inner.$post;
}
else
@@ -272,11 +276,10 @@
$pre = substr($html,0,$next_tag);
$inner = substr($html,$end_tag+1,$closer-($end_tag+1));
$post = substr($html,$end_tag+1+strlen($inner) + strlen($CloserTag));
- //echo "PRE:". htmlentities($pre,ENT_NOQUOTES);
- //echo "INNER:". htmlentities($inner,ENT_NOQUOTES);
- //echo "POST:". htmlentities($post,ENT_NOQUOTES);
-
+ $objParserLogger->StartOpenTag($tagtext,$this);
$parsed = $this->ParseElement($tagtext);
+ $objParserLogger->EndOpenTag($tagtext,$this);
+
if(strlen(trim($parsed)))
{
$html = $pre.$this->ParseTemplateText($inner).$post;
@@ -294,6 +297,9 @@
public function ParseTemplate($tname)
{
+ global $objParserLogger;
+
+ $objParserLogger->StartTemplate($tname,$this);
$html = "";
if(!is_object($this->Parser))
{
@@ -309,6 +315,7 @@
array_pop($this->Parser->stack);
}
$html = $this->Parser->ParseTemplateText($html);
+ $objParserLogger->EndTemplate($tname,$this);
return $html;
}
Modified: core/loader.php
===================================================================
--- core/loader.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/loader.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -33,6 +33,10 @@
include_once("clsTemplate.php");
include_once("xml.php");
include_once("browser.php");
+ include_once("clsTemplateLogger.php");
+
+ $objParserLogger = new clsParserLogger();
+
/* data object base classes and interfaces */
include('itembase/iTagItem.php');
@@ -193,6 +197,8 @@
{
$objCurrentCategory = new clsCategory($_GET["category"]);
}
+ else
+ setCurrentCategory(getCurrentCategory());
include_once($pathtoroot."core/ajax.php");
Modified: core/logs/clsLogEntry.php
===================================================================
--- core/logs/clsLogEntry.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/logs/clsLogEntry.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -23,6 +23,7 @@
$this->FieldDisplayTags = array();
$this->ItemObj = null;
+ $this->bEnableCustomFields = false;
parent::__construct();
if($id)
{
Modified: core/objects/category.php
===================================================================
--- core/objects/category.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/objects/category.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -18,7 +18,7 @@
$this->Relations = array (new clsRelation("clsCategory","parent_id","id","ParentCategory"));
$this->FieldDisplayTags = array();
-
+ $this->bEnableCustomFields = false;
parent::__construct();
if($id)
{
@@ -33,6 +33,13 @@
{
parent::__construct("clsCategory");
}
+
+ public function getTopCategories()
+ {
+ $sql = "SELECT id as value,name as label FROM categories WHERE parent_id=0";
+ $ret = $this->doSelectSQL($sql);
+ return $ret;
+ }
function getCurrentCategory()
{
Modified: core/objects/configure.php
===================================================================
--- core/objects/configure.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/objects/configure.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -20,12 +20,16 @@
'value_list'=>array('datatype'=>TEXT,'datasize'=>0),
'description'=>array('datatype'=>TEXT,'datasize'=>0),
'label'=>array('datatype'=>VARCHAR,'datasize'=>255),
- 'value'=>array('datatype'=>TEXT,'datasize'=>0)
+ 'value'=>array('datatype'=>TEXT,'datasize'=>0),
+ 'option_obj'=>array('datatype'=>VARCHAR,'datasize'=>255),
+ 'option_method'=>array('datatype'=>VARCHAR,'datasize'=>255),
);
$this->Relations = array ();
$this->FieldDisplayTags = array();
$this->CategoryCache = array();
+ $this->bEnableCustomFields = false;
parent::__construct();
+ clsDDLManager::RegisterObject($this);
if($id)
{
$this->fetch($id);
@@ -45,9 +49,9 @@
if($this->get("locked")==0)
{
$sql = "delete from category_config WHERE config_id=".$this->get("id")." AND category_id=$CategoryId";
- DB::doDeleteSQL($sql);
+ $this->doDeleteSQL($sql);
$sql = "insert into category_config (config_id,category_id,value) VALUES (".$this->get("id").",".$CategoryId.",'$Value')";
- DB::doInsertSQL($sql);
+ $this->doInsertSQL($sql);
}
}
}
@@ -62,7 +66,7 @@
{
$ret = "";
$sql = "select value FROM category_config WHERE config_id=".$this->get("id")." AND category_id=$CategoryId";
- $rs = DB::doSelectSQL($sql);
+ $rs = $this->doSelectSQL($sql);
if($rs)
{
$ret = $rs[0]["value"];
@@ -86,7 +90,7 @@
$vlist = $this->get("value_list");
if(strlen($vlist)>0)
{
- $el = new clsFormElement($this->get("input_type"),$id,$name,$val,$this->get("value_list"));
+ $el = new clsFormElement($this->get("input_type"),"",$this->get("name"),$val,$this->get("value_list"));
$el->InitValueList();
$v = $el->GetValues();
foreach($v as $value)
@@ -115,7 +119,8 @@
{
$bLocked = true;
}
- $el = new clsFormElement($this->get("input_type"),$id,$name,$this->GetValue(getCurrentCategory(),false),$this->get("value_list"));
+ $el = new clsFormElement($this->get("input_type"),$id,$name,$this->GetValue(getCurrentCategory(),false),
+ $this->get("value_list"),$this->get("option_obj"), $this->get("option_method"));
$ret = $el->RenderElement($extra_attribs, $bLocked);
return $ret;
}
@@ -222,7 +227,7 @@
function ClearCategoryValues($CategoryId)
{
$sql = "delete from ".$this->table." WHERE category_id=$CategoryId";
- DB::doDeleteSQL($sql);
+ $this->doDeleteSQL($sql);
}
function __construct()
Modified: core/sessions.php
===================================================================
--- core/sessions.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/sessions.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -18,7 +18,7 @@
);
$this->Relations = array ();
$this->FieldDisplayTags = array();
-
+ $this->bEnableCustomFields = false;
parent::__construct();
if($id)
{
@@ -74,7 +74,7 @@
$this->Relations = array(new clsRelation("clsUser","user_id","id","User"),
new clsRelation("clsUser","suder_user","id","SudoUser"));
$this->FieldDisplayTags = array();
-
+ $this->bEnableCustomFields = false;
parent::__construct();
$this->User = null;
$this->Data = new SessionData();
Modified: core/tags/system.php
===================================================================
--- core/tags/system.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/tags/system.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -246,7 +246,7 @@
$tpl = $objSession->GetSessionVar("_template_");
}
}
- $ret = SiteURL(GetArrayValue($attribs,"_page",""),GetArrayValue($attribs,"_server",""),
+ $ret = SiteURL(GetArrayValue($attribs,"_page",GetArrayValue($attribs,"_parser","")),GetArrayValue($attribs,"_server",""),
GetArrayValue($attribs,"_protocol",""),$tpl,
GetArrayValue($attribs,"_action",""),GetArrayValue($attribs,"_params",""));
@@ -434,6 +434,7 @@
{
global $objCurrentItem, $objCurrentObject;
+ $ret = "";
$obj = null;
$tpl = "";
$ret = "";
@@ -481,6 +482,7 @@
function _object_include($attribs)
{
+ $ret = "";
$obj = $attribs["_object"];
global $$obj;
@@ -658,6 +660,21 @@
}
return $res;
}
+
+ function _list_objects($attribs)
+ {
+ global $objTagLib;
+
+ $ret = "";
+ $objects = $objTagLib->GetListObjects();
+ foreach($objects as $obj_name=>$class_name)
+ {
+ $lc = new $class_name();
+ $attribs["_item"] = $lc->className;
+ $ret .= $this->_item_include($attribs);
+ }
+ return $ret;
+ }
}
@@ -695,6 +712,37 @@
}
}
}
+
+ function customfields()
+ {
+ $fields = GetArrayValue($_POST,"field",array());
+ if(count($fields)>0)
+ {
+ foreach($fields as $name=>$f)
+ {
+ if($name=="_new_")
+ continue; //skip this, it's the generic one used by jquery
+ $classname = $f["childclass"];
+ $obj = new $classname();
+ $f["childclass"] = "";
+ if(is_numeric($name))
+ {
+ $cf = new clsCustomField();
+ $f["category_id"] = getCurrentCategory();
+ $this->SaveCustomField($obj,$cf,$f);
+ }
+ else
+ {
+ if($f["category_id"] != getCurrentCategory())
+ {
+ $cf = $obj->GetCustomFieldByName($name);
+ $this->SaveCustomField($obj,$cf,$f);
+ }
+ }
+ }
+ setUserFeedback("Object custom fields updated");
+ }
+ }
}
Modified: core/user/group_base.php
===================================================================
--- core/user/group_base.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/user/group_base.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -26,6 +26,7 @@
$this->FieldDisplayTags = array();
}
parent::__construct();
+ clsDDLManager::RegisterObject($this);
if($id)
{
$this->fetch($id);
Modified: core/user/permission_base.php
===================================================================
--- core/user/permission_base.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/user/permission_base.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -23,6 +23,7 @@
$this->FieldDisplayTags = array();
}
parent::__construct();
+ clsDDLManager::RegisterObject($this);
if($id)
{
$this->fetch($id);
Modified: core/user/user_base.php
===================================================================
--- core/user/user_base.php 2011-02-23 21:36:05 UTC (rev 16)
+++ core/user/user_base.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -41,6 +41,7 @@
$this->AllowedExportFields = array("id","username","email","active","firstname","lastname","phone","division");
}
parent::__construct();
+ clsDDLManager::RegisterObject($this);
if($id)
{
$this->fetch($id);
Modified: domains/mcs/account.php
===================================================================
--- domains/mcs/account.php 2011-02-23 21:36:05 UTC (rev 16)
+++ domains/mcs/account.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -3,6 +3,8 @@
class MCS_Account extends Mysql_Account implements iAccount
{
private $credentials;
+ private $resource_credentials;
+ private $available_res_credentials;
function __construct($id=null)
{
@@ -28,6 +30,7 @@
new clsRelation("MCS_Resource","id","id","Resource","clsResourceList","account_resource","account_id","resource_id"),
new clsRelation("MCS_ResourceGroup","id","id","ResourceGroup","clsResourceGroupList","account_resourcegroup","account_id","resourcegroup_id"),
new clsRelation("Identity","identity_id","id","Identity"),
+ new clsRelation("MCS_AccountResourceCredential","id","account_id","AccountResourceCredential","MCS_clsAccountResourceCredentialList"),
//new clsRelation("Identity","identity_id","id","Sponsor","clsIdentityList","sponsor","account_id","identity_id"),
new clsRelation("IdentityCredential","id","id","Credential","clsIdentityCredentialList","account_credentials","account_id","identity_credential_id")
);
@@ -38,7 +41,10 @@
$this->SetFieldDefaultValue("state","inactive");
$this->SetFieldExtraDef("id","AUTO_INCREMENT");
$this->bClassFilePath = true; //include the class name & id in file paths
- $this->Credentials = null;
+ $this->credentials = null;
+ $this->resource_credentials = array();
+ $this->available_res_credentials = array();
+
if($id)
{
$this->fetch($id);
@@ -61,6 +67,54 @@
$this->fillFromArray($data);
$this->commit();
}
+
+ /* accepts a single credential or an array of credentials. Credentials can either be a credential object, or just an ID
+ * Not that we are not checking to see if the credential is already assigned to this resource, as we're relying on DB
+ * contstraints to take care of that..
+ * */
+ public function AddIdentityCredential($c)
+ {
+ if(is_array($c))
+ {
+ foreach($c as $cred)
+ {
+ $this->AddResourceCredential($cred);
+ }
+ }
+ if(is_object($c))
+ {
+ $this->AddRelatedObject("IdentityCredential",$c);
+ }
+ else
+ {
+ $cred = $this->NewRelationObject("IdentityCredential");
+ $cred->fetch($c);
+ $this->AddRelatedObject("IdentityCredential",$cred);
+ }
+ }
+
+ public function RemoveIdentityCredential($c)
+ {
+ if(is_object($c))
+ {
+ $this->DeleteJoinRelation("IdentityCredential",$c);
+ $credential_id = $c->get("id");
+ }
+ else
+ {
+ $cred = $this->NewRelationObject("IdentityCredential");
+ $cred->fetch($c);
+ $this->DeleteJoinRelation("IdentityCredential",$cred);
+ }
+ }
+
+ public function AssignCredential($objResource, $objIdentityCredential)
+ {
+ $arc = $this->NewRelationObject("AccountResourceCredential");
+ $arc->set("identity_credential_id",$objIdentityCredential->get("id"));
+ $arc->set("resource_id",$objResource->get("id"));
+ $this->AddRelatedObject("AccountResourceCredential",$arc);
+ }
/* since IdentityCredentials are managed by the identity, have to comprise a list of IdentityCredential ID's
* associated with this account, and then manually create IdentityCredential objects with the proper context.
@@ -90,6 +144,57 @@
}
return $this->credentials;
}
+
+ /* returns a list of account credentials that have not been assigned to the given resource, but are accepted by the resource */
+ public function AvailableResourceCredentials($ResourceId)
+ {
+ global $objDomains;
+
+ $d = $objDomains->getCurrentDomain();
+ if(is_object($d))
+ {
+ if(!is_object(GetArrayValue($this->available_res_credentials,$ResourceId,null)))
+ {
+ $arc = $d->getDomainObjectList("AccountResourceCredential");
+ $arc->LoadAccountResourceCrdentials($this->get("id"),$ResourceId);
+
+ $res = $d->getDomainObject("Resource",$ResourceId);
+ //$ResourceCredentials = $res->Credentials();
+
+ $this->available_res_credentials[$ResourceId] = $d->getDomainObjectList("IdentityCredential");
+ $sql = "select identity_credential_id FROM account_credentials WHERE account_id={$this->get("id")} AND
+ identity_credential_id NOT IN (".implode(",",$arc->getFieldArray("identity_credential_id",true)).")";
+ $rs = $this->doSelectSQL($sql);
+ if($rs)
+ {
+ foreach($rs as $r)
+ {
+ $rc = $d->getDomainObject("IdentityCredential",$r["identity_credential_id"]);
+ $cred = $rc->NamedRelationObject("Credential");
+ if($res->IsCredentialAccepted($cred))
+ $this->available_res_credentials[$ResourceId]->AddObject($rc);
+ }
+ }
+ }
+ }
+ return GetArrayValue($this->available_res_credentials,$ResourceId,null);
+ }
+
+ /* returns a list of credentials that have been assigned to the given resource */
+ public function ResourceCredentials($ResourceId,$ListName="all",$filter=array())
+ {
+ $ret = GetArrayValue($this->resource_credentials,$ResourceId,null);
+ if(!is_object($ret))
+ {
+ $del = $this->GetItemDelegate("rel");
+ $filter = array();
+ $filter["resource_id"] = $ResourceId;
+ $this->resource_credentials[$ResourceId] = $del->GetListClass("AccountResourceCredential",$ListName,$filter);
+ $ret = GetArrayValue($this->resource_credentials,$ResourceId,null);
+ }
+ return $ret;
+ }
+
/* methods required by iAccount */
public function AddCredential($objIdentityCredential)
{
@@ -101,6 +206,12 @@
$this->DeleteJoinRelation("Credential",$objIdentityCredential);
}
+ /* checks to see if the account has at least one identity credential that the resource can accept */
+ public function HasAcceptedCredentials($objResource)
+ {
+ return true;
+ }
+
public function AssignToIdentity($identity_id)
{
$this->set("identity_id",$identity_id);
@@ -130,6 +241,34 @@
$cl = $this->Credentials();
return $cl->_pagenav($attribs);
}
+
+ protected function _resource_credentials($attribs)
+ {
+ $ret = "";
+ if($this->IsContextType("Resource") && $this->GetContextValue()>0)
+ {
+ $cl = $this->ResourceCredentials($this->GetContextValue(),GetArrayValue($attribs,"_listtype","all"));
+ if($cl->NumItems()>0)
+ {
+ $ret = $cl->ParseListTemplate($attribs);
+ }
+ }
+ return $ret;
+ }
+
+ protected function _available_resource_credentials($attribs)
+ {
+ $ret = "";
+ if($this->IsContextType("Resource") && $this->GetContextValue()>0)
+ {
+ $cl = $this->AvailableResourceCredentials($this->GetContextValue());
+ if($cl->NumItems()>0)
+ {
+ $ret = $cl->ParseListTemplate($attribs);
+ }
+ }
+ return $ret;
+ }
protected function _list_unassigned_credentials($attribs)
{
@@ -164,7 +303,7 @@
parent::__construct("MCS_Account");
$this->SearchFields["admin"] = array();
}
-
+
function BuildListCountSQL($ListName)
{
switch(strtolower($ListName))
@@ -244,6 +383,35 @@
}
}
}
+
+ function identity_resource_credential_assign($AccountId=null,$ResourceId=null,$CredentialId=null)
+ {
+ global $objDomains;
+
+ $d = $objDomains->getCurrentDomain();
+ if(is_null($AccountId) || (int)$AccountId==0)
+ {
+ $AccountId = getItemId();
+ }
+ $data = $this->getFormData();
+ if((is_null($ResourceId) || (int)$ResourceId==0))
+ {
+ $ResourceId = $data["resource_id"];
+ }
+ if(is_null($CredentialId))
+ {
+ $CredentialId = $data["credential_id"];
+ }
+
+ if($AccountId && $ResourceId && $CredentialId)
+ {
+ $acct = $d->getDomainObject("Account",$AccountId);
+ $res = $d->getDomainObject("Resource",$ResourceId);
+ $cred = $d->getDomainObject("IdentityCredential",$CredentialId);
+ $acct->AssignCredential($res,$cred);
+ setUserFeedback("Credential {$cred->getDefaultText()} assigned to resource {$res->getDefaultText()}");
+ }
+ }
}
?>
\ No newline at end of file
Added: domains/mcs/account_resource_credential.php
===================================================================
--- domains/mcs/account_resource_credential.php (rev 0)
+++ domains/mcs/account_resource_credential.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -0,0 +1,114 @@
+<?php
+
+class MCS_AccountResourceCredential extends MySQL_AccountResourceCredential
+{
+ function __construct($id=null)
+ {
+ $this->tagPrefix = "arc";
+ $this->primaryKey = 'id';
+ $this->fieldDefs = array(
+ 'id' => array('datatype'=>INTEGER,'datasize'=>4),
+ 'account_id' => array('datatype'=>INTEGER,'datasize'=>4),
+ 'resource_id' => array('datatype'=>INTEGER,'datasize'=>4),
+ 'identity_credential_id' => array('datatype'=>INTEGER,'datasize'=>4)
+ );
+
+ $this->className="MCS_AccountResourceCredential";
+ $this->Relations = array (
+ new clsRelation("MCS_Account","account_id","id","Account"),
+ new clsRelation("MCS_Resource","resource_id","id","Resource"),
+ new clsRelation("IdentityCredential","identity_credential_id","id","IdentityCredential")
+ );
+ parent::__construct($id);
+ $this->SetFieldExtraDef("id","AUTO_INCREMENT");
+ if($id)
+ {
+ $this->fetch($id);
+ }
+ }
+
+ function GetDefaultText()
+ {
+ return $this->get("id");
+ }
+
+ function fetchByName($name)
+ {
+ return $this->fetchByValue(array("name"=>$name));
+ }
+}
+
+class MCS_clsAccountResourceCredentialList extends MySQL_clsAccountResourceCredentialList
+{
+ var $objDataList;
+
+ function __construct()
+ {
+ parent::__construct("MCS_AccountResourceCredential");
+ $this->SearchFields["admin"] = array();
+ }
+
+ public function LoadAccountResourceCrdentials($AccountId,$ResourceId)
+ {
+ $sql = "select * FROM {$this->table} WHERE account_id=$AccountId AND resource_id=$ResourceId";
+ return $this->fetchBySelect($sql);
+ }
+
+ function BuildListCountSQL($ListName)
+ {
+ switch(strtolower($ListName))
+ {
+ default:
+ $sql = parent::BuildListCountSQL($ListName);
+ break;
+ }
+ return $sql;
+ }
+
+ function BuildListSQL($ListName="all")
+ {
+ /* defaults to group name so we can list just single group from the template */
+ switch(strtolower($ListName))
+ {
+ case "select_list":
+ $sql = "select * FROM {$this->table} WHERE name !='' GROUP BY name";
+ break;
+ default:
+ $sql = parent::BuildListSQL($ListName);
+ break;
+ }
+ //echo $ListName.":".$sql."<br />\n";
+ return $sql;
+ }
+
+ function GetSelectList()
+ {
+ $res = array();
+ $this->Paging=false;
+ $this->LoadListItems("select_list");
+ if($this->NumItems()>0)
+ {
+ foreach($this->Items as $i)
+ {
+ $r = array();
+ $r['value'] = $i->get("id");
+ $r['label'] = $i->GetDefaultText();
+ $res[] = $r;
+ }
+ }
+
+ return $res;
+ }
+}
+
+class MCS_clsAccountResourceCredentialActions extends clsUserbaseMysqlActionHandler
+{
+ function __construct()
+ {
+ parent::__construct("MCS_clsAccountResourceCredentialList","MCS_AccountResourceCredential","Account Credential","Account Credentials");
+ }
+
+
+}
+
+?>
\ No newline at end of file
Modified: domains/mcs/domain_init.php
===================================================================
--- domains/mcs/domain_init.php 2011-02-23 21:36:05 UTC (rev 16)
+++ domains/mcs/domain_init.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -8,13 +8,15 @@
require_once('account.php');
require_once('affiliation.php');
require_once('identity_affiliation.php');
-
+ require_once('account_resource_credential.php');
+
//$c = new MCS_Credential();
$a = new MCS_Account();
$r = new MCS_Resource();
$rg = new MCS_ResourceGroup();
$af = new MCS_Affiliation();
$ia = new MCS_IdentityAffiliation();
+ $arc = new MCS_AccountResourceCredential();
global $objTagLib,$objActionHandler;
@@ -23,10 +25,12 @@
$objTagLib->AddListObject("MCS_Affiliation","MCS_clsAffiliationList",false);
$objTagLib->AddListObject("MCS_IdentityAffiliation","MCS_clsIdentityAffiliationList",false);
$objTagLib->AddListObject("MCS_Account","MCS_clsAccountList",false);
-
+ $objTagLib->AddListObject("MCS_AccountResourceCredential","MCS_clsAccountResourceCredentialList",false);
+
$objActionHandler->AddHandler("mcs_resourcegroup", new MCS_clsResourceGroupActions());
$objActionHandler->AddHandler("mcs_resource", new MCS_clsResourceActions());
$objActionHandler->AddHandler("mcs_affiliation", new MCS_clsAffiliationActions());
$objActionHandler->AddHandler("mcs_identityaffiliation", new MCS_clsIdentityAffiliationActions());
$objActionHandler->AddHandler("mcs_account", new MCS_clsAccountActions());
+ $objActionHandler->AddHandler("mcs_accountresourcecredential", new MCS_clsAccountResourceCredentialActions());
clsDDLManager::ValidateTables();
\ No newline at end of file
Modified: domains/mcs/resource.php
===================================================================
--- domains/mcs/resource.php 2011-02-23 21:36:05 UTC (rev 16)
+++ domains/mcs/resource.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -12,6 +12,8 @@
'name'=>array('datatype'=>VARCHAR,'datasize'=>64,'label'=>"Name",'section'=>"General",'display_order'=>1),
'url'=>array('datatype'=>VARCHAR,'datasize'=>255,'label'=>"URL",'section'=>"General",'display_order'=>2),
'public'=>array('datatype'=>BOOL,'datasize'=>array('No','Yes'),'label'=>"Public",'section'=>"General",'display_order'=>3),
+ 'requires_accounts'=>array('datatype'=>BOOL,'datasize'=>array('No','Yes'),'label'=>"Requires User Accounts",'section'=>"General",'display_order'=>3),
+ 'accepts_domain_pw'=>array('datatype'=>BOOL,'datasize'=>array('No','Yes'),'label'=>"Accepts Domain Password",'section'=>"General",'display_order'=>3),
'needs_approval'=>array('datatype'=>BOOL,'datasize'=>array('No','Yes'),'label'=>"Needs Approval",'section'=>"General",'display_order'=>4),
'state'=>array('datatype'=>ENUM,'datasize'=>array('requested','denied','approved','active','suspended','inactive','deleted'),'label'=>"State",'section'=>"General",'display_order'=>5),
'description'=>array('datatype'=>TEXT,'datasize'=>0,'label'=>"Description",'section'=>"General",'display_order'=>6),
@@ -24,13 +26,20 @@
new clsRelation("MCS_ResourceGroup","id","id","ResourceGroup","MCS_clsResourceGroupList","group_resources","resource_id","group_id"),
new clsRelation("MCS_Account","id","id","Account","MCS_clsAccountList","account_resource","resource_id","account_id"),
new clsRelation("Credential","id","id","Credential","clsCredentialList","resource_credential","resource_id","credential_id"),
- new clsRelation("Identity","id","id","Identity","clsIdentityList","identity_resource","resource_id","identity_id")
+ new clsRelation("Identity","id","id","Identity","clsIdentityList","identity_resource","resource_id","identity_id"),
+ new clsRelation("IdentityCredential","id","id","IdentityCredential","clsIdentityCredentialList","resource_identity_credentials","resource_id","identity_credential_id")
+
);
-
+ $this->AllowedExportFields = array("name","id","url","public","needs_approval","state","description","full_name","brief_description","resource_info","requires_accounts","accepts_domain_pw");
parent::__construct($id);
+ $this->SetFieldDefaultValue("requires_accounts",1);
+ $this->SetFieldDefaultValue("accepts_domain_pw",1);
+ $this->SetFieldDefaultValue("needs_approval",0);
$this->SetFieldDefaultValue("state","inactive");
+
$this->SetFieldExtraDef("id","AUTO_INCREMENT");
- $this->bClassFilePath = true; //include the class name & id in file paths
+ $this->bClassFilePath = true; //include the class name & id in file paths
+ $this->EnableRelationCustomFields("Account");
}
protected function _credentials($attribs,$extra_attribs)
@@ -52,19 +61,50 @@
$ret ="";
if($this->GetContextName()=="Identity" && $this->GetContextValue()>0)
{
- $accounts = $this->Accounts(GetArrayValue($attribs,"_Listtype","all"),$this->GetContextValue());
- $ret = $accounts->ParseListTemplate($attribs);
+ $del = $this->GetItemDelegate("rel");
+ $filter = array();
+ $filter["identity_id"] = $this->GetContextValue();
+ $attribs["_relation"] = "Account";
+ $ret = $del->_items($attribs,$filter);
}
return $ret;
}
+ protected function _identity_credentials($attribs,$extra_attribs="")
+ {
+ $ret ="";
+ if($this->GetContextName()=="Identity" && $this->GetContextValue()>0)
+ {
+ $del = $this->GetItemDelegate("rel");
+ $filter = array();
+ $filter["identity_id"] = $this->GetContextValue();
+ $attribs["_relation"] = "IdentityCredential";
+ $ret = $del->_items($attribs,$filter);
+ }
+ return $ret;
+ }
+
+ protected function _identity_compatible_accounts($attribs,$extra_attribs="")
+ {
+ $ret ="";
+ if($this->GetContextName()=="Identity" && $this->GetContextValue()>0)
+ {
+ $accounts = $this->CompatibleAccounts(GetArrayValue($attribs,"_Listtype","all"),$this->GetContextValue());
+ $ret = $accounts->ParseListTemplate($attribs);
+ }
+ return $ret;
+ }
+
protected function _num_identity_accounts($attribs,$extra_attribs="")
{
$ret = "";
if($this->GetContextName()=="Identity" && $this->GetContextValue()>0)
{
- $accounts = $this->Accounts(GetArrayValue($attribs,"_Listtype","all"),$this->GetContextValue());
- $ret = $accounts->ListCount;
+ $del = $this->GetItemDelegate("rel");
+ $filter = array();
+ $filter["identity_id"] = $this->GetContextValue();
+ $attribs["_relation"] = "Account";
+ $ret = $del->_num_items($attribs,$filter);
}
return $ret;
}
@@ -73,8 +113,8 @@
{
$ret ="";
if($this->GetContextName()!="Identity")
- {
- $accounts = $this->Accounts(GetArrayValue($attribs,"_Listtype","all"));
+ {
+ $accounts = $this->Accounts(GetArrayValue($attribs,"_listtype","all"));
$ret = $accounts->ParseListTemplate($attribs);
}
return $ret;
@@ -111,7 +151,7 @@
public function AddToIdentity($IdentityId)
{
$sql = "insert into identity_resource (resource_id,identity_id) VALUES ({$this->get("id")},$IdentityId)";
- DB::doSQL($sql);
+ $this->doSQL($sql);
}
public function RemoveFromIdentity($IdentityId)
@@ -128,59 +168,125 @@
}
}
$sql = "delete from identity_resource where resource_id={$this->get("id")} and identity_id=$IdentityId";
- DB::doSQL($sql);
+ $this->doSQL($sql);
}
public function AddAccount($a)
{
-
+ if(is_array($a))
+ {
+ foreach($a as $acct)
+ {
+ $this->AddAccount($acct);
+ }
+ }
+ if(is_object($a))
+ {
+ $this->AddRelatedObject("Account",$a);
+ }
+ else
+ {
+ $acct = $this->NewRelationObject("Account");
+ $acct->fetch($c);
+ $this->AddRelatedObject("Account",$acct);
+ }
}
public function RemoveAccount($a)
{
if(is_object($a))
{
- $a->delete();
+ $this->DeleteJoinRelation("Account",$a);
+ $account_id = $c->get("id");
}
else
{
- global $objDomains;
-
- $d = $objDomains->getCurrentDomain();
- $obj = $d->getDomainObject("Account",$a);
- $obj->delete();
+ $acct = $this->NewRelationObject("Account");
+ $acct->fetch($a);
+ $this->DeleteJoinRelation("Account",$acct);
}
}
+ /* accepts a single credential or an array of credentials. Credentials can either be a credential object, or just an ID
+ * Not that we are not checking to see if the credential is already assigned to this resource, as we're relying on DB
+ * contstraints to take care of that..
+ * */
public function AddCredential($c)
{
+ if(is_array($c))
+ {
+ foreach($c as $cred)
+ {
+ $this->AddCredential($cred);
+ }
+ }
if(is_object($c))
{
- $credential_id = $c->get("id");
+ $this->AddRelatedObject("Credential",$c);
}
else
- $credential_id = $c;
- $sql = "insert into resource_credential (credential_id,resource_id) VALUES ($credential_id,{$this->get("id")})";
- DB::doSQL($sql);
+ {
+ $cred = $this->NewRelationObject("Credential");
+ $cred->fetch($c);
+ $this->AddRelatedObject("Credential",$cred);
+ }
}
public function RemoveCredential($c)
{
if(is_object($c))
{
- $credential_id = $c->get("id");
+ $this->DeleteJoinRelation("Credential",$c);
+ $credential_id = $c->get("id");
}
else
- $credential_id = $c;
- $sql = "delete from resource_credential where credential_id=$credential_id AND resource_id={$this->get("id")}";
- DB::doSQL($sql);
+ {
+ $cred = $this->NewRelationObject("Credential");
+ $cred->fetch($c);
+ $this->DeleteJoinRelation("Credential",$cred);
+ }
}
+
+
+
public function ResourceGroups()
{
}
+ public function CompatibleAccounts($ListType="",$IdentityId="")
+ {
+ global $objDomains;
+ $d = $objDomains->getCurrentDomain();
+
+ $lst = $d->getDomainObjectList("Account");
+ if(is_object($lst))
+ {
+ $id = (int)$IdentityId;
+ if($id>0)
+ {
+ $lst->AddFilter("identity_id",$id);
+ }
+ }
+ $lst->LoadListItems($ListType);
+ $lst->SetObjectContext("Resource",$this->get("id"));
+ if($lst->NumItems()>0)
+ {
+ $x = 0;
+ while($x<$lst->NumItems())
+ {
+ if(!$lst->Items[$x]->HasAcceptedCredentials($this))
+ {
+ $lst->RemoveItem($x);
+ }
+ else
+ $x++;
+ }
+ }
+ return $lst;
+ }
+
public function Accounts($ListType="",$IdentityId="")
{
global $objDomains;
@@ -205,12 +311,39 @@
{
global $objDomains;
+ $ids = array();
$d = $objDomains->getCurrentDomain();
+ $sql = "select credential_id FROM resource_credential WHERE resource_id={$this->get("id")}";
+ $rs = $this->doSelectSQL($sql);
+ if($rs)
+ {
+ foreach($rs as $r)
+ {
+ $ids[] = $r['credential_id'];
+ }
+ }
$lst = new clsCredentialList();
- $lst->ResourceCredentials($ListType,$this->get("id"));
- $lst->SetObjectContext("Resource",$this->get("id"));
+ if(count($ids)>0)
+ {
+ $lst->AddFilter("id",$ids,"=");
+ $lst->LoadListItems("all");
+ $lst->SetObjectContext("Resource",$this->get("id"));
+ }
return $lst;
}
+
+ public function IsCredentialAccepted($objCredential)
+ {
+ $cl = $this->Credentials();
+ if($cl->NumItems()>0)
+ {
+ if($cl->ItemExists("id", $objCredential->get("id")))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
}
class MCS_clsResourceList extends MySQL_clsResourceList implements iResourceList
@@ -367,9 +500,9 @@
public function identity_remove($IdentityId=null,$ResourceId=null)
{
- if(is_null($IdentityId) && getArrayValue($_GET,"Context","")=="Identity")
+ if(is_null($IdentityId) && GetArrayValue($_GET,"Context","")=="Identity")
{
- $IdentityId = getArrayValue($_GET,"ContextValue",0);
+ $IdentityId = GetArrayValue($_GET,"ContextValue",0);
}
if(is_null($ResourceId))
{
@@ -431,5 +564,44 @@
}
}
+ protected function resource_wizard()
+ {
+ global $objDomains,$objItemDelegates;
+ $ResourceId = getItemId();
+
+ $data = GetArrayValue($_POST,"form",array());
+ $fields = GetArrayValue($_POST,"field",array());
+ $scripts = GetArrayValue($_POST,"script",array());
+ //echo "<pre>";print_r($scripts); echo "</pre>";
+ $credentials = GetArrayValue($data,"credentials",array());
+
+ $d = $objDomains->getCurrentDomain();
+ $res = $d->getDomainObject("Resource",$ResourceId);
+
+ $res->fillFromArray($data);
+ $res->commit();
+
+ if(count($credentials)>0)
+ $res->AddCredential(array_keys($credentials));
+ $this->handleItemCustomFields($res,$fields);
+
+ $script_ids = array();
+ $script_count = count(GetArrayValue($scripts,"name",array()));
+ if($script_count>0)
+ {
+ $objScriptDelegate = $objItemDelegates->GetDelegateObject("script",$res);
+ for($x=0;$x<$script_count;$x++)
+ {
+ $s = array();
+ foreach(array_keys($scripts) as $f)
+ {
+ $s[$f] = $scripts[$f][$x];
+ }
+ $script_ids[] = $objScriptDelegate->SaveScript($s);
+ }
+ }
+ $objScriptDelegate->ClearDeletedScripts($script_ids);
+ }
+
}
?>
\ No newline at end of file
Modified: modules/core/clsDomainBase.php
===================================================================
--- modules/core/clsDomainBase.php 2011-02-23 21:36:05 UTC (rev 16)
+++ modules/core/clsDomainBase.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -9,20 +9,43 @@
function __construct($id=null)
{
$this->table = "Domain";
- $this->className="DomainBase";
+ $this->className="clsDomainBase";
$this->tagPrefix = "dbc";
$this->primaryKey = 'id';
$this->fieldDefs = array(
'id' => array('datatype'=>INTEGER, 'datasize'=>4),
- 'active' => array('datatype'=>INTEGER, 'datasize'=>4),
- 'category_id'=>array('datatype'=>INTEGER,'datasize'=>4),
- 'path'=>array('datatype'=>VARCHAR,'datasize'=>255),
- 'name' => array('datatype'=>VARCHAR, 'datasize'=>255),
- 'obj_prefix' => array('datatype'=>VARCHAR, 'datasize'=>20),
+ 'active' => array('datatype'=>INTEGER,
+ 'datasize'=>4,
+ 'label'=>"Active",
+ 'section'=>"General",
+ 'display_order'=>2),
+ 'category_id'=>array('datatype'=>INTEGER,
+ 'datasize'=>4,
+ 'label'=>"Category",
+ 'section'=>"General",
+ 'display_order'=>3),
+ 'path'=>array('datatype'=>VARCHAR,
+ 'datasize'=>255,
+ 'label'=>"Domain Path",
+ 'section'=>"General",
+ 'display_order'=>4),
+ 'name' => array('datatype'=>VARCHAR, 'datasize'=>255,
+ 'label'=>"Name",
+ 'section'=>"General",
+ 'display_order'=>1),
+ 'obj_prefix' => array('datatype'=>VARCHAR, 'datasize'=>20,'label'=>"Object Prefix",
+ 'section'=>"General",
+ 'display_order'=>5),
);
$this->Relations = array ();
$this->FieldDisplayTags = array();
$this->CategoryCache = array();
+ $this->ItemName = "Domain";
+ $this->ItemPlural = "Domains";
+ $this->uiListColumns = array(
+ "admin"=>array("name","category_id","path","obj_prefix","active")
+ );
+ $this->bEnableCustomFields = false;
parent::__construct();
clsDDLManager::RegisterObject($this);
if($id)
@@ -95,8 +118,7 @@
$u = $objSession->GetUser();
if(is_object($u))
{
- $cat = $this->getCategory();
- return ($u->HasPermission($perm,$cat->get("id")));
+ return ($u->HasPermission($perms,$this->get("category_id")));
}
else
return false;
@@ -194,6 +216,35 @@
$this->Paging = false;
parent::__construct("clsDomainBase");
}
+
+ function BuildListCountSQL($ListName)
+ {
+ switch(strtolower($ListName))
+ {
+ default:
+ $sql = parent::BuildListCountSQL($ListName);
+ break;
+ }
+ return $sql;
+ }
+
+ function BuildListSQL($ListName="all")
+ {
+ /* defaults to group name so we can list just single group from the template */
+ switch(strtolower($ListName))
+ {
+ case "admin":
+ $t = $this->table;
+ $sql = "select $t.*,categories.name as category_name FROM $t left join categories ON (categories.id=$t.category_id)";
+ break;
+ default:
+ $sql = parent::BuildListSQL($ListName);
+ break;
+ }
+ //echo $ListName.":".$sql."<br />\n";
+ return $sql;
+ }
+
}
class clsDomainManager extends clsDomainList
@@ -295,4 +346,12 @@
}
return false;
}
+}
+
+class clsDomainBaseActions extends clsMysqlItemActionHandler
+{
+ function __construct()
+ {
+ parent::__construct("clsDomainBaseList","clsDomainBase","Domain","Domains");
+ }
}
\ No newline at end of file
Modified: modules/core/clsItemEventActions.php
===================================================================
--- modules/core/clsItemEventActions.php 2011-02-23 21:36:05 UTC (rev 16)
+++ modules/core/clsItemEventActions.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -11,6 +11,47 @@
$this->objScripts = new clsEventScriptList();
}
+ public function SaveItemScripts($actions)
+ {
+ $ids = array();
+ $this->LoadItemScripts();
+ foreach($actions as $script)
+ {
+ $id = GetArrayValue($script,"id","");
+ $s = $this->objScripts->NewObject($id);
+ $s->fillFromArray($script);
+ if(!$id)
+ {
+ $id = $s->commit();
+ }
+ else
+ $s->commit();
+ $ids[] = $id;
+ }
+ $this->objScripts->RemoveDeletedScripts($this->getItemObject(),$ids);
+ }
+
+ public function ClearDeletedScripts($IdsToKeep=array())
+ {
+ $this->objScripts->RemoveDeletedScripts($this->getItemObject(),$IdsToKeep);
+ }
+
+ public function SaveScript($action)
+ {
+ $id = GetArrayValue($action,"id","");
+ $action["item_id"] = $this->getItemPK();
+ $action["item_class"] = $this->getItemClass();
+ $s = $this->objScripts->NewObject($id);
+ $s->fillFromArray($action);
+ if(!$id)
+ {
+ $id = $s->commit();
+ }
+ else
+ $s->commit();
+ return $id;
+ }
+
private function LoadItemScripts()
{
if($this->IsValidObject() && !$this->bLoaded)
@@ -46,7 +87,11 @@
public function _template($attributes)
{
$e = $this->objScripts->NewObject();
- $e->LoadItemAction($this->getItemPK(),$this->getItemClass(),GetArrayValue($attributes,"_event",""));
+ $event = GetArrayValue($attributes,"_event","");
+ if(strlen($event)>0)
+ {
+ $e->LoadItemAction($this->getItemPK(),$this->getItemClass(),GetArrayValue($attributes,"_event",""));
+ }
$e->SetContext($this->getItemClass(),$this->getItemPK());
return $e->ParseTemplate($attributes["_template"]);
}
Modified: modules/core/event_script.php
===================================================================
--- modules/core/event_script.php 2011-02-23 21:36:05 UTC (rev 16)
+++ modules/core/event_script.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -2,6 +2,8 @@
class EventScript extends clsDBParsedItem
{
+ var $temp_id='';
+
function __construct($id=null)
{
$this->className="EventScript";
@@ -24,7 +26,7 @@
);
$this->Relations = array();
-
+ $this->bEnableCustomFields = false;
parent::__construct($id);
$this->SetFieldDefaultValue("state","inactive");
$this->SetFieldExtraDef("id","AUTO_INCREMENT");
@@ -52,6 +54,20 @@
return true;
}
+ protected function _line_id($attribs)
+ {
+ $ret = "";
+ if($this->get("id"))
+ {
+ $ret = $this->get("id");
+ }
+ else
+ {
+ $ret = "_new_";
+ }
+ return $ret;
+ }
+
}
class clsEventScriptList extends clsDBParsedCollection
@@ -72,6 +88,34 @@
}
}
+ public function RemoveAllItemScripts($obj)
+ {
+ $sql = "delete from {$this->table} WHERE item_id={$obj->getPK()} and item_class='{$obj->className}'";
+ $this->doDeleteSQL($sql);
+ }
+
+ public function RemoveDeletedScripts($obj,$IdsToKeep=array())
+ {
+ if(count($IdsToKeep)==0)
+ {
+ $this->RemoveAllItemScripts($obj);
+ }
+ else
+ {
+ $this->LoadObjectScripts($obj,"all");
+ if($this->NumItems()>0)
+ {
+ foreach($this->Items as $script)
+ {
+ if(!in_array($script->get("id"),$IdsToKeep))
+ {
+ $script->delete();
+ }
+ }
+ }
+ }
+ }
+
}
class clsEventScriptActions extends clsMysqlItemActionHandler
Modified: modules/core/module_init.php
===================================================================
--- modules/core/module_init.php 2011-02-23 21:36:05 UTC (rev 16)
+++ modules/core/module_init.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -25,6 +25,7 @@
$objTagLib->AddHandler("dlist",new DomainListTags("dlist"));
$objTagLib->AddHandler("dsys",new DomainSystemTags("dsys"));
}
-
+$objTagLib->AddListObject("Domain","clsDomainList",false);
$objTagLib->AddListObject("EventScript","clsEventScriptList",false);
-$objActionHandler->AddHandler("eventscript", new clsEventScriptActions());
\ No newline at end of file
+$objActionHandler->AddHandler("eventscript", new clsEventScriptActions());
+$objActionHandler->AddHandler("clsdomainbase", new clsDomainBaseActions());
\ No newline at end of file
Modified: modules/identity/identity.php
===================================================================
--- modules/identity/identity.php 2011-02-23 21:36:05 UTC (rev 16)
+++ modules/identity/identity.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -960,10 +960,11 @@
}
- public function assign_resource($IdentityId=null,$resources=null)
+ public function assign_resource($IdentityId=null,$objResource=null, $objAccount=null,$arrCredentials=null)
{
global $objDomains;
+ $d = $objDomains->getCurrentDomain();
$count = 0;
if(is_null($IdentityId) || (int)$IdentityId==0)
{
@@ -971,35 +972,39 @@
}
if($IdentityId>0)
{
- if(is_null($resources))
+ $objID = new Identity($IdentityId);
+ if(is_null($objResource))
{
$form = $this->getFormData();
- $resources = array_keys(getArrayValue($form,"resource",array()));
+ $objResource = $d->getDomainObject("Resource",GetArrayValue($form,"resource"));
}
- elseif(!is_array($resources))
+ if(is_null($objAccount) && GetArrayValue($form,"account_id",0)>0)
{
- $t = $resources;
- $resources[] = $t;
- }
-
- $objID = new Identity($IdentityId);
- if($objID->get("id")>0)
+ $objAccount = $d->getDomainObject("Account",GetArrayValue($form,"account_id"));
+ }
+ if(is_null($arrCredentials))
{
- foreach($resources as $res)
- {
- if(is_object($res)) //a resource object was passed in
- {
- $res->AddToIdentity($IdentityId);
- $count++;
- }
- else
+ $arrCredentials = array();
+ $ids = GetArrayValue($form,"credential_id",array());
+ if(count($ids)>0)
+ {
+ foreach($ids as $cred_id)
+ $arrCredentials[] = new IdentityCredential($cred_id);
+ }
+ }
+
+ if($objID->get("id")>0 && is_object($objResource))
+ {
+ $objResource->AddToIdentity($objID->get("id"));
+ if(is_object($objAccount))
+ {
+ $objResource->AddAccount($objAccount);
+ if(count($arrCredentials)>0)
{
- $d = $objDomains->getCurrentDomain();
- $r = $d->getDomainObject("Resource",$res);
- $r->AddToIdentity($IdentityId);
- setUserFeedback("Assigned resource \"{$r->getDefaultText()}\" to {$objID->GetDefaultText()}");
- }
- }
+ $objResource->AddIdentityCredential($arrCredentials);
+ }
+ }
+ setUserFeedback("Added resource {$objResource->getDefaultText()} to {$objID->getDefaultText()}");
}
}
}
Added: modules/mysql/account_resource_credential.php
===================================================================
--- modules/mysql/account_resource_credential.php (rev 0)
+++ modules/mysql/account_resource_credential.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -0,0 +1,22 @@
+<?php
+
+class MySQL_AccountResourceCredential extends clsMysqlDomainItem
+{
+ function __construct($id=null)
+ {
+ parent::__construct($id);
+ }
+
+ function GetDefaultText()
+ {
+ return $this->get("");
+ }
+}
+
+class MySQL_clsAccountResourceCredentialList extends clsMysqlDomainCollection
+{
+
+}
+
+
+?>
\ No newline at end of file
Modified: modules/mysql/clsMysqlDomainItem.php
===================================================================
--- modules/mysql/clsMysqlDomainItem.php 2011-02-23 21:36:05 UTC (rev 16)
+++ modules/mysql/clsMysqlDomainItem.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -16,6 +16,20 @@
}
+ protected function IsContextType($context_name)
+ {
+ global $objDomains;
+
+ $d = $objDomains->getCurrentDomain();
+ if(is_object($d))
+ {
+ $value = strtolower($this->GetContextName());
+ return (strtolower($d->getDomainClassName($context_name))==$value);
+ }
+ else
+ return parent::IsContextType($context_name);
+ }
+
protected function AddRelation($ClassName,$LocalField,$ForeignField,$RelationName="",$ListClass="",
$JoinTable="",$LocalJoinField="",$ForeignJoinField="")
{
@@ -105,4 +119,5 @@
else
return parent::NamedRelationListClass($RelName);
}
+
}
\ No newline at end of file
Modified: modules/mysql/module_init.php
===================================================================
--- modules/mysql/module_init.php 2011-02-23 21:36:05 UTC (rev 16)
+++ modules/mysql/module_init.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -7,3 +7,4 @@
require_once('account.php');
require_once('affiliation.php');
require_once('identity_affiliation.php');
+ require_once('account_resource_credential.php');
Modified: system/loader.php
===================================================================
--- system/loader.php 2011-02-23 21:36:05 UTC (rev 16)
+++ system/loader.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -60,5 +60,13 @@
include($pathtoroot."core/loader.php");
include($pathtoroot."system/system.php");
+/* create instances of system objects so the table validator has them handled */
+$ci = new ConfigItem();
+$u = new clsUser();
+$g = new clsGroup();
+$p = new clsPermission();
+$c = new clsCategory();
+$cf = new clsCustomField();
+
clsDDLManager::ValidateTables();
?>
\ No newline at end of file
Modified: www/css/admin.css
===================================================================
--- www/css/admin.css 2011-02-23 21:36:05 UTC (rev 16)
+++ www/css/admin.css 2011-02-23 21:47:12 UTC (rev 17)
@@ -307,4 +307,13 @@
margin-top: 1px;
font-weight: bold;
font-size: 12px;
+}
+
+.custom_field_list
+{
+ padding-bottom: 30px;
+ border-left: 1px solid #aaa;
+ border-right: 1px solid #aaa;
+ border-bottom: 1px solid #aaa;
+ background-color: #eee;
}
\ No newline at end of file
Modified: www/css/auto_admin.css
===================================================================
--- www/css/auto_admin.css 2011-02-23 21:36:05 UTC (rev 16)
+++ www/css/auto_admin.css 2011-02-23 21:47:12 UTC (rev 17)
@@ -49,7 +49,7 @@
max-width: 350px;
}
-.item_cutomfields
+.item_cutomfields, .item_events
{
width: 100%;
background-color:#eee;
@@ -76,9 +76,15 @@
.autoCustomFieldEdit input,
.autoCustomFieldEdit td select,
-.autoCustomFieldEdit td textarea
+.autoCustomFieldEdit td textarea,
+table.item_events input
{
border: 1px solid #333;
font-size: smaller;
color: black;
+}
+
+table.item_events input
+{
+ width: 80px;
}
\ No newline at end of file
Modified: www/item.php
===================================================================
--- www/item.php 2011-02-23 21:36:05 UTC (rev 16)
+++ www/item.php 2011-02-23 21:47:12 UTC (rev 17)
@@ -33,7 +33,7 @@
if(is_object($objCurrentItem))
{
$objCurrentItem->SetContext(GetArrayValue($_GET,"Context",""),GetArrayValue($_GET,"ContextValue",""));
- if((int)$objCurrentItem->get("id") != (int)$id)
+ if((int)$objCurrentItem->getPK() != $id)
{
if(GetArrayValue($_GET,"response_type","")!="xml")
{
@@ -66,6 +66,10 @@
}
$FormVar = GetArrayValue($_GET,"FormVar","form");
$$FormVar = $objCurrentItem->ExportArray();
+ if(GetArrayValue($_REQUEST,"response_type","html")=="xml")
+ {
+ header("Content-type: text/xml");
+ }
echo $objCurrentItem->ParseTemplate($_GET["tpl"]);
$OverrideTemplate = "";
$DefaultTemplate = "";
Modified: www/js/common.js
===================================================================
--- www/js/common.js 2011-02-23 21:36:05 UTC (rev 16)
+++ www/js/common.js 2011-02-23 21:47:12 UTC (rev 17)
@@ -3,7 +3,7 @@
el.className = classname;
}
-function urldecode (str) {
+function urldecode(str) {
// http://kevin.vanzonneveld.net
// + original by: Philip Peterson
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
Modified: www/js/events/dialog_boxes.js
===================================================================
--- www/js/events/dialog_boxes.js 2011-02-23 21:36:05 UTC (rev 16)
+++ www/js/events/dialog_boxes.js 2011-02-23 21:47:12 UTC (rev 17)
@@ -1,3 +1,14 @@
+function randomstring(L){
+ var s= '';
+ var randomchar=function(){
+ var n= Math.floor(Math.random()*62);
+ if(n<10) return n; //1-10
+ if(n<36) return String.fromCharCode(n+55); //A-Z
+ return String.fromCharCode(n+61); //a-z
+ }
+ while(s.length< L) s+= randomchar();
+ return s;
+}
function addNewCustomField(table)
{
@@ -16,6 +27,24 @@
}
+function addNewEventAction(table)
+{
+ var d = new Date();
+ var field_num = d.getHours().toString()+d.getMinutes().toString()+d.getSeconds().toString()+d.getMilliseconds().toString();
+ var h = $('#item_eventactions_master').html();
+ h = h.replace(/^\s+|\s+$/g,"");
+ h=h.replace('<tbody>','');
+ h=h.replace('</tbody>','');
+ while(h.search(id="_new_")>-1)
+ {
+ h=h.replace('id="_new_"','id="'+field_num+'_'+randomstring(10)+'"');
+ }
+ h = h.replace(/\[_new_\]/g,'['+field_num+']');
+ h=h.replace('value="_new_"','value=""');
+ $('tr:last',table).after(h);
+ $('tr:last',table).find('.autoCustomFieldEdit').show();
+}
+
//dialog box handling
$(document).ready(function() {
//Add/edit dialog
@@ -128,18 +157,21 @@
});
//edit form dialog custom field events
- $('.autoCustomFieldEditLink').live('click',function() {
+ $('.autoCustomFieldEditLink').live('click',function(event) {
+ event.preventDefault();
$(this).closest('tr.autoCustomFieldFormRow').find('.autoCustomFieldView').hide();
$(this).closest('tr.autoCustomFieldFormRow').find('.autoCustomFieldEdit').show();
});
- $('.autoCustomFieldAddLink').live('click',function() {
+ $('.autoCustomFieldAddLink').live('click',function(event) {
+ event.preventDefault();
addNewCustomField($(this).closest('table.item_cutomfields'));
//alert('No Implmented! Custom field must be added through the database');
});
- $('.autoCustomFieldDeleteLink').live('click',function() {
+ $('.autoCustomFieldDeleteLink').live('click',function(event) {
+ event.preventDefault();
$(this).closest('tr.autoCustomFieldFormRow').html('');
$(this).closest('tr.autoCustomFieldFormRow').remove();
});
@@ -159,4 +191,10 @@
else
$(this).closest('.autoCustomFieldEdit').children('.autoCustomFieldDataSizeEnum').hide();
});
+
+ //edit form dialog (and wizard) event actions events
+ $('.autoEventScriptAddLink').live('click',function(event) {
+ event.preventDefault();
+ addNewEventAction($(this).closest('table.item_events'));
+ });
});
\ No newline at end of file
Modified: www/js/events/node_lists.js
===================================================================
--- www/js/events/node_lists.js 2011-02-23 21:36:05 UTC (rev 16)
+++ www/js/events/node_lists.js 2011-02-23 21:47:12 UTC (rev 17)
@@ -187,9 +187,9 @@
var dialog_url = $(this).attr('href');
var wizard_init_url = $(this).attr('WizardInit');
var dialog_title = $(this).attr('title');
- var form_action = $(this).attr('AddAction');
+ var form_action = $(this).attr('FormAction');
if(!form_action)
- form_action = $(this).parents('[AddAction]').attr('AddAction');
+ form_action = $(this).parents('[FormAction]').attr('FormAction');
if(!form_action)
form_action ='edit';
@@ -201,4 +201,5 @@
$('#list-wizard').attr('RefreshId',$(this).attr('id'));
initWizard(dialog_url,wizard_init_url,form_action,dialog_title);
});
+
});
Modified: www/js/events/wizard.js
===================================================================
--- www/js/events/wizard.js 2011-02-23 21:36:05 UTC (rev 16)
+++ www/js/events/wizard.js 2011-02-23 21:47:12 UTC (rev 17)
@@ -1,4 +1,38 @@
+var Panels = new Array();
+
+function submitWizard(refresh_id)
+{
+ $('#frmWizardDialog').ajaxSubmit({
+ success: function(responseText, statusText, xhr, $form)
+ {
+ $('#frmDialogResponse').html(responseText);
+ $('#frmDialogResponse').show();
+ }
+ });
+ if(refresh_id)
+ {
+ $("#list-wizard").attr('RefreshId','');
+ refreshNode(refresh_id);
+ }
+}
+
+
+function getPaneName()
+{
+ return $('#wizard_pane_name').val();
+}
+
+function getWizardFormValue(name)
+{
+ var res = '';
+ $('#wizard_values input').each(function() {
+ if($(this).attr('name')==name)
+ res = $(this).val();
+ });
+ return res;
+}
+
//event handling for the wizard dialog
$(document).ready(function() {
$('#list-wizard').dialog({
@@ -11,19 +45,8 @@
var bValid = true;
storeCurrentPane();
if ( bValid ) {
- var refresh_id = $(this).attr('RefreshId');
- $('#frmWizardDialog').ajaxSubmit({
- success: function(responseText, statusText, xhr, $form)
- {
- $('#frmDialogResponse').html(responseText);
- $('#frmDialogResponse').show();
- }
- });
- if(refresh_id)
- {
- $(this).attr('RefreshId','');
- refreshNode(refresh_id);
- }
+ var refresh_id = $("#list-wizard").attr('RefreshId');
+ submitWizard(refresh_id);
$( this ).dialog( "close" );
}
},
@@ -33,22 +56,45 @@
"Next": function() {
storeCurrentPane();
+ var bContinue = true;
if($('#wizard_next_callback').val())
{
var func=$('#wizard_next_callback').val();
- eval(func);
+ if(func)
+ {
+ bContinue = eval(func);
+ }
}
- if($('#wizard_next_pane').val())
+ if(bContinue)
{
- loadPane($('#wizard_next_pane').val());
+ if($('#wizard_next_pane').val())
+ {
+ loadPane($('#wizard_next_pane').val());
+ }
+ else
+ {
+ submitWizard($(this).attr('RefreshId'));
+ }
}
},
"Prev": function() {
+ storeCurrentPane();
+ if($('#wizard_prev_callback').val())
+ {
+ var func=$('#wizard_prev_callback').val();
+ if(func)
+ eval(func);
+ }
+ restoreWizardPanel($('#wizard_prev_pane').val());
+ setNavValues();
+ restorePaneValues();
}
},
open: function() {
$('.ui-dialog-buttonpane').find('button:contains("Next")').addClass('NextPrevButtonClass');
$('.ui-dialog-buttonpane').find('button:contains("Prev")').addClass('NextPrevButtonClass');
+ Panels = new Array();
+ setNavValues();
},
close: function() {
//allFields.val( "" ).removeClass( "ui-state-error" );
@@ -80,10 +126,13 @@
function loadPane(url)
{
+ url = decodeURIComponent(url.replace(/\+/g, '%20'));
+ url = url.replace(/&/g,'&');
$.ajax({
url: url,
success: function(data) {
$('#tab_wizard').html(data);
+ //restorePaneValues();
setNavValues();
}
});
@@ -91,6 +140,7 @@
function clearNavValues()
{
+ $('#wizard_pane_name').val('');
$('#wizard_next_callback').val('');
$('#wizard_prev_callback').val('');
$('#wizard_next_pane').val('');
@@ -101,41 +151,67 @@
function setNavValues()
{
clearNavValues();
-
$('#wizard_next_callback').val($('#tab_wizard').children('div.wizard_next_callback').html());
$('#wizard_prev_callback').val($('#tab_wizard').children('div.wizard_prev_callback').html());
$('#wizard_next_pane').val($('#tab_wizard').children('div.wizard_next_pane').html());
$('#wizard_prev_pane').val($('#tab_wizard').children('div.wizard_prev_pane').html());
+ $('#wizard_pane_name').val($('#tab_wizard').children('div.wizard_pane_name').html());
}
function storeCurrentPane()
{
$('#tab_wizard').find('input, select, textarea').each(function() {
- var n = $(this).attr('name');
- if(($(this).attr('type')=='radio' && $(this).is(':checked')) || $(this).attr('type')!='radio')
+ var n = $(this).attr('id');
+ if(n != '_new_')
{
- var sn = $('#wizard_values input[name='+n+']');
- if(sn.length>0)
+ if((($(this).attr('type')=='radio' && $(this).is(':checked')) || ($(this).attr('type')=='checkbox' && $(this).is(':checked'))) || ($(this).attr('type')!='radio' && $(this).attr('type')!='checkbox'))
{
- $(sn).val($(this).val());
- }
- else
+ var sn = $('#wiz_'+n);
+ if(sn.length>0)
+ {
+ $(sn).val($(this).val());
+ }
+ else
+ {
+ var tag ='<input type="hidden" id="wiz_'+n+'" name="'+$(this).attr('name')+'" value="'+$(this).val()+'" />';
+ $('#wizard_values').append(tag);
+ }
+ }
+ else if($(this).attr('type')=='radio' || ($(this).attr('type')=='checkbox' && !$(this).is(':checked')))
{
- var tag ='<input type="hidden" name="'+n+'" value="'+$(this).val()+'" />';
- $('#wizard_values').append(tag);
+ //is a radio button but not checked
+ $('#wiz_'+n).remove();
}
}
});
+ saveWizardPanel($('#wizard_pane_name').val());
}
function restorePaneValues()
{
+ $('#tab_wizard input:radio').removeAttr('checked');
+ $('#tab_wizard input:radio').removeAttr('checked');
$('#tab_wizard').find('input, select, textarea').each(function() {
- var n = $(this).attr('name');
- var sn = $('#wizard_values input[name='+n+']');
- if(sn)
+ var sn = $('#wiz_'+$(this).attr("id"));
+
+ if($(this).attr('type')=='radio')
{
+ if(sn.length>0)
+ $(this).attr('checked',true);
+ }
+ else
+ {
$(this).val($(sn).val());
- }
+ }
});
+}
+
+function saveWizardPanel(panel_name)
+{
+ Panels[panel_name] = $('#tab_wizard').html();
+}
+
+function restoreWizardPanel(panel_name)
+{
+ $('#tab_wizard').html(Panels[panel_name]);
}
\ No newline at end of file
Modified: www/js/events/wizard_callbacks.js
===================================================================
--- www/js/events/wizard_callbacks.js 2011-02-23 21:36:05 UTC (rev 16)
+++ www/js/events/wizard_callbacks.js 2011-02-23 21:47:12 UTC (rev 17)
@@ -9,4 +9,57 @@
var next_url = $('#wizard_next_pane').val()+credential_id;
next_url = next_url.replace(/\&/g,'&');
$('#wizard_next_pane').val(next_url);
+}
+
+function add_res_init_next(sPane)
+{
+ switch(sPane)
+ {
+ case 'init':
+
+ break;
+ }
+}
+
+function account_credential_select()
+{
+ return true;
+}
+
+function identity_resource()
+{
+ var pane = getPaneName();
+ switch(pane)
+ {
+ case 'identity_resource_select':
+ //check to see if the resource needs an account or not
+ var res_id = getWizardFormValue('form[resource]');
+ $.ajax({
+ url: 'item.php?obj=Resource&id='+res_id+'&tpl=ajax/simple_item.tpl&response_type=xml',
+ success: function(data) {
+ var accounts_required = ($(data).find("requires_accounts").text()=='1');
+ var url = '';
+ if(accounts_required)
+ {
+ //next pane url here needs to have the current resource id appended to it
+ url = $('#wizard_next_pane').val()+res_id;
+ }
+ else
+ {
+ url = $('#tab_wizard').children('div.wizard_next_skip_acct').html();
+ }
+ loadPane(url);
+ }
+ });
+ return false;
+ break;
+ case 'identity_resource_account_select':
+ var acct_id = getWizardFormValue('form[account_id]');
+ var next_url = $('#wizard_next_pane').val()+acct_id;
+ next_url = next_url.replace(/\&/g,'&');
+ $('#wizard_next_pane').val(next_url);
+ break;
+ }
+
+ return true;
}
\ No newline at end of file
1
0
23 Feb '11
Author: cwalker
Date: 2011-02-23 15:36:05 -0600 (Wed, 23 Feb 2011)
New Revision: 16
Added:
www/tpl/admin/custom_fields/
www/tpl/admin/custom_fields/index.tpl
www/tpl/admin/custom_fields/list_all.tpl
www/tpl/admin/custom_fields/object_fields.tpl
www/tpl/admin/domains/
www/tpl/admin/domains/index.tpl
www/tpl/admin/domains/item.tpl
www/tpl/admin/domains/item_alt.tpl
www/tpl/admin/domains/list.tpl
www/tpl/ajax/
www/tpl/ajax/simple_item.tpl
www/tpl/common/items/resource_account_credential.tpl
www/tpl/nodes/account/ajax/resource_credential_list.tpl
www/tpl/nodes/account/resource_credentials.tpl
www/tpl/wizards/action_scripts/
www/tpl/wizards/action_scripts/new_script_field_item.tpl
www/tpl/wizards/action_scripts/new_script_row.tpl
www/tpl/wizards/action_scripts/script_field_item.tpl
www/tpl/wizards/action_scripts/script_row.tpl
www/tpl/wizards/add_resource/
www/tpl/wizards/add_resource/actions.tpl
www/tpl/wizards/add_resource/credentials.tpl
www/tpl/wizards/add_resource/custom_fields.tpl
www/tpl/wizards/add_resource/init_pane.tpl
www/tpl/wizards/context_customfields.tpl
www/tpl/wizards/event_scripts.tpl
www/tpl/wizards/identity_credential/edit_credential.tpl
www/tpl/wizards/identity_resource/
www/tpl/wizards/identity_resource/account_item.tpl
www/tpl/wizards/identity_resource/credential_type_item.tpl
www/tpl/wizards/identity_resource/finish.tpl
www/tpl/wizards/identity_resource/select_account.tpl
www/tpl/wizards/identity_resource/select_credentials.tpl
www/tpl/wizards/identity_resource/select_resource.tpl
www/tpl/wizards/identity_resource/select_resource_item.tpl
www/tpl/wizards/resource_account_credential/
www/tpl/wizards/resource_account_credential/select_credential.tpl
www/tpl/wizards/resource_account_credential/select_item.tpl
Modified:
www/tpl/admin/config/config.tpl
www/tpl/admin/config/section_header.tpl
www/tpl/common/content_top.tpl
www/tpl/common/items/account.tpl
www/tpl/common/items/resource.tpl
www/tpl/common/items/resource_credential.tpl
www/tpl/common/items/script.tpl
www/tpl/common/misc/dialog_customfields/field_item.tpl
www/tpl/common/misc/dialog_customfields/section_item_close.tpl
www/tpl/common/misc/wizard.tpl
www/tpl/nodes/identity/resources.tpl
www/tpl/nodes/resource_group/ungrouped_main.tpl
www/tpl/picker/resource.tpl
www/tpl/picker/resource_credential/item.tpl
www/tpl/picker/resource_credential/item_alt.tpl
www/tpl/wizards/identity_credential/credential_type_item.tpl
www/tpl/wizards/identity_credential/select_credential_type.tpl
Log:
This commit bring together many features which have been in progress for quite awhile:
- wizard dialogs have been created to add new resources, create identity credentials, assign resources to an identity, manage credentials for an account on a resource.
- wizards now support action scripts for any object which wants to use them
- admin to manage domains has been created. Note this just handles the database portion of creating a domain - the code must still be deployed, etc.
- Implemented an admin to manage custom fields at the object level, on a per-domain basis. (ie, it is possible to create a custom field for the Resouce object within the MCS domain.) It is also possible to create custom fields at the root level, effectively putting that field in all domains. This differs from context custom fields, which are defined for a given instance of an object (ie the 'Workstation' Resource.)
- Created an AccountResourceCredential object, which establishes the relationship between the Account, Resource, and IdentityCredential objects. This is the object that defines what credentials are assign to a resource for a given account.
- Created a generic AJAX template to export an item via XML. This will provide the basis for an access method for external consumers, but for now is only available to userbase itself.
- Deployed the DDL manager to system objects within the platform (ie clsCustomField, clsSession, etc) for consistency with domain objects
- Imported a template parser logging class, which allows for a tracing of the parsing engine
- Added a new system tag (<sys:list_objects />) which accepts a template attribute which is parsed by a generic instance of each object registered with the platform. This tag will be enhanced further to dynamicly build child nodes, allowing modules to create previously unknown associated objects.
Modified: www/tpl/admin/config/config.tpl
===================================================================
--- www/tpl/admin/config/config.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/admin/config/config.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -1,16 +1,16 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
- <sys:include _Template="common/jquery.tpl" />
- <sys:include _Template="admin/common/pagetop.tpl" />
+ <sys:include _Template="common/jquery.tpl" />
+ <sys:include _Template="common/pagetop.tpl" />
</head>
<body>
<div class="margin_container" style="width: 960px;">
- <sys:include _Template="admin/common/content_top.tpl" />
+ <sys:include _Template="common/content_top.tpl" />
<div class="content_body"><!-- content_body -->
<sys:perm_include _Permission="CONFIG" _Template="admin/config/config_list.tpl" _noaccess="admin/login.tpl" />
</div>
- <sys:include _Template="admin/common/content_bottom.tpl" />
+ <sys:include _Template="common/content_bottom.tpl" />
</div>
</body>
</html>
\ No newline at end of file
Modified: www/tpl/admin/config/section_header.tpl
===================================================================
--- www/tpl/admin/config/section_header.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/admin/config/section_header.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -1,3 +1,9 @@
<tr class="adminListHeader">
<td colspan="4"><item:config _Field="section" /></td>
+ </tr>
+ <tr class="adminListHeader">
+ <td>Config Field</td>
+ <td>Local Value</td>
+ <td>Master Value</td>
+ <td>Description</td>
</tr>
\ No newline at end of file
Added: www/tpl/admin/custom_fields/index.tpl
===================================================================
--- www/tpl/admin/custom_fields/index.tpl (rev 0)
+++ www/tpl/admin/custom_fields/index.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <sys:include _Template="common/jquery.tpl" />
+ <sys:include _Template="common/pagetop.tpl" />
+</head>
+<body>
+ <div class="margin_container" style="width: 960px;">
+ <sys:include _Template="common/content_top.tpl" />
+ <div class="content_body"><!-- content_body -->
+ <sys:perm_include _Permission="CONFIG" _Template="admin/custom_fields/list_all.tpl" _noaccess="admin/login.tpl" />
+ </div>
+ <sys:include _Template="common/content_bottom.tpl" />
+ </div>
+</body>
+</html>
\ No newline at end of file
Added: www/tpl/admin/custom_fields/list_all.tpl
===================================================================
--- www/tpl/admin/custom_fields/list_all.tpl (rev 0)
+++ www/tpl/admin/custom_fields/list_all.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,21 @@
+<div class="adminFeedback"><sys:user_feedback /></div>
+<h2>Object Custom Fields</h2>
+<table class="adminToolbar" cellpadding="0" cellspacing="0">
+ <tr class="adminToolbar">
+ <td>
+ <img src="images/admin/toolbar_save.gif" onClick="doSubmit('frmCustom');" onmouseover="setImage(this,'images/admin/toolbar_save_hover.gif');" onMouseOut="setImage(this,'images/admin/toolbar_save.gif');" />
+ <img src="images/admin/toolbar_cancel.gif" onClick="doCancel('frmCustom','<sys:thispage />');" onmouseover="setImage(this,'images/admin/toolbar_cancel_hover.gif');" onMouseOut="setImage(this,'images/admin/toolbar_cancel.gif');" />
+ </td>
+ <td align="right" class="adminToolbar">
+
+ </td>
+ <td align="right" class="adminToolbar">
+
+ </td>
+ <td align="right" class="adminToolbar">
+ </td>
+ </tr>
+</table>
+<form method="post" Validate="true" name="frmCustom" id="frmCustom" enctype="multipart/form-data" action="<sys:thispage _Template="admin/custom_fields/index.tpl" _action="sys:customfields" />">
+ <sys:list_objects _Template="admin/custom_fields/object_fields.tpl" />
+</form>
\ No newline at end of file
Added: www/tpl/admin/custom_fields/object_fields.tpl
===================================================================
--- www/tpl/admin/custom_fields/object_fields.tpl (rev 0)
+++ www/tpl/admin/custom_fields/object_fields.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,13 @@
+ <item:this _Field="custom_fields_enabled">
+ <div class="custom_field_list">
+ <table id="item_customfields_master" style="display: none;">
+ <item:this _Field="field_template" _Template="common/misc/dialog_customfields/field_item.tpl" />
+ </table>
+ <table class="item_cutomfields">
+ <item:this _Field="list_customfields"
+ _FieldTemplate="common/misc/dialog_customfields/field_item.tpl"
+ _headertemplate="common/misc/dialog_customfields/section_item_open.tpl"
+ _footertemplate="common/misc/dialog_customfields/section_item_close.tpl" />
+ </table>
+ </div>
+ </item:this>
\ No newline at end of file
Added: www/tpl/admin/domains/index.tpl
===================================================================
--- www/tpl/admin/domains/index.tpl (rev 0)
+++ www/tpl/admin/domains/index.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <sys:include _Template="common/jquery.tpl" />
+ <sys:include _Template="common/pagetop.tpl" />
+</head>
+<body>
+ <div class="margin_container" style="width: 960px;">
+ <sys:include _Template="common/content_top.tpl" />
+ <div class="content_body"><!-- content_body -->
+ <sys:perm_include _Permission="DOMAINS" _Template="admin/domains/list.tpl" _noaccess="common/login_form.tpl" />
+ </div>
+ <sys:include _Template="common/content_bottom.tpl" />
+ </div>
+ <sys:include _Template="common/misc/dialog_divs.tpl" />
+</body>
+</html>
Added: www/tpl/admin/domains/item.tpl
===================================================================
--- www/tpl/admin/domains/item.tpl (rev 0)
+++ www/tpl/admin/domains/item.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,18 @@
+<tr class="adminListRow">
+ <td style="vertical-align:middle">
+ <a onClick="return confirm('Confirm Delete');" href="<item:this _Field="link" _Template="admin/domains/index.tpl" _action="delete" />"><img src="images/admin/item_destroy.gif" alt="Remove from System" border="0" height="10" width="10" /></a>
+ </td>
+ <td>
+ <item:this _Field="has_permission" _Permission="DOMAIN.EDIT" _TrueText="true">
+ <a id="edit_item_<sys:random_string />" title="Edit Domain" href="<item:this _Field="link" _Parser="item.php" _Template="common/misc/dialog_form.tpl" />" class="list-node_edit_item">
+ </item:this>
+ <item:this _Field="name" />
+ <item:this _Field="has_permission" _Permission="DOMAIN.EDIT" _TrueText="true">
+ </a>
+ </item:this>
+ </td>
+ <td><item:this _Field="category_name" /></td>
+ <td><item:this _Field="path" /></td>
+ <td><item:this _Field="obj_prefix" /></td>
+ <td><item:this _Field="active_text" /></td>
+</tr>
\ No newline at end of file
Added: www/tpl/admin/domains/item_alt.tpl
===================================================================
--- www/tpl/admin/domains/item_alt.tpl (rev 0)
+++ www/tpl/admin/domains/item_alt.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,18 @@
+<tr class="adminListRowAlt">
+ <td style="vertical-align:middle">
+ <a onClick="return confirm('Confirm Delete');" href="<item:this _Field="link" _Template="admin/domains/index.tpl" _action="delete" />"><img src="images/admin/item_destroy.gif" alt="Remove from System" border="0" height="10" width="10" /></a>
+ </td>
+ <td>
+ <item:this _Field="has_permission" _Permission="DOMAIN.EDIT" _TrueText="true">
+ <a id="edit_item_<sys:random_string />" title="Edit Domain" href="<item:this _Field="link" _Parser="item.php" _Template="common/misc/dialog_form.tpl" />" class="list-node_edit_item">
+ </item:this>
+ <item:this _Field="name" />
+ <item:this _Field="has_permission" _Permission="DOMAIN.EDIT" _TrueText="true">
+ </a>
+ </item:this>
+ </td>
+ <td><item:this _Field="category_name" /></td>
+ <td><item:this _Field="path" /></td>
+ <td><item:this _Field="obj_prefix" /></td>
+ <td><item:this _Field="active_text" /></td>
+</tr>
\ No newline at end of file
Added: www/tpl/admin/domains/list.tpl
===================================================================
--- www/tpl/admin/domains/list.tpl (rev 0)
+++ www/tpl/admin/domains/list.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,59 @@
+<div class="adminFeedback"><sys:user_feedback /></div>
+<h2>Domain Management</h2>
+<table class="adminToolbar" cellpadding="0" cellspacing="0">
+ <tr class="adminToolbar">
+ <td>
+ <img src="images/admin/toolbar_newitem.gif" onClick="navTo('<sys:thispage _Template="admin/users/edit_user.tpl" />');" ALT="Add New Domain" onMouseOver="setImage(this,'images/admin/toolbar_newitem_hover.gif');" onMouseOut="setImage(this,'images/admin/toolbar_newitem.gif');" />
+ </td>
+ <td align="right" class="adminToolbar">
+ Page:<list:pagenav _Item="Domain" _ListType="admin" _HideEmpty="false" />
+ </td>
+ <td align="right" class="adminToolbar">
+ <form name="searchlist" id="searchlist" method="POST" style="display:inline" action="<sys:thispage />" />
+ <input type=hidden name="List[List]" value="<list:list_name _Item="Domain" _ListType="admin" />" />
+ <input type=hidden name="List[Page]" value="1" />
+ <input type=hidden name="action" value="list:vars" />
+ Search:<input id="searchbox" name="List[Search]" value="<sys:session_value _field="Domain_admin_Search" />">
+ <img src="images/admin/icon_search.gif" height="11" width="11" onClick="doSearch('searchlist','searchbox');" />
+ <img src="images/admin/icon_search_reset.gif" height="11" width="11" onClick="doSearchReset('searchlist','searchbox');" />
+ </td>
+ </tr>
+</table>
+<table class="adminList" cellpadding="0" cellspacing="0">
+ <tr class="adminListHeader">
+ <td> </td>
+ <td >
+ <A HREF="<list:sorturl _Item="Domain" _ListType="admin" _Column="username" />">
+ Name
+ </A>
+ <img src="<list:sorticon _Item="Domain" _ListType="admin" _Column="username" _DescIcon="images/admin/header_arrow_down.gif" _AscIcon="images/admin/header_arrow_up.gif" />" border=0 align="top">
+ </td>
+ <td class="adminListHeader">
+ <A HREF="<list:sorturl _Item="Domain" _ListType="admin" _Column="firstname" />">
+ Category
+ </A>
+ <img src="<list:sorticon _Item="Domain" _ListType="admin" _Column="firstname" _DescIcon="images/admin/header_arrow_down.gif" _AscIcon="images/admin/header_arrow_up.gif" />" border=0 align="top">
+ </td>
+ <td class="adminListHeader">
+ <A HREF="<list:sorturl _Item="Domain" _ListType="admin" _Column="lastname" />">
+ Path
+ </A>
+ <img src="<list:sorticon _Item="Domain" _ListType="admin" _Column="lastname" _DescIcon="images/admin/header_arrow_down.gif" _AscIcon="images/admin/header_arrow_up.gif" />" border=0 align="top">
+ </td>
+ <td class="adminListHeader">
+ <A HREF="<list:sorturl _Item="Domain" _ListType="admin" _Column="primary_group_name" />">
+ Object Prefix
+ </A>
+ <img src="<list:sorticon _Item="Domain" _ListType="admin" _Column="primary_group_name" _DescIcon="images/admin/header_arrow_down.gif" _AscIcon="images/admin/header_arrow_up.gif" />" border=0 align="top">
+ </td>
+ <td class="adminListHeader">
+ <A HREF="<list:sorturl _Item="Domain" _ListType="admin" _Column="active" />">
+ Active
+ </A>
+ <img src="<list:sorticon _Item="Domain" _ListType="admin" _Column="active" _DescIcon="images/admin/header_arrow_down.gif" _AscIcon="images/admin/header_arrow_up.gif" />" border=0 align="top">
+ </td>
+ </tr>
+ <list:items _ListType="admin" _Item="Domain" _ItemTemplate="admin/domains/item.tpl" _AltItemTemplate="admin/domains/item_alt.tpl" />
+</table>
+</body>
+</html>
\ No newline at end of file
Added: www/tpl/ajax/simple_item.tpl
===================================================================
--- www/tpl/ajax/simple_item.tpl (rev 0)
+++ www/tpl/ajax/simple_item.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1 @@
+<sys:current_item_detail _Field="xml_export" _deep="false" />
Modified: www/tpl/common/content_top.tpl
===================================================================
--- www/tpl/common/content_top.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/common/content_top.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -6,7 +6,10 @@
<li>
<a href="<sys:thispage _Template="admin/index.tpl" />">Admin</a>
<ul class="subnav">
- <li><a href="<sys:thispage _Template="admin/users/users.tpl" _Params="obj=Domain" />">App Users</a></li>
+ <li><a href="<sys:thispage _Template="admin/users/users.tpl" />">App Users</a></li>
+ <li><a href="<sys:thispage _Template="admin/domains/index.tpl" />">Domains</a></li>
+ <li><a href="<sys:thispage _Template="admin/config/config.tpl" />">Configuration</a></li>
+ <li><a href="<sys:thispage _Template="admin/custom_fields/index.tpl" />">Custom Fields</a></li>
</ul>
</li>
<li><a href="<sys:thispage _Template="identities.tpl" />">Identities</a></li>
Modified: www/tpl/common/items/account.tpl
===================================================================
--- www/tpl/common/items/account.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/common/items/account.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -18,11 +18,16 @@
<span class="list-node_item_label">uid:</span>
<span class="list-node_item_value"><item:this _Field="uid" /></span>
<span class="list-node_item_label">shell:</span>
- <span class="list-node_item_value"><item:this _Field="shell" /></span>
+ <span class="list-node_item_value"><item:this _Field="shell" /></span>
+ <item:this _Field="is_context_type" _Context="resource" _TrueText="true">
+ <div class="list-node" ajaxTemplate="<item:this _Field="link" _Parser="item.php" _Template="nodes/account/resource_credentials.tpl" />"></div>
+ </item:this>
<item:this _Field="is_context_type" _Context="identity" _FalseText="true">
<div class="list-node" ajaxTemplate="<item:this _Field="link" _Parser="item.php" _Template="nodes/account/identity.tpl" />"></div>
</item:this>
- <div class="list-node" ajaxTemplate="<item:this _Field="link" _Parser="item.php" _Template="nodes/account/credential.tpl" />"></div>
+ <item:this _Field="is_context_type" _Context="identity" _TrueText="true">
+ <div class="list-node" ajaxTemplate="<item:this _Field="link" _Parser="item.php" _Template="nodes/account/credential.tpl" />"></div>
+ </item:this>
</div>
</div>
<!-- end: common/items/account.tpl -->
\ No newline at end of file
Modified: www/tpl/common/items/resource.tpl
===================================================================
--- www/tpl/common/items/resource.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/common/items/resource.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -3,7 +3,8 @@
<span class="list-node_action_icons">
<item:this _Field="is_context_type" _Context="identity" _FalseText="true">
<a title="Edit Resource" id="edit_item_<sys:random_string />" FormAction="resource" href="<item:this _Field="link" _Parser="item.php" _Template="common/misc/dialog_form.tpl" />" class="list-node_edit_item"><img src="images/pencil.png" /></a>
- <a href="<item:this _Field="link" _Template="dialogs/del_confirm.tpl" />" class="list-node_edit_item"><img src="images/delete.png" /></a>
+ <a ConfirmPrompt="Are you sure you want to Delete this Resource? Click Confirm below to delete." id="delete_item_<sys:random_string />" href="<item:this _Parser="item.php" _Field="link" _Template="common/misc/dialog_confirm.tpl" />" class="list-node_confirm_item" title="Delete Resource <item:this _Field="tostring" />" ConfirmAction="delete"><img src="images/delete.png" /></a>
+
</item:this>
<item:this _Field="is_context_type" _Context="identity" _TrueText="true">
@@ -24,17 +25,19 @@
<span class="list-node_item_value"><item:this _Field="public_text" /></span>
<span class="list-node_item_label">Approval:</span>
<span class="list-node_item_value"><item:this _Field="needs_approval_text" /></span>
- <item:this _Field="template" _Template="nodes/resource/credential.tpl" />
+ <item:this _Field="context_include" _Context="Identity" _FalseTemplate="nodes/resource/credential.tpl" />
+
<item:this _Field="is_context_type" _Context="identity" _TrueText="true">
<div class="list-node">
<div class="list-node_header">
- <h2>Accounts</h2> (<item:this _Field="num_identity_accounts" _ListType="main" />)
+ <h2>Accounts</h2> (<item:this _Field="num_identity_accounts" _ListType="identity" />)
<sys:include _Template="common/misc/list_controls.tpl" />
</div>
<div class="list-node_items">
- <item:this _Field="identity_accounts" _ItemTemplate="common/items/account.tpl" />
+ <item:this _Field="identity_accounts" _ListType="identity" _ItemTemplate="common/items/account.tpl" />
</div>
</div>
+
</item:this>
<item:this _Field="is_context_type" _Context="identity" _FalseText="true">
Added: www/tpl/common/items/resource_account_credential.tpl
===================================================================
--- www/tpl/common/items/resource_account_credential.tpl (rev 0)
+++ www/tpl/common/items/resource_account_credential.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,8 @@
+<div class="list-node_item">
+ <span class="list-node_action_icons">
+ <a ConfirmPrompt="Are you sure you want to remove this credential? Click Confirm below to delete." id="delete_item_<sys:random_string />" href="<item:this _Parser="item.php" _Field="link" _Template="common/misc/dialog_confirm.tpl" />" class="list-node_confirm_item" title="Remove Credential from Resource: <item:this _Object="Resource" _Field="tostring" />" ConfirmAction="delete"><img src="images/delete.png" /></a>
+ </span>
+ <span class="list-node_item_name node_label"><item:this _Object="IdentityCredential::Credential" _Field="tostring" /></span>
+ <span class="list-node_item_label">Type:</span>
+ <span class="list-node_item_value"><item:this _Object="IdentityCredential::Credential" _Field="type" /></span>
+</div>
\ No newline at end of file
Modified: www/tpl/common/items/resource_credential.tpl
===================================================================
--- www/tpl/common/items/resource_credential.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/common/items/resource_credential.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -2,7 +2,7 @@
<span class="list-node_action_icons">
<item:this _Field="is_context_type" _Context="resource" _TrueText="true">
<a ConfirmPrompt="Are you sure you want remove this credential? Click Confirm below to delete." id="delete_item_<sys:random_string />" href="<item:this _Parser="item.php" _Field="link" _Template="common/misc/dialog_confirm.tpl" />" class="list-node_confirm_item" title="Remove Credential from Resource: <item:this _Field="tostring" />" ConfirmAction="remove_resource"><img src="images/delete.png" /></a>
- </item:this>
+ </item:this>
</span>
<span class="list-node_item_name node_label"><item:this _Field="tostring" /></span>
Modified: www/tpl/common/items/script.tpl
===================================================================
--- www/tpl/common/items/script.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/common/items/script.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -2,7 +2,8 @@
<span class="list-node_action_icons">
<item:this _Field="is_context_type" _Context="identity" _FalseText="true">
<a title="Edit Event" id="edit_item_<sys:random_string />" FormAction="edit" href="<item:this _Field="link" _Parser="item.php" _Template="common/misc/dialog_form.tpl" />" class="list-node_edit_item"><img src="images/pencil.png" /></a>
- <a href="<item:this _Field="link" _Template="dialogs/del_confirm.tpl" />" class="list-node_edit_item"><img src="images/delete.png" /></a>
+ <a ConfirmPrompt="Are you sure you want to Delete this Script Action? Click Confirm below to delete." id="delete_item_<sys:random_string />" href="<item:this _Parser="item.php" _Field="link" _Template="common/misc/dialog_confirm.tpl" />" class="list-node_confirm_item" title="Delete Script Action <item:this _Field="tostring" />" ConfirmAction="delete"><img src="images/delete.png" /></a>
+
</item:this>
<item:this _Field="is_context_type" _Context="identity" _TrueText="true">
Modified: www/tpl/common/misc/dialog_customfields/field_item.tpl
===================================================================
--- www/tpl/common/misc/dialog_customfields/field_item.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/common/misc/dialog_customfields/field_item.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -3,6 +3,7 @@
<a href="#" class="autoCustomFieldEditLink"><img src="images/pencil.png" /></a>
<a href="#" class="autoCustomFieldDeleteLink"><img src="images/delete.png" /></a>
<input type="hidden" name="field[<item:field _Field="name" />][childclass]" value="<item:field _Field="object_name" />" />
+ <input type="hidden" name="field[<item:field _Field="name" />][category_id]" value="<item:field _Field="category_id" />" />
</td>
<td>
<span class="autoCustomFieldView"><item:field _Field="name" /></span>
Modified: www/tpl/common/misc/dialog_customfields/section_item_close.tpl
===================================================================
--- www/tpl/common/misc/dialog_customfields/section_item_close.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/common/misc/dialog_customfields/section_item_close.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -1,2 +1,2 @@
</table>
-</div>
+
Modified: www/tpl/common/misc/wizard.tpl
===================================================================
--- www/tpl/common/misc/wizard.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/common/misc/wizard.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -2,6 +2,7 @@
<!-- <h2>Manage <autoform:objectplural />: Add/Edit <autoform:objectname /></h2> -->
<form method="post" Validate="true" name="frmWizardDialog" id="frmWizardDialog" enctype="multipart/form-data" action="<item:this _Object="parent" _field="link" _Template="common/misc/ajax_feedback.tpl" />">
<input type="hidden" name="action" id="frmWizardDialogAction" value="" />
+ <input type="hidden" id="wizard_pane_name" name="pane_name" value="" />
<input type="hidden" id="wizard_next_pane" name="next_pane" value="" />
<input type="hidden" id="wizard_prev_pane" name="prev_pane" value="" />
<input type="hidden" id="wizard_next_callback" name="next_callback" value="" />
Added: www/tpl/nodes/account/ajax/resource_credential_list.tpl
===================================================================
--- www/tpl/nodes/account/ajax/resource_credential_list.tpl (rev 0)
+++ www/tpl/nodes/account/ajax/resource_credential_list.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,2 @@
+<!-- Template: nodes/account/ajax/resource_credential_list.tpl -->
+<item:this _Field="resource_credentials" _ListType="main" _ItemTemplate="common/items/resource_account_credential.tpl" />
\ No newline at end of file
Added: www/tpl/nodes/account/resource_credentials.tpl
===================================================================
--- www/tpl/nodes/account/resource_credentials.tpl (rev 0)
+++ www/tpl/nodes/account/resource_credentials.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,49 @@
+<!-- template: nodes/account/credential.tpl -->
+ <div class="list-node_header" AddAction="credential">
+ <h2>Assigned Credentials</h2> (<item:this _Field="num_resource_credential" />)
+ <div class="list-node_buttons">
+ <a id="edit_item_<sys:random_string />" FormAction="identity_resource_credential_assign" title="Add Account Credential to Resource <item:this _Object="parent" _Field="tostring" />" href="<item:this _Parser="item.php" _Field="link" _Template="common/misc/wizard.tpl" />&Context=<item:this _Field="context_name" />&ContextValue=<item:this _Field="context_value" />" WizardInit="<item:this _Parser="item.php" _Field="link" _Template="wizards/resource_account_credential/select_credential.tpl" />" class="list-init_wizard">
+ <img class="hoverable" src="images/list_add.png" />
+ </a>
+ <a href="#" class="list-node_refresh_item" id="refresh_item_<sys:random_string />">
+ <img class="hoverable" src="images/list_refresh.png" />
+ </a>
+ </div>
+ <div class="list-node_controls">
+ <div class="list-node_search">
+ <form name="identity_searchlist" id="<item:this _Object="Credential" _Field="classname" />_searchlist" method="POST" style="display:inline" action="<item:this _Field="link" _Template="nodes/account/credential.tpl" />">
+ <input type=hidden name="List[List]" value="<item:this _Object="Credential" _Field="list_name" _ListType="main" />" />
+ <input type=hidden name="List[Page]" value="1" />
+ <input type=hidden name="action" value="list:vars" />
+ Search:
+ <input class="searchbox" name="List[Search]" value="<item:this _Object="Credential" _Field="list_var_value" _ListType="main" _var="Search" />">
+ <img class="list-node_search_submit" src="images/admin/icon_search.gif" height="11" width="11" />
+ <img class="list-node_search_clear" src="images/admin/icon_search_reset.gif" height="11" width="11" />
+ </form>
+ </div>
+ <div class="list-node_sort">
+ Sort:
+ <form name="identity_sortlist" id="identity_sortlist" method="POST" style="display:inline" action="<sys:thispage _Template="common/misc/ajax_feedback.tpl" />">
+ <input type=hidden name="List[List]" value="<item:this _Object="Credential" _Field="list_name" _ListType="main" />" />
+ <input type=hidden name="List[Page]" value="1" />
+ <input type=hidden name="action" value="list:vars" />
+ <select class="list-sort_select" name="List[SortCol]">
+ <option value=""></option>
+ <item:this _Object="Credential" _Field="sort_option_list" _ListType="main" />
+ </select>
+ </form>
+ <a href="<sys:thispage _Template="common/misc/ajax_feedback.tpl" _Params="List[List]=Credential_main&action=list:vars" />"
+ CurrentOrder="<item:this _Object="Credential" _Field="list_var_value" _Var="SortOrder" _Item="Credential" _ListType="main" />"
+ class="list-node_sort_order">
+ <img src="images/list_sort_toggle.png" />
+ </a>
+ </div>
+ <div class="list-node_paging">
+ Page: <item:this _Field="resource_credential_pagenav" _ListType="main" _HideEmpty="true" />
+ </div>
+ </div>
+ </div>
+ <div class="list-node_items" id="list_node_<sys:random_string />" ajaxTemplate="<item:this _Field="link" _Parser="item.php" _Template="nodes/account/ajax/resource_credential_list.tpl" />">
+ <item:this _Field="template" _Template="nodes/account/ajax/resource_credential_list.tpl" />
+ </div>
+<!-- end: nodes/account/credential.tpl -->
\ No newline at end of file
Modified: www/tpl/nodes/identity/resources.tpl
===================================================================
--- www/tpl/nodes/identity/resources.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/nodes/identity/resources.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -1,7 +1,14 @@
<!-- Template: nodes/identity/resources.tpl -->
<div class="list-node_header" AddAction="assign_resource">
<h2>Resources</h2> (<item:this _Field="num_resources" _Relation="Resource" _ListType="main" _ListType="main" />)
- <item:this _Field="template" _Template="nodes/identity/resource_picker/buttons.tpl" />
+ <div class="list-node_buttons">
+ <a id="edit_item_<sys:random_string />" FormAction="assign_resource" title="Assign Resource" href="<item:this _Parser="item.php" _Field="link" _Template="common/misc/wizard.tpl" />" WizardInit="<item:this _Parser="item.php" _Field="link" _Template="wizards/identity_resource/select_resource.tpl" />" class="list-init_wizard">
+ <img class="hoverable" src="images/list_add.png" />
+ </a>
+ <a href="#" class="list-node_refresh_item" id="refresh_item_<sys:random_string />">
+ <img class="hoverable" src="images/list_refresh.png" />
+ </a>
+ </div>
<div class="list-node_controls">
<div class="list-node_search">
<form name="affiliation_searchlist" id="<item:this _Object="Resource" _Field="classname" />_searchlist" method="POST" style="display:inline" action="<item:this _Field="link" _Template="nodes/identity/affiliation.tpl" />">
Modified: www/tpl/nodes/resource_group/ungrouped_main.tpl
===================================================================
--- www/tpl/nodes/resource_group/ungrouped_main.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/nodes/resource_group/ungrouped_main.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -1,6 +1,16 @@
<div class="list-node_header">
<h2>Ungrouped Resources</h2> (<dlist:num_items _Item="Resource" _ListType="orphins" />)
- <dsys:item_include _Item="Resource" _Template="common/misc/list_node_buttons.tpl" />
+ <div class="list-node_buttons">
+ <a id="edit_item_<sys:random_string />" FormAction="resource_wizard" title="Add Resource"
+ href="<sys:thispage _Parser="item.php" _Field="link" _Template="common/misc/wizard.tpl" _Params="obj=Resource&id=0" />"
+ WizardInit="<sys:thispage _Parser="item.php" _Template="wizards/add_resource/init_pane.tpl" _Params="obj=Resource&id=0" />"
+ class="list-init_wizard">
+ <img class="hoverable" src="images/list_add.png" />
+ </a>
+ <a href="#" class="list-node_refresh_item" id="refresh_item_<sys:random_string />">
+ <img class="hoverable" src="images/list_refresh.png" />
+ </a>
+ </div>
<dsys:item_include _Item="Resource" _Template="common/misc/list_controls/resource_orphins.tpl" />
</div>
<div class="list-node_items" ajaxTemplate="<sys:thispage _Template="nodes/resource_group/ajax/orphin_list.tpl" />">
Modified: www/tpl/picker/resource.tpl
===================================================================
--- www/tpl/picker/resource.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/picker/resource.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -1,5 +1,5 @@
<div class="list-node_item">
- <input type="checkbox" name="form[resource][<item:this _Field="id" />]" value="1" />
+ <input type="checkbox" id="form_resource_<item:this _Field="id" />" name="form[resource][<item:this _Field="id" />]" value="<item:this _Field="id" />" />
<span class="list-node_item_name"><item:this _Field="tostring" /></span>
<span class="list-node_item_label">Full Name:</span>
<span class="list-node_item_value"><item:this _Field="full_name" /></span>
Modified: www/tpl/picker/resource_credential/item.tpl
===================================================================
--- www/tpl/picker/resource_credential/item.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/picker/resource_credential/item.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -1,6 +1,6 @@
<tr class="adminListRow">
<td style="vertical-align:middle">
- <input type="checkbox" name="form[credentials][<item:this _Field="id" />]" value="1" />
+ <input id="form_credentials_list_<sys:random_string />" type="checkbox" name="form[credentials][<item:this _Field="id" />]" value="1" />
</td>
<td><item:this _Field="name" /></td>
<td><item:this _Field="type" /></td>
Modified: www/tpl/picker/resource_credential/item_alt.tpl
===================================================================
--- www/tpl/picker/resource_credential/item_alt.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/picker/resource_credential/item_alt.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -1,6 +1,6 @@
<tr class="adminListRowAlt">
<td style="vertical-align:middle">
- <input type="checkbox" name="form[credentials][<item:this _Field="id" />]" value="1" />
+ <input id="form_credentials_list_<sys:random_string />" type="checkbox" name="form[credentials][<item:this _Field="id" />]" value="1" />
</td>
<td><item:this _Field="name" /></td>
<td><item:this _Field="type" /></td>
Added: www/tpl/wizards/action_scripts/new_script_field_item.tpl
===================================================================
--- www/tpl/wizards/action_scripts/new_script_field_item.tpl (rev 0)
+++ www/tpl/wizards/action_scripts/new_script_field_item.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,6 @@
+ <div class="autoFormRow">
+ <div class="autoFormPrompt"><item:field _Field="label" /></div>
+ <div class="autoFormField">
+ <item:field _Field="form_element" class="autoForm" _FormVar="script" _FormSuffix="[]" _NoId="true" id="_new_" />
+ </div>
+ </div>
\ No newline at end of file
Added: www/tpl/wizards/action_scripts/new_script_row.tpl
===================================================================
--- www/tpl/wizards/action_scripts/new_script_row.tpl (rev 0)
+++ www/tpl/wizards/action_scripts/new_script_row.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,11 @@
+ <tr><td colspan="2"><div class="autoFormSectionHeader">Script Action</div></td>
+ <tr>
+ <td valign="top">
+ <a href="#" class="autoCustomFieldEditLink"><img src="images/pencil.png" /></a>
+ <a href="#" class="autoCustomFieldDeleteLink"><img src="images/delete.png" /></a>
+ </td>
+ <td>
+ <input type="hidden" name="script[id][]" value="<item:this _Field="id" />" id="_new_" />
+ <item:this _Field="+autoform:field_list" _FieldTemplate="wizards/action_scripts/new_script_field_item.tpl" />
+ </td>
+ </tr>
\ No newline at end of file
Added: www/tpl/wizards/action_scripts/script_field_item.tpl
===================================================================
--- www/tpl/wizards/action_scripts/script_field_item.tpl (rev 0)
+++ www/tpl/wizards/action_scripts/script_field_item.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,6 @@
+ <div class="autoFormRow">
+ <div class="autoFormPrompt"><item:field _Field="label" /></div>
+ <div class="autoFormField">
+ <item:field _Field="form_element" class="autoForm" _FormVar="script" _FormSuffix="[]" _idprefix="random" />
+ </div>
+ </div>
\ No newline at end of file
Added: www/tpl/wizards/action_scripts/script_row.tpl
===================================================================
--- www/tpl/wizards/action_scripts/script_row.tpl (rev 0)
+++ www/tpl/wizards/action_scripts/script_row.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,11 @@
+ <tr><td colspan="2"><div class="autoFormSectionHeader">Script Action</div></td>
+ <tr>
+ <td valign="top">
+ <a href="#" class="autoCustomFieldEditLink"><img src="images/pencil.png" /></a>
+ <a href="#" class="autoCustomFieldDeleteLink"><img src="images/delete.png" /></a>
+ </td>
+ <td>
+ <input type="hidden" name="script[id][]" value="<item:this _Field="id" />" />
+ <item:this _Field="+autoform:field_list" _FieldTemplate="wizards/action_scripts/script_field_item.tpl" />
+ </td>
+ </tr>
\ No newline at end of file
Added: www/tpl/wizards/add_resource/actions.tpl
===================================================================
--- www/tpl/wizards/add_resource/actions.tpl (rev 0)
+++ www/tpl/wizards/add_resource/actions.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,7 @@
+ <div class="wizard_pane_name" style="display: none;">add_res_actions</div>
+ <div class="wizard_next_callback" style="display: none;">add_res_init_next('actions')</div>
+ <div class="wizard_next_pane" style="display: none;"></div>
+ <div class="wizard_prev_pane" style="display: none;">add_res_credentials</div>
+ <div id="add_resource_context" style="display: none;"><sys:current_item_detail _Field="context" /></div>
+ <div id="add_resource_context_value" style="display: none;"><sys:current_item_detail _Field="context_value" /></div>
+ <sys:include _Template="wizards/event_scripts.tpl"/>
\ No newline at end of file
Added: www/tpl/wizards/add_resource/credentials.tpl
===================================================================
--- www/tpl/wizards/add_resource/credentials.tpl (rev 0)
+++ www/tpl/wizards/add_resource/credentials.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,33 @@
+ <div class="wizard_pane_name" style="display: none;">add_res_credentials</div>
+ <div class="wizard_next_callback" style="display: none;">add_res_init_next('credentials')</div>
+ <div class="wizard_next_pane" style="display: none;"><sys:thispage _Parser="item.php" _Template="wizards/add_resource/actions.tpl" />&obj=Resource&id=<sys:current_item_detail _Field="id" /></div>
+ <div class="wizard_prev_pane" style="display: none;">add_res_custom_fields</div>
+ <div id="add_resource_context" style="display: none;"><sys:current_item_detail _Field="context" /></div>
+ <div id="add_resource_context_value" style="display: none;"><sys:current_item_detail _Field="context_value" /></div>
+ <h1>Accepted Credentials</h1>
+ <div class="picker">
+ <table class="adminList" cellpadding="0" cellspacing="0">
+ <tr class="adminListHeader">
+ <td> </td>
+ <td >
+ <A HREF="<dlist:sorturl _Item="Credential" _ListType="resource_picker" _Column="name" />">
+ Name
+ </A>
+ <img src="<dlist:sorticon _Item="Credential" _ListType="resource_picker" _Column="name" _DescIcon="images/admin/header_arrow_down.gif" _AscIcon="images/admin/header_arrow_up.gif" />" border=0 align="top">
+ </td>
+ <td class="adminListHeader">
+ <A HREF="<dlist:sorturl _Item="Credential" _ListType="resource_picker" _Column="type" />">
+ Type
+ </A>
+ <img src="<dlist:sorticon _Item="Credential" _ListType="resource_picker" _Column="type" _DescIcon="images/admin/header_arrow_down.gif" _AscIcon="images/admin/header_arrow_up.gif" />" border=0 align="top">
+ </td>
+ <td class="adminListHeader">
+ <A HREF="<dlist:sorturl _Item="Credential" _ListType="resource_picker" _Column="verify" />">
+ Verify
+ </A>
+ <img src="<dlist:sorticon _Item="Credential" _ListType="resource_picker" _Column="verify" _DescIcon="images/admin/header_arrow_down.gif" _AscIcon="images/admin/header_arrow_up.gif" />" border=0 align="top">
+ </td>
+ </tr>
+ <dlist:items _ListType="resource_picker" _Item="Credential" _ItemTemplate="picker/resource_credential/item.tpl" _AltItemTemplate="picker/resource_credential/item_alt.tpl" />
+ </table>
+ </div>
\ No newline at end of file
Added: www/tpl/wizards/add_resource/custom_fields.tpl
===================================================================
--- www/tpl/wizards/add_resource/custom_fields.tpl (rev 0)
+++ www/tpl/wizards/add_resource/custom_fields.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,9 @@
+ <div class="wizard_pane_name" style="display: none;">add_res_custom_fields</div>
+ <div class="wizard_next_callback" style="display: none;">add_res_init_next('customfields')</div>
+ <div class="wizard_next_pane" style="display: none;"><sys:thispage _Parser="item.php" _Template="wizards/add_resource/credentials.tpl" />&obj=Resource&id=<sys:current_item_detail _Field="id" /></div>
+ <div class="wizard_prev_pane" style="display: none;">add_res_init</div>
+ <div id="add_resource_context" style="display: none;"><sys:current_item_detail _Field="context" /></div>
+ <div id="add_resource_context_value" style="display: none;"><sys:current_item_detail _Field="context_value" /></div>
+ <h1>Context Custom Fields</h1>
+ <sys:include _Template="wizards/context_customfields.tpl" />
+
\ No newline at end of file
Added: www/tpl/wizards/add_resource/init_pane.tpl
===================================================================
--- www/tpl/wizards/add_resource/init_pane.tpl (rev 0)
+++ www/tpl/wizards/add_resource/init_pane.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,6 @@
+ <div class="wizard_pane_name" style="display: none;">add_res_init</div>
+ <div class="wizard_next_callback" style="display: none;">add_res_init_next('init')</div>
+ <div class="wizard_next_pane" style="display: none;"><sys:thispage _Parser="item.php" _Template="wizards/add_resource/custom_fields.tpl" />&obj=Resource&id=<sys:current_item_detail _Field="id" /></div>
+ <div id="add_resource_context" style="display: none;"><sys:current_item_detail _Field="context" /></div>
+ <div id="add_resource_context_value" style="display: none;"><sys:current_item_detail _Field="context_value" /></div>
+ <sys:include _Template="wizards/autoform_fields.tpl" />
Added: www/tpl/wizards/context_customfields.tpl
===================================================================
--- www/tpl/wizards/context_customfields.tpl (rev 0)
+++ www/tpl/wizards/context_customfields.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,9 @@
+ <table id="item_customfields_master" style="display: none;">
+ <sys:current_item_detail _Field="field_template" _Template="common/misc/dialog_customfields/field_item.tpl" />
+ </table>
+ <table class="item_cutomfields">
+ <sys:current_item_detail _Field="list_relation_customfields"
+ _FieldTemplate="common/misc/dialog_customfields/field_item.tpl"
+ _headertemplate="common/misc/dialog_customfields/section_item_open.tpl"
+ _footertemplate="common/misc/dialog_customfields/section_item_close.tpl" />
+ </table>
\ No newline at end of file
Added: www/tpl/wizards/event_scripts.tpl
===================================================================
--- www/tpl/wizards/event_scripts.tpl (rev 0)
+++ www/tpl/wizards/event_scripts.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,15 @@
+<h1>Event Actions</h1>
+<table id="item_eventactions_master" style="display: none;">
+ <sys:current_item_detail _Field="+script:template" _Template="wizards/action_scripts/new_script_row.tpl" />
+
+</table>
+<table class="item_events" cellpadding="0" cellspacing="0">
+ <tr class="autoCustomFieldsHeader autoFormSectionHeader">
+ <td colspan="8">
+ <span style="float: right;margin-right: 4px;">
+ <a href="#" ClassName="<sys:current_item_detail _Field="classname" />" class="autoEventScriptAddLink">add new action</a>
+ </span>
+ </td>
+ </tr>
+ <sys:current_item_detail _Field="+script:list_items" _ItemTemplate="wizards/action_scripts/script_row.tpl" />
+</table>
\ No newline at end of file
Modified: www/tpl/wizards/identity_credential/credential_type_item.tpl
===================================================================
--- www/tpl/wizards/identity_credential/credential_type_item.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/wizards/identity_credential/credential_type_item.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -1,4 +1,4 @@
<div class="list-node_item">
- <input type="radio" name="form[credential_id]" value="<item:this _Field="id" />" />
+ <input type="radio" name="form[credential_id]" id="form_credential_id_<item:this _Field="id" />" value="<item:this _Field="id" />" />
<span class="list-node_item_name"><item:this _Field="tostring" /></span>
</div>
\ No newline at end of file
Added: www/tpl/wizards/identity_credential/edit_credential.tpl
===================================================================
--- www/tpl/wizards/identity_credential/edit_credential.tpl (rev 0)
+++ www/tpl/wizards/identity_credential/edit_credential.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,6 @@
+ <div class="wizard_pane_name" style="display: none;">identity_credential_edit</div>
+ <div class="wizard_next_callback" style="display: none;"></div>
+ <div class="wizard_next_pane" style="display: none;"></div>
+ <div class="wizard_prev_callback" style="display: none;"></div>
+ <div class="wizard_prev_pane" style="display: none;">identity_credential_select</div>
+ <sys:include _Template="wizards/autoform_fields.tpl" />
\ No newline at end of file
Modified: www/tpl/wizards/identity_credential/select_credential_type.tpl
===================================================================
--- www/tpl/wizards/identity_credential/select_credential_type.tpl 2011-02-07 20:54:33 UTC (rev 15)
+++ www/tpl/wizards/identity_credential/select_credential_type.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -1,5 +1,6 @@
+ <div class="wizard_pane_name" style="display: none;">identity_credential_select</div>
<div class="wizard_next_callback" style="display: none;">identity_credential_select()</div>
- <div class="wizard_next_pane" style="display: none;"><sys:thispage _Parser="item.php" _Template="wizards/autoform_fields.tpl" />&obj=IdentityCredential&id=&Context=Credential&ContextValue=</div>
+ <div class="wizard_next_pane" style="display: none;"><sys:thispage _Parser="item.php" _Template="wizards/identity_credential/edit_credential.tpl" />&obj=IdentityCredential&id=&Context=Credential&ContextValue=</div>
<div class="picker">
<div class="list-node">
<div class="list-node_header"></div>
Added: www/tpl/wizards/identity_resource/account_item.tpl
===================================================================
--- www/tpl/wizards/identity_resource/account_item.tpl (rev 0)
+++ www/tpl/wizards/identity_resource/account_item.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,4 @@
+<div class="list-node_item">
+ <input type="radio" name="form[account_id]" id="form_caccount_id_<item:this _Field="id" />" value="<item:this _Field="id" />" />
+ <span class="list-node_item_name"><item:this _Field="tostring" /></span>
+</div>
\ No newline at end of file
Added: www/tpl/wizards/identity_resource/credential_type_item.tpl
===================================================================
--- www/tpl/wizards/identity_resource/credential_type_item.tpl (rev 0)
+++ www/tpl/wizards/identity_resource/credential_type_item.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,4 @@
+<div class="list-node_item">
+ <input type="checkbox" name="form[credential_id][<item:this _Field="id" />]" id="form_credential_id_<item:this _Field="id" />" value="<item:this _Field="id" />" />
+ <span class="list-node_item_name"><item:this _Field="tostring" /></span>
+</div>
\ No newline at end of file
Added: www/tpl/wizards/identity_resource/finish.tpl
===================================================================
--- www/tpl/wizards/identity_resource/finish.tpl (rev 0)
+++ www/tpl/wizards/identity_resource/finish.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1 @@
+Success! Click save below to assign this resouce.
Added: www/tpl/wizards/identity_resource/select_account.tpl
===================================================================
--- www/tpl/wizards/identity_resource/select_account.tpl (rev 0)
+++ www/tpl/wizards/identity_resource/select_account.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,13 @@
+ <div class="wizard_pane_name" style="display: none;">identity_resource_account_select</div>
+ <div class="wizard_next_callback" style="display: none;">identity_resource()</div>
+ <div class="wizard_next_pane" style="display: none;"><sys:thispage _Parser="item.php" _Template="wizards/identity_resource/select_credentials.tpl" />&obj=Account&Context=Resource&ContextValue=<sys:current_item_detail _Field="id" />&id=</div>
+ <div class="wizard_prev_callback" style="display: none;"></div>
+ <div class="wizard_prev_pane" style="display: none;">identity_resource_select</div>
+ <div class="picker">
+ <div class="list-node">
+ <div class="list-node_header"></div>
+ <div class="list-node_items">
+ <sys:current_item_detail _Field="identity_compatible_accounts" _ListType="available" _ItemTemplate="wizards/identity_resource/account_item.tpl" />
+ </div>
+ </div>
+ </div>
\ No newline at end of file
Added: www/tpl/wizards/identity_resource/select_credentials.tpl
===================================================================
--- www/tpl/wizards/identity_resource/select_credentials.tpl (rev 0)
+++ www/tpl/wizards/identity_resource/select_credentials.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,13 @@
+ <div class="wizard_pane_name" style="display: none;">identity_resource_credentials_select</div>
+ <div class="wizard_next_callback" style="display: none;">identity_resource()</div>
+ <div class="wizard_next_pane" style="display: none;"></div>
+ <div class="wizard_prev_callback" style="display: none;"></div>
+ <div class="wizard_prev_pane" style="display: none;">identity_resource_account_select</div>
+ <div class="picker">
+ <div class="list-node">
+ <div class="list-node_header"></div>
+ <div class="list-node_items">
+ <sys:current_item_detail _Field="list_credentials" _ListType="available" _ItemTemplate="wizards/identity_resource/credential_type_item.tpl" />
+ </div>
+ </div>
+ </div>
\ No newline at end of file
Added: www/tpl/wizards/identity_resource/select_resource.tpl
===================================================================
--- www/tpl/wizards/identity_resource/select_resource.tpl (rev 0)
+++ www/tpl/wizards/identity_resource/select_resource.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,23 @@
+ <div class="wizard_pane_name" style="display: none;">identity_resource_select</div>
+ <div class="wizard_next_callback" style="display: none;">identity_resource()</div>
+ <div class="wizard_next_pane" style="display: none;"><sys:thispage _Parser="item.php" _Template="wizards/identity_resource/select_account.tpl" />&obj=Resource&Context=Identity&ContextValue=<sys:current_item_detail _Field="id" />&id=</div>
+ <div class="wizard_next_skip_acct" style="display: none;"><sys:thispage _Parser="item.php" _Template="wizards/identity_resource/finish.tpl" /></div>
+
+ <div class="picker">
+ <div class="list-node">
+ <div class="list-node_header">
+ Resource Groups
+ </div>
+ <div class="list-node_items">
+ <dlist:items _Item="ResourceGroup" _ListType="top" _ItemTemplate="picker/resource_group/resource_group.tpl" />
+ </div>
+ </div>
+ <div class="list-node">
+ <div class="list-node_header">
+ Ungrouped Resources
+ </div>
+ <div class="list-node_items">
+ <dlist:items _Item="Resource" _ListType="orphins" _ItemTemplate="wizards/identity_resource/select_resource_item.tpl" />
+ </div>
+ </div>
+ </div>
\ No newline at end of file
Added: www/tpl/wizards/identity_resource/select_resource_item.tpl
===================================================================
--- www/tpl/wizards/identity_resource/select_resource_item.tpl (rev 0)
+++ www/tpl/wizards/identity_resource/select_resource_item.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,16 @@
+<div class="list-node_item">
+ <input type="radio" id="form_resource_<item:this _Field="id" />" name="form[resource]" value="<item:this _Field="id" />" />
+ <span class="list-node_item_name"><item:this _Field="tostring" /></span>
+ <span class="list-node_item_label">Full Name:</span>
+ <span class="list-node_item_value"><item:this _Field="full_name" /></span>
+ <span class="list-node_item_label">Status:</span>
+ <span class="list-node_item_value"><item:this _Field="status_text" /></span>
+ <span class="list-node_item_label">url:</span>
+ <span class="list-node_item_value"><item:this _Field="url" /></span>
+ <span class="list-node_item_label">public:</span>
+ <span class="list-node_item_value"><item:this _Field="public_text" /></span>
+ <span class="list-node_item_label">Approval:</span>
+ <span class="list-node_item_value"><item:this _Field="needs_approval_text" /></span>
+ <span class="list-node_item_label">brief description:</span>
+ <span class="list-node_item_value"><item:this _Field="brief_description" /></span>
+</div>
Added: www/tpl/wizards/resource_account_credential/select_credential.tpl
===================================================================
--- www/tpl/wizards/resource_account_credential/select_credential.tpl (rev 0)
+++ www/tpl/wizards/resource_account_credential/select_credential.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,12 @@
+ <div class="wizard_next_callback" style="display: none;">account_resource_credential_select()</div>
+ <div class="wizard_next_pane" style="display: none;"></div>
+ <input type="hidden" name="form[resource_id]" id="hidden_form_resource_id" value="<sys:get_var _Var="ContextValue" />" />
+ <div class="picker">
+ <div class="list-node">
+ <div class="list-node_header"></div>
+ <div class="list-node_items">
+ <item:this _Field="available_resource_credentials" _ItemTemplate="wizards/account_credential/select_item.tpl" />
+ </div>
+
+ </div>
+ </div>
\ No newline at end of file
Added: www/tpl/wizards/resource_account_credential/select_item.tpl
===================================================================
--- www/tpl/wizards/resource_account_credential/select_item.tpl (rev 0)
+++ www/tpl/wizards/resource_account_credential/select_item.tpl 2011-02-23 21:36:05 UTC (rev 16)
@@ -0,0 +1,4 @@
+<div class="list-node_item">
+ <input type="radio" name="form[credential_id]" value="<item:this _Field="id" />" />
+ <span class="list-node_item_name"><item:this _Field="tostring" /></span>
+</div>
\ No newline at end of file
1
0