Index: trunk/kernel/include/parseditem.php
===================================================================
diff -u -r295 -r302
--- trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 295)
+++ trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 302)
@@ -41,11 +41,11 @@
*/
function ParseTimeStamp($d,$attribs=array())
{
- if($attribs["_tz"])
+ if( isset($attribs["_tz"]) )
{
$d = GetLocalTime($d,$objSession->Get("tz"));
}
- $part = strtolower($attribs["_part"]);
+ $part = isset($attribs["_part"]) ? strtolower($attribs["_part"]) : '';
if(strlen($part))
{
$ret = ExtractDatePart($part,$d);
@@ -179,7 +179,7 @@
break;
case "rating":
- $style = $element->attributes["_displaymode"];
+ $style = $element->GetAttributeByName("_displaymode");
if(!strlen($style))
$style = "numerical";
switch($style)
@@ -212,7 +212,7 @@
if(method_exists($this,"ReviewCount"))
{
- if($element->attributes["_today"])
+ if($element->GetAttributeByName("_today"))
$today = TRUE;
$ret = $this->ReviewCount($today);
}
@@ -271,7 +271,7 @@
{
if($this->IsHotItem())
{
- $ret = $element->attributes["_label"];
+ $ret = $element->GetAttributeByName("_label");
if(!strlen($ret))
$ret = "lu_hot";
$ret = language($ret);
@@ -294,7 +294,7 @@
case "admin_icon":
if(method_exists($this,"StatusIcon"))
{
- if($element->attributes["fulltag"])
+ if($element->GetAttributeByName("fulltag"))
{
$ret = "
StatusIcon()."\">";
}
@@ -1160,7 +1160,7 @@
function CopyFromEditTable($idfield = null)
{
global $objSession;
-
+ echo "INM
";
$dropRelTableFlag = false;
if($idfield == null) $idfield = $this->GetIDField();
$edit_table = $objSession->GetEditTable($this->SourceTable);
@@ -1229,17 +1229,18 @@
$c->Set("OrgId",0);
}
}
-
+
if(method_exists($c,"CategoryMemberList"))
{
$cats = $c->CategoryMemberList($objSession->GetEditTable("CategoryItems"));
- //echo "CATS: [$cats]
";
+ $ci_table = $objSession->GetEditTable('CategoryItems');
+ $primary_cat = $c->GetPrimaryCategory($ci_table);
$c->Update();
- UpdateCategoryItems($c,$cats);
+ UpdateCategoryItems($c,$cats,$primary_cat);
}
else
$c->Update();
-
+
unset($c);
unset($r);
@@ -1252,7 +1253,7 @@
$objRelGlobal->PurgeEditTable();
}
- @$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
+ if($edit_table) @$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS ".$objSession->GetEditTable("CategoryItems"));
}
@@ -1769,7 +1770,7 @@
return $ret;
}
-function UpdateCategoryItems($item,$NewCatList)
+function UpdateCategoryItems($item,$NewCatList,$PrimaryCatId = false)
{
global $objCatList;
@@ -1809,6 +1810,7 @@
$cat = $del_list[$i];
$item->RemoveFromCategory($cat);
}
+ if($PrimaryCatId !== false) $item->SetPrimaryCategory($PrimaryCatId);
}
class clsCatItemList extends clsItemList