Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sat, Feb 1, 8:04 PM

in-portal

This file is larger than 256 KB, so syntax highlighting was skipped.
Index: trunk/kernel/include/parseditem.php
===================================================================
--- trunk/kernel/include/parseditem.php (revision 122)
+++ trunk/kernel/include/parseditem.php (revision 123)
@@ -1,2757 +1,2749 @@
<?php
global $ItemTypePrefixes;
$ItemTypePrefixes = array();
$ItemTagFiles = array();
function RegisterPrefix($class,$prefix,$file)
{
global $ItemTypePrefixes, $ItemTagFiles;
$ItemTypePrefixes[$class] = $prefix;
$ItemTagFiles[$prefix] = $file;
}
class clsParsedItem extends clsItemDB
{
var $TagPrefix;
var $Parser;
var $AdminParser;
function clsParsedItem($id=NULL)
{
global $TemplateRoot;
$this->clsItemDB();
$this->Parser = new clsTemplateList($TemplateRoot);
$this->AdminParser = new clsAdminTemplateList();
}
/* function ParseObject($element)
{
$extra_attribs = ExtraAttributes($element->attributes);
if(strtolower($element->name)==$this->TagPrefix)
{
$field = strtolower($element->attributes["_field"]);
$tag = $this->TagPrefix."_".$field;
$ret = $this->parsetag($tag);
}
return $ret;
}
*/
function ParseTimeStamp($d,$attribs=array())
{
if($attribs["_tz"])
{
$d = GetLocalTime($d,$objSession->Get("tz"));
}
$part = strtolower($attribs["_part"]);
if(strlen($part))
{
$ret = ExtractDatePart($part,$d);
}
else
{
if($d<=0)
{
$ret = "";
}
else
$ret = LangDate($d);
}
return $ret;
}
function ParseObject($element)
{
global $objConfig, $objCatList, $var_list_update, $var_list, $n_var_list_update, $m_var_list_update;
$extra_attribs = ExtraAttributes($element->attributes);
$ret = "";
if ($this->TagPrefix == "email" && strtolower($element->name) == "touser") {
$this->TagPrefix = "touser";
}
if(strtolower($element->name)==$this->TagPrefix)
{
$field = strtolower($element->attributes["_field"]);
switch($field)
{
case "id":
$ret = $this->Get($this->id_field);
break;
case "resourceid":
if(!$this->NoResourceId)
$ret = $this->Get("ResourceId");
break;
case "category":
$c = $objCatList->GetItem($this->Get("CategoryId"));
if(is_object($c))
{
$ret = $c->parsetag($element->attributes["_cattag"]);
}
break;
case "priority":
if($this->Get("Priority")!=0)
{
$ret = (int)$this->Get("Priority");
}
else
$ret = "";
break;
case "link":
if(method_exists($this,"ItemURL"))
{
$ret = $this->ItemURL($element->attributes["_template"],FALSE,"");
}
break;
case "cat_link":
if(method_exists($this,"ItemURL"))
{
$ret = $this->ItemURL($element->attributes["_template"],TRUE,"");
}
break;
case "fullpath":
$ret = $this->Get("CachedNavbar");
if(!strlen($ret))
{
if(is_numeric($this->Get("CategoryId")))
{
$c = $objCatList->GetItem($this->Get("CategoryId"));
if(is_object($c))
$ret = $c->Get("CachedNavbar");
}
else
{
if(method_exists($this,"GetPrimaryCategory"))
{
$cat = $this->GetPrimaryCategory();
$c = $objCatList->GetItem($cat);
if(is_object($c))
$ret = $c->Get("CachedNavbar");
}
}
}
// $ret = $this->HighlightText($ret);
break;
case "relevance":
$style = $element->attributes["_displaymode"];
if(!strlen($style))
$style = "numerical";
switch ($style)
{
case "numerical":
$ret = (100 * LangNumber($this->Get("Relevance"),1))."%";
break;
case "bar":
$OffColor = $element->attributes["_offbackgroundcolor"];
$OnColor = $element->attributes["_onbackgroundcolor"];
$percentsOff = (int)(100 - (100 * $this->Get("Relevance"))); if ($percentsOff)
{
$percentsOn = 100 - $percentsOff;
$ret = "<td width=\"$percentsOn%\" bgcolor=\"$OnColor\"><img src=\"img/s.gif\"></td><td width=\"$percentsOff%\" bgcolor=\"$OffColor\"><img src=\"img/s.gif\"></td>";
}
else
$ret = "<td width=\"100%\" bgcolor=\"$OnColor\"><img src=\"img/s.gif\"></td>";
break;
case "graphical":
$OnImage = $element->attributes["_onimage"];
if (!strlen($OnImage))
break;
// Get image extension
$image_data = explode(".", $OnImage);
$image_ext = $image_data[count($image_data)-1];
unset($image_data[count($image_data)-1]);
$rel = (10 * LangNumber($this->Get("Relevance"),1));
$OnImage1 = join(".", $image_data);
if ($rel)
$img_src = $OnImage1."_".$rel.".".$image_ext;
else
$img_src = $OnImage;
$ret = "<img src=\"$img_src\" border=\"0\" alt=\"".(10*$rel)."\">";
break;
}
break;
case "rating":
$style = $element->attributes["_displaymode"];
if(!strlen($style))
$style = "numerical";
switch($style)
{
case "numerical":
$ret = LangNumber($this->Get("CachedRating"),1);
break;
case "text":
$ret = RatingText($this->Get("CachedRating"));
break;
case "graphical":
$OnImage = $element->attributes["_onimage"];
$OffImage = $element->attributes["_offimage"];
$images = RatingTickImage($this->Get("CachedRating"),$OnImage,$OffImage);
for($i=1;$i<=count($images);$i++)
{
$url = $images[$i];
if(strlen($url))
{
$ret .= "<IMG src=\"$url\" $extra_attribs >";
$ret .= $element->attributes["_separator"];
}
}
break;
}
break;
case "reviews":
$today = FALSE;
if(method_exists($this,"ReviewCount"))
{
if($element->attributes["_today"])
$today = TRUE;
$ret = $this->ReviewCount($today);
}
else
$ret = "";
break;
case "votes":
$ret = (int)$this->Get("CachedVotesQty");
break;
case "favorite":
if(method_exists($this,"IsFavorite"))
{
if($this->IsFavorite())
{
$ret = $element->attributes["_label"];
if(!strlen($ret))
$ret = "lu_favorite";
$ret = language($ret);
}
else
$ret = "";
}
break;
case "new":
if(method_exists($this,"IsNewItem"))
{
if($this->IsNewItem())
{
$ret = $element->attributes["_label"];
if(!strlen($ret))
$ret = "lu_new";
$ret = language($ret);
}
else
$ret = "";
}
break;
case "pop":
if(method_exists($this,"IsPopItem"))
{
if($this->IsPopItem())
{
$ret = $element->attributes["_label"];
if(!strlen($ret))
$ret = "lu_pop";
$ret = language($ret);
}
else
$ret = "";
}
break;
case "hot":
if(method_exists($this,"IsHotItem"))
{
if($this->IsHotItem())
{
$ret = $element->attributes["_label"];
if(!strlen($ret))
$ret = "lu_hot";
$ret = language($ret);
}
else
$ret = "";
}
break;
case "pick":
if($this->Get("EditorsPick")==1)
{
$ret = $element->attributes["_label"];
if(!strlen($ret))
$ret = "lu_pick";
$ret = language($ret);
}
else
$ret = "";
break;
case "admin_icon":
if(method_exists($this,"StatusIcon"))
{
if($element->attributes["fulltag"])
{
$ret = "<IMG $extra_attribs SRC=\"".$this->StatusIcon()."\">";
}
else
$ret = $this->StatusIcon();
}
break;
case "custom":
if(method_exists($this,"GetCustomFieldValue"))
{
$field = $element->attributes["_customfield"];
$default = $element->attributes["_default"];
if (strlen($field))
$ret = $this->GetCustomFieldValue($field,$default);
}
break;
case "image":
$default = $element->attributes["_primary"];
$name = $element->attributes["_name"];
if(strlen($name))
{
$img = $this->GetImageByName($name);
}
else
{
if($default)
$img = $this->GetDefaultImage();
}
if(is_object($img))
{
if(strlen($element->attributes["_imagetemplate"]))
{
$ret = $img->ParseTemplate($element->attributes["_imagetemplate"]);
break;
}
else
{
if($element->attributes["_thumbnail"])
{
$url = $img->parsetag("thumb_url");
}
else
{
if(!$element->attributes["_nothumbnail"])
{
$url = $img->parsetag("image_url");
}
else
{
$url = $img->FullURL(TRUE,"");
}
}
}
}
else
{
$url = $element->attributes["_defaulturl"];
}
if($element->attributes["_imagetag"])
{
if(strlen($url))
{
$ret = "<IMG src=\"$url\" $extra_attribs >";
}
else
$ret = "";
}
else
$ret = $url;
break;
default:
$ret = "Undefined:".$element->name;
break;
}
}
else if ($this->TagPrefix == 'email'){
$ret = "Undefined:".$element->name;
}
return $ret;
}
function ParseString($name)
{
$el = new clsHtmlTag();
$el->Clear();
$el->prefix = "inp";
$el->name = $name;
$numargs = func_num_args();
$arg_list = func_get_args();
for ($i = 1; $i < $numargs; $i++)
{
$attr = $arg_list[$i];
$parts = explode("=",$attr,2);
$name = $parts[0];
$val = $parts[1];
$el->attributes[$name] = $val;
}
return $this->ParseObject($el);
}
/* pass attributes as strings
ie: ParseStringEcho('tagname','_field="something" _data="somethingelse"');
*/
function ParseStringEcho($name)
{
$el = new clsHtmlTag();
$el->Clear();
$el->prefix = "inp";
$el->name = $name;
$numargs = func_num_args();
$arg_list = func_get_args();
for ($i = 1; $i < $numargs; $i++)
{
$attr = $arg_list[$i];
$parts = explode("=",$attr,2);
$name = $parts[0];
$val = $parts[1];
$el->attributes[$name] = $val;
}
echo $this->ParseObject($el);
}
function ParseElement($raw, $inner_html ="")
{
$tag = new clsHtmlTag($raw);
$tag->inner_html = $inner_html;
if($tag->parsed)
{
if($tag->name=="include" || $tag->name=="perm_include" || $tag->name=="lang_include")
{
$output = $this->Parser->IncludeTemplate($tag);
}
else
{
$output = $this->ParseObject($tag);
//echo $output."<br>";
if(substr($output,0,9)=="Undefined")
{
$output = $tag->Execute();
// if(substr($output,0,8)="{Unknown")
// $output = $raw;
} return $output;
}
}
else
return "";
}
function AdminParseTemplate($file)
{
$html = "";
$t = $this->AdminParser->GetTemplate($file);
if(is_object($t))
{
array_push($this->AdminParser->stack,$file);
$html = $t->source;
$next_tag = strpos($html,"<inp:");
while($next_tag)
{
$end_tag = strpos($html,"/>",$next_tag);
$tagtext = substr($html,$next_tag,($end_tag - $next_tag)+2);
$pre = substr($html,0,$next_tag);
$post = substr($html,$end_tag+2);
$inner = $this->ParseElement($tagtext);
$html = $pre.$inner.$post;
$next_tag = strpos($html,"<inp:");
}
array_pop($this->AdminParser->stack);
}
return $html;
}
function ParseTemplateText($text)
{
$html = $text;
$search = "<inp:".$this->TagPrefix;
$next_tag = strpos($html,"<inp:");
//$next_tag = strpos($html,$search);
while($next_tag)
{
$closer = strpos(strtolower($html),">",$next_tag);
$end_tag = strpos($html,"/>",$next_tag);
if($end_tag < $closer || $closer == 0)
{
$tagtext = substr($html,$next_tag,($end_tag - $next_tag)+2);
$pre = substr($html,0,$next_tag);
$post = substr($html,$end_tag+2);
$inner = $this->ParseElement($tagtext);
$html = $pre.$inner.$post;
}
else
{
$OldTagStyle = "</inp>";
## Try to find end of TagName
$TagNameEnd = strpos($html, " ", $next_tag);
## Support Old version
// $closer = strpos(strtolower($html),"</inp>",$next_tag);
if ($TagNameEnd)
{
$Tag = strtolower(substr($html, $next_tag, $TagNameEnd-$next_tag));
$TagName = explode(":", $Tag);
if (strlen($TagName[1]))
$CloserTag = "</inp:".$TagName[1].">";
}
else
{
$CloserTag = $OldTagStyle;
}
$closer = strpos(strtolower($html), $CloserTag, $next_tag);
## Try to find old tag closer
if (!$closer && ($CloserTag != $OldTagStyle))
{
$CloserTag = $OldTagStyle;
$closer = strpos(strtolower($html), $CloserTag, $next_tag);
}
$end_tag = strpos($html,">",$next_tag);
$tagtext = substr($html,$next_tag,($end_tag - $next_tag)+1);
$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);
$parsed = $this->ParseElement($tagtext);
if(strlen($parsed))
{
$html = $pre.$this->ParseTemplateText($inner).$post;
}
else
$html = $pre.$post;
}
$next_tag = strpos($html,$search);
}
return $html;
}
function ParseTemplate($tname)
{
global $objTemplate, $LogLevel,$ptime,$timestart;
LogEntry("Parsing $tname\n");
$LogLevel++;
$html = "";
$t = $objTemplate->GetTemplate($tname);
//$t = $this->Parser->GetTemplate($tname);
if(is_object($t))
{
array_push($this->Parser->stack,$tname);
$html = $t->source;
$html = $this->ParseTemplateText($html);
array_pop($this->Parser->stack);
}
$LogLevel--;
LogEntry("Finished Parsing $tname\n");
$ptime = round(getmicrotime() - $timestart,6);
$xf = 867530; //Download ID
if($xf != 0)
{
$x2 = substr($ptime,-6);
$ptime .= $xf ^ $x2; //(1/1000);
}
return $html;
}
function SendUserEventMail($EventName,$ToUserId,$LangId=NULL,$RecptName=NULL)
{
global $objMessageList,$FrontEnd;
$Event =& $objMessageList->GetEmailEventObject($EventName,0,$LangId);
if(is_object($Event))
{
if($Event->Get("Enabled")=="1" || ($Event->Get("Enabled")==2 && $FrontEnd))
{
$Event->Item = $this;
if(is_numeric($ToUserId))
{
return $Event->SendToUser($ToUserId);
}
else
return $Event->SendToAddress($ToUserId,$RecptName);
}
}
}
function SendAdminEventMail($EventName,$LangId=NULL)
{
global $objMessageList,$FrontEnd;
//echo "Firing Admin Event $EventName <br>\n";
$Event =& $objMessageList->GetEmailEventObject($EventName,1,$LangId);
if(is_object($Event))
{
if($Event->Get("Enabled")=="1" || ($Event->Get("Enabled")==2 && $FrontEnd))
{
$Event->Item = $this;
//echo "Admin Event $EventName Enabled <br>\n";
return $Event->SendAdmin($ToUserId);
}
}
}
function parse_template($t)
{
}
}
class clsItemCollection
{
var $Items;
var $CurrentItem;
var $adodbConnection;
var $classname;
var $SourceTable;
var $LiveTable;
var $QueryItemCount;
var $AdminSearchFields = array();
var $SortField;
var $debuglevel;
var $id_field = null; // id field for list item
var $BasePermission;
var $Dummy = null;
function SetTable($action, $table_name = null) // new by Alex
{
// $action = {'live', 'restore','edit'}
switch($action)
{
case 'live':
$this->LiveTable = $table_name;
$this->SourceTable = $this->LiveTable;
break;
case 'restore':
$this->SourceTable = $this->LiveTable;
break;
case 'edit':
global $objSession;
$this->SourceTable = $objSession->GetEditTable($this->LiveTable);
break;
}
}
function &GetDummy() // new by Alex
{
if( !isset($this->Dummy) )
$this->Dummy =& new $this->classname();
$this->Dummy->tablename = $this->SourceTable;
return $this->Dummy;
}
function clsItemCollection()
{
$this->adodbConnection = GetADODBConnection();
$this->Clear();
$this->BasePermission="";
}
function GetIDField() // new by Alex
{
// returns id field for list item
if( !isset($this->id_field) )
{
$dummy =& $this->GetDummy();
$this->id_field = $dummy->IdField();
}
return $this->id_field;
}
function &GetNewItemClass()
{
return new $this->classname();
}
function Clear()
{
unset($this->Items);
$this->Items = array();
$this->CurrentItem=0;
}
function &SetCurrentItem($id)
{
$this->CurrentItem=$id;
return $this->GetItem($id);
}
function &GetCurrentItem()
{
if($this->CurrentItem>0)
{
return $this->GetItem($this->CurrentItem);
}
else
return FALSE;
}
function NumItems()
{
if(is_array($this->Items))
{
// echo "TEST COUNT: ".count($this->Items)."<BR>";
return count($this->Items);
}
else
return 0;
}
function ItemLike($index, $string)
{
// check if any of the item field
// even partially matches $string
$found = false;
$string = strtolower($string);
$item_data = $this->Items[$index]->GetData();
foreach($item_data as $field => $value)
if( in_array($field, $this->AdminSearchFields) )
if( strpos(strtolower($value), $string) !== false)
{
$found = true;
break;
}
return $found;
}
function DeleteItem($index) // by Alex
{
// deletes item with specific index from list
$i = $index; $item_count = $this->NumItems();
while($i < $item_count - 1)
{
$this->Items[$i] = $this->Items[$i + 1];
$i++;
}
unset($this->Items[$i]);
}
function ShowItems()
{
$i = 0; $item_count = $this->NumItems();
while($i < $item_count)
{
echo "Item No <b>$i</b>:<br>";
$this->Items[$i]->PrintVars();
$i++;
}
}
function SwapItems($Index,$Index2)
{
$temp = $this->Items[$Index]->GetData();
$this->Items[$Index]->SetData($this->Items[$Index2]->GetData());
$this->Items[$Index2]->SetData($temp);
}
function CopyResource($OldId,$NewId)
{
$this->Clear();
$sql = "SELECT * FROM ".$this->SourceTable." WHERE ResourceId=$OldId";
$this->Query_Item($sql);
// echo $sql."<br>\n";
if($this->NumItems()>0)
{
foreach($this->Items as $item)
{
$item->UnsetIdField();
$item->Set("ResourceId",$NewId);
$item->Create();
}
}
}
function ItemsOnClipboard()
{
global $objSession;
$clip = $objSession->GetPersistantVariable("ClipBoard");
$count = 0;
$table = $this->SourceTable;
$prefix = GetTablePrefix();
if(substr($table,0,strlen($prefix))==$prefix)
$table = substr($table,strlen($prefix));
if(strlen($clip))
{
$clipboard = ParseClipboard($clip);
if($clipboard["table"] == $table)
{
$count = count(explode(",",$clipboard["ids"]));
}
else
$count = 0;
}
else
$count = 0;
return $count;
}
function CopyToClipboard($command,$idfield, $idlist)
{
global $objSession,$objCatList;
if(is_array($idlist))
{
$list = implode(",",$idlist);
}
else
$list = $idlist;
$clip = $command."-".$objCatList->CurrentCategoryID().".".$this->SourceTable.".$idfield=".$list;
$objSession->SetVariable("ClipBoard",$clip);
}
function SortItems($asc=TRUE)
{
$done = FALSE;
$field = $this->SortField;
$ItemCount = $this->NumItems();
while(!$done)
{
$done=TRUE;
for($i=1;$i<$this->NumItems();$i++)
{
$doswap = FALSE;
if($asc)
{
$val1 = $this->Items[$i-1]->Get($field);
$val2 = $this->Items[$i]->Get($field);
$doswap = ($val1 > $val2);
}
else
{
$val1 = $this->Items[$i-1]->Get($field);
$val2 = $this->Items[$i]->Get($field);
$doswap = ($val1 < $val2);
}
if($doswap)
{
$this->SwapItems($i-1,$i);
$done = FALSE;
}
}
}
}
function &GetItem($ID,$LoadFromDB=TRUE)
{
$found=FALSE;
if(is_array($this->Items) && count($this->Items) )
{
for($x=0;$x<count($this->Items);$x++)
{
$i =& $this->GetItemRefByIndex($x);
if($i->UniqueID()==$ID)
{
$found=TRUE;
break;
}
}
}
if(!$found)
{
if($LoadFromDB)
{
$n = NULL;
$n = new $this->classname();
$n->tablename = $this->SourceTable;
$n->LoadFromDatabase($ID);
$index = array_push($this->Items, $n);
$i =& $this->Items[count($this->Items)-1];
}
else
$i = FALSE;
}
return $i;
}
function GetItemByIndex($index)
{
return $this->Items[$index];
}
function &GetItemRefByIndex($index)
{
return $this->Items[$index];
}
function &GetItemByField($Field,$Value,$LoadFromDB=TRUE)
{
$found=FALSE;
if(is_array($this->Items))
{
foreach($this->Items as $i)
{
if($i->Get($Field)==$Value)
{
$found = TRUE;
break;
}
}
}
if(!$found && $LoadFromDB==TRUE)
{
$sql = "SELECT * FROM ".$this->SourceTable." WHERE $Field = '$Value'";
//echo $sql;
$res = $this->adodbConnection->Execute($sql);
if($res && !$res->EOF)
{
$i = $this->AddItemFromArray($res->fields);
$i->tablename = $this->SourceTable;
$i->Clean();
}
else
$i = FALSE;
}
return $i;
}
function GetPage($Page, $ItemsPerPage)
{
$result = array_slice($this->Items, ($Page * $ItemsPerPage) - $ItemsPerPage, $ItemsPerPage);
return $result;
}
function GetNumPages($ItemsPerPage)
{
if ($_GET['reset'] == 1) {
$this->Page = 1;
}
return GetPageCount($ItemsPerPage,$this->QueryItemCount);
}
function &AddItemFromArray($data, $clean=FALSE)
{
$class = new $this->classname;
$class->SetFromArray($data);
$class->tablename = $this->SourceTable;
if($clean==TRUE)
$class->Clean();
//array_push($this->Items,$class);
$this->Items[] =& $class;
return $class;
}
function Query_Item($sql, $offset=-1,$rows=-1)
{
global $Errors;
$dummy =& $this->GetDummy();
if( !$dummy->TableExists() )
{
if($this->debuglevel) echo "ERROR: table <b>".$dummy->tablename."</b> missing.<br>";
$this->Clear();
return false;
}
if($rows>-1 && $offset>-1)
{
//echo "<b>Executing SelectLimit</b> $sql <b>Offset:</b> $offset,$rows<br>\n";
$result = $this->adodbConnection->SelectLimit($sql, $rows,$offset);
}
else {
//echo $sql."<br><br>";
$result = $this->adodbConnection->Execute($sql);
}
if ($result === false)
{
$Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Query_Item");
echo '<br><br>'.$sql.'<br><br>';
echo "Error: ".$this->adodbConnection->ErrorMsg()."<br>";
return false;
}
$this->Clear();
if($this->debuglevel > 0)
{
echo "This SQL: $sql<br>";
if( ($this->debuglevel > 1) && ($result->RecordCount() > 0) )
{
echo '<pre>'.print_r($result->GetRows(), true).'</pre>';
$result->MoveFirst();
}
}
LogEntry("SQL Loop Start\n");
$count = 0;
while ($result && !$result->EOF)
{
$count++;
$data = $result->fields;
$this->AddItemFromArray($data,TRUE);
if( defined('ADODB_EXTENSION') && constant('ADODB_EXTENSION') > 0 )
adodb_movenext($result);
else
$result->MoveNext();
}
LogEntry("SQL Loop End ($count iterations)\n");
return $this->Items;
}
function GetOrderClause($FieldVar,$OrderVar,$DefaultField,$DefaultVar,$Priority=TRUE,$UseTableName=FALSE)
{
global $objConfig, $objSession;
if($UseTableName)
{
$TableName = $this->SourceTable.".";
}
else
$TableName = "";
$PriorityClause = $TableName."EditorsPick DESC, ".$TableName."Priority DESC";
if(strlen(trim($FieldVar))>0)
{
if(is_object($objSession))
{
if(strlen($objSession->GetPersistantVariable($FieldVar))>0)
{
$OrderBy = trim($TableName.$objSession->GetPersistantVariable($FieldVar) . " ".
$objSession->GetPersistantVariable($OrderVar));
$FieldUsed = $objSession->GetPersistantVariable($FieldVar);
}
}
$OrderBy = trim($OrderBy);
if (strlen(trim($OrderBy))==0)
{
if(!$UseTableName)
{
$OrderBy = trim($DefaultField." ".$DefaultVar);
}
else
{
if(strlen(trim($DefaultField))>0)
{
$OrderBy = $this->SourceTable.".".$DefaultField.".".$DefaultVar;
}
$FieldUsed=$DefaultField;
}
}
}
if(($FieldUsed != "Priority" || strlen($OrderBy)==0) && $Priority==TRUE)
{
if(strlen($OrderBy)==0)
{
$OrderBy = $PriorityClause;
}
else
$OrderBy = $PriorityClause.", ".$OrderBy;
}
return $OrderBy;
}
function GetResourceIDList()
{
$ret = array();
foreach($this->Items as $i)
array_push($ret,$i->Get("ResourceId"));
return $ret;
}
function GetFieldList($field)
{
$ret = array();
foreach($this->Items as $i)
array_push($ret,$i->Get($field));
return $ret;
}
function SetCommonField($FieldName,$FieldValue)
{
for($i=0;$i<$this->NumItems();$i++)
{
$this->Items[$i]->Set($FieldName,$fieldValue);
$this->Items[$i]->Update();
}
}
function ClearCategoryItems($CatId,$CatTable = "CategoryItems")
{
$CatTable = AddTablePrefix($CatTable);
$sql = "SELECT * FROM ".$this->SourceTable." INNER JOIN $CatTable ".
" ON (".$this->SourceTable.".ResourceId=$CatTable.ItemResourceId) WHERE CategoryId=$CatId";
$this->Clear();
$this->Query_Item($sql);
if($this->NumItems()>0)
{
foreach($this->Items as $i)
{
$i->DeleteCategoryItems($CatId,$CatTable);
}
}
}
function CopyToEditTable($idfield = null, $idlist = 0)
{
global $objSession;
if($idfield == null) $idfield = $this->GetIDField();
$edit_table = $objSession->GetEditTable($this->SourceTable);
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
if(is_array($idlist))
{
$list = implode(",",$idlist);
}
else
$list = $idlist;
$query = "SELECT * FROM ".$this->SourceTable." WHERE $idfield IN ($list)";
$insert = "CREATE TABLE ".$edit_table." ".$query;
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($insert,ENT_NOQUOTES)."<br>\n";
$this->adodbConnection->Execute($insert);
}
function CreateEmptyEditTable($idfield = null)
{
global $objSession;
if($idfield == null) $idfield = $this->GetIDField();
$edit_table = $objSession->GetEditTable($this->SourceTable);
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
$query = "SELECT * FROM ".$this->SourceTable." WHERE $idfield = -1";
$insert = "CREATE TABLE ".$edit_table." ".$query;
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($insert,ENT_NOQUOTES)."<br>\n";
$this->adodbConnection->Execute($insert);
}
function CopyFromEditTable($idfield = null)
{
global $objSession;
$dropRelTableFlag = false;
if($idfield == null) $idfield = $this->GetIDField();
$edit_table = $objSession->GetEditTable($this->SourceTable);
$sql = "SELECT * FROM $edit_table";
$rs = $this->adodbConnection->Execute($sql);
// echo $sql."<BR>";
while($rs && !$rs->EOF)
{
$data = $rs->fields;
$c = new $this->classname;
$c->SetFromArray($data);
$c->idfield = $idfield;
$c->Dirty();
if($c->Get($idfield)<1)
{
$old_id = $c->Get($idfield);
$c->UnsetIdField();
if(!is_numeric($c->Get("OrgId")) || $c->Get("OrgId")==0)
{
$c->Clean(array("OrgId"));
}
else
{
if($c->Get("Status") != -2)
{
$org = new $this->classname();
$org->LoadFromDatabase($c->Get("OrgId"));
$org->DeleteCustomData();
$org->Delete(TRUE);
$c->Set("OrgId",0);
}
}
$c->Create();
}
if(is_numeric($c->Get("ResourceId")))
{
if( isset($c->Related) && is_object($c->Related) )
{
$r = $c->Related;
$r->CopyFromEditTable($c->Get("ResourceId"));
$dropRelTableFlag = true;
}
unset($r);
if( isset($c->Reviews) && is_object($c->Reviews) )
{
$r = $c->Reviews;
$r->CopyFromEditTable($c->Get("ResourceId"));
}
}
if(!is_numeric($c->Get("OrgId")) || $c->Get("OrgId")==0)
{
$c->Clean(array("OrgId"));
}
else
{
if($c->Get("Status") != -2)
{
$org = new $this->classname();
$org->LoadFromDatabase($c->Get("OrgId"));
$org->DeleteCustomData();
$org->Delete(TRUE);
$c->Set("OrgId",0);
}
}
if(method_exists($c,"CategoryMemberList"))
{
$cats = $c->CategoryMemberList($objSession->GetEditTable("CategoryItems"));
//echo "CATS: [$cats]<br>";
$c->Update();
UpdateCategoryItems($c,$cats);
}
else
$c->Update();
unset($c);
unset($r);
$rs->MoveNext();
}
if ($dropRelTableFlag)
{
$objRelGlobal = new clsRelationshipList();
$objRelGlobal->PurgeEditTable();
}
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS ".$objSession->GetEditTable("CategoryItems"));
}
function GetNextTempID()
{
// get next temporary id (lower then zero) from temp table
$db =& $this->adodbConnection;
$sql = 'SELECT MIN(%s) AS MinValue FROM %s';
return $db->GetOne( sprintf($sql, $this->GetIDField(), $this->SourceTable) ) - 1;
}
function PurgeEditTable($idfield = null)
{
global $objSession;
if($idfield == null) $idfield = $this->GetIDField();
$edit_table = $objSession->GetEditTable($this->SourceTable);
/* $rs = $this->adodbConnection->Execute("SELECT * FROM $edit_table");
while($rs && !$rs->EOF)
{
$data = $rs->fields;
$c = new $this->classname;
$c->SetFromArray($data);
$c->id_field = $idfield;
$c->tablename = $edit_table;
$c->Delete();
$rs->MoveNext();
}*/
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS ".$objSession->Get("CategoryItems"));
}
function CopyCatListToEditTable($idfield, $idlist)
{
global $objSession;
$edit_table = $objSession->GetEditTable("CategoryItems");
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
if(is_array($idlist))
{
$list = implode(",",$idlist);
}
else
$list = $idlist;
$query = "SELECT * FROM ".GetTablePrefix()."CategoryItems WHERE $idfield IN ($list)";
$insert = "CREATE TABLE ".$edit_table." ".$query;
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($insert,ENT_NOQUOTES)."<br>\n";
$this->adodbConnection->Execute($insert);
}
function CreateEmptyCatListTable($idfield)
{
global $objSession;
$edit_table = $objSession->GetEditTable("CategoryItems");
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
$query = "SELECT * FROM ".GetTablePrefix()."CategoryItems WHERE $idfield = -1";
$insert = "CREATE TABLE ".$edit_table." ".$query;
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($insert,ENT_NOQUOTES)."<br>\n";
$this->adodbConnection->Execute($insert);
}
function PurgeCatListEditTable()
{
global $objSession;
$edit_table = $objSession->GetEditTable("CategoryItems");
$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
}
-
- function AdminSearchWhereClause($SearchList)
+ function AdminSearchWhereClause($SearchList)
{
- $sql = "";
- if(!is_array($SearchList))
- {
- $SearchList = explode(",",$SearchList);
- }
-
- if(!count($SearchList) || !count($this->AdminSearchFields))
- return "";
+ $sql = "";
+ if( !is_array($SearchList) ) $SearchList = explode(",",$SearchList);
+ if( !count($SearchList) || !count($this->AdminSearchFields) ) return '';
- for($f=0;$f<count($SearchList);$f++)
- {
- $value = $SearchList[$f];
- if(strlen($value))
- {
- $inner_sql = "";
- for($i=0; $i<count($this->AdminSearchFields);$i++)
- {
- $field = $this->AdminSearchFields[$i];
-
- if(strlen(trim($value)))
- {
- if(strlen($inner_sql))
- $inner_sql .= " OR ";
- $inner_sql .= $field." LIKE '%".$value."%'";
- }
- }
- if(strlen($inner_sql))
- {
- $sql .= "(".$inner_sql.") ";
- if($f<count($SearchList)-1)
- $sql .= " AND ";
- }
- }
- }
- return $sql;
+ for($f = 0; $f < count($SearchList); $f++)
+ {
+ $value = $SearchList[$f];
+ if( strlen($value) )
+ {
+ $inner_sql = "";
+ for($i = 0; $i < count($this->AdminSearchFields); $i++)
+ {
+ $field = $this->AdminSearchFields[$i];
+ if( strlen( trim($value) ) )
+ {
+ if( strlen($inner_sql) ) $inner_sql .= " OR ";
+ $inner_sql .= $field." LIKE '%".$value."%'";
+ }
+ }
+ if( strlen($inner_sql) )
+ {
+ $sql .= '('.$inner_sql.') ';
+ if($f < count($SearchList) - 1) $sql .= " AND ";
+ }
+ }
+ }
+ return $sql;
}
function BackupData($OutFileName,$Start,$Limit)
{
$fp=fopen($Outfile,"a");
if($fp)
{
if($Start==1)
{
$sql = "DELETE FROM ".$this->SourceTable;
fputs($fp,$sql);
}
$this->Query_Item("SELECT * FROM ".$this->SourceTable." LIMIT $Start, $Limit");
foreach($this->Items as $i)
{
$sql = $i->CreateSQL();
fputs($fp,$sql);
}
fclose($fp);
$this->Clear();
}
}
function RestoreData($InFileName,$Start,$Limit)
{
$res = -1;
$fp=fopen($InFileName,"r");
if($fp)
{
fseek($fp,$Start);
$Line = 0;
while($Line < $Limit)
{
$sql = fgets($fp,16384);
$this->adodbConnection->Execute($sql);
$Line++;
}
$res = ftell($fp);
fclose($fp);
}
return $res;
}
function Delete_Item($Id)
{
global $objCatList;
$l =& $this->GetItem($Id);
$l->BasePermission=$this->BasePermission;
$l->DeleteCategoryItems($objCatList->CurrentCategoryID());
}
function Move_Item($Id, $OldCat, $ParentTo)
{
global $objCatList;
$l = $this->GetItem($Id);
$l->BasePermission=$this->BasePermission;
$l->AddtoCategory($ParentTo);
$l->RemoveFromCategory($OldCat);
}
function Copy_Item($Id, $ParentTo)
{
$l = $this->GetItem($Id);
$l->BasePermission=$this->BasePermission;
$l->AddtoCategory($ParentTo);
}
}/* clsItemCollection */
class clsItemList extends clsItemCollection
{
var $Page;
var $PerPageVar;
var $EnablePaging;
var $MaxListCount = 0;
var $PageEnvar;
var $PageEnvarIndex;
var $ListType;
function clsItemList()
{
$this->clsItemCollection();
$this->EnablePaging = TRUE;
$this->PageEnvarIndex = "p";
}
function GetPageLimitSQL()
{
global $objConfig;
$limit = NULL;
if($this->EnablePaging)
{
if($this->Page<1)
$this->Page=1;
//echo "Limited to ".$objConfig->Get($this->PerPageVar)." items per page<br>\n";
if(is_numeric($objConfig->Get($this->PerPageVar)))
{
$Start = ($this->Page-1)*$objConfig->Get($this->PerPageVar);
$limit = "LIMIT ".$Start.",".$objConfig->Get($this->PerPageVar);
}
else
$limit = NULL;
}
else
{
if($this->MaxListCount)
{
$limit = "LIMIT 0, $MaxListCount";
}
}
return $limit;
}
function GetPageOffset()
{
global $objConfig;
$Start = 0;
if($this->EnablePaging)
{
if($this->Page<1)
$this->Page=1;
if(is_numeric($objConfig->Get($this->PerPageVar)))
{
$Start = ($this->Page-1)*$objConfig->Get($this->PerPageVar);
}
}
else
{
if((int)$this->MaxListCount==0)
$Start = -1;
}
return $Start;
}
function GetPageRowCount()
{
global $objConfig;
if($this->EnablePaging)
{
if($this->Page<1)
$this->Page=1;
// echo "PerPageVar = ".$this->PerPageVar."<br>\n";
// echo "<pre>"; print_r($objConfig); echo "</pre>";
return $objConfig->Get($this->PerPageVar);
}
else
return (int)$this->MaxListCount;
}
function Query_Item($sql,$limit=NULL)
{
if(strlen($limit))
{
$sql .= " ".$limit;
//echo "[$sql]<br>\n";
return parent::Query_Item($sql);
}
else
{
// echo "-------------------<br>$sql<br>\n";
// echo "Paging: ".$this->EnablePaging." Offset: ".$this->GetPageOffset()." Count: ".$this->GetPageRowCount()."<br>\n";
// echo "===================<br>\n";
return parent::Query_Item($sql,$this->GetPageOffset(),$this->GetPageRowCount());
}
}
function Query_List($whereClause,$orderByClause=NULL,$JoinCats=TRUE)
{
global $objSession, $Errors;
if($JoinCats)
{
$cattable = GetTablePrefix()."CategoryItems";
$t = $this->SourceTable;
$sql = "SELECT *,CategoryId FROM $t INNER JOIN $cattable ON $cattable.ItemResourceId=$t.ResourceId";
}
else
$sql = "SELECT * FROM ". $this->SourceTable;
if(trim($whereClause)!="")
{
if(isset($whereClause))
$sql = sprintf('%s WHERE %s',$sql,$whereClause);
}
if(strlen($orderByClause)>0)
{
if(substr($orderByClause,0,8)=="ORDER BY")
{
$sql .= " ".$orderByClause;
}
else
{
$sql .= " ORDER BY $orderByClause";
}
}
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo $sql."<br>\n";
+
return $this->Query_Item($sql);
}
function GetPageLinkList($dest_template=NULL,$page = "",$PagesToList=10, $HideEmpty=TRUE)
{
global $objConfig, $var_list_update, $var_list;
$v= $this->PageEnvar;
global ${$v};
if(!strlen($page))
$page = GetIndexURL();
$PerPage = $objConfig->Get($this->PerPageVar);
if($PerPage<1)
$PerPage=20;
$NumPages = ceil($this->GetNumPages($PerPage));
if($NumPages==1 && $HideEmpty)
return "";
if(strlen($dest_template))
{
$var_list_update["t"] = $dest_template;
}
else
$var_list_update["t"] = $var_list["t"];
$o = "";
if($this->Page==0 || !is_numeric($this->Page))
$this->Page=1;
if($this->Page>$NumPages)
$this->Page=$NumPages;
$StartPage = (int)$this->Page - ($PagesToList/2);
if($StartPage<1)
$StartPage=1;
$EndPage = $StartPage+($PagesToList-1);
if($EndPage>$NumPages)
{
$EndPage = $NumPages;
$StartPage = $EndPage-($PagesToList-1);
if($StartPage<1)
$StartPage=1;
}
$o = "";
if($StartPage>1)
{
${$v}[$this->PageEnvarIndex] = $this->Page-$PagesToList;
$prev_url = $page."?env=".BuildEnv();
$o .= "<A HREF=\"$prev_url\">&lt;&lt;</A>";
}
for($p=$StartPage;$p<=$EndPage;$p++)
{
if($p!=$this->Page)
{
${$v}[$this->PageEnvarIndex]=$p;
$href = $page."?env=".BuildEnv();
$o .= " <A HREF=\"$href\">$p</A> ";
}
else
{
$o .= " <SPAN class=\"current-page\">$p</SPAN>";
}
}
if($EndPage<$NumPages && $EndPage>0)
{
${$v}[$this->PageEnvarIndex]=$this->Page+$PagesToList;
$next_url = $page."?env=".BuildEnv();
$o .= "<A HREF=\"$next_url\"> &gt;&gt;</A>";
}
unset(${$v}[$this->PageEnvarIndex],$var_list_update["t"] );
return $o;
}
function GetAdminPageLinkList($url)
{
global $objConfig, $var_list_update, $var_list;
$v = $this->PageEnvar;
global ${$v};
if(strlen($this->PerPageVar)==0)
$this->PerPageVar = "Perpage_Links";
$PerPage = $objConfig->Get($this->PerPageVar);
if($PerPage<1)
$PerPage=20;
$NumPages = ceil($this->GetNumPages($PerPage));
//echo $this->CurrentPage." of ".$NumPages." Pages";
$o = "";
if($this->Page>$NumPages)
$this->Page=$NumPages;
$StartPage = $this->Page - 5;
if($StartPage<1)
$StartPage=1;
$EndPage = $StartPage+9;
if($EndPage>$NumPages)
{
$EndPage = $NumPages;
$StartPage = $EndPage-9;
if($StartPage<1)
$StartPage=1;
}
$o = "";
if($StartPage>1)
{
${$v}[$this->PageEnvarIndex]= $this->Page-10;
$prev_url = $url."?env=".BuildEnv();
$o .= "<A HREF=\"$prev_url\">&lt;&lt;</A>";
}
for($p=$StartPage;$p<=$EndPage;$p++)
{
if($p!=$this->Page)
{
${$v}[$this->PageEnvarIndex]=$p;
$href = $url."?env=".BuildEnv();
$o .= " <A HREF=\"$href\" class=\"NAV_URL\">$p</A> ";
}
else
{
$o .= "<SPAN class=\"CURRENT_PAGE\">$p</SPAN>";
}
}
if($EndPage<$NumPages)
{
${$v}[$this->PageEnvarIndex]=$this->Page+10;
$next_url = $url."?env=".BuildEnv();
$o .= "<A HREF=\"$next_url\"> &gt;&gt;</A>";
}
unset( ${$v}[$this->PageEnvarIndex]);
return $o;
}
}
function ParseClipboard($clip)
{
$ret = array();
$parts = explode(".",$clip,3);
$command = $parts[0];
$table = $parts[1];
$prefix = GetTablePrefix();
if(substr($table,0,strlen($prefix))==$prefix)
$table = substr($table,strlen($prefix));
$subparts = explode("=",$parts[2],2);
$idfield = $subparts[0];
$idlist = $subparts[1];
$cmd = explode("-",$command);
$ret["command"] = $cmd[0];
$ret["source"] = $cmd[1];
$ret["table"] = $table;
$ret["idfield"] = $idfield;
$ret["ids"] = $idlist;
//print_pre($ret);
return $ret;
}
function UpdateCategoryItems($item,$NewCatList)
{
global $objCatList;
$CurrentList = explode(",",$item->CategoryMemberList());
$del_list = array();
$ins_list = array();
if(!is_array($NewCatList))
{
if(strlen(trim($NewCatList))==0)
$NewCatList = $objCatList->CurrentCategoryID();
$NewCatList = explode(",",$NewCatList);
}
//print_r($NewCatList);
for($i=0;$i<count($NewCatList);$i++)
{
$cat = $NewCatList[$i];
if(!in_array($cat,$CurrentList))
$ins_list[] = $cat;
}
for($i=0;$i<count($CurrentList);$i++)
{
$cat = $CurrentList[$i];
if(!in_array($cat,$NewCatList))
$del_list = $cat;
}
for($i=0;$i<count($ins_list);$i++)
{
$cat = $ins_list[$i];
$item->AddToCategory($cat);
}
for($i=0;$i<count($del_list);$i++)
{
$cat = $del_list[$i];
$item->RemoveFromCategory($cat);
}
}
class clsCatItemList extends clsItemList
{
var $PerPageVarLong;
var $PerPageShortVar;
var $Query_SortField;
var $Query_SortOrder;
var $ItemType;
function clsCatItemList()
{
$this->ClsItemList();
$this->Query_SortField = array();
$this->Query_SortOrder = array();
}
function QueryOrderByClause($EditorsPick=FALSE,$Priority=FALSE,$UseTableName=FALSE)
{
global $objSession;
if($UseTableName)
{
$TableName = $this->SourceTable.".";
}
else {
$TableName = "";
}
$Orders = array();
if($EditorsPick)
{
$Orders[] = $TableName."EditorsPick DESC";
}
if($Priority)
{
$Orders[] = $TableName."Priority DESC";
}
if(count($this->Query_SortField)>0)
{
for($x=0; $x<count($this->Query_SortField); $x++)
{
$FieldVar = $this->Query_SortField[$x];
$OrderVar = $this->Query_SortOrder[$x];
if(is_object($objSession))
{
$FieldVarData = $objSession->GetPersistantVariable($FieldVar);
if(strlen($FieldVarData)>0)
{
$Orders[] = trim($TableName.$objSession->GetPersistantVariable($FieldVar) . " ".
$objSession->GetPersistantVariable($OrderVar));
}
}
}
}
if(count($Orders)>0)
{
$OrderBy = "ORDER BY ".implode(", ",$Orders);
}
else
$OrderBy="";
return $OrderBy;
}
function AddSortField($SortField, $SortOrder)
{
if(strlen($SortField))
{
$this->Query_SortField[] = $SortField;
$this->Query_SortOrder[] = $SortOrder;
}
}
function ClearSortFields()
{
$this->Query_SortField = array();
$this->Query_SortOrder = array();
}
/* skeletons in this closet */
function GetNewValue($CatId=NULL)
{
return 0;
}
function GetPopValue($CategoryId=NULL)
{
return 0;
}
/* end of skeletons */
function GetCountSQL($PermName,$CatId=NULL, $GroupId=NULL, $AdditonalWhere="")
{
global $objSession, $objPermissions, $objCatList;
$ltable = $this->SourceTable;
$acl = $objSession->GetACLClause();
$cattable = GetTablePrefix()."CategoryItems";
$CategoryTable = GetTablePrefix()."Category";
$ptable = GetTablePrefix()."PermCache";
$VIEW = $objPermissions->GetPermId($PermName);
$sql = "SELECT count(*) as CacheVal FROM $ltable ";
$sql .="INNER JOIN $cattable ON ($cattable.ItemResourceId=$ltable.ResourceId) ";
$sql .="INNER JOIN $CategoryTable ON ($CategoryTable.CategoryId=$cattable.CategoryId) ";
$sql .="INNER JOIN $ptable ON ($cattable.CategoryId=$ptable.CategoryId) ";
$sql .="WHERE ($acl AND PermId=$VIEW AND $cattable.PrimaryCat=1 AND $CategoryTable.Status=1) ";
if(strlen($AdditonalWhere)>0)
{
$sql .= "AND (".$AdditonalWhere.")";
}
return $sql;
}
function SqlCategoryList($attribs = array())
{
$CatTable = GetTablePrefix()."CategoryItems";
$t = $this->SourceTable;
$sql = "SELECT *,$CatTable.CategoryId FROM $t INNER JOIN $CatTable ON $CatTable.ItemResourceId=$t.ResourceId ";
$sql .="WHERE ($CatTable.CategoryId=".$catid." AND $t.Status=1)";
return $sql;
}
function CategoryCount($attribs=array())
{
global $objCatList, $objCountCache;
$cat = $attribs["_catid"];
if(!is_numeric($cat))
{
$cat = $objCatList->CurrentCategoryID();
}
if((int)$cat>0)
$c = $objCatList->GetCategory($cat);
$CatTable = GetTablePrefix()."CategoryItems";
$t = $this->SourceTable;
$sql = "SELECT count(*) as MyCount FROM $t INNER JOIN $CatTable ON ($CatTable.ItemResourceId=$t.ResourceId) ";
if($attribs["_subcats"])
{
$ctable = $objCatList->SourceTable;
$sql .= "INNER JOIN $ctable ON ($CatTable.CategoryId=$ctable.CategoryId) ";
$sql .= "WHERE (ParentPath LIKE '".$c->Get("ParentPath")."%' ";
if(!$attribs["_countcurrent"])
{
$sql .=" AND $ctable.CategoryId != $cat) ";
}
else
$sql .=") ";
}
else
$sql .="WHERE ($CatTable.CategoryId=".$cat." AND $t.Status=1) ";
if($attribs["_today"])
{
$today = mktime(0,0,0,date("m"),date("d"),date("Y"));
$sql .= "AND ($t.CreatedOn>=$today) ";
}
//echo $sql."<br><br>\n";
$rs = $this->adodbConnection->Execute($sql);
$ret = "";
if($rs && !$rs->EOF)
$ret = (int)$rs->fields["MyCount"];
return $ret;
}
function SqlGlobalCount($attribs=array())
{
global $objSession;
$p = $this->BasePermission.".VIEW";
$t = $this->SourceTable;
if($attribs["_today"])
{
$today = mktime(0,0,0,date("m"),date("d"),date("Y"));
$where = "($t.CreatedOn>=$today)";
}
if($attribs["_grouponly"])
{
$GroupList = $objSession->Get("GroupList");
}
else
$GroupList = NULL;
$sql = $this->GetCountSQL($p,NULL,$GroupList,$where);
return $sql;
}
function DoGlobalCount($attribs)
{
global $objCountCache;
$cc = $objCountCache->GetValue($this->CacheListType("_"),$this->ItemType,$this->CacheListExtraId("_"),(int)$attribs["_today"], 3600);
if(!is_numeric($cc))
{
$sql = $this->SqlGlobalCount($attribs);
$ret = QueryCount($sql);
$objCountCache->SetValue($this->CacheListType("_"),$this->ItemType,$this->CacheListExtraId("_"),(int)$attribs["_today"],$ret);
}
else
$ret = $cc;
return $ret;
}
function CacheListExtraId($ListType)
{
global $objSession;
if(!strlen($ListType))
$ListType="_";
switch($ListType)
{
case "_":
$ExtraId = $objSession->Get("GroupList");
break;
case "category":
$ExtraId = $objSession->Get("GroupList");
break;
case "myitems":
$ExtraId = $objSession->Get("PortalUserId");
break;
case "hot":
$ExtraId = $objSession->Get("GroupList");
break;
case "pop":
$ExtraId = $objSession->Get("GroupList");
break;
case "pick":
$ExtraId = $objSession->Get("GroupList");
break;
case "favorites":
$ExtraId = $objSession->Get("PortalUserId");
break;
case "new":
$ExtraId = $objSession->Get("GroupList");
break;
}
return $ExtraId;
}
function CacheListType($ListType)
{
if(!strlen($ListType))
$ListType="_";
switch($ListType)
{
case "_":
$ListTypeId = 0;
break;
case "category":
$ListTypeId = 1;
break;
case "myitems":
$ListTypeId = 2;
break;
case "hot":
$ListTypeId = 3;
break;
case "pop":
$ListTypeId = 4;
break;
case "pick":
$ListTypeId = 5;
break;
case "favorites":
$ListTypeId = 6;
break;
case "new":
$ListTypeId = 8;
break;
}
return $ListTypeId;
}
function PerformItemCount($attribs=array())
{
global $objCountCache, $objSession;
$ret = "";
$ListType = $attribs["_listtype"];
if(!strlen($ListType))
$ListType="_";
$ListTypeId = $this->CacheListType($ListType);
//echo "ListType: $ListType ($ListTypeId)<br>\n";
$ExtraId = $this->CacheListExtraId($ListType);
switch($ListType)
{
case "_":
$ret = $this->DoGlobalCount($attribs);
break;
case "category":
$ret = $this->CategoryCount($attribs);
break;
case "myitems":
$sql = $this->SqlMyItems($attribs);
break;
case "hot":
$sql = $this->SqlHotItems($attribs);
break;
case "pop":
$sql = $this->SqlPopItems($attribs);
break;
case "pick":
$sql = $this->SqlPickItems($attribs);
break;
case "favorites":
$sql = $this->SqlFavorites($attribs);
break;
case "search":
$sql = $this->SqlSearchItems($attribs);
break;
case "new":
$sql = $this->SqlNewItems($attribs);
break;
}
//echo "SQL: $sql<br>";
if(strlen($sql))
{
if(is_numeric($ListTypeId))
{
$cc = $objCountCache->GetValue($ListTypeId,$this->ItemType,$ExtraId,(int)$attribs["_today"], 3600);
if(!is_numeric($cc) || $attribs['_nocache'] == 1)
{
$ret = QueryCount($sql);
$objCountCache->SetValue($ListTypeId,$this->ItemType,$ExtraId,(int)$attribs["_today"],$ret);
}
else
$ret = $cc;
}
else
$ret = QueryCount($sql);
}
return $ret;
}
function GetJoinedSQL($PermName, $CatId=NULL, $AdditionalWhere="")
{
global $objSession, $objPermissions;
$ltable = $this->SourceTable;
$acl = $objSession->GetACLClause();
$cattable = GetTablePrefix()."CategoryItems";
$CategoryTable = GetTablePrefix()."Category";
$ptable = GetTablePrefix()."PermCache";
$VIEW = $objPermissions->GetPermId($PermName);
$sql ="INNER JOIN $cattable ON ($cattable.ItemResourceId=$ltable.ResourceId) ";
$sql .="INNER JOIN $CategoryTable ON ($CategoryTable.CategoryId=$cattable.CategoryId) ";
$sql .= "INNER JOIN $ptable ON ($cattable.CategoryId=$ptable.CategoryId) ";
$sql .="WHERE ($acl AND PermId=$VIEW AND PrimaryCat=1 AND $CategoryTable.Status=1) ";
if(is_numeric($CatId))
{
$sql .= " AND ($CategoryTable.CategoryId=$CatId) ";
}
if(strlen($AdditionalWhere)>0)
{
$sql .= "AND (".$AdditionalWhere.")";
}
return $sql;
}
function CountFavorites($attribs)
{
if($attribs["_today"])
{
global $objSession, $objConfig, $objPermissions;
$acl = $objSession->GetACLClause();
$favtable = GetTablePrefix()."Favorites";
$ltable = $this->SourceTable;
$cattable = GetTablePrefix()."CategoryItems";
$CategoryTable = GetTablePrefix()."Category";
$ptable = GetTablePrefix()."PermCache";
$today = mktime(0,0,0,date("m"),date("d"),date("Y"));
$where = "PortalUserId=".$objSession->Get("PortalUserId")." AND $ltable.Status=1";
$where .= " AND $favtable.Modified >= $today AND ItemTypeId=".$this->ItemType;
$p = $this->BasePermission.".VIEW";
$sql = "SELECT $ltable.*,$CategoryTable.CategoryId,$CategoryTable.CachedNavBar FROM $favtable INNER JOIN $ltable ON ($favtable.ResourceId=$ltable.ResourceId) ";
$sql .= $this->GetJoinedSQL($p,NULL,$where);
$ret = QueryCount($sql);
}
else
{
if (!$this->ListType == "favorites")
{
$this->ListType = "favorites";
$this->LoadFavorites($attribs);
$ret = $this->QueryItemCount;
}
else
$ret = $this->QueryItemCount;
}
return $ret;
}
function CountPickItems($attribs)
{
if (!$this->ListType == "pick")
{
$this->ListType = "pick";
$this->LoadPickItems($attribs);
$ret = $this->QueryItemCount;
}
else
$ret = $this->QueryItemCount;
return $ret;
}
function CountMyItems($attribs)
{
if (!$this->ListType == "myitems")
{
$this->ListType = "myitems";
$this->LoadMyItems($attribs);
$ret = $this->QueryItemCount;
}
else
$ret = $this->QueryItemCount;
return $ret;
}
function CountHotItems($attribs)
{
if (!$this->ListType == "hotitems")
{
$this->ListType = "hotitems";
$this->LoadHotItems($attribs);
$ret = $this->QueryItemCount;
}
else
$ret = $this->QueryItemCount;
return $ret;
}
function CountNewItems($attribs)
{
if (!$this->ListType == "newitems")
{
$this->ListType = "newitems";
$this->LoadNewItems($attribs);
$ret = $this->QueryItemCount;
}
else
$ret = $this->QueryItemCount;
return $ret;
}
function CountPopItems($attribs)
{
if (!$this->ListType == "popitems")
{
$this->ListType = "popitems";
$this->LoadPopItems($attribs);
$ret = $this->QueryItemCount;
}
else
$ret = $this->QueryItemCount;
return $ret;
}
function CountSearchItems($attribs)
{
if (!$this->ListType == "search")
{
$this->ListType = "search";
$this->LoadSearchItems($attribs);
$ret = $this->QueryItemCount;
}
else
$ret = $this->QueryItemCount;
return $ret;
}
function SqlFavorites($attribs)
{
global $objSession, $objConfig, $objPermissions;
$acl = $objSession->GetACLClause();
$favtable = GetTablePrefix()."Favorites";
$ltable = $this->SourceTable;
$cattable = GetTablePrefix()."CategoryItems";
$CategoryTable = GetTablePrefix()."Category";
$ptable = GetTablePrefix()."PermCache";
$where = "PortalUserId=".$objSession->Get("PortalUserId")." AND $ltable.Status=1";
if($attribs["_today"])
{
$today = mktime(0,0,0,date("m"),date("d"),date("Y"));
$where .= " AND $favtable.Modified >= $today AND ItemTypeId=".$this->ItemType;
}
$p = $this->BasePermission.".VIEW";
$sql = "SELECT $ltable.*,$CategoryTable.CategoryId,$CategoryTable.CachedNavBar FROM $favtable INNER JOIN $ltable ON ($favtable.ResourceId=$ltable.ResourceId) ";
$sql .= $this->GetJoinedSQL($p,NULL,$where);
$OrderBy = $this->QueryOrderByClause(TRUE,TRUE,TRUE);
$sql .= " ".$OrderBy;
return $sql;
}
function LoadFavorites($attribs)
{
global $objSession, $objCountCache;
$sql = $this->SqlFavorites($attribs);
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
if($attribs["_shortlist"])
{
$this->PerPageVar = $this->PerPageShortVar;
}
else
$this->PerPageVar = $this->PerPageVarLong;
$CachedCount = $objCountCache->GetValue($this->CacheListType("favorites"),$this->ItemType,$this->CacheListExtraId("favorites"),(int)$attribs["_today"],3600);
if(!is_numeric($CachedCount))
{
$this->QueryItemCount = QueryCount($sql);
$objCountCache->SetValue($this->CacheListType("favorites"),$this->ItemType,$this->CacheListExtraId("favorites"),(int)$attribs["_today"],$this->QueryItemCount);
}
else
$this->QueryItemCount = (int)$CachedCount;
return $this->Query_Item($sql);
}
function SqlPickItems($attribs)
{
global $objSession, $objCatList;
$catid = (int)$attribs["_catid"];
$scope = (int)$attribs["_scope"];
//$JoinCats = (int)$attribs["_catinfo"] || $scope;
$TableName = $this->SourceTable;
if($scope)
{
if (!$catid)
{
$catid = $objCatList->CurrentCategoryID();
}
$where = "CategoryId =".$catid." AND ".$TableName.".EditorsPick=1 AND ".$TableName.".Status=1";
}
else
{
$where = $TableName.".EditorsPick=1 AND ".$TableName.".Status=1 ";
$catid=NULL;
}
if($attribs["_today"])
{
$today = mktime(0,0,0,date("m"),date("d"),date("Y"));
$where .= " AND ($TableName.CreatedOn>=$today)";
}
$CategoryTable = GetTablePrefix()."Category";
$sql = "SELECT $TableName.*,$CategoryTable.CategoryId,$CategoryTable.CachedNavBar FROM $TableName ";
$p = $this->BasePermission.".VIEW";
$sql .= $this->GetJoinedSQL($p,$CatUd,$where);
$OrderBy = $this->QueryOrderByClause(TRUE,TRUE,TRUE);
$sql .= " ".$OrderBy;
return $sql;
}
function LoadPickItems($attribs)
{
global $objSession, $objCountCache;
$sql = $this->SqlPickItems($attribs);
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
if($attribs["_shortlist"])
{
$this->PerPageVar = $this->PerPageShortVar;
}
else
$this->PerPageVar = $this->PerPageVarLong;
$CachedCount = $objCountCache->GetValue($this->CacheListType("pick"),$this->ItemType,$this->CacheListExtraId("pick"),(int)$attribs["_today"],3600);
if(!is_numeric($CachedCount))
{
$this->QueryItemCount= QueryCount($sql);
$objCountCache->SetValue($this->CacheListType("pick"),$this->ItemType,$this->CacheListExtraId("pick"),(int)$attribs["_today"],$this->QueryItemCount);
}
else
$this->QueryItemCount=$CachedCount;
return $this->Query_Item($sql);
}
function SqlMyItems($attribs= array())
{
global $objSession;
$TableName = $this->SourceTable;
$where = " ".$TableName.".Status>-1 AND ".$TableName.".CreatedById=".$objSession->Get("PortalUserId");
if($attribs["_today"])
{
$today = mktime(0,0,0,date("m"),date("d"),date("Y"));
$where .= " AND ($TableName.CreatedOn>=$today)";
}
$CategoryTable = GetTablePrefix()."Category";
$sql = "SELECT $TableName.*,$CategoryTable.CategoryId,$CategoryTable.CachedNavBar FROM $TableName ";
$p = $this->BasePermission.".VIEW";
$sql .= $this->GetJoinedSQL($p,$CatUd,$where);
$OrderBy = $this->QueryOrderByClause(TRUE,TRUE,TRUE);
$sql .= " ".$OrderBy;
return $sql;
}
function LoadMyItems($attribs=array())
{
global $objSession,$objCountCache;
$sql = $this->SqlMyItems($attribs);
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
if($attribs["_shortlist"])
{
$this->PerPageVar = $this->PerPageShortVar;
}
else
$this->PerPageVar = $this->PerPageVarLong;
$CachedCount = $objCountCache->GetValue($this->CacheListType("myitems"),$this->ItemType,$this->CacheListExtraId("myitems"),(int)$attribs["_today"],3600);
if(!is_numeric($CachedCount))
{
$this->QueryItemCount= QueryCount($sql);
$objCountCache->SetValue($this->CacheListType("myitems"),$this->ItemType,$this->CacheListExtraId("myitems"),(int)$attribs["_today"],$this->QueryItemCount);
}
else
$this->QueryItemCount=$CachedCount;
return $this->Query_Item($sql);
}
function SqlNewItems($attribs = array())
{
global $objSession, $objCatList;
$catid = (int)$attribs["_catid"];
$scope = (int)$attribs["_scope"];
//$JoinCats = (int)$attribs["_catinfo"] || $scope;
$TableName = $this->SourceTable;
if($attribs["_today"])
{
$cutoff = mktime(0,0,0,date("m"),date("d"),date("Y"));
}
else
{
if($scope)
{
if (!$catid)
{
$catid = $objCatList->CurrentCategoryID();
}
$cutoff = $this->GetNewValue($catid);
}
else
$cutoff = $this->GetNewValue();
}
if($scope)
{
if (!$catid)
{
$catid = $objCatList->CurrentCategoryID();
}
$where = "CategoryId =".$catid." AND ((".$TableName.".CreatedOn >=".$cutoff." AND ".$TableName.".NewItem != 0) OR ".$TableName.".NewItem=1 ) AND ".$TableName.".Status=1 ";
}
else
{
$where = "((".$TableName.".CreatedOn >=".$this->GetNewValue()." AND ".$TableName.".NewItem != 0) OR ".$TableName.".NewItem=1 ) AND ".$TableName.".Status=1 ";
}
$CategoryTable = GetTablePrefix()."Category";
$sql = "SELECT $TableName.*,$CategoryTable.CategoryId,$CategoryTable.CachedNavBar FROM $TableName ";
$p = $this->BasePermission.".VIEW";
$sql .= $this->GetJoinedSQL($p,$CatUd,$where);
$OrderBy = $this->QueryOrderByClause(TRUE,TRUE,TRUE);
$sql .= " ".$OrderBy;
return $sql;
}
function LoadNewItems($attribs)
{
global $objSession,$objCountCache;
$sql = $this->SqlNewItems($attribs);
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
if($attribs["_shortlist"])
{
$this->PerPageVar = $this->PerPageShortVar;
}
else
$this->PerPageVar = $this->PerPageVarLong;
$CachedCount = $objCountCache->GetValue($this->CacheListType("new"),$this->ItemType,$this->CacheListExtraId("new"),(int)$attribs["_today"],3600);
if(!is_numeric($CachedCount))
{
$this->QueryItemCount= QueryCount($sql);
$objCountCache->SetValue($this->CacheListType("new"),$this->ItemType,$this->CacheListExtraId("new"),(int)$attribs["_today"],$this->QueryItemCount);
}
else
$this->QueryItemCount=$CachedCount;
return $this->Query_Item($sql);
}
function SqlPopItems($attribs)
{
global $objSession, $objCatList;
$catid = (int)$attribs["_catid"];
$scope = (int)$attribs["_scope"];
//$JoinCats = (int)$attribs["_catinfo"] || $scope;
$TableName = $this->SourceTable;
if($scope)
{
if (!$catid)
{
$catid = $objCatList->CurrentCategoryID();
}
$where = "CategoryId =".$catid." AND ((".$TableName.".Hits >=".$this->GetLinkPopValue()." AND ".$TableName.".PopItem !=0) OR ".$TableName.".PopItem=1) AND ".$TableName.".Status=1";
}
else
{
$where = "((".$TableName.".CachedRating >=".$this->GetPopValue()." AND ".$TableName.".PopItem !=0 ) OR ".$TableName.".PopItem=1) AND ".$TableName.".Status=1 ";
$where = "((".$TableName.".Hits >=".$this->GetPopValue()." AND ".$TableName.".PopItem !=0) OR ".$TableName.".PopItem=1) AND ".$TableName.".Status=1 ";
}
if($attribs["_today"])
{
$today = mktime(0,0,0,date("m"),date("d"),date("Y"));
$where .= " AND ($TableName.CreatedOn>=$today)";
}
$CategoryTable = GetTablePrefix()."Category";
$sql = "SELECT $TableName.*,$CategoryTable.CategoryId,$CategoryTable.CachedNavBar FROM $TableName ";
$p = $this->BasePermission.".VIEW";
$sql .= $this->GetJoinedSQL($p,$catid,$where);
$OrderBy = $this->QueryOrderByClause(TRUE,TRUE,TRUE);
$sql .= " ".$OrderBy;
return $sql;
}
function LoadPopItems($attribs)
{
global $objSession,$objCountCache;
$sql = $this->SqlPopItems($attribs);
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
if($attribs["_shortlist"])
{
$this->PerPageVar = $this->PerPageShortVar;
}
else
$this->PerPageVar = $this->PerPageVarLong;
$CachedCount = $objCountCache->GetValue($this->CacheListType("pop"),$this->ItemType,$this->CacheListExtraId("pop"),(int)$attribs["_today"],3600);
if(!is_numeric($CachedCount))
{
$this->QueryItemCount= QueryCount($sql);
$objCountCache->SetValue($this->CacheListType("pop"),$this->ItemType,$this->CacheListExtraId("pop"),(int)$attribs["_today"],$this->QueryItemCount);
}
else
$this->QueryItemCount=$CachedCount;
return $this->Query_Item($sql);
}
function SqlHotItems($attribs)
{
global $objSession, $objCatList;
$catid = (int)$attribs["_catid"];
$scope = (int)$attribs["_scope"];
// $JoinCats = (int)$attribs["_catinfo"] || $scope;
$TableName = $this->SourceTable;
$OrderBy = $TableName.".CachedRating DESC";
if($scope)
{
if (!$catid)
{
$catid = $objCatList->CurrentCategoryID();
}
$where = "CategoryId =".$catid." AND ((".$TableName.".CachedRating >=".$this->GetHotValue()." AND ".$TableName.".PopItem !=0) OR ".$TableName.".PopItem=1) AND ".$TableName.".Status=1";
}
else
{
$where = "((".$TableName.".CachedRating >=".$this->GetPopValue()." AND ".$TableName.".PopItem !=0 ) OR ".$TableName.".PopItem=1) AND ".$TableName.".Status=1 ";
}
if($attribs["_today"])
{
$today = mktime(0,0,0,date("m"),date("d"),date("Y"));
$where .= " AND ($TableName.CreatedOn>=$today)";
}
$CategoryTable = GetTablePrefix()."Category";
$sql = "SELECT $TableName.*,$CategoryTable.CategoryId,$CategoryTable.CachedNavBar FROM $TableName ";
$p = $this->BasePermission.".VIEW";
$CatId = !$scope? NULL : $catid;
$sql .= $this->GetJoinedSQL($p,$CatId,$where);
if(strlen($OrderBy))
$sql .= " ORDER BY $OrderBy ";
return $sql;
}
function LoadHotItems($attribs)
{
global $objSession,$objCountCache;
$sql = $this->SqlHotItems($attribs);
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
if($attribs["_shortlist"])
{
$this->PerPageVar = $this->PerPageShortVar;
}
else
$this->PerPageVar = $this->PerPageVarLong;
$CachedCount = $objCountCache->GetValue($this->CacheListType("hot"),$this->ItemType,$this->CacheListExtraId("hot"),(int)$attribs["_today"], 0);
if(!is_numeric($CachedCount))
{
$this->QueryItemCount= QueryCount($sql);
$objCountCache->SetValue($this->CacheListType("hot"),$this->ItemType,$this->CacheListExtraId("hot"),(int)$attribs["_today"],$this->QueryItemCount);
}
else
$this->QueryItemCount=$CachedCount;
return $this->Query_Item($sql);
}
function SqlSearchItems($attribs = array())
{
global $objConfig, $objItemTypes, $objSession, $objPermissions, $CountVal;
$acl = $objSession->GetACLClause();
$this->Clear();
//$stable = "ses_".$objSession->GetSessionKey()."_Search";
$stable = $objSession->GetSearchTable();
$ltable = $this->SourceTable;
$catitems = GetTablePrefix()."CategoryItems";
$cattable = GetTablePrefix()."Category";
$ptable = GetTablePrefix()."PermCache";
$p = $this->BasePermission.".VIEW";
$i = new $this->classname();
$sql = "SELECT $cattable.CategoryId,$cattable.CachedNavbar,$ltable.*, Relevance FROM $stable ";
$sql .= "INNER JOIN $ltable ON ($stable.ItemId=$ltable.".$i->id_field.") ";
$where = "ItemType=".$this->ItemType." AND $ltable.Status=1";
$sql .= $this->GetJoinedSQL($p,NULL,$where);
$sql .= " ORDER BY EdPick DESC,Relevance DESC ";
$tmp = $this->QueryOrderByClause(FALSE,TRUE,TRUE);
$tmp = substr($tmp,9);
if(strlen($tmp))
{
$sql .= ", ".$tmp." ";
}
return $sql;
}
function LoadSearchItems($attribs = array())
{
global $CountVal, $objSession;
//echo "Loading <b>".get_class($this)."</b> Search Items<br>";
$sql = $this->SqlSearchItems($attribs);
//echo "$sql<br>";
$this->Query_Item($sql);
$Keywords = GetKeywords($objSession->GetVariable("Search_Keywords"));
//echo "SQL Loaded ItemCount (<b>".get_class($this).'</b>): '.$this->NumItems().'<br>';
for($i = 0; $i < $this->NumItems(); $i++)
{
$this->Items[$i]->Keywords = $Keywords;
}
if(is_numeric($CountVal[$this->ItemType]))
{
$this->QueryItemCount = $CountVal[$this->ItemType];
//echo "CACHE: <pre>"; print_r($CountVal); echo "</pre><BR>";
}
else
{
$this->QueryItemCount = QueryCount($sql);
//echo "<b>SQL</b>: ".$sql."<br><br>";
$CountVal[$this->ItemType] = $this->QueryItemCount;
}
}
function PasteFromClipboard($TargetCat,$NameField="")
{
global $objSession,$objCatList;
$clip = $objSession->GetVariable("ClipBoard");
if(strlen($clip))
{
$ClipBoard = ParseClipboard($clip);
$IsCopy = (substr($ClipBoard["command"],0,4)=="COPY") || ($ClipBoard["source"] == $TargetCat);
$item_ids = explode(",",$ClipBoard["ids"]);
for($i=0;$i<count($item_ids);$i++)
{
$item = $this->GetItem($item_ids[$i]);
if(!$IsCopy) // paste to other category then current
{
$item->MoveToCategory($ClipBoard["source"],$TargetCat);
$clip = str_replace("CUT","COPY",$clip);
$objSession->SetVariable("ClipBoard",$clip);
}
else
{
$item->CopyToNewResource($TargetCat,$NameField); // create item copy, but with new ResourceId
$item->AddToCategory($TargetCat);
UpdateCategoryCount($item->type,$TargetCat);
}
}
}
}
}
?>
Property changes on: trunk/kernel/include/parseditem.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.7
\ No newline at end of property
+1.8
\ No newline at end of property
Index: trunk/kernel/include/category.php
===================================================================
--- trunk/kernel/include/category.php (revision 122)
+++ trunk/kernel/include/category.php (revision 123)
@@ -1,2288 +1,2287 @@
<?php
define('TYPE_CATEGORY', 0);
$DownloadId=0;
RegisterPrefix("clsCategory","cat","kernel/include/category.php");
class clsCategory extends clsItem
{
var $Permissions;
function clsCategory($CategoryId=NULL)
{
global $objSession;
$this->clsItem(TRUE);
//$this->adodbConnection = GetADODBConnection();
$this->tablename = GetTablePrefix()."Category";
$this->type=1;
$this->BasePermission ="CATEGORY";
$this->id_field = "CategoryId";
$this->TagPrefix = "cat";
$this->debuglevel=0;
/* keyword highlighting */
$this->OpenTagVar = "Category_Highlight_OpenTag";
$this->CloseTagVar = "Category_Highlight_CloseTag";
if($CategoryId!=NULL)
{
$this->LoadFromDatabase($CategoryId);
$this->Permissions = new clsPermList($CategoryId,$objSession->Get("GroupId"));
}
else
{
$this->Permissions = new clsPermList();
}
}
function ClearCacheData()
{
$env = "':m".$this->Get("CategoryId")."%'";
DeleteTagCache("m_itemcount","Category%");
DeleteTagCache("m_list_cats","",$env);
}
function Delete()
{
global $CatDeleteList;
if(!is_array($CatDeleteList))
$CatDeleteList = array();
if($this->UsingTempTable()==FALSE)
{
$this->Permissions->Delete_CatPerms($this->Get("CategoryId"));
$sql = "DELETE FROM ".GetTablePrefix()."CountCache WHERE CategoryId=".$this->Get("CategoryId");
$this->adodbConnection->Execute($sql);
$CatDeleteList[] = $this->Get("CategoryId");
if($this->Get("CreatedById")>0)
$this->SendUserEventMail("CATEGORY.DELETE",$this->Get("CreatedById"));
$this->SendAdminEventMail("CATEGORY.DELETE");
parent::Delete();
$this->ClearCacheData();
}
else
{
parent::Delete();
}
}
function Update($UpdatedBy=NULL)
{
parent::Update($UpdatedBy);
if($this->tablename==GetTablePrefix()."Category")
$this->ClearCacheData();
}
function Create()
{
if((int)$this->Get("CreatedOn")==0)
$this->Set("CreatedOn",date("U"));
parent::Create();
if($this->tablename==GetTablePrefix()."Category")
$this->ClearCacheData();
}
function SetParentId($value)
{
//Before we set a parent verify that propsed parent is not our child.
//Otherwise it will cause recursion.
$id = $this->Get("CategoryId");
$path = $this->Get("ParentPath");
$sql = sprintf("SELECT CategoryId From ".GetTablePrefix()."Category WHERE ParentPath LIKE '$path%' AND CategoryId = %d ORDER BY ParentPath",$value);
$rs = $this->adodbConnection->SelectLimit($sql,1,0);
if(!$rs->EOF)
{
return;
}
$this->Set("ParentId",$value);
}
function Approve()
{
global $objSession;
if($this->Get("CreatedById")>0)
$this->SendUserEventMail("CATEGORY.APPROVE",$this->Get("CreatedById"));
$this->SendAdminEventMail("CATEGORY.APPROVE");
$this->Set("Status", 1);
$this->Update();
}
function Deny()
{
global $objSession;
if($this->Get("CreatedById")>0)
$this->SendUserEventMail("CATEGORY.DENY",$this->Get("CreatedById"));
$this->SendAdminEventMail("CATEGORY.DENY");
$this->Set("Status", 0);
$this->Update();
}
function IsEditorsPick()
{
return $this->Is("EditorsPick");
}
function SetEditorsPick($value)
{
$this->Set("EditorsPick", $value);
}
function GetSubCats($limit=NULL, $target_template=NULL, $separator=NULL, $anchor=NULL, $ending=NULL, $class=NULL)
{
global $m_var_list, $m_var_list_update, $var_list, $var_list_update;
$sql = "SELECT CategoryId, Name from ".GetTablePrefix()."Category where ParentId=".$this->Get("CategoryId")." AND Status=1 ORDER BY Priority";
if(isset($limit))
{
$rs = $this->adodbConnection->SelectLimit($sql, $limit, 0);
}
else
{
$rs = $this->adodbConnection->Execute($sql);
}
$count=1;
$class_name = is_null($class)? "catsub" : $class;
while($rs && !$rs->EOF)
{
if(!is_null($target_template))
{
$var_list_update["t"] = $target_template;
}
$m_var_list_update["cat"] = $rs->fields["CategoryId"];
$m_var_list_update["p"] = "1";
$cat_name = $rs->fields['Name'];
if (!is_null($anchor))
$ret .= "<a class=\"$class_name\" href=\"".GetIndexURL()."?env=" . BuildEnv() . "\">$cat_name</a>";
else
$ret .= "<span=\"$class_name\">$cat_name</span>";
$rs->MoveNext();
if(!$rs->EOF)
{
$ret.= is_null($separator)? ", " : $separator;
}
}
if(strlen($ret))
$ret .= is_null($ending)? " ..." : $ending;
unset($var_list_update["t"], $m_var_list_update["cat"], $m_var_list_update["p"]);
return $ret;
}
function Validate()
{
global $objSession;
$dataValid = true;
if(!isset($this->m_Type))
{
$Errors->AddError("error.fieldIsRequired",'Type',"","","clsCategory","Validate");
$dataValid = false;
}
if(!isset($this->m_Name))
{
$Errors->AddError("error.fieldIsRequired",'Name',"","","clsCategory","Validate");
$dataValid = false;
}
if(!isset($this->m_Description))
{
$Errors->AddError("error.fieldIsRequired",'Description',"","","clsCategory","Validate");
$dataValid = false;
}
if(!isset($this->m_Visible))
{
$Errors->AddError("error.fieldIsRequired",'Visible',"","","clsCategory","Validate");
$dataValid = false;
}
if(!isset($this->m_CreatedById))
{
$Errors->AddError("error.fieldIsRequired",'CreatedBy',"","","clsCategory","Validate");
$dataValid = false;
}
return $dataValid;
}
function UpdateCachedPath()
{
if($this->UsingTempTable()==TRUE)
return;
$Id = $this->Get("CategoryId");
$Id2 = $Id;
$NavPath = "";
$path = array();
do
{
$rs = $this->adodbConnection->Execute("SELECT ParentId,Name from ".$this->tablename." where CategoryId='$Id2'");
$path[] = $Id2;
$nav[] = $rs->fields["Name"];
if ($rs && !$rs->EOF)
{
//echo $path;
$Id2 = $rs->fields["ParentId"];
}
else
$Id2="0"; //to prevent infinite loop
} while ($Id2 != "0");
$parentpath = "|".implode("|",array_reverse($path))."|";
$NavBar = implode(">",array_reverse($nav));
//echo "<BR>\n";
//$rs = $this->adodbConnection->Execute("update Category set ParentPath='$path' where CategoryId='$Id'");
if($this->Get("ParentPath")!=$parentpath || $this->Get("CachedNavbar")!=$NavBar)
{
$this->Set("ParentPath",$parentpath);
$this->Set("CachedNavbar",$NavBar);
$this->Update();
}
}
function GetCachedNavBar()
{
$res = $this->Get("CachedNavbar");
if(!strlen($res))
{
$this->UpdateCachedPath();
$res = $this->Get("CachedNavbar");
}
return $res;
}
function Increment_Count()
{
$this->Increment("CachedDescendantCatsQty");
}
function Decrement_Count()
{
$this->Decrement("CachedDescendantCatsQty");
$this->Update();
}
function LoadFromDatabase($Id)
{
global $objSession, $Errors, $objConfig;
if($Id==0)
return FALSE;
if(!isset($Id))
{
$Errors->AddError("error.AppError",NULL,'Internal error: LoadFromDatabase id',"",get_class($this),"LoadFromDatabase");
return false;
}
$sql = sprintf("SELECT * FROM ".$this->tablename." WHERE CategoryId = '%s'",$Id);
$result = $this->adodbConnection->Execute($sql);
if ($result === false)
{
$Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"LoadFromDatabase");
return false;
}
$data = $result->fields;
if(is_array($data))
{
$this->SetFromArray($data);
$this->Clean();
}
else
return false;
return true;
}
function SetNewItem()
{
global $objConfig;
$value = $this->Get("CreatedOn");
$cutoff = adodb_date("U") - ($objConfig->Get("Category_DaysNew") * 86400);
$this->IsNew = FALSE;
if($value>$cutoff)
$this->IsNew = TRUE;
return $this->IsNew;
}
function LoadFromResourceId($Id)
{
global $objSession, $Errors;
if(!isset($Id))
{
$Errors->AddError("error.AppError",NULL,'Internal error: LoadFromDatabase id',"",get_class($this),"LoadFromResourceId");
return false;
}
$sql = sprintf("SELECT * FROM ".$this->tablename." WHERE ResourceId = '%s'",$Id);
$result = $this->adodbConnection->Execute($sql);
if ($result === false)
{
$Errors->AddError("error.DatabaseError",NULL,$adodbConnection->ErrorMsg(),"",get_class($this),"LoadFromResourceId");
return false;
}
$data = $result->fields;
if(is_array($data))
$this->SetFromArray($data);
else
return false;
return true;
}
function GetParentField($fieldname,$skipvalue,$default)
{
/* this function moves up the category tree until a value for $field other than
$skipvalue is returned. if no matches are made, then $default is returned */
$path = $this->Get("ParentPath");
$path = substr($path,1,-1); //strip off the first & last tokens
$aPath = explode("|",$path);
$aPath = array_slice($aPath,0,-1);
$ParentPath = implode("|",$aPath);
$sql = "SELECT $fieldname FROM category WHERE $fieldname != '$skipvalue' AND ParentPath LIKE '$ParentPath' ORDER BY ParentPath DESC";
$rs = $this->adodbConnection->execute($sql);
if($rs && !$rs->EOF)
{
$ret = $rs->fields[$fieldname];
}
else
$ret = $default;
$update = "UPDATE ".$this->SourceTable." SET $fieldname='$ret' WHERE CategoryId=".$this->Get("CategoryId");
$this->adodbConnection->execute($update);
return $ret;
}
function GetCustomField($fieldName)
{
global $objSession, $Errors;
if(!isset($this->m_CategoryId))
{
$Errors->AddError("error.appError","Get field is required in order to set custom field values","","",get_class($this),"GetCustomField");
return false;
}
return GetCustomFieldValue($this->m_CategoryId,"category",$fieldName);
}
function SetCustomField($fieldName, $value)
{
global $objSession, $Errors;
if(!isset($this->m_CategoryId))
{
$Errors->AddError("error.appError","Set field is required in order to set custom field values","","",get_class($this),"SetCustomField");
return false;
}
return SetCustomFieldValue($this->m_CategoryId,"category",$fieldName,$value);
}
function LoadPermissions($first=1)
{
/* load all permissions for group on this category */
$this->Permissions->CatId=$this->Get("CategoryId");
if($this->Permissions->NumItems()==0)
{
$cats = explode("|",substr($this->Get("ParentPath"),1,-1));
if(is_array($cats))
{
$cats = array_reverse($cats);
$cats[] = 0;
foreach($cats as $catid)
{
$this->Permissions->LoadCategory($catid);
}
}
}
if($this->Permissions->NumItems()==0)
{
if($first==1)
{
$this->Permissions->GroupId=NULL;
$this->LoadPermissions(0);
}
}
}
function PermissionObject()
{
return $this->Permissions;
}
function PermissionItemObject($PermissionName)
{
$p = $this->Permissions->GetPermByName($PermissionName);
return $p;
}
function HasPermission($PermissionName,$GroupID)
{
global $objSession;
$perm = $this->PermissionValue($PermissionName,$GroupID);
// echo "Permission $PermissionName for $GroupID is $perm in ".$this->Get("CategoryId")."<br>\n";
if(!$perm)
{
$perm=$objSession->HasSystemPermission("ROOT");
}
return ($perm==1);
}
function PermissionValue($PermissionName,$GroupID)
{
//$this->LoadPermissions();
$ret=NULL;
//echo "Looping though ".count($this->Permissions)." permissions Looking for $PermissionName of $GroupID<br>\n";
if($this->Permissions->GroupId != $GroupID)
{
$this->Permissions->Clear();
$this->Permissions->GroupId = $GroupID;
}
$this->Permissions->CatId=$this->Get("CategoryId");
$ret = $this->Permissions->GetPermissionValue($PermissionName);
if($ret == NULL)
{
$cats = explode("|",substr($this->Get("ParentPath"),1,-1));
if(is_array($cats))
{
$cats = array_reverse($cats);
$cats[] = 0;
foreach($cats as $catid)
{
$this->Permissions->LoadCategory($catid);
$ret = $this->Permissions->GetPermissionValue($PermissionName);
if(is_numeric($ret))
break;
}
}
}
return $ret;
}
function SetPermission($PermName,$GroupID,$Value,$Type=0)
{
global $objSession, $objPermissions, $objGroups;
if($this->Permissions->GroupId != $GroupID)
{
$this->Permissions->Clear();
$this->Permissions->GroupId = $GroupID;
}
if($objSession->HasSystemPermission("GRANT"))
{
$current = $this->PermissionValue($PermName,$GroupID);
if($current == NULL)
{
$this->Permissions->Add_Permission($this->Get("CategoryId"),$GroupId,$PermName,$Value,$Type);
}
else
{
$p = $this->Permissions->GetPermByName($PermName);
if($p->Inherited==FALSE)
{
$p->Set("PermissionValue",$Value);
$p->Update();
}
else
$this->Permissions->Add_Permission($this->Get("CategoryId"),$GroupId,$PermName,$Value,$Type);
}
if($PermName == "CATEGORY.VIEW")
{
$Groups = $objGroups->GetAllGroupList();
$ViewList = $this->Permissions->GetGroupPermList($this,"CATEGORY.VIEW",$Groups);
$this->SetViewPerms("CATEGORY.VIEW",$ViewList,$Groups);
$this->Update();
}
}
}
function SetViewPerms($PermName,$acl,$allgroups)
{
global $objPermCache;
$dacl = array();
if(!is_array($allgroups))
{
global $objGroups;
$allgroups = $objGroups->GetAllGroupList();
}
for($i=0;$i<count($allgroups);$i++)
{
$g = $allgroups[$i];
if(!in_array($g,$acl))
$dacl[] = $g;
}
if(count($acl)<count($dacl))
{
$aval = implode(",",$acl);
$dval = "";
}
else
{
$dval = implode(",",$dacl);
$aval = "";
}
if(strlen($aval)==0 && strlen($dval)==0)
{
$aval = implode(",",$allgroups);
}
$PermId = $this->Permissions->GetPermId($PermName);
$pc = $objPermCache->GetPerm($this->Get("CategoryId"),$PermId);
if(is_object($pc))
{
$pc->Set("ACL",$aval);
$pc->Set("DACL",$dval);
$pc->Update();
}
else
$objPermCache->AddPermCache($this->Get("CategoryId"),$PermId,$aval,$dval);
//$this->Update();
}
function GetACL($PermName)
{
global $objPermCache;
$ret = "";
$PermId = $this->Permissions->GetPermId($PermName);
$pc = $objPermCache->GetPerm($this->Get("CategoryId"),$PermId);
if(is_object($pc))
{
$ret = $this->Get("ACL");
}
return $ret;
}
function UpdateACL()
{
global $objGroups, $objPermCache;
$glist = $objGroups->GetAllGroupList();
$ViewList = $this->Permissions->GetGroupPermList($this,"CATEGORY.VIEW",$glist);
$perms = $this->Permissions->GetAllViewPermGroups($this,$glist);
//echo "<PRE>";print_r($perms); echo "</PRE>";
foreach($perms as $PermName => $l)
{
$this->SetViewPerms($PermName,$l,$glist);
}
}
function Cat_Link()
{
global $m_var_list_update;
$m_var_list_update["cat"] = $this->Get("CategoryId");
$ret = GetIndexURL()."?env=".BuildEnv();
unset($m_var_list_update["cat"]);
return $ret;
}
function Parent_Link()
{
global $m_var_list_update;
$m_var_list_update["cat"] = $this->Get("ParentId");
$ret = GetIndexURL()."?env=".BuildEnv();
unset($m_var_list_update["cat"]);
return $ret;
}
function Admin_Parent_Link($page=NULL)
{
global $m_var_list_update;
if(!strlen($page))
$page = $_SERVER["PHP_SELF"];
$m_var_list_update["cat"] = $this->Get("ParentId");
$ret = $page."?env=".BuildEnv();
unset($m_var_list_update["cat"]);
return $ret;
}
function StatusIcon()
{
global $imagesURL;
$ret = $imagesURL."/itemicons/";
switch($this->Get("Status"))
{
case STATUS_DISABLED:
$ret .= "icon16_cat_disabled.gif";
break;
case STATUS_PENDING:
$ret .= "icon16_cat_pending.gif";
break;
case STATUS_ACTIVE:
$img = "icon16_cat.gif";
if($this->IsPopItem())
$img = "icon16_cat_pop.gif";
if($this->IsHotItem())
$img = "icon16_cat_hot.gif";
if($this->IsNewItem())
$img = "icon16_cat_new.gif";
if($this->Is("EditorsPick"))
$img = "icon16_car_pick.gif";
$ret .= $img;
break;
}
return $ret;
}
function SubCatCount()
{
$ret = $this->Get("CachedDescendantCatsQty");
$sql = "SELECT COUNT(*) as SubCount FROM ".$this->tablename." WHERE ParentPath LIKE '".$this->Get("ParentPath")."%' AND CategoryId !=".$this->Get("CategoryId");
$rs = $this->adodbConnection->Execute($sql);
if($rs && !$rs->EOF)
{
$val = $rs->fields["SubCount"];
if($val != $this->Get("CachedDescendantCatsQty"))
{
$this->Set("CachedDescendantCatsQty",$val);
$this->Update();
}
$ret = $this->Get("CachedDescendantCatsQty");
}
return $ret;
}
function GetSubCatIds()
{
$sql = "SELECT CategoryId FROM ".$this->tablename." WHERE ParentPath LIKE '".$this->Get("ParentPath")."%' AND CategoryId !=".$this->Get("CategoryId");
$rs = $this->adodbConnection->Execute($sql);
$ret = array();
while($rs && !$rs->EOF)
{
$ret[] = $rs->fields["CategoryId"];
$rs->MoveNext();
}
return $ret;
}
function GetParentIds()
{
$Parents = array();
$ParentPath = $this->Get("ParentPath");
if(strlen($ParentPath))
{
$ParentPath = substr($ParentPath,1,-1);
$Parents = explode("|",$ParentPath);
}
return $Parents;
}
function ItemCount($ItemType="")
{
global $objItemTypes,$objCatList,$objCountCache;
if(!is_numeric($ItemType))
{
$TypeId = $objItemTypes->GetItemTypeValue($ItemType);
}
else
$TypeId = (int)$ItemType;
//$path = $this->Get("ParentPath");
//$path = substr($path,1,-1);
//$path = str_replace("|",",",$path);
$path = implode(",",$this->GetSubCatIds());
if(strlen($path))
{
$path = $this->Get("CategoryId").",".$path;
}
else
$path = $this->Get("CategoryId");
$res = TableCount(GetTablePrefix()."CategoryItems","CategoryId IN ($path)",FALSE);
return $res;
}
function ParseObject($element)
{
global $objConfig, $objCatList, $rootURL, $var_list, $var_list_update, $m_var_list_update, $objItemTypes,$objCountCache;
$extra_attribs = ExtraAttributes($element->attributes);
//print_r($element);
if(strtolower($element->name)==$this->TagPrefix)
{
$field = strtolower( $element->GetAttributeByName('_field') );
switch($field)
{
case "name":
/*
@field:cat.name
@description:Category name
*/
$ret = $this->HighlightField("Name");
break;
case "description":
/*
@field:cat.description
@description:Category Description
*/
$ret = inp_unescape($this->Get("Description"));
$ret = $this->HighlightText($ret);
break;
case "cachednavbar":
/*
@field:cat.cachednavbar
@description: Category cached navbar
*/
$ret = $this->HighlightField("CachedNavbar");
if(!strlen($ret))
{
$this->UpdateCachedPath();
$ret = $this->HighlightField("CachedNavbar");
}
break;
case "image":
/*
@field:cat.image
@description:Return an image associated with the category
@attrib:_default:bool:If true, will return the default image if the requested image does not exist
@attrib:_name::Return the image with this name
@attrib:_thumbnail:bool:If true, return the thumbnail version of the image
@attrib:_imagetag:bool:If true, returns a complete image tag. exta html attributes are passed to the image tag
*/
$default = $element->GetAttributeByName('_primary');
$name = $element->GetAttributeByName('_name');
if(strlen($name))
{
$img = $this->GetImageByName($name);
}
else
{
if($default)
$img = $this->GetDefaultImage();
}
if($img)
{
if( $element->GetAttributeByName('_thumbnail') )
{
$url = $img->parsetag("thumb_url");
}
else
$url = $img->parsetag("image_url");
}
else
{
$url = $element->GetAttributeByName('_defaulturl');
}
if( $element->GetAttributeByName('_imagetag') )
{
if(strlen($url))
{
$ret = "<IMG src=\"$url\" $extra_attribs >";
}
else
$ret = "";
}
else
$ret = $url;
break;
case "createdby":
/*
@field:cat.createdby
@description:parse a user field of the user that created the category
@attrib:_usertag::User field to return (defaults to login ID)
*/
$field = $element->GetAttributeByName('_usertag');
if(!strlen($field))
{
$field = "user_login";
}
$u = $objUsers->GetUser($this->Get("CreatedById"));
$ret = $u->parsetag($field);
break;
case "custom":
/*
@field:cat.custom
@description:Returns a custom field
@attrib:_customfield::field name to return
@attrib:_default::default value
*/
$field = $element->GetAttributeByName('_customfield');
$default = $element->GetAttributeByName('_default');
$ret = $this->GetCustomFieldValue($field,$default);
break;
case "catsubcats":
/*
@field:cat.catsubcats
@description:Returns a list of subcats of current category
@attrib:_limit:int:Number of categories to return
@attrib:_separator::Separator between categories
@attrib:_anchor:bool:Make an anchor (only if template is not specified)
@attrib:_TargetTemplate:tpl:Target template
@attrib:_Ending::Add special text at the end of subcategory list
@attrib:_Class::Specify stly sheet class for anchors (if used) or "span" object
*/
$limit = ((int)$element->attributes["_limit"]>0)? $element->attributes["_limit"] : NULL;
$separator = $element->attributes["_separator"];
$anchor = (int)($element->attributes["_anchor"])? 1 : NULL;
$template = strlen($element->attributes["_TargetTemplate"])? $element->attributes["_TargetTemplate"] : NULL;
$ending = strlen($element->attributes["_ending"])? $element->attributes["_ending"] : NULL;
$class = strlen($element->attributes["_class"])? $element->attributes["_class"] : NULL;
$ret = $this->GetSubCats($limit, $template, $separator, $anchor, $ending, $class);
break;
case "date":
/*
@field:cat.date
@description:Returns the date/time the category was created
@attrib:_tz:bool:Convert the date to the user's local time
@attrib:_part::Returns part of the date. The following options are available: month,day,year,time_24hr,time_12hr
*/
$d = $this->Get("CreatedOn");
if( $element->GetAttributeByName('_tz') )
{
$d = GetLocalTime($d,$objSession->Get("tz"));
}
$part = strtolower( $element->GetAttributeByName('_part') );
if(strlen($part))
{
$ret = ExtractDatePart($part,$d);
}
else
{
if(!is_numeric($d))
{
$ret = "";
}
else
$ret = LangDate($d);
}
break;
case "link":
/*
@field:cat.link
@description:Returns a URL setting the category to the current category
@attrib:_template:tpl:Template URL should point to
@attrib:_mod_template:tpl:Template INSIDE a module to which the category belongs URL should point to
*/
if ( strlen( $element->GetAttributeByName('_mod_template') ) ){
//will prefix the template with module template root path depending on category
$ids = $this->GetParentIds();
$tpath = GetModuleArray("template");
$roots = GetModuleArray("rootcat");
// get template path of module, by searching for moudle name
// in this categories first parent category
// and then using found moudle name as a key for module template paths array
$path = $tpath[array_search ($ids[0], $roots)];
$t = $path . $element->GetAttributeByName('_mod_template');
}
else
$t = $element->GetAttributeByName('_template');
if(strlen($t))
{
$var_list_update["t"] = $t;
}
else
$var_list_update["t"] = $var_list["t"];
$m_var_list_update["cat"] = $this->Get("CategoryId");
$ret = GetIndexURL()."?env=" . BuildEnv();
unset($m_var_list_update["cat"], $var_list_update["t"]);
break;
case "adminlink":
$m_var_list_update["cat"] = $this->Get("CategoryId");
$m_var_list_update["p"] = 1;
$ret = $_SERVER["PHP_SELF"]."?env=" . BuildEnv();
unset($m_var_list_update["cat"]);
unset($m_var_list_update["p"]);
return $ret;
break;
case "customlink":
$t = $this->GetCustomFieldValue("indextemplate","");
if(strlen($t))
{
$var_list_update["t"] = $t;
}
else
$var_list_update["t"] = $var_list["t"];
$m_var_list_update["cat"] = $this->Get("CategoryId");
$ret = GetIndexURL()."?env=" . BuildEnv();
unset($m_var_list_update["cat"], $var_list_update["t"]);
break;
case "link_selector":
$m_var_list_update["cat"] = $this->Get("CategoryId");
$ret = $_SERVER["PHP_SELF"]."?env=" . BuildEnv();
// pass through selector
if( isset($_REQUEST['Selector']) ) $ret .= '&Selector='.$_REQUEST['Selector'];
// pass new status
if( isset($_REQUEST['new']) ) $ret .= '&new='.$_REQUEST['new'];
unset($m_var_list_update["cat"]);
return $ret;
break;
case "admin_icon":
if( $element->GetAttributeByName('fulltag') )
{
$ret = "<IMG $extra_attribs SRC=\"".$this->StatusIcon()."\">";
}
else
$ret = $this->StatusIcon();
break;
case "subcats":
/*
@field:cat.subcats
@description: Loads category's subcategories into a list and renders using the m_list_cats global tag
@attrib:_subcattemplate:tpl:Template used to render subcategory list elements
@attrib: _columns:int: Numver of columns to display the categories in (defaults to 1)
@attrib: _maxlistcount:int: Maximum number of categories to list
@attrib: _FirstItemTemplate:tpl: Template used for the first category listed
@attrib: _LastItemTemplate:tpl: Template used for the last category listed
@attrib: _NoTable:bool: If set to 1, the categories will not be listed in a table. If a table is used, all HTML attributes are passed to the TABLE tag
*/
$attr = array();
$attr["_catid"] = $this->Get("CategoryId");
$attr["_itemtemplate"] = $element->GetAttributeByName('_subcattemplate');
if( $element->GetAttributeByName('_notable') )
$attr["_notable"]=1;
$ret = m_list_cats($attr);
break;
case "subcatcount":
/*
@field:cat.subcatcount
@description:returns number of subcategories
*/
$GroupOnly = $element->GetAttributeByName('_grouponly') ? 1 : 0;
$txt = "<inp:m_itemcount _CatId=\"".$this->Get("CategoryId")."\" _SubCats=\"1\" ";
$txt .="_CategoryCount=\"1\" _ItemType=\"1\" _GroupOnly=\"$GroupOnly\" />";
$tag = new clsHtmlTag($txt);
$ret = $tag->Execute();
break;
case "itemcount":
/*
@field:cat.itemcount
@description:returns the number of items in the category
@attrib:_itemtype::name of item type to count, or all items if not set
*/
$typestr = $element->GetAttributeByName('_itemtype');
if(strlen($typestr))
{
$type = $objItemTypes->GetTypeByName($typestr);
if(is_object($type))
{
$TypeId = $type->Get("ItemType");
$GroupOnly = $element->GetAttributeByName('_grouponly') ? 1 : 0;
$txt = "<inp:m_itemcount _CatId=\"".$this->Get("CategoryId")."\" _SubCats=\"1\" ";
$txt .=" _ListType=\"category\" _CountCurrent=\"1\" _ItemType=\"$TypeId\" _GroupOnly=\"$GroupOnly\" />";
$tag = new clsHtmlTag($txt);
$ret = $tag->Execute();
}
else
$ret = "";
}
else
{
$ret = (int)$objCountCache->GetCatListTotal($this->Get("CategoryId"));
}
break;
case "totalitems":
/*
@field:cat.totalitems
@description:returns the number of items in the category and all subcategories
*/
$ret = $this->ItemCount();
break;
case "itemdate":
/*
@field:cat.itemdate
@description:Returns the date the cache count was last updated
@attrib:_itemtype:Item name to check
@attrib:_tz:bool:Convert the date to the user's local time
@attrib:_part::Returns part of the date. The following options are available: month,day,year,time_24hr,time_12hr
*/
$typestr = $element->GetAttributeByName('_itemtype');
$type = $objItemTypes->GetTypeByName($typestr);
if(is_object($type))
{
$TypeId = $type->Get("ItemType");
$cc = $objCountCache->GetCountObject(1,$TypeId,$this->get("CategoryId"),0);
if(is_object($cc))
{
$date = $cc->Get("LastUpdate");
}
else
$date = "";
//$date = $this->GetCacheCountDate($TypeId);
if( $element->GetAttributeByName('_tz') )
{
$date = GetLocalTime($date,$objSession->Get("tz"));
}
$part = strtolower($element->GetAttributeByName('_part') );
if(strlen($part))
{
$ret = ExtractDatePart($part,$date);
}
else
{
if($date<=0)
{
$ret = "";
}
else
$ret = LangDate($date);
}
}
else
$ret = "";
break;
case "new":
/*
@field:cat.new
@description:returns text if category's status is "new"
@attrib:_label:lang: Text to return if status is new
*/
if($this->IsNewItem())
{
$ret = $element->GetAttributeByName('_label');
if(!strlen($ret))
$ret = "lu_new";
$ret = language($ret);
}
else
$ret = "";
break;
-
case "pick":
/*
@field:cat.pick
@description:returns text if article's status is "hot"
@attrib:_label:lang: Text to return if status is "hot"
*/
if($this->Get("EditorsPick")==1)
{
$ret = $element->GetAttributeByName('_label');
if(!strlen($ret))
$ret = "lu_pick";
$ret = language($ret);
}
else
$ret = "";
break;
case "parsetag":
/*
@field:cat.parsetag
@description:returns a tag output with this categoriy set as a current category
@attrib:_tag:: tag name
*/
$tag = new clsHtmlTag();
$tag->name = $element->GetAttributeByName('_tag');
$tag->attributes = $element->attributes;
$tag->attributes["_catid"] = $this->Get("CategoryId");
$ret = $tag->Execute();
break;
/*
@field:cat.relevance
@description:Displays the category relevance in search results
@attrib:_displaymode:: How the relevance should be displayed<br>
<UL>
<LI>"Numerical": Show the decimal value
<LI>"Bar": Show the HTML representing the relevance. Returns two HTML cells &lg;td&lt; with specified background colors
<LI>"Graphical":Show image representing the relevance
</UL>
@attrib:_onimage::Zero relevance image shown in graphical display mode. Also used as prefix to build other images (i.e. prefix+"_"+percentage+".file_extension"
@attrib:_OffBackGroundColor::Off background color of HTML cell in bar display mode
@attrib:_OnBackGroundColor::On background color of HTML cell in bar display mode
*/
}
if( !isset($ret) ) $ret = parent::ParseObject($element);
}
return $ret;
}
function parsetag($tag)
{
global $objConfig,$objUsers, $m_var_list, $m_var_list_update;
if(is_object($tag))
{
$tagname = $tag->name;
}
else
$tagname = $tag;
switch($tagname)
{
case "cat_id":
return $this->Get("CategoryId");
break;
case "cat_parent":
return $this->Get("ParentId");
break;
case "cat_fullpath":
return $this->Get("CachedNavbar");
break;
case "cat_name":
return inp_unescape($this->Get("Name"));
break;
case "cat_desc":
return inp_unescape($this->Get("Description"));
break;
case "cat_priority":
if($this->Get("Priority")!=0)
{
return (int)$this->Get("Priority");
}
else
return "";
break;
case "cat_pick":
if ($this->Get("EditorsPick"))
return "pick";
break;
case "cat_status":
return $this->Get("Status");
break;
case "cat_Pending":
return $this->Get("Name");
break;
case "cat_pop":
if($this->IsPopItem())
return "pop";
break;
case "cat_new":
if($this->IsNewItem())
return "new";
break;
case "cat_hot":
if($this->IsHotItem())
return "hot";
break;
case "cat_metakeywords":
return inp_unescape($this->Get("MetaKeywords"));
break;
case "cat_metadesc":
return inp_unescape($this->Get("MetaDescription"));
break;
case "cat_createdby":
return $objUsers->GetUserName($this->Get("CreatedById"));
break;
case "cat_resourceid":
return $this->Get("ResourceId");
break;
case "cat_sub_cats":
return $this->GetSubCats($objConfig->Get("SubCat_ListCount"));
break;
case "cat_link":
return $this->Cat_Link();
break;
case "subcat_count":
return $this->SubCatCount();
break;
case "cat_itemcount":
return (int)$this->GetTotalItemCount();
break;
case "cat_link_admin":
$m_var_list_update["cat"] = $this->Get("CategoryId");
$m_var_list_update["p"] = 1;
$ret = $_SERVER["PHP_SELF"]."?env=" . BuildEnv();
unset($m_var_list_update["cat"]);
unset($m_var_list_update["p"]);
return $ret;
break;
case "cat_admin_icon":
$ret = $this->StatusIcon();
return $ret;
break;
case "cat_link_selector":
$m_var_list_update["cat"] = $this->Get("CategoryId");
$ret = $_SERVER["PHP_SELF"]."?env=" . BuildEnv();
unset($m_var_list_update["cat"]);
return $ret;
break;
case "cat_link_edit":
$m_var_list_update["id"] = $this->Get("CategoryId");
$ret = "addcategory.php?env=" . BuildEnv();
unset($m_var_list_update["id"]);
return $ret;
break;
case "cat_date":
return LangDate($this->Get("CreatedOn"));
break;
case "cat_num_cats":
return $this->Get("CachedDescendantCatsQty");
break;
case "cell_back":
if ($m_var_list_update["cat_cell"]=="#cccccc")
{
$m_var_list_update["cat_cell"]="#ffffff";
return "#ffffff";
}
else
{
$m_var_list_update["cat_cell"]="#cccccc";
return "#cccccc";
}
break;
default:
return "Undefined:$tagname";
}
}
function ParentNames()
{
global $objCatList;
if(strlen($this->Get("CachedNavbar"))==0)
{
$nav = "";
//echo "Rebuilding Navbar..<br>\n";
if(strlen($this->Get("ParentPath"))==0)
{
$this->UpdateCachedPath();
}
$cats = explode("|",substr($this->Get("ParentPath"),1,-1));
foreach($cats as $catid)
{
$cat =& $objCatList->GetCategory($catid);
if(is_object($cat))
{
if(strlen($cat->Get("Name")))
$names[] = $cat->Get("Name");
}
}
$nav = implode(">", $names);
$this->Set("CachedNavbar",$nav);
$this->Update();
}
$res = explode(">",$this->Get("CachedNavbar"));
return $res;
}
function UpdateCacheCounts()
{
global $objItemTypes;
$CatId = $this->Get("CategoryId");
if($CatId>0)
{
//echo "Updating count for ".$this->Get("CachedNavbar")."<br>\n";
UpdateCategoryCount(0,$CatId);
}
}
}
class clsCatList extends clsItemCollection
{
// var $Categories;
// var $adodbConnection;
var $Page;
var $PerPageVar;
function clsCatList()
{
global $m_var_list;
$this->clsItemCollection();
$this->classname="clsCategory";
+ $this->AdminSearchFields = array("Name","Description");
$this->Page=(int)$m_var_list["p"];
$this->PerPageVar = "Perpage_Category";
$this->SourceTable = GetTablePrefix()."Category";
$this->BasePermission="CATEGORY";
}
function GetCountSQL($PermName,$CatId=NULL, $GroupId=NULL, $AdditonalWhere="")
{
global $objSession, $objPermissions, $objCatList;
$ltable = $this->SourceTable;
$acl = $objSession->GetACLClause();
$cattable = GetTablePrefix()."CategoryItems";
$CategoryTable = GetTablePrefix()."Category";
$ptable = GetTablePrefix()."PermCache";
$VIEW = $objPermissions->GetPermId($PermName);
$sql = "SELECT count(*) as CacheVal FROM $ltable ";
$sql .="INNER JOIN $ptable ON ($ltable.CategoryId=$ptable.CategoryId) ";
$sql .="WHERE ($acl AND PermId=$VIEW AND $ltable.Status=1) ";
if(strlen($AdditonalWhere)>0)
{
$sql .= "AND (".$AdditonalWhere.")";
}
return $sql;
}
function CountCategories($attribs)
{
global $objSession;
$cat = $attribs["_catid"];
if(!is_numeric($cat))
{
$cat = $this->CurrentCategoryID();
}
if((int)$cat>0)
$c = $this->GetCategory($cat);
if($attribs["_subcats"] && $cat>0)
{
$ParentWhere = "(ParentPath LIKE '".$c->Get("ParentPath")."%' AND ".$this->SourceTable.".CategoryId != $cat)";
}
if($attribs["_today"])
{
$today = mktime(0,0,0,date("m"),date("d"),date("Y"));
$TodayWhere = "(CreatedOn>=$today)";
}
if($attribs["_grouponly"])
{
$GroupList = $objSession->Get("GroupList");
}
else
$GroupList = NULL;
$where = "";
if(strlen($ParentWhere))
{
$where = $ParentWhere;
}
if(strlen($TodayWhere))
{
if(strlen($where))
$where .=" AND ";
$where .= $TodayWhere;
}
$sql = $this->GetCountSQL("CATEGORY.VIEW",$cat,$GroupList,$where);
// echo "SQL: ".$sql."<BR>";
$rs = $this->adodbConnection->Execute($sql);
if($rs && !$rs->EOF)
{
$ret = $rs->fields["CacheVal"];
}
else
$ret = 0;
return $ret;
}
function CurrentCategoryID()
{
global $m_var_list;
return (int)$m_var_list["cat"];
}
function NumCategories()
{
return $this->NumItems();
}
function &CurrentCat()
{
//return $this->GetCategory($this->CurrentCategoryID());
return $this->GetItem($this->CurrentCategoryID());
}
function &GetCategory($CatID)
{
return $this->GetItem($CatID);
}
function GetByResource($ResId)
{
return $this->GetItemByField("ResourceId",$ResId);
}
function QueryOrderByClause($EditorsPick=FALSE,$Priority=FALSE,$UseTableName=FALSE)
{
global $objSession;
if($UseTableName)
{
$TableName = $this->SourceTable.".";
}
else
$TableName = "";
$Orders = array();
if($EditorsPick)
{
$Orders[] = $TableName."EditorsPick DESC";
}
if($Priority)
{
$Orders[] = $TableName."Priority DESC";
}
$FieldVar = "Category_Sortfield";
$OrderVar = "Category_Sortorder";
if(is_object($objSession))
{
if(strlen($objSession->GetPersistantVariable($FieldVar))>0)
{
$Orders[] = trim($TableName.$objSession->GetPersistantVariable($FieldVar) . " ".
$objSession->GetPersistantVariable($OrderVar));
}
}
$FieldVar = "Category_Sortfield2";
$OrderVar = "Category_Sortorder2";
if(is_object($objSession))
{
if(strlen($objSession->GetPersistantVariable($FieldVar))>0)
{
$Orders[] = trim($TableName.$objSession->GetPersistantVariable($FieldVar) . " ".
$objSession->GetPersistantVariable($OrderVar));
}
}
if(count($Orders)>0)
{
$OrderBy = "ORDER BY ".implode(", ",$Orders);
}
else
$OrderBy="";
return $OrderBy;
}
function LoadCategories($where="",$orderBy = "")
{
global $objConfig;
$PerPage = $objConfig->Get($this->PerPageVar);
if(!is_numeric($PerPage))
$PerPage = 10;
-
+
$this->QueryItemCount=TableCount($this->SourceTable,$where,0);
//echo $this->QueryItemCount." Items Loaded<br>\n";
if(is_numeric($objConfig->Get($this->PerPageVar)))
{
$Start = ($this->Page-1)*$PerPage;
$limit = "LIMIT ".$Start.",".$PerPage;
}
else
$limit = NULL;
$limit = NULL;
return $this->Query_Category($where,$orderBy,$limit);
}
function Query_Category($whereClause="",$orderByClause="",$limit=NULL)
{
global $m_var_list, $objSession, $Errors, $objPermissions;
$GroupID = $objSession->Get("GroupID");
-
$resultset = array();
$table = $this->SourceTable;
$ptable = GetTablePrefix()."PermCache";
$CAT_VIEW = $objPermissions->GetPermId("CATEGORY.VIEW");
if(!$objSession->HasSystemPermission("ADMIN"))
{
$sql = "SELECT * FROM $table INNER JOIN $ptable ON ($ptable.CategoryId=$table.CategoryId)";
$acl_where = $objSession->GetACLClause();
if(strlen($whereClause))
{
$sql .= " WHERE ($acl_where) AND PermId=$CAT_VIEW AND ".$whereClause;
}
else
$sql .= " WHERE ($acl_where) AND PermId=$CAT_VIEW ";
}
else
{
- $sql ="SELECT * FROM $table WHERE $whereClause";
+ $sql ="SELECT * FROM $table ".($whereClause ? "WHERE $whereClause" : '');
}
$sql .=" ".$orderByClause;
if(isset($limit) && strlen(trim($limit)))
$sql .= " ".$limit;
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo $sql;
return $this->Query_item($sql);
}
function CountPending()
{
return TableCount($this->SourceTable,"Status=".STATUS_PENDING,0);
}
function GetPageLinkList($dest_template=NULL,$page="",$PagesToList=10,$HideEmpty=TRUE)
{
global $objConfig, $m_var_list_update, $var_list_update, $var_list;
if(!strlen($page))
$page = GetIndexURL();
$NumPages = ceil($this->GetNumPages($objConfig->Get($this->PerPageVar)));
$PerPage = $objConfig->Get($this->PerPageVar);
if($PerPage<1)
$PerPage=20;
$NumPages = ceil($this->GetNumPages($PerPage));
if($NumPages==1 && $HideEmpty)
return "";
if(strlen($dest_template))
{
$var_list_update["t"] = $dest_template;
}
else
$var_list_update["t"] = $var_list["t"];
$o = "";
if($this->Page>$NumPages)
$this->Page=$NumPages;
$StartPage = (int)$this->Page - ($PagesToList/2);
if($StartPage<1)
$StartPage=1;
$EndPage = $StartPage+($PagesToList-1);
if($EndPage>$NumPages)
{
$EndPage = $NumPages;
$StartPage = $EndPage-($PagesToList-1);
if($StartPage<1)
$StartPage=1;
}
$o = "";
if($StartPage>1)
{
$m_var_list_update["p"] = $this->Page-$PagesToList;
$prev_url = $page."?env=".BuildEnv();
$o .= "<A HREF=\"$prev_url\">&lt;&lt;</A>";
}
for($p=$StartPage;$p<=$EndPage;$p++)
{
if($p!=$this->Page)
{
$m_var_list_update["p"]=$p;
$href = $page."?env=".BuildEnv();
$o .= " <A HREF=\"$href\" >$p</A> ";
}
else
{
$o .= "$p";
}
}
if($EndPage<$NumPages && $EndPage>0)
{
$m_var_list_update["p"]=$this->Page+$PagesToList;
$next_url = $page."?env=".BuildEnv();
$o .= "<A HREF=\"$next_url\"> &gt;&gt;</A>";
}
unset($m_var_list_update,$var_list_update["t"] );
return $o;
}
function GetAdminPageLinkList($url)
{
global $objConfig, $m_var_list_update, $var_list_update, $var_list;
$PerPage = $objConfig->Get($this->PerPageVar);
if(!is_numeric($PerPage))
$PerPage = 10;
$NumPages = ceil($this->GetNumPages($PerPage));
$o = "";
if($this->Page>1)
{
$m_var_list_update["p"]=$this->Page-1;
$prev_url = $url."?env=".BuildEnv();
unset($m_var_list_update["p"]);
$o .= "<A HREF=\"$prev_url\" class=\"NAV_URL\"><<</A>";
}
if($this->Page<$NumPages)
{
$m_var_list_update["p"]=$this->Page+1;
$next_url = $url."?env=".BuildEnv();
unset($m_var_list_update["p"]);
}
for($p=1;$p<=$NumPages;$p++)
{
if($p!=$this->Page)
{
$m_var_list_update["p"]=$p;
$href = $url."?env=".BuildEnv();
unset($m_var_list_update["p"]);
$o .= "-<A HREF=\"$href\" class=\"NAV_URL\">$p</A>-";
}
else
{
$o .= "<SPAN class=\"CURRENT_PAGE\">$p</SPAN>";
}
}
if($this->Page<$NumPages)
{
$o .= "<A HREF=\"$next_url\" class=\"NAV_URL\">>></A>";
}
return $o;
}
function Search_Category($orderByClause)
{
global $objSession, $objConfig, $Errors;
$Start = ($this->Page-1)*$objConfig->Get("Perpage_Category");
$objResults = new clsSearchResults("Category","clsCategory");
$this->Clear();
$this->Categories = $objResults->LoadSearchResults($Start,$objConfig->Get("Perpage_Category"));
return $this->Categories;
}
function GetSubCats($ParentCat)
{
return $this->Query_Category("ParentId=".$ParentCat,"");
}
function AllSubCats($ParentCat)
{
$c =& $this->GetCategory($ParentCat);
$sql = "SELECT * FROM ".$this->SourceTable." WHERE ParentPath LIKE '".$c->Get("ParentPath")."%'";
$rs = $this->adodbConnection->Execute($sql);
$subcats = array();
while($rs && !$rs->EOF)
{
if($rs->fields["CategoryId"]!=$ParentCat)
{
$subcats[] = $rs->fields["CategoryId"];
}
$rs->MoveNext();
}
if($ParentCat>0)
{
if($c->Get("CachedDescendantCatsQty")!=count($subcats))
{
$c->Set("CachedDescendantCatsQty",count($subcats));
}
}
return $subcats;
}
function cat_navbar($admin=0, $cat, $target_template, $separator = " > ", $LinkLeaf = FALSE,
$root = 0,$RootTemplate="",$modcat=0, $ModTemplate="", $LinkRoot = FALSE)
{
// draw category navigation bar (at top)
global $Errors, $var_list_update, $var_list, $m_var_list_update, $m_var_list, $objConfig;
$selector = isset($_REQUEST['Selector']) ? '&Selector='.$_REQUEST['Selector'] : '';
$new = isset($_REQUEST['new']) ? '&new='.$_REQUEST['new'] : '';
$nav = "";
$m_var_list_update["p"]=1;
if(strlen($target_template)==0)
$target_template = $var_list["t"];
if($cat == 0)
{
$cat_name = language($objConfig->Get("Root_Name"));
if ($LinkRoot)
{
$var_list_update["t"] = strlen($RootTemplate)? $RootTemplate : $target_template;
$nav = "<a class=\"navbar\" href=\"".GetIndexURL()."?env=". BuildEnv().$selector.$new."\">$cat_name</a>"; }
else
$nav = "<span class=\"NAV_CURRENT_ITEM\">$cat_name</span>";
}
else
{
$nav = array();
$c =& $this->GetCategory($cat);
$nav_unparsed = $c->Get("ParentPath");
if(strlen($nav_unparsed)==0)
{
$c->UpdateCachedPath();
$nav_unparsed = $c->Get("ParentPath");
}
//echo " Before $nav_unparsed ";
if($root)
{
$r =& $this->GetCategory($root);
$rpath = $r->Get("ParentPath");
$nav_unparsed = substr($nav_unparsed,strlen($rpath),-1);
$cat_name = $r->Get("Name");
$m_var_list_update["cat"] = $root;
if($cat == $catid && !$LinkLeaf)
{
$nav[] = "<span class=\"NAV_CURRENT_ITEM\" >".$cat_name."</span>"; //href=\"browse.php?env=". BuildEnv() ."\"
}
else
{
if ($admin == 1)
{
$nav[] = "<a class=\"control_link\" href=\"".$_SERVER["PHP_SELF"]."?env=". BuildEnv().$selector.$new."\">".$cat_name."</a>";
}
else
{
if(strlen($RootTemplate))
{
$var_list_update["t"] = $RootTemplate;
}
else
{
$var_list_update["t"] = $target_template;
}
$nav[] = "<a class=\"navbar\" href=\"".GetIndexURL()."?env=". BuildEnv().$selector.$new."\">".$cat_name."</a>";
}
}
}
else
{
$nav_unparsed = substr($nav_unparsed,1,-1);
$cat_name = language($objConfig->Get("Root_Name"));
$m_var_list_update["cat"] = 0;
if($cat == 0)
{
$nav[] = "<span class=\"NAV_CURRENT_ITEM\" >".$cat_name."</span>"; //href=\"browse.php?env=". BuildEnv() ."\"
}
else
{
if ($admin == 1)
{
$nav[] = "<a class=\"control_link\" href=\"".$_SERVER["PHP_SELF"]."?env=". BuildEnv().$selector.$new."\">".$cat_name."</a>";
}
else
{
if(strlen($RootTemplate))
{
$var_list_update["t"] = $RootTemplate;
}
else
$var_list_update["t"] = $target_template;
$nav[] = "<a class=\"navbar\" href=\"".GetIndexURL()."?env=". BuildEnv().$selector.$new."\">".$cat_name."</a>";
}
}
}
//echo " After $nav_unparsed <br>\n";
if(strlen($target_template)==0)
$target_template = $var_list["t"];
$cats = explode("|", $nav_unparsed);
foreach($cats as $catid)
{
if($catid)
{
$c =& $this->GetCategory($catid);
if(is_object($c))
{
$cat_name = $c->Get("Name");
$m_var_list_update["cat"] = $catid;
if($catid==$modcat && strlen($ModTemplate)>0)
{
$t = $ModTemplate;
}
else
$t = $target_template;
if($cat == $catid && !$LinkLeaf)
{
$nav[] = "<span class=\"NAV_CURRENT_ITEM\" >".$cat_name."</span>";
}
else
{
if ($admin == 1)
{
$nav[] = "<a class=\"control_link\" href=\"".$_SERVER["PHP_SELF"]."?env=". BuildEnv().$selector.$new."\">".$cat_name."</a>";
}
else
{
$var_list_update["t"] = $t;
$nav[] = "<a class=\"navbar\" href=\"".GetIndexURL()."?env=". BuildEnv().$selector.$new."\">".$cat_name."</a>";
unset($var_list_update["t"]);
}
}
unset($m_var_list_update["cat"]);
}
}
}
$nav = implode($separator, $nav);
}
return $nav;
}
function &Add($ParentId, $Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, $New, $Pop,
$Priority, $MetaKeywords,$MetaDesc)
{
global $objSession;
$UserId = $objSession->Get("UserId");
$d = new clsCategory(NULL);
$d->tablename = $this->SourceTable;
if($d->UsingTempTable())
$d->Set("CategoryId",-1);
$d->idfield = "CategoryId";
$d->Set(array("ParentId", "Name", "Description", "CreatedOn", "EditorsPick", "Status", "HotItem",
"NewItem","PopItem", "Priority", "MetaKeywords", "MetaDescription", "CreatedById"),
array($ParentId, $Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, $New,
$Pop, $Priority, $MetaKeywords,$MetaDesc, $UserId));
$d->Create();
if($Status==1)
{
$d->SendUserEventMail("CATEGORY.ADD",$objSession->Get("PortalUserId"));
$d->SendAdminEventMail("CATEGORY.ADD");
}
else
{
$d->SendUserEventMail("CATEGORY.ADD.PENDING",$objSession->Get("PortalUserId"));
$d->SendAdminEventMail("CATEGORY.ADD.PENDING");
}
$d->UpdateCachedPath();
//RunUp($ParentId, "Increment_Count");
return $d;
}
function &Edit_Category($CategoryId, $Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot,
$NewItem, $Pop, $Priority, $MetaKeywords,$MetaDesc)
{
$d =& $this->GetCategory($CategoryId);
$d->Set(array("Name", "Description", "CreatedOn", "EditorsPick", "Status", "HotItem",
"NewItem", "PopItem", "Priority", "MetaKeywords","MetaDescription"),
array($Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, $NewItem,
$Pop, $Priority, $MetaKeywords,$MetaDesc));
$d->Update();
$d->UpdateCachedPath();
return $d;
}
function Move_Category($Id, $ParentTo)
{
global $objCatList;
$d =& $this->GetCategory($Id);
$oldparent = $d->Get("ParentId");
$ChildList = $d->GetSubCatIds();
/*
echo "Target Parent Id: $ParentTo <br>\n";
echo "<PRE>";print_r($ChildList); echo "</PRE>";
echo "Old Parent: $oldparent <br>\n";
echo "ID: $Id <br>\n";
*/
/* sanity checks */
if(!in_array($ParentTo,$ChildList) && $oldparent != $ParentTo && $oldparent != $Id &&
$Id != $ParentTo)
{
$d->Set("ParentId", $ParentTo);
$d->Update();
$d->UpdateCachedPath();
RunUp($oldparent, "Decrement_Count");
RunUp($ParentTo, "Increment_Count");
RunDown($ParentTo, "UpdateCachedPath");
return TRUE;
}
else
{
global $Errors;
$Errors->AddAdminUserError("la_error_move_subcategory");
return FALSE;
}
die();
}
function Copy_CategoryTree($Id, $ParentTo)
{
global $PastedCatIds;
$new = $this->Copy_Category($Id, $ParentTo);
if($new)
{
$PastedCatIds[$Id] = $new;
$sql = "SELECT CategoryId from ".GetTablePrefix()."Category where ParentId=$Id";
$result = $this->adodbConnection->Execute($sql);
if ($result && !$result->EOF)
{
while(!$result->EOF)
{
$this->Copy_CategoryTree($result->fields["CategoryId"], $new);
$result->MoveNext();
}
}
}
return $new;
}
function Copy_Category($Id, $ParentTo)
{
global $objGroups;
$src = $this->GetCategory($Id);
$Children = $src->GetSubCatIds();
if($Id==$ParentTo || in_array($ParentTo,$Children))
{
/* sanity error here */
global $Errors;
$Errors->AddAdminUserError("la_error_copy_subcategory");
return 0;
}
$dest = $src;
$dest->Set("ParentId", $ParentTo);
if ($src->get("ParentId") == $ParentTo)
{
$OldName = $src->Get("Name");
if(substr($OldName,0,5)=="Copy ")
{
$parts = explode(" ",$OldName,4);
if($parts[2]=="of" && is_numeric($parts[1]))
{
$Name = $parts[3];
}
else
if($parts[1]=="of")
{
$Name = $parts[2]." ".$parts[3];
}
else
$Name = $OldName;
}
else
$Name = $OldName;
//echo "New Name: $Name<br>";
$dest->Set("Name", $Name);
$Names = CategoryNameCount($ParentTo,$Name);
//echo "Names Count: ".count($Names)."<br>";
if(count($Names)>0)
{
$NameCount = count($Names);
$found = FALSE;
$NewName = "Copy of $Name";
if(!in_array($NewName,$Names))
{
//echo "Matched on $NewName in:<br>\n";
$found = TRUE;
}
else
{
for($x=2;$x<$NameCount+2;$x++)
{
$NewName = "Copy ".$x." of ".$Name;
if(!in_array($NewName,$Names))
{
$found = TRUE;
break;
}
}
}
if(!$found)
{
$NameCount++;
$NewName = "Copy $NameCount of $Name";
}
//echo "New Name: $NewName<br>";
$dest->Set("Name",$NewName);
}
}
$dest->UnsetIdField();
$dest->Set("CachedDescendantCatsQty",0);
$dest->Set("ResourceId",NULL);
$dest->Create();
$dest->UpdateCachedPath();
$p = new clsPermList();
$p->Copy_Permissions($src->Get("CategoryId"),$dest->Get("CategoryId"));
$glist = $objGroups->GetAllGroupList();
$view = $p->GetGroupPermList($dest, "CATEGORY.VIEW", $glist);
$dest->SetViewPerms("CATEGORY.VIEW",$view,$glist);
RunUp($ParentTo, "Increment_Count");
return $dest->Get("CategoryId");
}
function Delete_Category($Id)
{
global $objSession;
$d =& $this->GetCategory($Id);
if(is_object($d))
{
if($d->Get("CategoryId")==$Id)
{
$d->SendUserEventMail("CATEGORY.DELETE",$objSession->Get("PortalUserId"));
$d->SendAdminEventMail("CATEGORY.DELETE");
$p =& $this->GetCategory($d->Get("ParentId"));
RunDown($d->Get("CategoryId"), "Delete");
RunUp($p->Get("CategoryId"), "Decrement_Count");
RunUp($d->Get("CategoryId"),"ClearCacheData");
}
}
}
function PasteFromClipboard($TargetCat)
{
global $objSession;
$clip = $objSession->GetVariable("ClipBoard");
if(strlen($clip))
{
$ClipBoard = ParseClipboard($clip);
$IsCopy = (substr($ClipBoard["command"],0,4)=="COPY") || ($ClipBoard["source"] == $TargetCat);
$item_ids = explode(",",$ClipBoard["ids"]);
for($i=0;$i<count($item_ids);$i++)
{
$ItemId = $item_ids[$i];
$item = $this->GetItem($item_ids[$i]);
if(!$IsCopy)
{
$this->Move_Category($ItemId, $TargetCat);
$clip = str_replace("CUT","COPY",$clip);
$objSession->SetVariable("ClipBoard",$clip);
}
else
{
$this->Copy_CategoryTree($ItemId,$TargetCat);
}
}
}
}
function NumChildren($ParentID)
{
$cat_filter = "m_cat_filter";
global $$cat_filter;
$filter = $$cat_filter;
$adodbConnection = GetADODBConnection();
$sql = "SELECT COUNT(Name) as children from ".$this->SourceTable." where ParentId=" . $ParentID . $filter;
$result = $adodbConnection->Execute($sql);
return $result->fields["children"];
}
function UpdateMissingCacheData()
{
$rs = $this->adodbConnection->Execute("SELECT * FROM ".$this->SourceTable." WHERE ParentPath IS NULL or ParentPath=''");
while($rs && !$rs->EOF)
{
$c = new clsCategory(NULL);
$data = $rs->fields;
$c->SetFromArray($data);
$c->UpdateCachedPath();
$rs->MoveNext();
}
$rs = $this->adodbConnection->Execute("SELECT * FROM ".$this->SourceTable." WHERE CachedNavbar IS NULL or CachedNavBar=''");
while($rs && !$rs->EOF)
{
$c = new clsCategory(NULL);
$data = $rs->fields;
$c->SetFromArray($data);
$c->UpdateCachedPath();
$rs->MoveNext();
}
}
function CopyFromEditTable($idfield)
{
global $objGroups, $objSession, $objPermList;
$objPermList = new clsPermList();
$edit_table = $objSession->GetEditTable($this->SourceTable);
$sql = "SELECT * FROM $edit_table";
$rs = $this->adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$data = $rs->fields;
$c = new $this->classname;
$c->SetFromArray($data);
$c->Dirty();
if($c->Get("CategoryId")>0)
{
$c->Update();
}
else
{
$c->UnsetIdField();
$c->Create();
$sql = "UPDATE ".GetTablePrefix()."Permissions SET CatId=".$c->Get("CategoryId")." WHERE CatId=-1";
$this->adodbConnection->Execute($sql);
}
$c->UpdateCachedPath();
$c->UpdateACL();
$c->SendUserEventMail("CATEGORY.MODIFY",$objSession->Get("PortalUserId"));
$c->SendAdminEventMail("CATEGORY.MODIFY");
$c->Related = new clsRelationshipList();
if(is_object($c->Related))
{
$r = $c->Related;
$r->CopyFromEditTable($c->Get("ResourceId"));
}
//RunDown($c->Get("CategoryId"),"UpdateCachedPath");
//RunDown($c->Get("CategoryId"),"UpdateACL");
unset($c);
unset($r);
$rs->MoveNext();
}
@$this->adodbConnection->Execute("DROP TABLE $edit_table");
//$this->UpdateMissingCacheData();
}
function PurgeEditTable($idfield)
{
parent::PurgeEditTable($idfield);
$sql = "DELETE FROM ".GetTablePrefix()."Permissions WHERE CatId=-1";
$this->adodbConnection->Execute($sql);
}
function GetExclusiveType($CatId)
{
global $objItemTypes, $objConfig;
$itemtype = NULL;
$c =& $this->GetItem($CatId);
$path = $c->Get("ParentPath");
foreach($objItemTypes->Items as $Type)
{
$RootVar = $Type->Get("ItemName")."_Root";
$RootId = $objConfig->Get($RootVar);
if((int)$RootId)
{
$rcat = $this->GetItem($RootId);
$rpath = $rcat->Get("ParentPath");
$p = substr($path,0,strlen($rpath));
//echo $rpath." vs. .$p [$path]<br>\n";
if($rpath==$p)
{
$itemtype = $Type;
break;
}
}
}
return $itemtype;
}
}
function RunUp($Id, $function, $Param=NULL)
{
global $objCatList;
$d = $objCatList->GetCategory($Id);
$ParentId = $d->Get("ParentId");
if ($ParentId == 0)
{
if($Param == NULL)
{
$d->$function();
}
else
{
$d->$function($Param);
}
}
else
{
RunUp($ParentId, $function, $Param);
if($Param == NULL)
{
$d->$function();
}
else
{
$d->$function($Param);
}
}
}
function RunDown($Id, $function, $Param=NULL)
{
global $objCatList;
$adodbConnection = GetADODBConnection();
$sql = "select CategoryId from ".GetTablePrefix()."Category where ParentId='$Id'";
$rs = $adodbConnection->Execute($sql);
//echo $sql."<br>\n";
while($rs && !$rs->EOF)
{
RunDown($rs->fields["CategoryId"], $function, $Param);
$rs->MoveNext();
}
$d = $objCatList->GetCategory($Id);
if($Param == NULL)
{
$d->$function();
}
else
$d->$function($Param);
}
?>
Property changes on: trunk/kernel/include/category.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/kernel/admin/include/parser.php
===================================================================
--- trunk/kernel/admin/include/parser.php (revision 122)
+++ trunk/kernel/admin/include/parser.php (revision 123)
@@ -1,274 +1,274 @@
<?php
-function adListSubCats($ParentId,$template)
+function adListSubCats($ParentId, $template, $KeywordsVar = 'SearchWord')
{
global $var_list, $m_cat_filter, $m_category_sort, $m_category_sortby,
$objCatList, $objSession,$pathtoroot, $objConfig,$admin;
if($objCatList->NumCategories()==0)
return "<br>No Categories<br><br>";
$o="<table border=0 cellspacing=2 width=\"100%\"><tbody><tr>";
$i=1;
- $list = $objSession->GetVariable("SearchWord");
+ $list = $objSession->GetVariable($KeywordsVar);
if(strlen($list))
$Keywords = explode(",",$list);
$template = $pathtoroot.$admin."/templates/".$template;
$topleft = 0;
$topright = 0;
$rightcount = 0;
$totalcats = 0;
$totalcats = $objCatList->NumItems();
$topleft = ceil($totalcats/2);
$topright = $totalcats-$topleft;
for ($x=0;$x<$topleft;$x++)
{
//printingleft
$cat = $objCatList->Items[$x];
if($cat->Get("CategoryId")!=$ParentId)
{
if ($i > 2)
{
$o.="</tr>\n<tr>";
$i = 1;
}
//$cat->LoadPermissions($objSession->Get("GroupId"));
if(strlen($list))
{
$h = $cat->AdminParseTemplate($template);
$h = HighlightKeywords($Keywords, $h);
$o .= $h;
$h = "";
}
else
$o.=$cat->AdminParseTemplate($template);
$i++;
}
//printingright
if ($rightcount < $topright && (($x+$topleft) <$totalcats))
{
$cat = $objCatList->Items[$x+$topleft];
if($cat->Get("CategoryId")!=$ParentId)
{
if ($i > 2)
{
$o.="</tr>\n<tr>";
$i = 1;
}
//$cat->LoadPermissions($objSession->Get("GroupId"));
if(strlen($list))
{
$h = $cat->AdminParseTemplate($template);
$h = HighlightKeywords($Keywords, $h);
$o .= $h;
$h = "";
}
else
$o.=$cat->AdminParseTemplate($template);
$i++;
}
$rightcount++;
}
}
$o .="\n</tr></tbody></table>\n";
return $o;
}
function list_custom($c,$Type)
{
global $objSession, $objCustomFieldList, $objCustomDataList,
$imagesURL;
$field_list = $objCustomFieldList->Query_CustomField("Type=$Type");
if (count($field_list) == 0)
return "No Custom Fields<br><br>";
$o="";
$i = 1;
$objCustomDataList->SourceTable = $objSession->GetEditTable("CustomMetaData");
$objCustomDataList->LoadResource($c->Get("ResourceId"));
foreach($field_list as $field)
{
$fieldname = $field->Get("FieldName");
$fieldlabel = $field->Get("FieldLabel");
$fieldid = $field->Get("CustomFieldId");
$f = $objCustomDataList->GetDataItem($fieldid);
if(is_object($f))
{
$fieldvalue = $f->Get("Value");
}
else
$fieldvalue="";
$o .="<tr " . int_table_color_ret() .">";
$o .="<td valign=\"top\"><img src=\"$imagesURL/itemicons/icon16_custom.gif\" height=\"16\" width=\"16\" align=\"absmiddle\"><span class=\"text\"> $fieldname</span></td>
<td valign=\"top\"><span class=\"text\">$fieldlabel</span></td>
<td>
<input type=\"text\" name=\"customdata[$fieldid]\" class=\"text\" size=\"30\" value=\"$fieldvalue\">
</td></tr>\n";
$i++;
}
return $o;
}
function adListRelatedCategories($Item)
{
global $objCatList;
if(is_object($Item))
{
$catlist = $Item->GetRelatedCategories(0);
$o = "";
foreach($catlist as $catrel)
{
$o .= "<input type=checkbox NAME=\"dellist[]\" VALUE=\"".$catrel->Get("RelationshipId")."\">";
$cat = $objCatList->GetByResource($catrel->Get("TargetId"));
$path = $cat->ParentNames();
if(strlen($path))
{
$o .= implode(">",$path);
}
$o .="<br>\n";
}
}
return $o;
}
function adListRelatedItems($Item)
{
global $objCatList;
if(is_object($Item))
{
$item_list=$Item->GetRelatedItems(0);
$o = "";
foreach($item_list as $i)
{
$data = $i->GetTargetItemData();
$o .= "<tr ".int_table_color_ret().">";
$o .= "<TD>";
$o .= "<input type=checkbox NAME=\"dellist[]\" VALUE=\"".$i->Get("RelationshipId")."\">";
$o .= $data[$data["TitleField"]];
$o .= "</TD>";
$o .= "<TD>".$data["SourceTable"]."</TD>";
$cat =& $objCatList->GetCategory($data["CategoryId"]);
$o .= "<TD>";
$path = $cat->ParentNames();
if(strlen($path))
{
$o .= implode(">",$path);
}
$o .= "</TD></TR>";
}
}
return $o;
}
function adListItemReviews($Item)
{
global $pathtoroot,$admin;
$Reviews = $Item->GetItemReviews();
$o = "";
if($Reviews->ItemCount()>0)
{
foreach($Reviews->ItemList as $r)
{
$o .= "<TR ".int_table_color_ret().">";
$o .= "<TD width=\"5%\">";
if($r->Get("Pending")==0)
{
$o .= "<INPUT TYPE=checkbox NAME=\"deletelist[]\" VALUE=\"".$r->Get("ReviewId")."\"> Delete";
}
$o .= "</TD><TD width=\"5%\">";
if($r->Get("Pending")!=0)
{
$o .= "<INPUT TYPE=checkbox NAME=\"approvelist[]\" VALUE=\"".$r->Get("ReviewId")."\"> Approve";
}
$o .= "</TD>";
$o .= $r->parse_template(admintemplate($pathtoroot.$admin."/templates/review_element.tpl"));
$o .= "</TR>";
}
}
return $o;
}
function adImageUploadFormTags($img)
{
static $file_count=0;
$o = "";
if($file_count==0)
{
$o .= "<INPUT TYPE=HIDDEN NAME=\"img\" VALUE=1>";
}
$o .= "<TD><INPUT TYPE=TEXT NAME=\"img_Name_$file_count\" VALUE=\"".$img->Get("Name")."\"></TD>";
$o .= "<TD><INPUT TYPE=TEXT NAME=\"img_Alt_$file_count\" VALUE=\"".$img->Get("AltName")."\"></TD>";
$o .= "<TD>";
$o .= "<INPUT TYPE=TEXT size=40 NAME=\"img_Url_$file_count\" VALUE=\"".$img->Get("Url")."\">";
$o .= "</TD><TD>";
$o .= "<INPUT TYPE=FILE class=\"button\" VALUE=\"".$img->Get("Url")."\" NAME=\"$file_count\">";
$o .= "<INPUT TYPE=HIDDEN NAME=\"img_Res_$file_count\" VALUE=\"".$img->Get("ResourceId")."\">";
$o .= "<INPUT TYPE=HIDDEN NAME=\"img_Rel_$file_count\" VALUE=\"".$img->Get("RelatedTo")."\">";
$o .= "<INPUT TYPE=HIDDEN NAME=\"img_Thumb_$file_count\" VALUE=\"".$img->Get("IsThumbnail")."\">";
$parts = pathinfo($img->Get("LocalPath"));
$destdir = $parts["dirname"];
$o .= "<INPUT TYPE=HIDDEN NAME=\"img_DestDir_$file_count\" VALUE=\"$destdir\">";
if($img->Get("RelatedTo")>0)
$o .= "<input type=\"submit\" name=\"img_Del_$file_count\" value=\"Delete\" class=\"button2\">";
$o .= "</TD>";
$file_count++;
return $o;
}
function m_GetModuleInfo($info_type)
{
// get information for building sql in
switch($info_type)
{
case 'rel_list': // Edit Category -> Relations List
return Array( 'MainTable' => 'Category', 'ItemNameField' => 'CachedNavbar',
'ItemNamePhrase' => 'la_Text_Category', 'TargetType' => 1);
break;
case 'summary_pending':
global $imagesURL;
$ret = Array();
$UserURL = $GLOBALS['adminURL'].'/users/user_list.php?env='.BuildEnv();
// pending users
$ret[] = Array( 'link' => "config_val('User_View', '4' ,'$UserURL')",
'icon_image' => $imagesURL.'/itemicons/icon16_user_pending.gif',
'phrase' => 'la_Text_Users', 'list_var_name' => 'objUsers' );
// pending categories
$ret[] = Array( 'link' => "PendingLink('category','Category_View',32)",
'icon_image' => $imagesURL.'/itemicons/icon16_cat_pending.gif',
'phrase' => 'la_tab_Categories', 'list_var_name' => 'objCatList');
return $ret;
break;
}
return false;
}
?>
Property changes on: trunk/kernel/admin/include/parser.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property
Index: trunk/kernel/admin/include/toolbar/advanced_view.php
===================================================================
--- trunk/kernel/admin/include/toolbar/advanced_view.php (nonexistent)
+++ trunk/kernel/admin/include/toolbar/advanced_view.php (revision 123)
@@ -0,0 +1,431 @@
+<?php
+global $objConfig,$objSections,$section, $rootURL,$adminURL, $admin, $imagesURL,$envar,
+ $m_var_list_update,$objCatList, $homeURL, $upURL, $objSession,$DefaultTab;
+
+global $CategoryFilter,$TotalItemCount;
+
+global $Bit_All,$Bit_Pending,$Bit_Disabled,$Bit_New,$Bit_Pop,$Bit_Hot,$Bit_Ed;
+
+//global $hideSelectAll;
+
+
+if(strlen($DefaultTab))
+{
+ $m_tab_Categories_hide = ($DefaultTab=="category") ? 0 : 1;
+}
+
+
+/* bit place holders for category view menu */
+$Bit_Active=64;
+$Bit_Pending=32;
+$Bit_Disabled=16;
+$Bit_New=8;
+$Bit_Pop=4;
+$Bit_Hot=2;
+$Bit_Ed=1;
+
+// category list filtering stuff: begin
+
+$CategoryView = $objConfig->Get("Category_View");
+if(!is_numeric($CategoryView))
+{
+ $CategoryView = 127;
+}
+
+$Category_Sortfield = $objConfig->Get("Category_Sortfield");
+if( !strlen($Category_Sortfield) ) $Category_Sortfield = "Name";
+
+$Category_Sortorder = $objConfig->Get("Category_Sortorder");
+if( !strlen($Category_Sortorder) ) $Category_Sortorder = "desc";
+
+$Perpage_Category = (int)$objConfig->Get("Perpage_Category");
+if(!$Perpage_Category)
+ $Perpage_Category="'all'";
+
+
+if($CategoryView == 127)
+{
+ $Category_ShowAll = 1;
+}
+else
+{
+ $Category_ShowAll = 0;
+ // FILTERING CODE V. 1.1
+ $where_clauses = Array();
+
+ //Group #1: Category Statuses (active,pending,disabled)
+ $Status = array(-1);
+ if($CategoryView & $Bit_Pending) $Status[] = STATUS_PENDING;
+ if($CategoryView & $Bit_Active) $Status[] = STATUS_ACTIVE;
+ if($CategoryView & $Bit_Disabled) $Status[] = STATUS_DISABLED;
+ if( count($Status) ) $where_clauses[] = 'Status IN ('.implode(',', $Status).')';
+
+ //Group #2: Category Statistics (new,pick)
+ $Status = array();
+ if(!($CategoryView & $Bit_New))
+ {
+ $cutoff = adodb_date("U") - ($objConfig->Get("Category_DaysNew") * 86400);
+ if($cutoff > 0) $q = 'CreatedOn > '.$cutoff;
+ $q .= (!empty($q) ? ' OR ' : '').'NewItem = 1';
+ $Status[] = "NOT ($q)";
+ }
+ if(!($CategoryView & $Bit_Ed)) $Status[] = 'NOT (EditorsPick = 1)';
+
+ if( count($Status) )
+ $where_clauses[] = '('.implode(') AND (', $Status).')';
+
+ $CategoryFilter = count($where_clauses) ? '('.implode(') AND (', $where_clauses).')' : '';
+}
+
+// category list filtering stuff: end
+
+ $OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE);
+ $objCatList->Clear();
+ $IsSearch = FALSE;
+
+ $list = $objSession->GetVariable("m_adv_view_search");
+ $SearchQuery = $objCatList->AdminSearchWhereClause($list);
+ if(strlen($SearchQuery))
+ {
+ $SearchQuery = " (".$SearchQuery.")".($CategoryFilter ? 'AND ('.$CategoryFilter.')' : '');
+ $objCatList->LoadCategories($SearchQuery,$OrderBy);
+ $IsSearch = TRUE;
+ }
+ else
+ $objCatList->LoadCategories($CategoryFilter,$OrderBy);
+
+ $TotalItemCount += $objCatList->QueryItemCount;
+
+
+$CatTotal = TableCount($objCatList->SourceTable,null,false);
+
+$mnuClearSearch = language("la_SearchMenu_Clear");
+$mnuNewSearch = language("la_SearchMenu_New");
+$mnuSearchCategory = language("la_SearchMenu_Categories");
+
+$lang_New = language("la_Text_New");
+$lang_Hot = language("la_Text_Hot");
+$lang_EdPick = language("la_prompt_EditorsPick");
+$lang_Pop = language("la_Text_Pop");
+
+$lang_Rating = language("la_prompt_Rating");
+$lang_Hits = language("la_prompt_Hits");
+$lang_Votes = language("la_prompt_Votes");
+$lang_Name = language("la_prompt_Name");
+
+$lang_Categories = language("la_ItemTab_Categories");
+$lang_Description = language("la_prompt_Description");
+$lang_MetaKeywords = language("la_prompt_MetaKeywords");
+$lang_SubSearch = language("la_prompt_SubSearch");
+$lang_Within = language("la_Text_Within");
+$lang_Current = language("la_Text_Current");
+$lang_Active = language("la_Text_Active");
+$lang_SubCats = language("la_Text_SubCats");
+$lang_SubItems = language("la_Text_Subitems");
+
+$ItemTabs->AddTab(language("la_ItemTab_Categories"),"category",$objCatList->QueryItemCount, $m_tab_Categories_hide, $CatTotal);
+
+print <<<END
+
+<script language="JavaScript">
+var default_tab = "$DefaultTab";
+var Category_Sortfield = '$Category_Sortfield';
+var Category_Sortorder = '$Category_Sortorder';
+var Category_Perpage = $Perpage_Category;
+var Category_ShowAll = $Category_ShowAll;
+var CategoryView = $CategoryView;
+
+//JS Language variables
+var lang_New = "$lang_New";
+var lang_Hot = "$lang_Hot";
+var lang_EdPick = "$lang_EdPick";
+
+var lang_Pop = "$lang_Pop";
+var lang_Rating = "$lang_Rating";
+var lang_Hits = "$lang_Hits";
+var lang_Votes = "$lang_Votes";
+var lang_Name = "$lang_Name";
+var lang_Categories = "$lang_Categories";
+var lang_Description = "$lang_Description";
+var lang_MetaKeywords = "$lang_MetaKeywords";
+var lang_SubSearch = "$lang_SubSearch";
+var lang_Within="$lang_Within";
+var lang_Current = "$lang_Current";
+var lang_Active = "$lang_Active";
+var lang_SubCats = "$lang_SubCats";
+var lang_SubItems = "$lang_SubItems";
+
+var hostname = '$rootURL';
+var env = '$envar';
+var actionlist = new Array();
+
+ // Common function for all "Advanced View" page
+ function InitPage()
+ {
+ addCommonActions();
+ initToolbar('mainToolBar', actionHandler);
+ initCheckBoxes(null, false);
+ toggleMenu();
+ }
+
+ function AddButtonAction(actionname,actionval)
+ {
+ var item = new Array(actionname,actionval);
+ actionlist[actionlist.length] = item;
+ }
+
+ function actionHandler(button)
+ {
+ for(i=0; i<actionlist.length;i++)
+ {
+ a = actionlist[i];
+ if(button.action == a[0])
+ {
+ eval(a[1]);
+ break;
+ }
+ }
+ }
+
+ function addCommonActions()
+ {
+ AddButtonAction('edit',"check_submit('','edit');"); //edit
+ AddButtonAction('delete',"check_submit('$admin/advanced_view','delete');"); //delete
+ AddButtonAction('approve',"check_submit('$admin/advanced_view','approve');"); //approve
+ AddButtonAction('decline',"check_submit('$admin/advanced_view','decline');"); //decline
+ AddButtonAction('print',"window.print();"); //print ?
+ AddButtonAction('view',"toggleMenu(); window.FW_showMenu(window.cat_menu,getRealLeft(button) - ((document.all) ? 6 : -2),getRealTop(button)+32);");
+ }
+
+ function check_submit(page,actionValue)
+ {
+
+ if (actionValue.match(/delete$/))
+ if (!theMainScript.Confirm(lang_DeleteConfirm)) return;
+
+ var formname = '';
+ var action_prefix ='';
+
+ if (activeTab)
+ {
+ form_name = activeTab.id;
+ action_prefix = activeTab.getAttribute("ActionPrefix");
+ if(page.length == 0) page = activeTab.getAttribute("EditURL");
+ }
+
+ var f = document.getElementsByName(form_name+'_form')[0];
+ if(f)
+ {
+ f.Action.value = action_prefix + actionValue;
+ f.action = '$rootURL' + page + '.php?'+ env;
+ f.submit();
+ }
+ }
+
+ function flip_current(field_suffix)
+ {
+ if(activeTab)
+ {
+ field = activeTab.getAttribute("tabTitle")+field_suffix;
+ return flip(eval(field));
+ }
+ }
+
+ function config_current(field_suffix,value)
+ {
+ if(activeTab)
+ {
+ field = activeTab.getAttribute("tabTitle")+field_suffix;
+ config_val(field,value);
+ }
+ }
+
+ function toggleMenu()
+ {
+ if (activeTab)
+ {
+ // module filtring menu
+ filterfunc = activeTab.getAttribute("tabTitle")+'_FilterMenu(cat_menu_filter);';
+ window.cat_menu_filter = new Menu(lang_View);
+ cat_menu_filter = eval(filterfunc);
+
+ // module sorting menu
+ sortfunc = activeTab.getAttribute("tabTitle")+'_SortMenu(cat_menu_sorting);';
+ window.cat_menu_sorting = new Menu(lang_Sort);
+ cat_menu_sorting = eval(sortfunc);
+
+ // module select menu
+ selectfunc = activeTab.getAttribute("tabTitle")+"_SelectMenu(cat_menu_select);";
+ window.cat_menu_select = new Menu(lang_Select);
+ cat_menu_select = eval(selectfunc);
+
+ // module per-page menu (in case if module selected)
+ pagefunc = activeTab.getAttribute("tabTitle")+"_PerPageMenu();";
+ window.PerPageMenu = eval(pagefunc);
+ }
+ window.cat_menu = new Menu("root");
+ if (activeTab)
+ {
+ // add root ViewMenu elements
+ window.cat_menu.addMenuItem(cat_menu_filter); // "View" menu
+ window.cat_menu.addMenuItem(cat_menu_sorting); // "Sort" menu
+ window.cat_menu.addMenuItem(PerPageMenu); // Module "Per-Page" menu
+ window.cat_menu.addMenuItem(cat_menu_select); // "Select" menu
+ }
+ window.triedToWriteMenus = false;
+ window.cat_menu.writeMenus();
+ }
+
+ function toggleTabB(tabId, atm)
+ {
+ var hl = document.getElementById("hidden_line");
+ var activeTabId;
+
+ if (activeTab) activeTabId = activeTab.id;
+
+
+ if (activeTabId != tabId)
+ {
+ if (activeTab)
+ {
+ //alert('switching to tab');
+ toggleTab(tabId, true)
+ }
+ else
+ {
+ //alert('opening tab');
+ toggleTab(tabId, atm)
+ }
+
+ if (hl) hl.style.display = "none";
+ }
+ tab_hdr = document.getElementById('tab_headers');
+ if (!tab_hdr) return;
+
+ // process all module tabs
+ var active_str = '';
+ for (var i = 0; i < tabIDs.length; i++)
+ {
+ var tabHeader;
+ TDs = tab_hdr.getElementsByTagName("TD");
+ // find tab
+ for (var j = 0; j < TDs.length; j++)
+ if (TDs[j].getAttribute("tabHeaderOf") == tabIDs[i])
+ {
+ tabHeader = TDs[j];
+ break;
+ }
+ if (!tabHeader) continue;
+
+ var tab = document.getElementById(tabIDs[i]);
+ if (!tab) continue;
+ active_str = (tab.active) ? "tab_active" : "tab_inactive";
+ if (TDs[j].getAttribute("tabHeaderOf") == tabId) {
+ // module tab is selected
+ SetBackground('l_' + tabId, "$imagesURL/itemtabs/" + active_str + "_l.gif");
+ SetBackground('m_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif");
+ SetBackground('m1_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif");
+ SetBackground('r_' + tabId, "$imagesURL/itemtabs/" + active_str + "_r.gif");
+ }
+ else
+ {
+ // module tab is not selected
+ SetBackground('l_' +tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_l.gif");
+ SetBackground('m_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + ".gif");
+ SetBackground('m1_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + ".gif");
+ SetBackground('r_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_r.gif");
+ }
+
+ var images = tabHeader.getElementsByTagName("IMG");
+ if (images.length < 1) continue;
+
+ images[0].src = "$imagesURL/itemtabs/" + ((tab.active) ? "divider_up" : "divider_empty") + ".gif";
+ }
+ }
+
+ function SetBackground(element_id, img_url)
+ {
+ // set background image of element specified by id
+ var el = document.getElementById(element_id);
+ el.style.backgroundImage = 'url('+img_url+')';
+ }
+
+ function initContextMenu()
+ {
+ window.contextMenu = new Menu("Context");
+ contextMenu.addMenuItem("Edit","check_submit('','edit');","");
+ contextMenu.addMenuItem("Delete","check_submit('admin/advanced_view','delete');","");
+ contextMenu.addMenuSeparator();
+ contextMenu.addMenuItem("Approve","check_submit('admin/advanced_view','approve');","");
+ contextMenu.addMenuItem("Decline","check_submit('admin/advanced_view','decline');","");
+
+ window.triedToWriteMenus = false;
+ window.contextMenu.writeMenus();
+ return true;
+ }
+
+
+ // only "Category" tab functions
+ function Categories_SortMenu(menu_sorting)
+ {
+ if(menu_sorting == null && typeof(menu_sorting) == 'undefined') menu_sorting = new Menu(lang_Categories);
+
+ menu_sorting.addMenuItem(lang_Asc,"config_val('Category_Sortorder','asc');",RadioIsSelected(Category_Sortorder,'asc'));
+ menu_sorting.addMenuItem(lang_Desc,"config_val('Category_Sortorder','desc');",RadioIsSelected(Category_Sortorder,'desc'));
+ menu_sorting.addMenuSeparator();
+
+ menu_sorting.addMenuItem(lang_Default,"config_val('Category_Sortfield','Name');","");
+ menu_sorting.addMenuItem(lang_Name,"config_val('Category_Sortfield','Name');",RadioIsSelected(Category_Sortfield,'Name'));
+ menu_sorting.addMenuItem(lang_Description,"config_val('Category_Sortfield','Description');",RadioIsSelected(Category_Sortfield,'Description'));
+
+ menu_sorting.addMenuItem(lang_CreatedOn,"config_val('Category_Sortfield','CreatedOn');",RadioIsSelected(Category_Sortfield,'CreatedOn'));
+ menu_sorting.addMenuItem(lang_SubCats,"config_val('Category_Sortfield','CachedDescendantCatsQty');",RadioIsSelected(Category_Sortfield,'CachedDescendantCatsQty'));
+ menu_sorting.addMenuItem(lang_SubItems,"config_val('Category_Sortfield','SubItems');",RadioIsSelected(Category_Sortfield,'SubItems'));
+
+ return menu_sorting;
+
+ }
+
+ function Categories_FilterMenu(menu_filter)
+ {
+ if(menu_filter == null && typeof(menu_filter) == 'undefined') menu_filter = new Menu(lang_Categories);
+ menu_filter.addMenuItem(lang_All,"config_val('Category_View', 127);",CategoryView==127);
+ menu_filter.addMenuSeparator();
+ menu_filter.addMenuItem(lang_Active,"FlipBit('Category_View',CategoryView,6);",BitStatus(CategoryView,6));
+ menu_filter.addMenuItem(lang_Pending,"FlipBit('Category_View',CategoryView,5);", BitStatus(CategoryView,5));
+ menu_filter.addMenuItem(lang_Disabled,"FlipBit('Category_View',CategoryView,4);",BitStatus(CategoryView,4));
+
+ menu_filter.addMenuSeparator();
+ menu_filter.addMenuItem(lang_New,"FlipBit('Category_View',CategoryView,3);",BitStatus(CategoryView,3));
+ menu_filter.addMenuItem(lang_EdPick,"FlipBit('Category_View',CategoryView,0);",BitStatus(CategoryView,0));
+
+ return menu_filter;
+ }
+
+ function Categories_SelectMenu(menu_select)
+ {
+ if(menu_select == null && typeof(menu_select) == 'undefined') menu_select = new Menu(lang_Categories);
+ menu_select.addMenuItem(lang_All,"javascript:selectAllC('"+activeTab.id+"');","");
+ menu_select.addMenuItem(lang_Unselect,"javascript:unselectAll('"+activeTab.id+"');","");
+ menu_select.addMenuItem(lang_Invert,"javascript:invert('"+activeTab.id+"');","");
+
+ return menu_select;
+ }
+
+ function Categories_PerPageMenu()
+ {
+ caption = lang_Categories +" "+lang_PerPage;
+
+ menu_results = new Menu(caption);
+ menu_results.addMenuItem("10","config_val('Perpage_Category', '10');",RadioIsSelected(Category_Perpage,10));
+ menu_results.addMenuItem("20","config_val('Perpage_Category', '20');",RadioIsSelected(Category_Perpage,20));
+ menu_results.addMenuItem("50","config_val('Perpage_Category', '50');",RadioIsSelected(Category_Perpage,50));
+ menu_results.addMenuItem("100","config_val('Perpage_Category', '100');",RadioIsSelected(Category_Perpage,100));
+ menu_results.addMenuItem("500","config_val('Perpage_Category', '500');",RadioIsSelected(Category_Perpage,500));
+ return menu_results;
+ }
+
+</script>
+
+END;
+?>
\ No newline at end of file
Property changes on: trunk/kernel/admin/include/toolbar/advanced_view.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/kernel/admin/advanced_view.php
===================================================================
--- trunk/kernel/admin/advanced_view.php (nonexistent)
+++ trunk/kernel/admin/advanced_view.php (revision 123)
@@ -0,0 +1,57 @@
+<?php
+##############################################################
+##In-portal ##
+##############################################################
+## In-portal ##
+## Intechnic Corporation ##
+## All Rights Reserved, 1998-2002 ##
+## ##
+## No portion of this code may be copied, reproduced or ##
+## otherwise redistributed without proper written ##
+## consent of Intechnic Corporation. Violation will ##
+## result in revocation of the license and support ##
+## privileges along maximum prosecution allowed by law. ##
+##############################################################
+
+global $rootURL, $imagesURL, $adminURL,$admin,$pathtoroot;
+
+$localURL = $rootURL."kernel/";
+$pathtolocal = $pathtoroot."kernel/";
+
+require_once ($pathtolocal."admin/include/navmenu.php");
+
+//Set Section
+$section = 'in-portal:advanced_view';
+
+//Set Environment Variable
+$envar = "env=" . BuildEnv();
+
+?>
+<!-- CATS -->
+
+<div id="category" class="ini_tab" isTab="true" tabTitle="Categories" ActionPrefix="m_cat_" EditURL="admin/category/addcategory">
+
+
+<table cellSpacing=0 cellPadding=2 width="100%" class="tabTable">
+ <tr>
+ <td align="left" width="70%">
+ <img height=15 src="<?php echo $imagesURL; ?>/arrow.gif" width=15 align=absMiddle border=0>
+ <b class=text><?php echo prompt_language("la_Page"); ?></b> <?php print $objCatList->GetAdminPageLinkList($_SERVER["PHP_SELF"]); ?>
+ </td>
+ <td align="right" width="30%">
+ <?php ShowSearchForm('m', $envar); ?>
+
+ </td>
+ </tr>
+</table><br>
+
+<form name=category_form action="" method=post>
+ <input type="hidden" name="Action">
+ <table cellSpacing=0 cellPadding=2 width="100%" border=0>
+ <tbody>
+ <?php print adListSubCats(0, 'cat_tab_element.tpl','m_adv_view_search'); ?>
+ </tbody>
+ </table>
+</form>
+</div>
+<!-- END CATS -->
\ No newline at end of file
Property changes on: trunk/kernel/admin/advanced_view.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/kernel/searchaction.php
===================================================================
--- trunk/kernel/searchaction.php (revision 122)
+++ trunk/kernel/searchaction.php (revision 123)
@@ -1,191 +1,200 @@
<?php
/* action handlers for listview searches */
//echo "in search action (global)<br>";
//print_pre($_REQUEST);
switch($Action)
{
case "m_SearchWord": /* browse and modify*/
$searchlist = trim($objSession->GetVariable("SearchWord"));
if($_POST["NewSearch"]==1)
$searchlist = "";
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["SearchWord"];
$objSession->SetVariable("SearchWord",$searchlist);
$objSession->SetVariable("SearchType",$_POST["SearchType"]);
$objSession->SetVariable("SearchScope",(int)$_POST["SearchScope"]);
break;
case "m_ClearSearch": /* browse and modify*/
$objSession->SetVariable("SearchWord","");
break;
case "m_user_search": /* user list */
$searchlist = trim($objSession->GetVariable("UserSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("UserSearchWord",$searchlist);
$objSession->SetVariable("Page_Userlist",1);
break;
case "m_user_search_reset": /*user list */
$objSession->SetVariable("UserSearchWord","");
$objSession->SetVariable("Page_Userlist",1);
break;
case "m_summary_search": /* summary list */
$searchlist = trim($objSession->GetVariable("UserSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("SummarySearchWord",$searchlist);
$objSession->SetVariable("Page_Summary",1);
break;
case "m_summary_search_reset": /* summary list */
$objSession->SetVariable("SummarySearchWord","");
$objSession->SetVariable("Page_Summary",1);
break;
case "m_userselect_search": /* popup user list */
$searchlist = trim($objSession->GetVariable("UserSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("UserSelectSearchWord",$searchlist);
$objSession->SetVariable("Page_UserSelect",1);
break;
case "m_userselect_search_reset": /* popup user list */
$objSession->SetVariable("UserSelectSearchWord","");
$objSession->SetVariable("Page_UserSelect",1);
break;
case "m_group_search": /* group list */
$searchlist = trim($objSession->GetVariable("GroupSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("GroupSearchWord",$searchlist);
$objSession->SetVariable("Page_Grouplist",1);
break;
case "m_group_search_reset": /*group list */
$objSession->SetVariable("GroupSearchWord","");
break;
case "m_rel_search": /* category relations list */
$searchlist = trim($objSession->GetVariable("CatRelSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("CatRelSearchWord",$searchlist);
$objSession->SetVariable("Page_Relations",1);
break;
case "m_rel_search_reset": /* category relations list */
$objSession->SetVariable("CatRelSearchWord","");
break;
case "m_group_search": /* group list */
$searchlist = trim($objSession->GetVariable("GroupSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("GroupSearchWord",$searchlist);
$objSession->SetVariable("Page_Grouplist",1);
break;
case "m_group_search_reset": /*group list */
$objSession->SetVariable("GroupSearchWord","");
break;
case "m_phrase_search": /* category relations list */
$searchlist = trim($objSession->GetVariable("PhraseSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("PhraseSearchWord",$searchlist);
$objSession->SetVariable("Page_Phrase",1);
break;
case "m_phrase_search_reset": /* category relations list */
$objSession->SetVariable("PhraseSearchWord","");
$objSession->SetVariable("Page_Phrase",1);
break;
case "m_template_file_search": /* theme template file list */
$searchlist = trim($objSession->GetVariable("TemplateSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("TemplateSearchWord",$searchlist);
$objSession->SetVariable("Page_Template",1);
break;
case "m_template_file_search_reset": /* theme template file list */
$objSession->SetVariable("TemplateSearchWord","");
$objSession->SetVariable("Page_Template",1);
break;
case "m_lang_search": /* language package list */
$searchlist = trim($objSession->GetVariable("LangSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("LangSearchWord",$searchlist);
$objSession->SetVariable("Page_LV_Lang",1);
break;
case "m_lang_search_reset": /* language package list */
$objSession->SetVariable("LangSearchWord","");
$objSession->SetVariable("Page_LV_Lang",1);
break;
case "m_emailevent_search": /* Email event list */
$searchlist = trim($objSession->GetVariable("EmailEventSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("EmailEventSearchWord",$searchlist);
$objSession->SetVariable("Page_Email",1);
break;
case "m_emailevent_search_reset":
$objSession->SetVariable("EmailEventSearchWord","");
$objSession->SetVariable("Page_Email",1);
break;
case "m_langemailevent_search": /* Email event list */
$searchlist = trim($objSession->GetVariable("LangEmailEventSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("LangEmailEventSearchWord",$searchlist);
$objSession->SetVariable("Page_LangEmail",1);
break;
case "m_langemailevent_search_reset":
$objSession->SetVariable("LangEmailEventSearchWord","");
$objSession->SetVariable("Page_LangEmail",1);
break;
case "m_rule_search": /* Email event list */
$searchlist = trim($objSession->GetVariable("RuleSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("RuleSearchWord",$searchlist);
$objSession->SetVariable("Page_BanRules",1);
break;
case "m_rule_search_reset":
$objSession->SetVariable("RuleSearchWord","");
$objSession->SetVariable("Page_BanRules",1);
break;
// Theme List Search
case 'm_theme_search':
echo "in search action (themes)<br>";
$searchlist = trim( $objSession->GetVariable("ThemeSearchWord") );
if(strlen($searchlist) > 0) $searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("ThemeSearchWord",$searchlist);
$objSession->SetVariable("Page_LV_Themes",1);
break;
case 'm_theme_search_reset':
$objSession->SetVariable("ThemeSearchWord","");
$objSession->SetVariable("Page_LV_Themes",1);
break;
+
+ // Advanced View Search Actions
+ case 'm_adv_view_search':
+ SaveAdvView_SearchWord('m');
+ break;
+
+ case 'm_adv_view_search_reset':
+ ResetAdvView_SearchWord('m');
+ break;
}
?>
Property changes on: trunk/kernel/searchaction.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property
Index: trunk/admin/browse.php
===================================================================
--- trunk/admin/browse.php (revision 122)
+++ trunk/admin/browse.php (revision 123)
@@ -1,465 +1,467 @@
<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
//$pathtoroot="";
$b_topmargin = "0";
//$b_header_addon = "<DIV style='position:relative; z-Index: 1; background-color: #ffffff; padding-top:1px;'><div style='position:absolute; width:100%;top:0px;' align='right'><img src='images/logo_bg.gif'></div><img src='images/spacer.gif' width=1 height=15><br><div style='z-Index:1; position:relative'>";
if(!strlen($pathtoroot))
{
$path=dirname(realpath($_SERVER['SCRIPT_FILENAME']));
if(strlen($path))
{
/* determine the OS type for path parsing */
$pos = strpos($path,":");
if ($pos === false)
{
$gOS_TYPE="unix";
$pathchar = "/";
}
else
{
$gOS_TYPE="win";
$pathchar="\\";
}
$p = $path.$pathchar;
/*Start looking for the root flag file */
while(!strlen($pathtoroot) && strlen($p))
{
$sub = substr($p,strlen($pathchar)*-1);
if($sub==$pathchar)
{
$filename = $p."root.flg";
}
else
$filename = $p.$pathchar."root.flg";
if(file_exists($filename))
{
$pathtoroot = $p;
}
else
{
$parent = realpath($p.$pathchar."..".$pathchar);
if($parent!=$p)
{
$p = $parent;
}
else
$p = "";
}
}
if(!strlen($pathtoroot))
$pathtoroot = ".".$pathchar;
}
else
{
$pathtoroot = ".".$pathchar;
}
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
//echo $pathtoroot;
require_once($pathtoroot."kernel/startup.php");
if (!admin_login())
{
if(!headers_sent())
setcookie("sid"," ",time()-3600);
$objSession->Logout();
header("Location: ".$adminURL."/login.php");
die();
//require_once($pathtoroot."admin/login.php");
}
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
$browseURL = $adminURL."/browse";
$cssURL = $adminURL."/include";
$indexURL = $rootURL."index.php";
$m_var_list_update["cat"] = 0;
$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');";
unset($m_var_list_update["cat"]);
$envar = "env=" . BuildEnv();
if($objCatList->CurrentCategoryID()>0)
{
$c = $objCatList->CurrentCat();
$upURL = "javascript:AdminCatNav('".$c->Admin_Parent_Link()."');";
}
else
$upURL = $_SERVER["PHP_SELF"]."?".$envar;
//admin only util
$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
//require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/browse/toolbar.php");
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value."admin/include/parser.php";
if(file_exists($path))
{
//echo "<!-- $path -->";
@include_once($path);
}
}
if(!$is_install)
{
if (!admin_login())
{
if(!headers_sent())
setcookie("sid"," ",time()-3600);
$objSession->Logout();
header("Location: ".$adminURL."/login.php");
die();
//require_once($pathtoroot."admin/login.php");
}
}
//Set Section
$section = 'in-portal:browse';
//Set Environment Variable
//echo $objCatList->ItemsOnClipboard()." Categories on the clipboard<br>\n";
//echo $objTopicList->ItemsOnClipboard()." Topics on the clipboard<br>\n";
//echo $objLinkList->ItemsOnClipboard()." Links on the clipboard<br>\n";
//echo $objArticleList->ItemsOnClipboard()." Articles on the clipboard<br>\n";
// save last category visited
$objSession->SetVariable('prev_category', $objSession->GetVariable('last_category') );
$objSession->SetVariable('last_category', $objCatList->CurrentCategoryID() );
/* // for testing
$last_cat = $objSession->GetVariable('last_category');
$prev_cat = $objSession->GetVariable('prev_category');
echo "Last CAT: [$last_cat]<br>";
echo "Prev CAT: [$prev_cat]<br>";
*/
$SearchType = $objSession->GetVariable("SearchType");
if(!strlen($SearchType))
$SearchType = "all";
$SearchLabel = "la_SearchLabel";
if( GetVar('SearchWord') !== false ) $objSession->SetVariable('admin_seach_words', GetVar('SearchWord') );
$SearchWord = $objSession->GetVariable('admin_seach_words');
$objSession->SetVariable("HasChanges", 0);
+// where should all edit popups submit changes
+$objSession->SetVariable("ReturnScript", basename($_SERVER['PHP_SELF']) );
/* page header */
print <<<END
<html>
<head>
<title>In-portal</title>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
</script>
END;
require_once($pathtoroot.$admin."/include/mainscript.php");
print <<<END
<script type="text/javascript">
if (window.opener != null) {
theMainScript.CloseAndRefreshParent();
}
</script>
END;
print <<<END
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/checkboxes_new.js"></script>
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
END;
load_module_styles();
if( !isset($list) ) $list = '';
if(($SearchType=="categories" || $SearchType="all") && strlen($list))
{
int_SectionHeader(NULL,NULL,NULL,admin_language("la_Title_SearchResults"));
}
else
int_SectionHeader();
if($objSession->GetVariable("SearchWord") != '') {
$filter = true;
}
else {
$sessVars = $objConfig->GetSessionValues(0);
//print_pre($sessVars);
foreach ($sessVars as $key => $value) {
if (strstr($key, '_View')) {
//echo "$value<br>";
if ($value != 1) {
$filter = true;
}
}
}
}
?>
</div>
<!-- alex mark -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<div name="toolBar" id="mainToolBar">
<tb:button action="upcat" alt="<?php echo admin_language("la_ToolTip_Up"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="homecat" alt="<?php echo admin_language("la_ToolTip_Home"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="new_cat" alt="<?php echo admin_language("la_ToolTip_New_Category"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="editcat" alt="<?php echo admin_language("la_ToolTip_Edit_Current_Category"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<?php
foreach($NewButtons as $btn)
{
print "<tb:button action=\"".$btn["Action"]."\" alt=\"".$btn["Alt"]."\" ImagePath=\"".$btn["ImagePath"]."\" ";
if(strlen($btn["Tab"])>0)
print "tab=\"".$btn["Tab"]."\"";
print ">\n";
}
?>
<tb:button action="edit" alt="<?php echo admin_language("la_ToolTip_Edit"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="delete" alt="<?php echo admin_language("la_ToolTip_Delete"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="approve" alt="<?php echo admin_language("la_ToolTip_Approve"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="decline" alt="<?php echo admin_language("la_ToolTip_Decline"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="cut" alt="<?php echo admin_language("la_ToolTip_Cut"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="copy" alt="<?php echo admin_language("la_ToolTip_Copy"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="paste" alt="<?php echo admin_language("la_ToolTip_Paste"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="move_up" alt="<?php echo admin_language("la_ToolTip_Move_Up"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="move_down" alt="<?php echo admin_language("la_ToolTip_Move_Down"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="print" alt="<?php echo admin_language("la_ToolTip_Print"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="view" alt="<?php echo admin_language("la_ToolTip_View"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
</div>
</td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" width="100%" bgcolor="#e0e0da" border="0" class="tableborder_full_a">
<tbody>
<tr>
<td><img height="15" src="<?php echo $imagesURL; ?>/arrow.gif" width="15" align="middle" border="0">
<span class="navbar"><?php $attribs["admin"]=1; print m_navbar($attribs); ?></span>
</td>
<td align="right">
<FORM METHOD="POST" ACTION="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>" NAME="admin_search" ID="admin_search"><INPUT ID="SearchScope" NAME="SearchScope" type="hidden" VALUE="<?php echo $objSession->GetVariable("SearchScope"); ?>"><INPUT ID="SearchType" NAME="SearchType" TYPE="hidden" VALUE="<?php echo $objSession->GetVariable("SearchType"); ?>"><INPUT ID="NewSearch" NAME="NewSearch" TYPE="hidden" VALUE="0"><INPUT TYPE="HIDDEN" NAME="Action" value="m_Exec_Search">
<table cellspacing="0" cellpadding="0"><tr>
<td><?php echo admin_language($SearchLabel); ?>&nbsp;</td>
<td><input ID="SearchWord" type="text" value="<?php echo $SearchWord; ?>" name="SearchWord" size="10" style="border-width: 1; border-style: solid; border-color: 999999"></td>
<td><img id="imgSearch" action="search_b" src="<?php echo $imagesURL."/toolbar/";?>/icon16_search.gif" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" src="<?php echo $imagesURL."/toolbar/";?>/arrow16.gif" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search.gif'" style="cursor:hand" width="22" width="22"><img action="search_a" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" src="<?php echo $imagesURL."/toolbar/";?>/arrow16.gif" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16.gif'" style="cursor:hand">
<img action="search_c" src="<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="document.all.SearchWord.value = ''; this.action = this.getAttribute('action'); actionHandler(this);" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif'" style="cursor:hand" width="22" width="22">&nbsp;
</td>
</tr></table>
</FORM>
<!--tb:button action="search_b" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="right" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="search_a" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="right" ImagePath="<?php echo $imagesURL."/toolbar/";?>"-->
</td>
</tr>
</tbody>
</table>
<?php if ($filter) { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Filter")); ?>
</td>
</tr>
</table>
<?php } ?>
<br>
<!-- CATEGORY DIVIDER -->
<?php
$OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE);
$objCatList->Clear();
$IsSearch = FALSE;
if($SearchType == 'categories' || $SearchType == 'all')
{
$list = $objSession->GetVariable("SearchWord");
$SearchQuery = $objCatList->AdminSearchWhereClause($list);
if(strlen($SearchQuery))
{
$SearchQuery = " (".$SearchQuery.") ";
if( strlen($CatScopeClause) ) $SearchQuery .= " AND ".$CatScopeClause;
$objCatList->LoadCategories($SearchQuery.$CategoryFilter,$OrderBy);
$IsSearch = TRUE;
}
else
$objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter,$OrderBy);
}
else
$objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter, $OrderBy);
$TotalItemCount += $objCatList->QueryItemCount;
?>
<?php
$e = $Errors->GetAdminUserErrors();
if(count($e)>0)
{
echo "<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" border=\"0\">";
for($ex = 0; $ex<count($e);$ex++)
{
echo "<tr><td width=\100%\" class=\"error\">".prompt_language($e[$ex])."</td></tr>";
}
echo "</TABLE><br>";
}
?>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td width="138" height="20" nowrap="nowrap" class="active_tab" onclick="toggleCategoriesB(this)" id="cats_tab">
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td id="l_cat" background="<?php echo $imagesURL; ?>/itemtabs/tab_active_l.gif" class="left_tab">
<img src="<?php echo $imagesURL; ?>/itemtabs/divider_up.gif" width="20" height="20" border="0" align="absmiddle">
</td>
<td id="m_cat" nowrap background="<?php echo $imagesURL; ?>/itemtabs/tab_active.gif" class="tab_class">
<?php echo admin_language("la_ItemTab_Categories"); ?>:&nbsp;
</td>
<td id="m1_cat" align="right" valign="top" background="<?php echo $imagesURL; ?>/itemtabs/tab_active.gif" class="tab_class">
<span class="cats_stats">(<?php echo $objCatList->QueryItemCount; ?>)</span>&nbsp;
</td>
<td id="r_cat" background="<?php echo $imagesURL; ?>/itemtabs/tab_active_r.gif" class="right_tab">
<img src="<?php echo $imagesURL; ?>/spacer.gif" width="21" height="20">
</td>
</tr>
</table>
</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<div class="divider" style="" id="categoriesDevider"><img width="1" height="1" src="<?php echo $imagesURL; ?>/spacer.gif"></div>
</DIV>
</div>
<DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index:0" id="firstContainer">
<DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index:2" id="secondContainer">
<!-- CATEGORY OUTPUT START -->
<div id="categories" tabtitle="Categories">
<form id="categories_form" name="categories_form" action="" method="post">
<input type="hidden" name="Action">
<?php
if($IsSearch)
{
$template = "cat_search_element.tpl";
}
else {
$template = "cat_element.tpl";
}
print adListSubCats($objCatList->CurrentCategoryID(),$template);
?>
</form>
</div>
<BR>
<!-- CATEGORY OUTPUT END -->
<?php
print $ItemTabs->TabRow();
if(count($ItemTabs->Tabs))
{
?>
<div class="divider" id="tabsDevider"><img width=1 height=1 src="images/spacer.gif"></div>
<?php
}
?>
</DIV>
<?php
unset($m);
$m = GetModuleArray("admin");
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value."admin/browse.php";
if(file_exists($path))
{
//echo "\n<!-- $path -->\n";
include_once($path);
}
}
?>
<form method="post" action="browse.php?env=<?php echo BuildEnv(); ?>" name="viewmenu">
<input type="hidden" name="fieldname" value="">
<input type="hidden" name="varvalue" value="">
<input type="hidden" name="varvalue2" value="">
<input type="hidden" name="Action" value="">
</form>
</DIV>
<!-- END CODE-->
<script language="JavaScript">
InitPage();
cats_on = theMainScript.GetCookie('cats_tab_on');
if (cats_on == 0) {
toggleCategoriesB(document.getElementById('cats_tab'), true);
}
tabs_on = theMainScript.GetCookie('tabs_on');
if (tabs_on == '1' || tabs_on == null) {
if(default_tab.length == 0 || default_tab == 'categories' )
{
cookie_start = theMainScript.GetCookie('active_tab');
if (cookie_start != null) start_tab = cookie_start;
if(start_tab!=null) {
//alert('ok');
toggleTabB(start_tab, true);
}
}
else
{
//alert('ok');
toggleTabB(default_tab,true);
}
}
d = document.getElementById('SearchWord');
if(d)
{
d.onkeyup = function(event) {
if(window.event.keyCode==13)
{
var el = document.getElementById('imgSearch');
el.onclick();
}
}
}
</script>
<?php int_footer(); ?>
Property changes on: trunk/admin/browse.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/admin/tree/tree.php
===================================================================
--- trunk/admin/tree/tree.php (revision 122)
+++ trunk/admin/tree/tree.php (revision 123)
@@ -1,175 +1,175 @@
<?php
if(!strlen($pathtoroot))
{
$path=dirname(realpath($_SERVER['SCRIPT_FILENAME']));
if(strlen($path))
{
/* determine the OS type for path parsing */
$pos = strpos($path,":");
if ($pos === false)
{
$gOS_TYPE="unix";
$pathchar = "/";
}
else
{
$gOS_TYPE="win";
$pathchar="\\";
}
$p = $path.$pathchar;
/*Start looking for the root flag file */
while(!strlen($pathtoroot) && strlen($p))
{
$sub = substr($p,strlen($pathchar)*-1);
if($sub==$pathchar)
{
$filename = $p."root.flg";
}
else
$filename = $p.$pathchar."root.flg";
if(file_exists($filename))
{
$pathtoroot = $p;
}
else
{
$parent = realpath($p.$pathchar."..".$pathchar);
if($parent!=$p)
{
$p = $parent;
}
else
$p = "";
}
}
if(!strlen($pathtoroot))
$pathtoroot = ".".$pathchar;
}
else
{
$pathtoroot = ".".$pathchar;
}
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
require_once($pathtoroot."kernel/startup.php");
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
$pathtolocal = $pathtoroot;
$envar = "env=" . BuildEnv();
//include section data; create Section hash
//main In-portal sections
//require_once ($pathtoroot."admin/include/navmenu.php");
//All modules
/*if(!isset($SysData))
$SysData=new SystemConfiguration();
$ModuleList=$SysData->GetModuleList();*/
//$sections = array();
//foreach($mod_prefix as $key => $value)
//{
// $mod = $pathtoroot . $value . "admin/include/navmenu.php";
// include_once($mod);
//}
include_once($pathtoroot.$admin."/include/sections.php");
$ServerName = $objConfig->Get("Site_Name");
$rootLink = $adminURL."/subitems.php?env=".BuildEnv()."&section=in-portal:root";
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="<?php echo $adminURL."/include/style.css"; ?>">
<script src="ua.js"></script>
<script src="ftiens4.js"></script>
<script language="javascript">
// Decide if the names are links or just the icons
USETEXTLINKS = 1 //replace 0 with 1 for hyperlinks
// Decide if the tree is to start all open or just showing the root folders
STARTALLOPEN = 0 //replace 0 with 1 to show the whole tree
var foldersTree = gFld('In-Portal','<?php echo $rootLink; ?>');
foldersTree.desc = '<?php echo $ServerName; ?>';
foldersTree.iconSrc='<?php echo $adminURL."/icons/icon24_site.gif"; ?>';
function credits(url)
{
var width = 200;
var height = 200;
var screen_x = (screen.availWidth-width)/2;
var screen_y = (screen.availHeight-height)/2;
window.open(url, 'credits', 'width=280,height=520,left='+screen_x+',top='+screen_y);
}
<?php
$objSections->BuildTree('in-portal:site', 'foldersTree');
$title = "In-Portal v ".$kernel_version."&nbsp;&nbsp;";
?>
</script>
</head>
<body topmargin="0" marginheight="0" marginwidth="0" marginheight="0" bgcolor="#DCEBF6">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<!--<tr><td colspan="2" bgcolor="black"><img alt="" width="1" height="1" src="images/spacer.gif"></td></tr>-->
<tr>
<td background="../images/menu_bar.gif" align="left" class="tree_head" width="80%"> <!-- 60000 -->
&nbsp;<a class="tree_head_credits" href="javascript:credits('<?php echo $rootURL.$admin."/help/credits.php?env=".BuildEnv();?>&destform=popup');"><?php echo $title; ?></a>
</td>
<td background="../images/menu_bar.gif" align="right" class="tree_head" width="20%"> <!-- 40000 -->
<FORM style="display:inline" name="lang_select" method="POST" action="<?php echo $rootURL.$admin."/index.php?env=".BuildEnv(); ?>" TARGET="main_frame">
- <SELECT NAME="langselect" style="width: 62px; border: 0px; background: none; font-size: 9px; color: black" onchange="document.lang_select.submit()">
+ <SELECT NAME="langselect" style="width: 62px; border: 0px; background-color: #FFFFFF; font-size: 9px; color: black" onchange="document.lang_select.submit()">
<!-- width: 52px; font-size: 8.5px; -->
<?php
$objLanguages->Query_Item("SELECT * FROM ".$objLanguages->SourceTable." WHERE Enabled=1");
foreach($objLanguages->Items as $l)
{
$selected = "";
if($l->Get("LanguageId")==$m_var_list["lang"])
$selected = " SELECTED";
- echo "<OPTION onclick=\"this.form.submit();\" STYLE=\"background:none;\" value=\"".$l->Get("LanguageId")."\" $selected>".$l->Get("LocalName")."</OPTION>\n";
+ echo "<OPTION onclick=\"this.form.submit();\" value=\"".$l->Get("LanguageId")."\" $selected>".$l->Get("LocalName")."</OPTION>\n";
}
?>
</SELECT>
<input type=hidden name="Action" value="m_lang_select">
</FORM>
</td>
<td background="../images/menu_bar.gif"><img alt="" height="21" width="1" src="../images/spacer.gif"></td>
</tr>
</table>
<table cellpadding="5" cellspacing="0" border="0">
<tr>
<td>
<script>
initializeDocument();
</script>
</td>
</tr>
</table>
</body>
</html>
Property changes on: trunk/admin/tree/tree.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3
\ No newline at end of property
+1.4
\ No newline at end of property
Index: trunk/admin/browse/checkboxes_new.js
===================================================================
--- trunk/admin/browse/checkboxes_new.js (revision 122)
+++ trunk/admin/browse/checkboxes_new.js (revision 123)
@@ -1,671 +1,669 @@
var animationTimeout = 500;//ms
var focusType = "";
var tabIDs = new Array();
var tabSelection = new Array();
var LastCheckedItem = null;
var enableContextMenus= true;
var doubleClickAction = "edit";
var CurrentTab = new String("");
var PasteButton = false;
var start_tab = null;
var selcount = 0;
var _single_select = false;
-function initCheckBoxes(selChangedHandler)
+function initCheckBoxes(selChangedHandler, use_cats)
{
- //theMainScript.InitGrids();
- //return;
+ if(use_cats == null && typeof(use_cats) == 'undefined') use_cats = true;
//set single_select to true to turn on radio-buttons select mode
if (typeof(single_select) != 'undefined') _single_select = single_select;
- var checkBoxContainers = document.body.getElementsByTagName("DIV");
- for (var i = 0; i < checkBoxContainers.length; i++)
- if (checkBoxContainers[i].getAttribute("isTab"))
- {
- if(tabIDs.length ==0)
- start_tab = checkBoxContainers[i].id;
-
- tabIDs[tabIDs.length] = checkBoxContainers[i].id
-
- tabSelection[checkBoxContainers[i].id] = 0;
- }
-
- tabSelection['categories'] = 0;
+ var checkBoxContainers = document.body.getElementsByTagName("DIV");
+ for (var i = 0; i < checkBoxContainers.length; i++)
+ if( checkBoxContainers[i].getAttribute("isTab") )
+ {
+ if(tabIDs.length == 0) start_tab = checkBoxContainers[i].id;
+ tabIDs[tabIDs.length] = checkBoxContainers[i].id
+ tabSelection[checkBoxContainers[i].id] = 0;
+ }
- categoriesTab = document.getElementById('categories');
- var catInputs = categoriesTab.getElementsByTagName("INPUT");
- for (var i = 0; i < catInputs.length; i++)
- catInputs.checked = false;
- if (categoriesTab)
- categoriesTab.active = true;
-
+ tabSelection['categories'] = 0;
+
+ if(use_cats == true)
+ {
+ categoriesTab = document.getElementById('categories');
+ var catInputs = categoriesTab.getElementsByTagName("INPUT");
+ for (var i = 0; i < catInputs.length; i++) catInputs.checked = false;
+ if (categoriesTab) categoriesTab.active = true;
+ }
+
var unique_id = 1;
for (var i = 0; i < checkBoxContainers.length; i++) {
+
if (checkBoxContainers[i].getAttribute("inportalType"))
{
var inputs = checkBoxContainers[i].getElementsByTagName("INPUT");
var checkBox;
for (var j = 0; j < inputs.length; j++)
if (inputs[j].type == "checkbox")
{
checkBox = inputs[j];
if (_single_select) {
if (document.all) {
unique_id++;
checkBox.outerHTML = '<INPUT ID="swapped_to_radio_'+unique_id+'" TYPE="radio" NAME="'+checkBox.name+'" VALUE="'+checkBox.value+'" ItemType="'+checkBox.ItemType+'" inportalType="'+checkBoxContainers[i].getAttribute("inportalType")+'">';
checkBox = document.getElementById('swapped_to_radio_'+unique_id);
}
else {
radio = document.createElement('input');
radio.type = 'radio';
radio.name = checkBox.name;
radio.value = checkBox.value;
radio.checked = true;
radio.ItemType = checkBox.getAttribute('ItemType');
checkBox.parentNode.replaceChild(radio, checkBox);
checkBox = radio;
}
}
break;
}
checkBox.inportalType = checkBoxContainers[i].getAttribute("inportalType");
checkBox.onclick = checkBoxClick;
checkBox.container = checkBoxContainers[i];
- var selNode = (checkBox.container.getAttribute("inportalType") == "categories") ? checkBox.container.parentNode : checkBox.container.parentNode.parentNode;
+ var selNode = (checkBox.container.getAttribute("inportalType") == "categories" || checkBox.container.getAttribute("inportalType") == "category") ? checkBox.container.parentNode : checkBox.container.parentNode.parentNode;
selNode.chB = checkBox;
document.body.onclick = function(e)
{
//alert('body click');
var srcElement = (document.all) ? event.srcElement : e.target;
if (!srcElement) return;
if (srcElement.onclick || srcElement.onmousedown || srcElement.onmouseup) return;
if (selcount == 0) {
unselectAll('categories')
if (activeTab) unselectAll(activeTab.id)
}
else {
selcount = 0;
}
}
if(enableContextMenus==true)
{
selNode.oncontextmenu = function(e)
{
// alert('menu');
// unselectAll('categories')
// if (activeTab) unselectAll(activeTab.id)
if (!this.chB.checked)
{
unselectAll('categories')
if (activeTab) unselectAll(activeTab.id)
this.chB.checked = true;
this.chB.onclick();
}
var evt = (!document.all) ? e : event; if (evt)
{
evt.cancelBubble = true;
evt.returnValue = false;
}
showContextMenu(evt);
return false;
}
}
selNode.style.cursor = 'default';
// document.onselectstart = function(){return false;}
selNode.ondblclick = function(e)
{
unselectAll('categories')
if (activeTab) unselectAll(activeTab.id)
this.chB.checked = (!this.chB.checked);
this.chB.onclick();
this.action = doubleClickAction;
actionHandler(this);
var evt = (!document.all) ? e : event; if (evt)
{
evt.cancelBubble = true;
evt.returnValue = false;
return false;
}
}
selNode.onclick = function(e)
{
//alert('onclick of selNode');
var evt = (!document.all) ? e : event;
if (!evt) return;
if (evt)
{
evt.cancelBubble = true;
// evt.returnValue = false;
}
// alert('d')
if (_single_select || (!evt.ctrlKey && !evt.shiftKey))
{
//alert('unselectAll');
unselectAll('categories')
if (activeTab) unselectAll(activeTab.id)
if (this.chB.checked == true) return
//alert('setting '+this.chB.name+' '+this.chB.value+' checked = true');
this.chB.checked = true;
//alert('calling onclick');
this.chB.onclick();
return;
}
if (document.all) document.selection.empty()
else
{
var selection = window.getSelection();
}
if (evt.shiftKey)
{
var container = (this.chB.inportalType == "categories") ? document.getElementById("categories") : activeTab;
var inputs = container.getElementsByTagName("INPUT");
var checkboxes = new Array();
for (var i = 0; i < inputs.length; i++)
if ((inputs[i].type == "checkbox" || inputs[i].type == "radio") && inputs[i].container) checkboxes[checkboxes.length] = inputs[i];
var cIndex; var maxIndex = 0; maxLcp = 0;
for (var i = 0; i < checkboxes.length; i++)
{
if (checkboxes[i] == this.chB) cIndex = i;
if (checkboxes[i].lcp > maxLcp)
{
maxIndex = i;
maxLcp = checkboxes[i].lcp;
}
// checkboxes[i].onclick();
}
checkboxes[maxIndex].onclick();
for (var i = 0; i < checkboxes.length; i++)
selectContainer(checkboxes[i], (i <= cIndex && i >= maxIndex && maxIndex <= cIndex || i >= cIndex && i <= maxIndex && maxIndex > cIndex) )
//selectContainer(checkBox, value, doNotFireSelectionEvent)
return;
}
// alert(evt.srcElement)
this.chB.checked = (!this.chB.checked);
this.chB.onclick();
return false;
}
checkBox.checked = false;
// checkBoxContainers[i].className = (checkBox.checked) ? "selectedContainer" : "unselectedContainer";
selectContainer(checkBox, checkBox.checked, true)
if (checkBox.checked)
tabSelection[checkBox.inportalType]++;
}
}
tabChanged();
selectionChanged();
initTabsForAnimation();
}
function clear_checkboxes(){
//alert('clear checkboxes');
var inputs = document.body.getElementsByTagName("INPUT");
for (var j = 0; j < inputs.length; j++)
if ((inputs[j].type == "checkbox") && (inputs[j].inportalType))
{
inputs[j].checked = false;
}
}
var lcp = 1;
function checkBoxClick(e)
{
//alert('click '+this.checked + ' inptype: ' + this.inportalType);
this.lcp = lcp++;
if (_single_select) {
ch = this.checked;
this.checked = false;
unselectAll('categories')
if (activeTab) unselectAll(activeTab.id)
this.checked = ch;
}
if (this.inportalType == "categories")
{
if (activeTab) unselectAll(activeTab.id)
}
else unselectAll("categories");
selectContainer(this, this.checked);
if (this.checked)
{
tabSelection[this.inportalType]++
LastCheckedItem = this;
}
else
{
tabSelection[this.inportalType]--;
LastCheckedItem = null;
}
updateStatus();
var evt = (typeof(document.all) == 'undefined') ? e : event;
if (!evt) return;
evt.cancelBubble = true;
// evt.returnValue = false;
return;
}
function toggleTab(tabId, atm)
{
var tab = document.getElementById(tabId);
if (!tab) return;
for (var i = 0; i < tabIDs.length; i++)
{
if (tabIDs[i] != tabId)
{
inactiveTab = document.getElementById(tabIDs[i]);
if(inactiveTab.getAttribute("isTab"))
{
unselectAll(tabIDs[i]);
if (inactiveTab.style.display != "none")
{
inactiveTab.style.top = inactiveTab.pTop - inactiveTab.oHeight;
inactiveTab.pY = -inactiveTab.oHeight;
}
inactiveTab.style.display = "none";
inactiveTab.active = false;
}
}
}
tab.style.display = "";
tab.active = true;
if(toolbar) toolbar.setTab(tabId);
activeTab = tab;
tabChanged();
showTab(atm);
CurrentTab = activeTab.tabTitle;
}
var collapseTab;
function showTab(atm)
{
var container = (activeTab) ? activeTab : collapseTab;
if (!container) return;
var scrollJumpA = scrollJump;
if (!container.startTime)
{
container.startTime = new Date();
}
else
{
var cDate = new Date();
if (cDate - container.startTime >= animationTimeout) scrollJumpA = container.oHeight;
}
var sj = (atm) ? container.oHeight :scrollJumpA;
container.pY += (container.active) ? sj : -sj;
if (container.pY > container.pTop) container.pY = container.pTop;
if (container.pY < -container.oHeight) container.pY = -container.oHeight;
container.style.top = container.pY;
if ((container.pY != container.pTop && container.active) || (container.pY != -container.oHeight && !container.active))
setTimeout("showTab()", 0)
else
{
unselectAll(container.id);
if (container.active)
{
var devider = document.getElementById("tabsDevider");
devider.style.display = "none";
theMainScript.SetCookie('active_tab', container.id);
theMainScript.SetCookie('tabs_on',1);
}
else
{
container.style.top = container.pTop - container.oHeight;
container.style.display = "none";
theMainScript.SetCookie('tabs_on',0);
}
container.startTime = null;
}
}
function toggleCategories(instant)
{
var tab = document.getElementById("categories");
tab.active = (!tab.active);
if(tab.active)
CurrentTab = 'Categories';
var devider = document.getElementById("categoriesDevider");
if (!tab.active) devider.style.display = "";
toolbar.showButton('new_cat', tab.active)
unselectAll("categories");
tabChanged();
var container = document.getElementById("firstContainer");
if (!container.pY) container.pY = 0;
if (!container.pTop && container.pTop != 0) container.pTop = -1;
showCategories(instant);
}
var scrollJump = 8;
function showCategories(instant)
{
var container = document.getElementById("firstContainer");
var categories = document.getElementById("categories");
var scrollJumpA = scrollJump;
scrollJumpA = (instant) ? container.offsetHeight : scrollJumpA;
if (!categories.startTime)
{
categories.startTime = new Date();
}
else
{
var cDate = new Date();
if (cDate - categories.startTime >= animationTimeout) scrollJumpA = categories.offsetHeight;
//ert(animationTimeout);
}
(categories.active) ? container.pY += scrollJumpA : container.pY -= scrollJumpA;
if (container.pY < container.pTop - categories.offsetHeight)
container.pY = container.pTop - categories.offsetHeight;
if (container.pY > container.pTop)
container.pY = container.pTop;
container.style.top = container.pY;
if (((Math.abs(container.pY) <= categories.offsetHeight + container.pTop) && (!categories.active)) || ((container.pY < container.pTop) && (categories.active)))
setTimeout("showCategories()", 0)
else
{
unselectAll("categories");
if (categories.active) //shown categories
{
var devider = document.getElementById("categoriesDevider");
//devider.style.display = "none";
theMainScript.SetCookie('cats_tab_on', 1);
}
else { //hidden categories
theMainScript.SetCookie('cats_tab_on', 0);
}
categories.startTime = null;
}
}
/*
function toggleCategories()
{
var tab = document.getElementById("categories");
var devider = document.getElementById("categoriesDevider");
devider.style.display = (tab.style.display == "none") ? "" : "none";
// tab.style.display = (tab.style.display == "none") ? "" : "none";
tab.active = (tab.style.display != "none");
toolbar.showButton('new_cat', tab.active)
unselectAll("categories");
tabChanged();
var container = document.getElementById("firstContainer");
if (!container.pY) container.pY = 0;
showCategories();
}
function showCategories()
{
var container = document.getElementById("firstContainer");
var categories = document.getElementById("categories");
container.style.top = (categories.active) ? container.pY++ : container.pY--;
if (((Math.abs(container.pY) < categories.offsetHeight) && (!categories.active)) || ((container.pY < 0) && (categories.active)))
setTimeout("showCategories()", 10)
else
unselectAll("categories");
}
*/
function selectAllC(tabId)
{
if (tabId != 'categories') {
unselectAll('categories');
}
else {
unselectAll('links');
unselectAll('news');
unselectAll('topics');
}
selcount = 0;
changeSelection(tabId, 0);
}
function unselectAll(tabId)
{
selcount = 0;
changeSelection(tabId, 1);
LastCheckedItem = null;
}
function invert(tabId)
{
if (tabId != 'categories') {
unselectAll('categories');
}
else {
unselectAll('links');
unselectAll('news');
unselectAll('topics');
}
selcount = 0;
changeSelection(tabId, 2);
}
function changeSelection(tabId, action)
{
if (selcount == 0) {
selcount++;
//alert('change Selection');
if(toolbar)
{
var tab = document.getElementById(tabId);
if (!tab) return;
var inputs = tab.getElementsByTagName("INPUT");
//alert(inputs.length);
for (var j = 0; j < inputs.length; j++) {
//alert(inputs[j].type + ' ' + inputs[j].name + ' ' + inputs[j].inportalType);
if ((inputs[j].type == "checkbox" || inputs[j].type == "radio") && (inputs[j].inportalType))
{
//alert('will do');
switch (action)
{
case (0) :
selectContainer(inputs[j], true, true)
break;
case (1) :
selectContainer(inputs[j], false, true)
break;
default:
selectContainer(inputs[j], (!inputs[j].checked), true)
break;
}
}
}
selectionChanged();
}
}
else {
selcount = 0;
}
}
function selectContainer(checkBox, value, doNotFireSelectionEvent)
{
//alert('select cont');
if (!checkBox) return;
if (checkBox.checked != value)
{
//alert('setting '+value);
checkBox.checked = value;
if (value)
tabSelection[checkBox.inportalType]++
else
tabSelection[checkBox.inportalType]--;
}
- var selNode = (checkBox.container.getAttribute("inportalType") == "categories") ? checkBox.container.parentNode : checkBox.container.parentNode.parentNode;
+ var selNode = (checkBox.container.getAttribute("inportalType") == "categories" || checkBox.container.getAttribute("inportalType") == "category") ? checkBox.container.parentNode : checkBox.container.parentNode.parentNode;
if (!selNode.oriCN && checkBox.checked || selNode.className != "selectedContainer" && selNode.className != "unselectedContainer")
selNode.oriCN = (selNode.className) ? selNode.className : "";
selNode.className = (checkBox.checked) ? "selectedContainer" : ((selNode.oriCN != "") ? selNode.oriCN : "unselectedContainer");
// checkBox.container.className = (checkBox.checked) ? "selectedContainer" : "unselectedContainer";
if (!doNotFireSelectionEvent)
selectionChanged();
}
function updateStatus()
{
var StatusString="";
for (var i = 0; i < tabIDs.length; i++)
StatusString+= tabIDs[i] + ": " + tabSelection[tabIDs[i]] + "; ";
StatusString+= "categories: " + tabSelection['categories'] + "; ";
window.status = StatusString;
}
function selectionChanged()
{
setTimeout('selectionChangedA()', 0)
}
var activeTab;
function TabPasteEnabled(TabTitle)
{
//alert('Checking '+TabTitle);
var Enable_Paste = false;
try
{
Enable_Paste = eval(TabTitle+'_Paste');
return Enable_Paste;
}
catch (e)
{
return;
}
}
function selectionChangedA()
{
var categories = document.getElementById('categories');
for (var i = 0; i < tabIDs.length; i++)
{
var thisTab = document.getElementById(tabIDs[i])
if (!thisTab) continue;
if (thisTab.active)
{
activeTab = thisTab;
activeTab.title = getTabTitle(tabIDs[i]);
break;
}
}
var numCategoriesSelected = tabSelection['categories'];
var numActiveTabSelected = (activeTab) ? tabSelection[activeTab.id] : 0;
if(toolbar)
{
//toolbar.enableButton("edit", (numCategoriesSelected + numActiveTabSelected == 1));
var enableMiscButtons = (numCategoriesSelected + numActiveTabSelected > 0 && numCategoriesSelected * numActiveTabSelected == 0);
var enableCurrentButton = !enableMiscButtons;
toolbar.enableButton("editcat",enableCurrentButton);
toolbar.enableButton("edit", enableMiscButtons);
toolbar.enableButton("delete", enableMiscButtons);
toolbar.enableButton("approve", enableMiscButtons);
toolbar.enableButton("decline", enableMiscButtons);
toolbar.enableButton("cut", enableMiscButtons);
toolbar.enableButton("copy", enableMiscButtons);
toolbar.enableButton("paste", PasteButton);
toolbar.enableButton("move_up", enableMiscButtons);
toolbar.enableButton("move_down", enableMiscButtons);
}
}
function tabChanged()
{
if (activeTab)
{
//alert('now active: '+activeTab.id)
}
// toggleMenu();
}
function getTabTitle(tabId)
{
var tab = document.getElementById(tabId);
if (!tab) return;
return tab.getAttribute("tabTitle");
}
function isAnyChecked(tabId)
{
//return theMainScript.Grids[tabId].CountSelected() > 0;
return tabSelection[tabId] > 0;
}
function initTabsForAnimation()
{
var iniTop = 0;
for (var i = 0; i < tabIDs.length; i++)
{
var tab = document.getElementById(tabIDs[i]);
if (!tab) continue;
tab.oHeight = tab.offsetHeight;
tab.style.top = -iniTop;
iniTop += tab.offsetHeight;
tab.pTop = -1;
}
for (var i = 0; i < tabIDs.length; i++)
{
var tab = document.getElementById(tabIDs[i]);
if (!tab) continue;
tab.style.top = tab.pTop - tab.offsetHeight;
tab.pY = -tab.offsetHeight;
tab.style.visibility = "inherit";
tab.style.display = "none";
}
}
\ No newline at end of file
Property changes on: trunk/admin/browse/checkboxes_new.js
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/admin/browse/toolbar.php
===================================================================
--- trunk/admin/browse/toolbar.php (revision 122)
+++ trunk/admin/browse/toolbar.php (revision 123)
@@ -1,252 +1,248 @@
<?php
##############################################################
## In-portal :: Administration Interfaces :: Tool Bar ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
class clsToolBarItem
{
var $m_img;
var $m_alt;
var $link;
var $onMouseOver;
var $onMouseOut;
var $onClick;
var $filename;
function clsToolBarItem()
{
}
function GetItem()
{
global $imagesURL;
$o = "";
if ($this->img=="divider")
{
$o .= "<img src=\"".$imagesURL."/toolbar/tool_divider.gif\" width=\"4\" height=\"32\" border=\"0\">\n";
}
else
{
$o .= "<a href=\"".$this->link."\" onMouseOut=\"".$this->onMouseOut."\"";
$o .= " onMouseOver=\"".$this->onMouseOver."\" onClick=\"".$this->onClick."\">\n";
$o .= "<img ID=\"".$this->img."\" alt=\"".language($this->alt)."\" src=\"".$this->filename."\" width=\"32\" height=\"32\" border=\"0\">";
$o .= "</a>\n";
}
return $o;
}
}
class clsToolBar
{
var $Items;
var $m_section;
var $m_load_menu_func;
var $m_CheckClass;
var $InitScript;
function clsToolBar()
{
$this->Items = array();
$this->InitScript = array();
}
function Get($name)
{
$var = "m_" . $name;
return $this->$var;
}
function Set($name, $value)
{
if (is_array($name))
{
for ($i=0; $i<sizeof($name); $i++)
{ $var = "m_" . $name[$i];
$this->$var = $value[$i];
$this->m_dirtyFieldsMap[$name[$i]] = $value[$i];
echo "$var = ".$value[$i]."<br>\n";
}
}
else
{
$var = "m_" . $name;
$this->$var = $value;
$this->m_dirtyFieldsMap[$name] = $value;
}
}
function Add($img,$alt="",$link="",$MouseOver="",$MouseOut="",$onClick="", $filename="")
{
global $imagesURL;
$t = new clsToolBarItem();
$t->img = $img;
$t->alt = $alt;
$t->link = $link;
$t->onMouseOver = $MouseOver;
$t->onMouseOut = $MouseOut;
$t->onClick = $onClick;
if(strlen($filename)==0)
{
$t->filename = $imagesURL."/toolbar/tool_".$img.".gif";
}
else
{
if(substr($filename,0,4)=="http")
{
$t->filename = $filename;
}
else
{
if(substr($filename,0,1)!="/")
$filename = "/".$filename;
if(substr($filename,0,9)!="/toolbar/")
$filename = "/toolbar".$filename;
$t->filename = $imagesURL.$filename;
}
}
array_push($this->Items,$t);
return $t;
}
function AddToInitScript($s)
{
if(is_array($s))
{
for($i=0;$i<count($s);$i++)
array_push($this->InitScript,$s[$i]);
}
else
array_push($this->InitScript,$s);
}
function GetInitScript()
{
$s="";
if(count($this->InitScript)>0)
$s = implode("\n",$this->InitScript);
return "<SCRIPT language=\"JavaScript\">$s</SCRIPT>";
}
function Build()
{
global $imagesURL;
$o = "<table border=0 cellpadding=0 cellspacing=0 width=\"100%\" class=\"toolbar\">";
$o .= "<tr><td><img alt="|" src=\"".$imagesURL."/toolbar_start.gif\" width=10 height=50 border=0></td>\n";
foreach($this->Items as $t)
{
$o .= "<TD>".$t->GetItem()."</TD>";
}
$o .= "<TD width=\"100%\"></TD></TR></TABLE>";
return $o;
}
function onLoadString()
{
return "";
}
}
class clsItemTabs
{
var $Tabs;
var $ItemCount;
function clsItemTabs()
{
$this->Tabs = array();
$this->ItemCount = array();
}
function SetItemCount($divname,$Value)
{
$this->ItemCount[$divname] = $Value;
}
function GetItemCount($divname)
{
return (int)$this->ItemCount[$divname];
}
function AddTab($Caption,$divname,$ItemCount,$selected,$numfunc="")
{
$t["caption"]=$Caption;
$t["divname"]=$divname;
$this->SetItemCount($divname,$ItemCount);
$t["selected"]=$selected;
$t["numfunc"]=$numfunc;
$this->Tabs[] = $t;
}
function TabItem($i)
{
global $imagesURL;
$t = $this->Tabs[$i];
$div = $t["divname"];
- $o = "<td width=\"138\" height=\"20\" noWrap class=activeTab ";
- //$o .= " background=\"".$imagesURL."/itemtabs/tab_inactive.gif\" ";
+ $o = '<td width="138" height="20" noWrap class="activeTab" ';
+
$o .= "tabHeaderOf=\"$div\" ";
$o .= "onclick=\"toggleTabB('$div');\" style=\"cursor:hand\">\n<table cellspacing=0 cellpadding=0 width=100%>
<tr>
- <td id=\"l_$div\" background=\"".$imagesURL."/itemtabs/tab_inactive_l.gif\" class=\"left_tab\"><!--<img height=\"20\" src=\"".$imagesURL."/itemtabs/divider_empty.gif\" width=\"20\" border=\"0\" >-->&nbsp;&nbsp;</td>
- <td id=\"m_$div\" nowrap background=\"".$imagesURL."/itemtabs/tab_inactive.gif\" class=\"tab_class\">";
+ <td id=\"l_$div\" background=\"".$imagesURL."/itemtabs/tab_inactive_l.gif\" class=\"left_tab\">&nbsp;&nbsp;</td>
+ <td width=\"80%\" id=\"m_$div\" nowrap background=\"".$imagesURL."/itemtabs/tab_inactive.gif\" class=\"tab_class\">";
$o .= " <img height=\"20\" src=\"".$imagesURL."/itemtabs/divider_empty.gif\" align=absMiddle ";
$o .= "width=\"20\" border=\"0\" >";
$o .= $t["caption"]."&nbsp;</td><td id=\"m1_$div\" nowrap align=right valign=top background=\"".$imagesURL."/itemtabs/tab_inactive.gif\" class=\"tab_class\"><span class=\"cats_stats\">";
$func = $t["numfunc"];
if( is_numeric($func) )
$total = $func;
else
if( function_exists($func) ) $total = $func();
$count = $this->GetItemCount($div);
$o .= '('.( ($total != $count) ? $count.' / '.$total : $count ).')';
$o .= '</SPAN>&nbsp;</td>
<td id="r_'.$div.'" background="'.$imagesURL.'/itemtabs/tab_inactive_r.gif" class="right_tab">
<img src="'.$imagesURL.'/spacer.gif" width="21" height="20">
</td>
</tr></table></td>'."\n";
return $o;
}
function tabRow()
{
global $imagesURL;
- $o = "<table cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" border=\"0\" id=\"tab_headers\">\n";
+ $o = '<table cellspacing="0" cellpadding="0" border="0" id="tab_headers">'."\n";
$o .= "<tbody><tr>\n";
- for($i=0;$i<count($this->Tabs);$i++)
+ for($i = 0; $i < count($this->Tabs); $i++)
{
$o .= $this->TabItem($i);
+ $o .= '<td><img src="'.$imagesURL.'/spacer.gif" width="5" height="1"></td>'."\n";
}
- $o .= "<td>&nbsp;</td>\n";
+
$o .= "</tr></tbody></table>\n";
- //$o .= "<div id=\"hidden_line\">\n";
- //$o .= "<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" border=\"0\">\n";
- //$o .= "<tbody><tr class=\"divider\">\n";
- //$o .= "<td colspan=\"2\"><img height=\"1\" src=\"$imagesURL/spacer.gif\" width=\"1\" border=\"0\">\n";
- //$o .= "</td></tr></tbody></table></div\n";
return $o;
}
}
$ItemTabs = new clsItemTabs();
?>
Property changes on: trunk/admin/browse/toolbar.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/admin/browse/toolbar.js
===================================================================
--- trunk/admin/browse/toolbar.js (revision 122)
+++ trunk/admin/browse/toolbar.js (revision 123)
@@ -1,220 +1,219 @@
var toolbar;
//var imagesPath = "images/";
var separatorImg = "divider";
var imagesPreName = "tool_";
var imagesPostName_Active = "_f2";
var imagesPostName_Disabled = "_f3";
var imagesExt = ".gif";
var preloadImages = new Array();
preloadImage(getButtonSrc(separatorImg, 0));
function initToolbar(id, actionHandler)
{
toolbar = document.getElementById(id);
if (!toolbar) return;
toolbar.actionHandler = actionHandler;
toolbar.className = "toolbarDiv"
var childNodes = toolbar.getElementsByTagName("*");
if (childNodes.length == 0) childNodes = toolbar.childNodes;
var _oTable = document.createElement("TABLE");
var _oTBody = document.createElement("TBODY");
var _oTR = document.createElement("TR");
var _oTD = document.createElement("TD");
_oTD.className = "toolbarTD";
_oTR.appendChild(_oTD);
_oTBody.appendChild(_oTR);
_oTable.appendChild(_oTBody);
_oTable.align = "left";
_oTable.cellSpacing = 0;
_oTable.cellPadding = 0;
_oTable.border = 0;
_oTable.className= "toolbarTable"
_oTable.width = "100%";
var oTable = document.createElement("TABLE");
var oTBody = document.createElement("TBODY");
var oTR = document.createElement("TR");
oTR.parentToolbar = toolbar;
oTBody.appendChild(oTR);
oTable.appendChild(oTBody);
oTable.align = "left";
oTable.cellSpacing = 0;
oTable.cellPadding = 0;
oTable.border = 0;
// oTable.width = "100%";
oTable.className= "toolbarTable"
_oTD.appendChild(oTable);
for (var i = 0; i < childNodes.length; i++)
if (childNodes[i].nodeType == 1)
{
oTD = document.createElement("TD");
oTD.action = childNodes[i].getAttribute("action");
// oTD.width = "1%";
oIMG = document.createElement("IMG");
if (childNodes[i].getAttribute("align") == "right" && !oTR.alignedRight)
{
_owTD = document.createElement("TD");
_owTD.innerHTML = "&nbsp;";
_owTD.width = "99%";
oTR.appendChild(_owTD);
oTR.alignedRight = true;
}
switch(childNodes[i].tagName.toLowerCase())
{
case "tb:separator" :
oIMG.basepath = childNodes[i].getAttribute("ImagePath");
oIMG.action = "divider";
oIMG.src = getButtonSrc(oIMG, 0);
break;
case "tb:button" :
oIMG.toolbar = toolbar;
oIMG.action = childNodes[i].getAttribute("action");
var enabled = new String(childNodes[i].getAttribute("enabled"));
oIMG.disabled = (enabled == "false");
oIMG.basepath = childNodes[i].getAttribute("ImagePath");
oIMG.src = getButtonSrc(oIMG, (oIMG.disabled) ? 2 : 0)
for (var j = 0; j < 3; j++)
preloadImage(getButtonSrc(oIMG, j),oIMG.basepath);
oIMG.style.cursor = (oIMG.disabled) ? "default" : "hand";
oIMG.setAttribute("alt", childNodes[i].getAttribute("alt"));
oIMG.onclick = function()
{
if (this.disabled) return;
if (this.toolbar.actionHandler)
this.toolbar.actionHandler(this)
}
oIMG.onmouseover = function(e)
{
if (this.disabled) return;
this.src = getButtonSrc(this, 1);
var evt = (e) ? e : event; evt.cancelBubble = true;
}
oIMG.onmouseout = function(e)
{
if (this.disabled) return;
this.src = getButtonSrc(this, 0);
var evt = (e) ? e : event; evt.cancelBubble = true;
}
break;
}
var tab = (childNodes[i].getAttribute("tab")) ? childNodes[i].getAttribute("tab") : "";
oTD.tab = tab;
if (tab != "") oTD.style.display = "none";
oTD.appendChild(oIMG);
oTR.appendChild(oTD)
}
toolbar.appendChild(_oTable);
toolbar.setTab = toolbarSetTab;
toolbar.showButton = toolbarShowButton;
toolbar.enableButton = toolbarEnableButton;
toolbar.disableButton = toolbarDisableButton;
}
function toolbarSetTab(tab)
{
var TDs = this.getElementsByTagName("TD");
for (var i = 0; i < TDs.length; i++)
if (TDs[i].tab)
if (TDs[i].tab != "")
{
if (TDs[i].tab == tab) TDs[i].style.display = ""
else TDs[i].style.display = "none";
}
}
function toolbarShowButton(action, value)
{
var TDs = this.getElementsByTagName("TD");
for (var i = 0; i < TDs.length; i++)
if (TDs[i].action == action)
TDs[i].style.display = (value) ? "" : "none";
}
function findButton(toolbar, action)
{
if (!toolbar) return;
var buttons = toolbar.getElementsByTagName("IMG");
for (var i = 0; i < buttons.length; i++)
if (buttons[i].action == action) return buttons[i];
}
function toolbarEnableButton(action, value)
{
var button = findButton(this, action);
if (!button) return;
button.src = getButtonSrc(button, (value == false) ? 2 : 0)
button.style.cursor = (value == false) ? "default" : "hand";
button.disabled = (value == false) ? true : false;
}
function toolbarDisableButton(action)
{
this.enableButton(action, false)
}
function getButtonSrc(button, state)
{
var stateExt;
switch(state)
{
case (1) : stateExt = imagesPostName_Active; break;
case (2) : stateExt = imagesPostName_Disabled; break;
default : stateExt = "";
}
return button.basepath + imagesPreName + button.action + stateExt + imagesExt;
}
function preloadImage(src)
{
var img = new Image();
img.src = src;
preloadImages[preloadImages.length] = img;
}
-
function showContextMenu(evt) {
initContextMenu(evt.clientX,evt.clientY);
window.FW_showMenu(window.contextMenu,evt.clientX,evt.clientY);
evt.returnValue = false;
evt.cancelBubble = true;
return false;
}
function initContextMenu(){
- window.contextMenu = new Menu("Context");
- contextMenu.addMenuItem("Edit","check_submit('','edit');","");
- contextMenu.addMenuItem("Delete","check_submit('admin/browse','delete');","");
- contextMenu.addMenuSeparator();
- contextMenu.addMenuItem("Approve","check_submit('admin/browse','approve');","");
- contextMenu.addMenuItem("Decline","check_submit('admin/browse','decline');","");
- contextMenu.addMenuSeparator();
- contextMenu.addMenuItem("Cut","check_submit('admin/browse','cut');","");
- contextMenu.addMenuItem("Copy","check_submit('admin/browse','copy');","");
- if (typeof(activeTab) != 'undefined') {
- if(TabPasteEnabled(activeTab.title)) {
+ window.contextMenu = new Menu("Context");
+ contextMenu.addMenuItem("Edit","check_submit('','edit');","");
+ contextMenu.addMenuItem("Delete","check_submit('admin/browse','delete');","");
+ contextMenu.addMenuSeparator();
+ contextMenu.addMenuItem("Approve","check_submit('admin/browse','approve');","");
+ contextMenu.addMenuItem("Decline","check_submit('admin/browse','decline');","");
+ contextMenu.addMenuSeparator();
+ contextMenu.addMenuItem("Cut","check_submit('admin/browse','cut');","");
+ contextMenu.addMenuItem("Copy","check_submit('admin/browse','copy');","");
+ if (typeof(activeTab) != 'undefined') {
+ if(TabPasteEnabled(activeTab.title))
contextMenu.addMenuItem("Paste","check_submit('admin/browse','paste');","");
- }
- }
+
+ }
- window.triedToWriteMenus = false;
- window.contextMenu.writeMenus();
- return true;
+ window.triedToWriteMenus = false;
+ window.contextMenu.writeMenus();
+ return true;
}
Property changes on: trunk/admin/browse/toolbar.js
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/admin/category/addcategory_images.php
===================================================================
--- trunk/admin/category/addcategory_images.php (revision 122)
+++ trunk/admin/category/addcategory_images.php (revision 123)
@@ -1,345 +1,346 @@
<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
if(!strlen($pathtoroot))
{
$path=dirname(realpath($_SERVER['SCRIPT_FILENAME']));
if(strlen($path))
{
/* determine the OS type for path parsing */
$pos = strpos($path,":");
if ($pos === false)
{
$gOS_TYPE="unix";
$pathchar = "/";
}
else
{
$gOS_TYPE="win";
$pathchar="\\";
}
$p = $path.$pathchar;
/*Start looking for the root flag file */
while(!strlen($pathtoroot) && strlen($p))
{
$sub = substr($p,strlen($pathchar)*-1);
if($sub==$pathchar)
{
$filename = $p."root.flg";
}
else
$filename = $p.$pathchar."root.flg";
if(file_exists($filename))
{
$pathtoroot = $p;
}
else
{
$parent = realpath($p.$pathchar."..".$pathchar);
if($parent!=$p)
{
$p = $parent;
}
else
$p = "";
}
}
if(!strlen($pathtoroot))
$pathtoroot = ".".$pathchar;
}
else
{
$pathtoroot = ".".$pathchar;
}
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
//echo $pathtoroot;
require_once($pathtoroot."kernel/startup.php");
//admin only util
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot. $value."admin/include/parser.php";
if(file_exists($path))
{
include_once($path);
}
}
/* ------------------------------------- Edit Table --------------------------------------------------- */
unset($objEditItems);
$objEditItems = new clsCatList();
$objEditItems->SourceTable = $objSession->GetEditTable("Category");
$en = (int)$_GET["en"];
$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable);
$itemcount=$objEditItems->NumItems();
$c = $objEditItems->GetItemByIndex($en);
if($itemcount>1)
{
if ($en+1 == $itemcount)
$en_next = -1;
else
$en_next = $en+1;
if ($en == 0)
$en_prev = -1;
else
$en_prev = $en-1;
}
$action = "m_item_image";
/* -------------------------------------- Section configuration ------------------------------------------- */
$envar = "env=" . BuildEnv() . "&en=$en";
$section = 'in-portal:editcategory_images';
$sec = $objSections->GetSection($section);
$title = admin_language("la_Text_Editing")." ".admin_language("la_Text_Category")." '".$c->Get("Name")."' - ".admin_language("la_tab_Images");
$SortFieldVar = "Image_LV_Sortfield";
$SortOrderVar = "Image_LV_Sortorder";
$DefaultSortField = "FullName";
$PerPageVar = "Perpage_Images";
$CurrentPageVar = "Page_Images";
$CurrentFilterVar = "CatImg_View";
$ListForm = "imagelistform";
$CheckClass = "PermChecks";
/* ------------------------------------- Configure the toolbar ------------------------------------------- */
$objListToolBar = new clsToolBar();
$saveURL = $admin."/category/category_maint.php";
+$cancelURL = $admin."/".$objSession->GetVariable('ReturnScript');
$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('save_edit_buttons','CatEditStatus','$saveURL',1);","tool_select.gif");
-$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('save_edit_buttons','CatEditStatus','".$admin."/browse.php',2);","tool_cancel.gif");
+$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('save_edit_buttons','CatEditStatus','".$cancelURL."',2);","tool_cancel.gif");
if($itemcount == 1) $objListToolBar->Add("divider");
$objListToolBar->Set("section",$section);
$objListToolBar->Set("load_menu_func","");
$objListToolBar->Set("CheckClass",$CheckClass);
$objListToolBar->Set("CheckForm",$ListForm);
if ( isset($en_prev) || isset($en_next) )
{
$url = $RootUrl.$admin."/category/addcategory_images.php";
$StatusField = "CatEditStatus";
$form = "category";
MultiEditButtons($objListToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'','la_PrevCategory','la_NextCategory');
$objListToolBar->Add("divider");
}
$listImages = array();
$objListToolBar->Add("new_img", "la_ToolTip_New_Image",$adminURL."/category/addimage.php?".$envar,"swap('new_img','toolbar/tool_new_image_f2.gif');",
"swap('new_img', 'toolbar/tool_new_image.gif');",
"","tool_new_image.gif");
$objListToolBar->Add("img_edit","la_ToolTip_Edit","#", "if (PermChecks.itemChecked()) swap('img_edit','toolbar/tool_edit_f2.gif');",
"if (PermChecks.itemChecked()) swap('img_edit', 'toolbar/tool_edit.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addimage', '');",
"tool_edit.gif",TRUE,TRUE);
$listImages[] = "PermChecks.addImage('img_edit','$imagesURL/toolbar/tool_edit.gif','$imagesURL/toolbar/tool_edit_f3.gif',1);\n";
$objListToolBar->Add("img_del","la_ToolTip_Delete","#", "if (PermChecks.itemChecked()) swap('img_del','toolbar/tool_delete_f2.gif');",
"if (PermChecks.itemChecked()) swap('img_del', 'toolbar/tool_delete.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addcategory_images', 'm_img_delete');",
"tool_delete.gif",FALSE,TRUE);
$listImages[] = "PermChecks.addImage('img_del','$imagesURL/toolbar/tool_delete.gif','$imagesURL/toolbar/tool_delete_f3.gif',1);\n ";
$objListToolBar->Add("divider");
$objListToolBar->Add("img_move_up","la_ToolTip_Move_Up","#", "if (PermChecks.itemChecked()) swap('img_move_up','toolbar/tool_move_up_f2.gif');",
"if (PermChecks.itemChecked()) swap('img_move_up', 'toolbar/tool_move_up.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addcategory_images', 'm_img_move_up');",
"tool_move_up.gif",FALSE,TRUE);
$listImages[] = "PermChecks.addImage('img_move_up','$imagesURL/toolbar/tool_move_up.gif','$imagesURL/toolbar/tool_move_up_f3.gif',1);\n ";
$objListToolBar->Add("img_move_down","la_ToolTip_Move_Down","#", "if (PermChecks.itemChecked()) swap('img_move_down','toolbar/tool_move_down_f2.gif');",
"if (PermChecks.itemChecked()) swap('img_move_down', 'toolbar/tool_move_down.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addcategory_images', 'm_img_move_down');",
"tool_move_down.gif",FALSE,TRUE);
$listImages[] = "PermChecks.addImage('img_move_down','$imagesURL/toolbar/tool_move_down.gif','$imagesURL/toolbar/tool_move_down_f3.gif',1);\n ";
$objListToolBar->Add("divider");
$objListToolBar->Add("viewmenubutton", "la_ToolTip_View","#","swap('viewmenubutton','toolbar/tool_view_f2.gif'); ",
"swap('viewmenubutton', 'toolbar/tool_view.gif');",
"ShowViewMenu();","tool_view.gif");
$objListToolBar->AddToInitScript($listImages);
/* ----------------------------------------- Set the View Filter ---------------------------------------- */
$Img_AllValue = 3;
$Bit_Enabled=1;
$Bit_Disabled=2;
$FilterLabels = array();
$FilterLabels[0] = admin_language("la_Text_Enabled");
$FilterLabels[1] = admin_language("la_Text_Disabled");
$ImgView = $objConfig->Get($CurrentFilterVar);
if(!is_numeric($ImgView))
{
$ImgView = $Img_AllValue;
}
else
{
if($ImgView & $Bit_Enabled)
$Filters[] = "img.Enabled=1";
if($ImgView & $Bit_Disabled)
$Filters[] = "img.Enabled=0";
if(count($Filters))
{
$imgFilter = implode(" OR ",$Filters);
}
else
$imgFilter = "ImageId = -1";
}
/* ------------------------------------ Build the SQL statement to populate the list ---------------------------*/
$objImageList = new clsImageList();
$objImageList->SourceTable = $objSession->GetEditTable("Images");
$sql = "SELECT ELT(img.Enabled+1,'".admin_language("la_Text_Disabled")." ','".admin_language("la_Text_Enabled")." ') as Status, ";
$sql .="img.AltName as AltName, img.ImageId as ImageId, img.Enabled as Enabled, img.Priority as Priority, ";
$sql .="concat(img.Name,ELT(img.DefaultImg+1,'','<br>(".admin_language("la_prompt_Primary").") ')) as FullName, ";
$sql .="if(img.LocalImage=1,'(".admin_language("la_Text_Local").") ',img.Url) as ShowURL, concat( '<IMG src=\"',";
$sql .="IF (img.LocalThumb=1, CASE WHEN ( LENGTH( img.ThumbPath ) >0 AND img.LocalThumb =1 ) ";
$sql .="THEN concat('".$rootURL."',img.ThumbPath,'?".time()."') END , img.ThumbUrl), '\">') AS Preview ";
$sql .="FROM ".$objImageList->SourceTable." as img WHERE img.ResourceId=".$c->Get("ResourceId");
if(strlen($imgFilter))
$sql .= " AND ($imgFilter)";
$order = trim($objConfig->Get($SortFieldVar)." ".$objConfig->Get($SortOrderVar));
$sql .=" ORDER BY Priority DESC";
if(strlen($order))
$sql .= ", ".$order;
$sql .=" ".GetLimitSQL($objSession->GetVariable($CurrentPageVar),$objConfig->Get($PerPageVar));
$objImageList->Query_Item($sql);
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
for($i=0;$i<count($objImageList->Items);$i++)
{
$img =& $objImageList->GetItemRefByIndex($i);
$icon = $imagesURL."/itemicons/icon16_image_disabled.gif";
if($img->Get("Enabled")=="1")
{
$icon = $imagesURL."/itemicons/icon16_image.gif";
}
$img->Set("Icon",$icon);
}
/* ---------------------------------------- Configure the list view ---------------------------------------- */
$objListView = new clsListView($objListToolBar,$objImageList);
$objListView->IdField = "ImageId";
$SortOrder=0;
if($objConfig->Get($SortOrderVar)=="asc")
$SortOrder=1;
$objListView->ColumnHeaders->Add("FullName",language("la_ColHeader_Image"),1,0,$order,"width=\"10%\"",$SortFieldVar,$SortOrderVar,"FullName");
$objListView->ColumnHeaders->Add("AltName",language("la_ColHeader_AltValue"),1,0,$order,"width=\"20%\"",$SortFieldVar,$SortOrderVar,"AltName");
$objListView->ColumnHeaders->Add("ShowURL",language("la_ColHeader_Url"),1,0,$order,"width=\"20%\"",$SortFieldVar,$SortOrderVar,"ShowURL");
$objListView->ColumnHeaders->Add("Status",language("la_ColHeader_Enabled"),1,0,$order,"width=\"10%\"",$SortFieldVar,$SortOrderVar,"Status");
$objListView->ColumnHeaders->Add("Preview",language("la_ColHeader_Preview"),1,0,$order,"width=\"40%\"",$SortFieldVar,$SortOrderVar,"Preview");
$objListView->ColumnHeaders->SetSort($objConfig->Get($SortFieldVar), $objConfig->Get($SortOrderVar));
$objListView->PrintToolBar = FALSE;
$objListView->CurrentPageVar = "Page_Images";
$objListView->PerPageVar = "Perpage_Images";
$objListView->CheckboxName = "itemlist[]";
$objListView->ConfigureViewMenu($SortFieldVar,$SortOrderVar,$DefaultSortField,
$CurrentFilterVar,$ImgView,$Img_AllValue);
foreach($FilterLabels as $Bit=>$Label)
{
$objListView->AddViewMenuFilter($Label,$Bit);
}
for($i=0;$i<count($objImageList->Items);$i++)
{
$img =& $objImageList->GetItemRefByIndex($i);
$objListView->RowIcons[] = $img->Get("Icon");
}
$objListToolBar->AddToInitScript("fwLoadMenus();\n");
$h = "\n\n<SCRIPT Language=\"JavaScript1.2\">\n".$objListView->GetViewMenu($imagesURL)."\n</SCRIPT>\n";
int_header($objListToolBar,NULL, $title,NULL,$h);
if ($objSession->GetVariable("HasChanges") == 1) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Save_Item")); ?>
</td>
</tr>
</table>
<?php } ?>
<form name="imagelistform" ID="imagelistform" action="<?php echo $_SERVER["PHP_SELF"]."?".$envar;?>" method=POST>
<table cellSpacing="0" cellPadding="2" width="100%" class="tableborder">
<tbody>
<?php
print $objListView->PrintList();
?>
<input TYPE="hidden" NAME="ResourceId" VALUE="<?php echo $c->Get("ResourceId"); ?>">
<input type="hidden" name="Action" value="m_item_image">
</FORM>
</TBODY>
</table>
<FORM NAME="save_edit_buttons" ID="save_edit_buttons" method="POST" ACTION="">
<input type=hidden NAME="Action" VALUE="save_category_edit">
<input type="hidden" name="CatEditStatus" VALUE="0">
</FORM>
<FORM ID="ListSearchForm" NAME="ListSearchForm" method="POST" action="<?php echo $_SERVER["PHP_SELF"]."?env=".BuildEnv(); ?>">
<INPUT TYPE="HIDDEN" NAME="Action" VALUE="">
<INPUT TYPE="HIDDEN" NAME="list_search">
</FORM>
<!-- CODE FOR VIEW MENU -->
<form ID="viewmenu" method="post" action="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>" name="viewmenu">
<input type="hidden" name="fieldname" value="">
<input type="hidden" name="varvalue" value="">
<input type="hidden" name="varvalue2" value="">
<input type="hidden" name="Action" value="">
</form>
<script language="JavaScript1.2" src="<?php echo $adminURL; ?>/listview/listview.js"></script>
<script language="JavaScript1.2">
initSelectiorContainers();
<?php echo $objListToolBar->Get("CheckClass").".setImages();"; ?>
</script>
<!-- END CODE-->
<?php int_footer(); ?>
\ No newline at end of file
Property changes on: trunk/admin/category/addcategory_images.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/admin/category/addcategory_custom.php
===================================================================
--- trunk/admin/category/addcategory_custom.php (revision 122)
+++ trunk/admin/category/addcategory_custom.php (revision 123)
@@ -1,255 +1,256 @@
<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
if(!strlen($pathtoroot))
{
$path=dirname(realpath($_SERVER['SCRIPT_FILENAME']));
if(strlen($path))
{
/* determine the OS type for path parsing */
$pos = strpos($path,":");
if ($pos === false)
{
$gOS_TYPE="unix";
$pathchar = "/";
}
else
{
$gOS_TYPE="win";
$pathchar="\\";
}
$p = $path.$pathchar;
/*Start looking for the root flag file */
while(!strlen($pathtoroot) && strlen($p))
{
$sub = substr($p,strlen($pathchar)*-1);
if($sub==$pathchar)
{
$filename = $p."root.flg";
}
else
$filename = $p.$pathchar."root.flg";
if(file_exists($filename))
{
$pathtoroot = $p;
}
else
{
$parent = realpath($p.$pathchar."..".$pathchar);
if($parent!=$p)
{
$p = $parent;
}
else
$p = "";
}
}
if(!strlen($pathtoroot))
$pathtoroot = ".".$pathchar;
}
else
{
$pathtoroot = ".".$pathchar;
}
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
//echo $pathtoroot;
require_once($pathtoroot."kernel/startup.php");
//admin only util
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
//$pathtolocal = $pathtoroot."in-news/";
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
//require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot. $value."admin/include/parser.php";
if(file_exists($path))
{
include_once($path);
}
}
unset($objEditItems);
$objEditItems = new clsCatList();
$objEditItems->SourceTable = $objSession->GetEditTable("Category");
//Multiedit init
$en = (int)$_GET["en"];
$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable);
$itemcount=$objEditItems->NumItems();
$c = $objEditItems->GetItemByIndex($en);
if($itemcount>1)
{
if ($en+1 == $itemcount)
$en_next = -1;
else
$en_next = $en+1;
if ($en == 0)
$en_prev = -1;
else
$en_prev = $en-1;
}
$action = "m_edit_category";
$envar = "env=" . BuildEnv() . "&en=$en";
$section = 'in-portal:editcategory_custom';
$title = admin_language("la_Text_Editing")." ".admin_language("la_Text_Category")." '".$c->Get("Name")."' - ".admin_language("la_tab_Custom");
$formaction = $rootURL.$admin."/category/addcategory_custom.php?".$envar;
//echo $envar."<br>\n";
//Display header
$sec = $objSections->GetSection($section);
$objCatToolBar = new clsToolBar();
$ListForm = "permlistform";
$CheckClass = "PermChecks";
$objCatToolBar->Set("CheckClass",$CheckClass);
$objCatToolBar->Set("CheckForm",$ListForm);
-$saveURL = $admin."/category/category_maint.php";
+$saveURL = $admin."/category/category_maint.php";
+$cancelURL = $admin."/".$objSession->GetVariable('ReturnScript');
$objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('category','CatEditStatus','$saveURL',1);","tool_select.gif");
-$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('category','CatEditStatus','".$admin."/browse.php',2);","tool_cancel.gif");
+$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('category','CatEditStatus','".$cancelURL."',2);","tool_cancel.gif");
if ( isset($en_prev) || isset($en_next) )
{
$url = $RootUrl.$admin."/category/addcategory_custom.php";
$StatusField = "CatEditStatus";
$form = "category";
MultiEditButtons($objCatToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'','la_PrevCategory','la_NextCategory');
}
int_header($objCatToolBar,NULL,$title);
if ($objSession->GetVariable("HasChanges") == 1) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Save_Item")); ?>
</td>
</tr>
</table>
<?php } ?>
<form id="category" name="category" action="" method=POST>
<?php
$objCustomFields = new clsCustomFieldList(1);
$objCustomDataList->SourceTable = $objSession->GetEditTable("CustomMetaData");
$objCustomDataList->LoadResource($c->Get("ResourceId"));
for($i=0;$i<$objCustomFields->NumItems(); $i++)
{
$field =& $objCustomFields->GetItemRefByIndex($i);
$fieldid = $field->Get("CustomFieldId");
$f = $objCustomDataList->GetDataItem($fieldid);
$fieldname = "CustomData[$fieldid]";
if(is_object($f))
{
$val_field = "<input type=\"text\" tabindex=\"".($i+1)."\" VALUE=\"".$f->Get("Value")."\" name=\"$fieldname\">";
$field->Set("Value", $val_field);
$field->Set("DataId",$f->Get("CustomDataId"));
}
else
{
$val_field = "<input type=text tabindex=\"".($i+1)."\" VALUE=\"\" name=\"$fieldname\">";
$field->Set("Value", $val_field);
$field->Set("DataId",0);
}
}
$objCustomFields->SortField = $objConfig->Get("CustomData_LV_Sortfield");;
$objCustomFields->SortItems($objConfig->Get("CustomData_LV_Sortorder")!="desc");
$objListView = new clsListView($objCatToolBar,$objCustomFields);
$objListView->IdField = "DataId";
$order = $objConfig->Get("CustomData_LV_Sortfield");
$SortOrder=0;
if($objConfig->Get("CustomData_LV_Sortorder")=="asc")
$SortOrder=1;
$objListView->ColumnHeaders->Add("FieldName",admin_language("la_ColHeader_FieldName"),1,0,$order,"width=\"30%\"","CustomData_LV_Sortfield","CustomData_LV_Sortorder","FieldName");
$objListView->ColumnHeaders->Add("FieldLabel",admin_language("la_ColHeader_FieldLabel"),1,0,$order,"width=\"30%\"","CustomData_LV_Sortfield","CustomData_LV_Sortorder","FieldLabel");
$objListView->ColumnHeaders->Add("Value",admin_language("la_ColHeader_Value"),1,0,$order,"width=\"40%\"","CustomData_LV_Sortfield","CustomData_LV_Sortorder","Value");
$objListView->ColumnHeaders->SetSort($objConfig->Get("CustomData_LV_Sortfield"), $objConfig->Get("CustomData_LV_Sortorder"));
$objListView->PrintToolBar = FALSE;
$objListView->checkboxes = FALSE;
$objListView->CurrentPageVar = "Page_CustomData";
$objListView->PerPageVar = "Perpage_CustomData";
//$objListView->CheckboxName = "itemlist[]";
for($i=0;$i<count($objCustomFields->Items);$i++)
{
$objListView->RowIcons[] = $imagesURL."/itemicons/icon16_custom.gif";
}
$objListView->PageLinks = $objListView->PrintPageLinks();
$objListView->SliceItems();
print $objListView->PrintList();
?>
<input type="hidden" name="ItemId" value="<?php echo $c->Get("ResourceId"); ?>">
<input type="hidden" name="Action" value="m_edit_custom_data">
<input type="hidden" name="CatEditStatus" VALUE="0">
</FORM>
<FORM id="save_edit" method="POST" NAME="save_edit" ID="save_edit">
<input type="hidden" name="CatEditStatus" VALUE="0">
</FORM>
<!-- CODE FOR VIEW MENU -->
<form ID="viewmenu" method="post" action="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>" name="viewmenu">
<input type="hidden" name="fieldname" value="">
<input type="hidden" name="varvalue" value="">
<input type="hidden" name="varvalue2" value="">
<input type="hidden" name="Action" value="">
</form>
<script src="<?php echo $adminURL; ?>/listview/listview.js"></script>
<script>
initSelectiorContainers();
<?php //echo $objCatToolBar->Get("CheckClass").".setImages();"; ?>
MarkAsRequired(document.getElementById("category"));
</script>
<?php int_footer(); ?>
Property changes on: trunk/admin/category/addcategory_custom.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/admin/category/addcategory_permissions.php
===================================================================
--- trunk/admin/category/addcategory_permissions.php (revision 122)
+++ trunk/admin/category/addcategory_permissions.php (revision 123)
@@ -1,274 +1,275 @@
<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
if(!strlen($pathtoroot))
{
$path=dirname(realpath($_SERVER['SCRIPT_FILENAME']));
if(strlen($path))
{
/* determine the OS type for path parsing */
$pos = strpos($path,":");
if ($pos === false)
{
$gOS_TYPE="unix";
$pathchar = "/";
}
else
{
$gOS_TYPE="win";
$pathchar="\\";
}
$p = $path.$pathchar;
/*Start looking for the root flag file */
while(!strlen($pathtoroot) && strlen($p))
{
$sub = substr($p,strlen($pathchar)*-1);
if($sub==$pathchar)
{
$filename = $p."root.flg";
}
else
$filename = $p.$pathchar."root.flg";
if(file_exists($filename))
{
$pathtoroot = $p;
}
else
{
$parent = realpath($p.$pathchar."..".$pathchar);
if($parent!=$p)
{
$p = $parent;
}
else
$p = "";
}
}
if(!strlen($pathtoroot))
$pathtoroot = ".".$pathchar;
}
else
{
$pathtoroot = ".".$pathchar;
}
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
//echo $pathtoroot;
require_once($pathtoroot."kernel/startup.php");
//admin only util
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
//$pathtolocal = $pathtoroot."in-news/";
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
//require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot. $value."admin/include/parser.php";
if(file_exists($path))
{
include_once($path);
}
}
unset($objEditItems);
$objEditItems = new clsCatList();
$objEditItems->SourceTable = $objSession->GetEditTable("Category");
//Multiedit init
$en = (int)$_GET["en"];
$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable);
$itemcount=$objEditItems->NumItems();
if(isset($_GET["en"]))
{
$c = $objEditItems->GetItemByIndex($en);
}
if(!is_object($c))
{
$c = new clsCategory($m_var_list["cat"]);
$c->Set("CategoryId",$m_var_list["cat"]);
}
if($itemcount>1)
{
if ($en+1 == $itemcount)
$en_next = -1;
else
$en_next = $en+1;
if ($en == 0)
$en_prev = -1;
else
$en_prev = $en-1;
}
$action = "m_edit_category";
/* -------------------------------------- Section configuration ------------------------------------------- */
$envar = "env=" . BuildEnv() . "&en=$en";
$section = 'in-portal:editcategory_permissions';
$sec =& $objSections->GetSection($section);
if($c->Get("CategoryId")==0)
{
$sec->Set("left",NULL);
$sec->Set("right",NULL);
}
if($c->Get("CategoryId")!=0)
{
$title = admin_language("la_Text_Editing")." ".admin_language("la_Text_Category")." '".$c->Get("Name")."' - ".admin_language("la_tab_Permissions");
}
else
$title = admin_language("la_Text_Editing")." ".admin_language("la_Text_Root")." ".admin_language("la_Text_Category")." - ".admin_language("la_tab_Permissions");
$SortFieldVar = "GroupPerm_SortField";
$SortOrderVar = "GroupPerm_SortOrder";
$DefaultSortField = "FullName";
$PerPageVar = "Perpage_Grouplist";
$CurrentPageVar = "Page_Grouplist";
$CurrentFilterVar = "CatImg_View";
$ListForm = "permlistform";
$CheckClass = "PermChecks";
/* ------------------------------------- Configure the toolbar ------------------------------------------- */
$saveURL = $admin."/category/category_maint.php";
+$cancelURL = $admin."/".$objSession->GetVariable('ReturnScript');
$objListToolBar = new clsToolBar();
$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('save_edit_buttons','CatEditStatus','$saveURL',1);","tool_select.gif");
-$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('save_edit_buttons','CatEditStatus','".$admin."/browse.php',2);","tool_cancel.gif");
+$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('save_edit_buttons','CatEditStatus','".$cancelURL."',2);","tool_cancel.gif");
if($itemcount == 1) $objListToolBar->Add("divider");
$objListToolBar->Set("section",$section);
$objListToolBar->Set("load_menu_func","");
$objListToolBar->Set("CheckClass",$CheckClass);
$objListToolBar->Set("CheckForm",$ListForm);
if ( isset($en_prev) || isset($en_next) )
{
$url = $RootUrl.$admin."/category/addcategory_permissions.php";
$StatusField = "CatEditStatus";
$form = "category";
MultiEditButtons($objListToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'','la_PrevCategory','la_NextCategory');
$objListToolBar->Add("divider");
}
$listImages = array();
//$img, $alt, $link, $onMouseOver, $onMouseOut, $onClick
$objListToolBar->Add("new_perm", "la_ToolTip_New_Permission","#","swap('new_perm','toolbar/tool_new_permission_f2.gif');",
"swap('new_perm', 'toolbar/tool_new_permission.gif');",
"OpenGroupSelector('$envar&source=addcategory_permissions&CatId=".$c->Get("CategoryId")."&destform=popup&destfield=itemlist');",
"tool_new_permission.gif");
$objListToolBar->Add("perm_edit","Edit","#", "if (PermChecks.itemChecked()) swap('perm_edit','toolbar/tool_edit_f2.gif');",
"if (PermChecks.itemChecked()) swap('perm_edit', 'toolbar/tool_edit.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addpermission_modules', '');",
"tool_edit.gif",TRUE,TRUE);
$listImages[] = "PermChecks.addImage('perm_edit','$imagesURL/toolbar/tool_edit.gif','$imagesURL/toolbar/tool_edit_f3.gif',1); ";
$objListToolBar->Add("perm_del","Delete","#", "if (PermChecks.itemChecked()) swap('perm_del','toolbar/tool_delete_f2.gif');",
"if (PermChecks.itemChecked()) swap('perm_del', 'toolbar/tool_delete.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addcategory_permissions', 'm_perm_delete_group');",
"tool_delete.gif",FALSE,TRUE);
$listImages[] = "PermChecks.addImage('perm_del','$imagesURL/toolbar/tool_delete.gif','$imagesURL/toolbar/tool_delete_f3.gif',1); ";
$objListToolBar->Add("divider");
$objListToolBar->AddToInitScript($listImages);
/* ------------------------------------ Build the SQL statement to populate the list ---------------------------*/
$objGroupList = new clsGroupList();
$order = $objConfig->Get("Group_SortOrder");
$objGroupList->Clear();
$sql = "SELECT ResourceId, g.name as Name, ELT(g.Personal+1,'Group ','User ') as UserGroup FROM ".GetTablePrefix()."Permissions as p ";
$sql .="LEFT JOIN ".GetTablePrefix()."PortalGroup as g ON p.GroupId=g.GroupId WHERE p.CatId=".(int)$c->Get("CategoryId")." GROUP BY Name";
//$sql = "SELECT GroupId, count(*) as PermCount FROM ".GetTablePrefix()."Permissions WHERE CatId=".$c->Get("CategoryId")." GROUP BY GroupId";
$objGroupList->Query_Item($sql);
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
/* ---------------------------------------- Configure the list view ---------------------------------------- */
$objListView = new clsListView($objListToolBar,$objGroupList);
$objListView->IdField = "ResourceId";
$objListView->PageLinkTemplate = $pathtoroot. "admin/templates/user_page_link.tpl";
$objListView->ColumnHeaders->Add("Name",admin_language("la_prompt_Name"),1,0,$order,"width=\"20%\"",$SortFieldVar,$SortOrderVar,"Name");
$objListView->ColumnHeaders->Add("UserGroup",admin_language("la_Colheader_GroupType"),1,0,$order,"width=\"30%\"",$SortFieldVar,$SortOrderVar,"UserGroup");
$objListView->ColumnHeaders->SetSort($objConfig->Get($SortFieldVar),$order);
$objListView->PrintToolBar = FALSE;
$objListView->CurrentPageVar = $CurrentPageVar;
$objListView->PerPageVar = $PerPageVar;
$objListView->CheckboxName = "itemlist[]";
int_header($objListToolBar,NULL,$title);
if ($objSession->GetVariable("HasChanges") == 1) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Save_Item")); ?>
</td>
</tr>
</table>
<?php } ?>
<FORM method="POST" ACTION="" NAME="<?php echo $ListForm; ?>" ID="<?php echo $ListForm; ?>">
<?php
print $objListView->PrintList();
?>
<input type="hidden" name="Action" value="">
<INPUT TYPE="hidden" NAME="CategoryId" VALUE="<?php echo $c->Get("CategoryId"); ?>">
</FORM>
<FORM NAME="save_edit_buttons" ID="save_edit_buttons" method="POST" ACTION="">
<input type="hidden" NAME="Action" VALUE="save_category_edit">
<INPUT TYPE="hidden" NAME="CategoryId" VALUE="<?php echo $c->Get("CategoryId"); ?>">
<input type="hidden" name="CatEditStatus" VALUE="0">
</FORM>
<FORM NAME="popup" ID="popup" METHOD="POST" ACTION="addpermission_modules.php?<?php echo $envar; ?>">
<INPUT TYPE="hidden" NAME="itemlist">
</FORM>
<!-- CODE FOR VIEW MENU -->
<form ID="viewmenu" method="post" action="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>" name="viewmenu">
<input type="hidden" name="fieldname" value="">
<input type="hidden" name="varvalue" value="">
<input type="hidden" name="varvalue2" value="">
<input type="hidden" name="Action" value="">
</form>
<script src="<?php echo $adminURL; ?>/listview/listview.js"></script>
<script>
initSelectiorContainers();
<?php echo $objListToolBar->Get("CheckClass").".setImages();"; ?>
</script>
<!-- END CODE-->
<?php int_footer(); ?>
Property changes on: trunk/admin/category/addcategory_permissions.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property
Index: trunk/admin/category/category_maint.php
===================================================================
--- trunk/admin/category/category_maint.php (revision 122)
+++ trunk/admin/category/category_maint.php (revision 123)
@@ -1,233 +1,233 @@
<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
if(!strlen($pathtoroot))
{
$path = dirname(realpath($_SERVER['SCRIPT_FILENAME']));
if( strlen($path) )
{
// determine the OS type for path parsing
$pos = strpos($path, ':');
$gOS_TYPE = ($pos === false) ? 'unix' : 'win';
$pathchar = ($gOS_TYPE == 'unix') ? '/' : "\\";
$p = $path.$pathchar;
// Start looking for the root flag file
while( !strlen($pathtoroot) && strlen($p) )
{
$sub = substr($p, strlen($pathchar) * -1);
$filename = $p.( ($sub == $pathchar) ? '' : $pathchar).'root.flg';
if( !file_exists($filename) )
{
$parent = realpath($p.$pathchar."..".$pathchar);
$p = ($parent != $p) ? $parent : '';
}
else
$pathtoroot = $p;
}
if( !strlen($pathtoroot) ) $pathtoroot = '.'.$pathchar;
}
else
$pathtoroot = '.'.$pathchar;
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if( $sub != $pathchar) $pathtoroot = $pathtoroot.$pathchar;
//echo $pathtoroot;
$FrontEnd=2;
require_once($pathtoroot."kernel/startup.php");
//admin only util
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
//$pathtolocal = $pathtoroot."in-news/";
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
//require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");
$section = "in-portal:category_maint";
$CatsPerLoad = 10;
$ado = GetADODBConnection();
if(!is_numeric($_GET["CatIndex"]))
{
unset($objEditItems);
$objEditItems = new clsCatList();
$objEditItems->SourceTable = $objSession->GetEditTable("Category");
$table = $objEditItems->SourceTable;
//echo "Dropping Table..<br>\n";
@$ado->Execute("DROP TABLE $table");
if($objCatList->CurrentCategoryID()>0)
{
$c = $objCatList->GetItem($objCatList->CurrentCategoryID());
$path = $c->Get("ParentPath");
$sql = "SELECT CategoryId,ParentPath FROM ".$objCatList->SourceTable." WHERE ParentPath LIKE '".$path."%'";
$ado->Execute("CREATE TABLE $table ".$sql);
}
else
{
$sql = "SELECT CategoryId,ParentPath FROM ".$objCatList->SourceTable;
$objEditTable->SourceTable = $objCatList->SourceTable;
$table = $objCatList->SourceTable;
}
$NumCats = TableCount($table,"",0);
}
// init vars
if( !isset($NumCats) ) $NumCats = 0;
if( !isset($CatIndex) ) $CatIndex = 0;
if(is_numeric($_GET["CatIndex"]))
{
$NumCats = $_REQUEST['NumCats'];
$CatIndex = (int)$_REQUEST['CatIndex'];
$table = ($objCatList->CurrentCategoryID() > 0) ? $objSession->GetEditTable("Category") : $objCatList->SourceTable;
//echo $NumCats." Loaded <br>\n";
$title = prompt_language("la_prompt_updating")." ".prompt_language("la_Text_Categories");
$title .= " $CatIndex / $NumCats ".prompt_language("la_Text_complete");
}
else
$title = prompt_language("la_prompt_updating")." ".prompt_language("la_Text_Categories");
$sql = "SELECT * FROM $table ORDER BY ParentPath ASC LIMIT $CatIndex,$CatsPerLoad";
$start = getmicrotime();
//echo $sql."<br>\n";
$objCatList->Query_Item($sql);
//echo getmicrotime() - $start." QUERY ".$x."<br>\n";
$x = 0;
foreach($objCatList->Items as $cat)
{
// echo getmicrotime() - $start." START ".$x."<br>\n";
$cat->UpdateACL();
// echo getmicrotime() - $start." ACL ".$x."<br>\n";
$cat->UpdateCachedPath();
// echo getmicrotime() - $start." PATH ".$x."<br>\n";
$x++;
// echo "<br>\n";
// echo $cat->Get("ParentPath")."<br>\n";
// $cat->UpdateCacheCounts();
// $objSystemCache->PurgeCategory($cat->Get("CategoryId"));
}
int_header(NULL,NULL,$title);
?>
<TABLE cellspacing="0" cellpadding="2" width="100%" border="0" class="tableborder">
<script language="javascript">
function goto_url(url)
{
document.location = url;
}
</script>
<?php
if(!is_numeric($_GET["CatIndex"]) && $NumCats > $CatsPerLoad)
{
int_subsection_title(prompt_language("la_confirm_maintenance"));
$yes_url = $_SERVER['PHP_SELF'].'?env='.BuildEnv().'&CatIndex=0&NumCats='.$NumCats;
$no_url = $adminURL.'/browse.php?env='.BuildEnv();
?>
<tr>
<td align="center" colspan="3" bgcolor="#FFFFFF"><?php echo prompt_language("la_prompt_perform_now"); ?></td>
</tr>
<tr>
<td align="right" width="50%">
<input type="button" name="yes_btn" value="<?php echo admin_language("lu_yes"); ?>" onclick="javascript:goto_url('<?php echo $yes_url; ?>');" class="button">
</td>
<td><img src="<?php echo $imagesURL; ?>/spacer.gif" width="10"></td>
<td align="left" width="50%">
<input type="button" name="yes_btn" value="<?php echo admin_language("lu_no"); ?>" onclick="javascript:goto_url('<?php echo $no_url; ?>');" class="button">
</td>
</tr>
</table>
<?php
int_footer();
die();
}
?>
<?php int_subsection_title(""); ?>
<?php
if($NumCats==0)
{
$percent=100;
}
else
{
$percent = (int)(($CatIndex/$NumCats) * 100);
}
if(is_numeric($_GET["CatIndex"]))
{
if ($percent == 0)
{
echo "<TR>";
echo "<TD BGCOLOR=\"#FFFFFF\" width=\"100%\" >$percent";
echo "%</td></TR>";
}
else if ($percent < 60)
{
echo "<TR><TD BGCOLOR=\"#4682B2\" width=\"".$percent."%\" >";
$row2 = 100-$percent;
echo "</td> <TD BGCOLOR=\"#FFFFFF\" width=\"".$row2."%\" > $percent";
echo "%</td></TR>";
}
else if ($percent == 100)
{
echo "<TR><TD BGCOLOR=\"#4682B2\" align=\"right\" width=\"100%\" ><FONT COLOR=\"#FFFFFF\">$percent%</FONT></td>";
}
else
{
echo "<TR><TD BGCOLOR=\"#4682B2\" align=\"right\" width=\"".$percent."%\" ><FONT COLOR=\"#FFFFFF\">$percent%</FONT>";
$row2 = 100-$percent;
echo "</td> <TD BGCOLOR=\"#FFFFFF\" width=\"".$row2."%\" ></td></TR>";
}
}
flush();
?>
</TABLE>
<?php
if($CatIndex+1 >$NumCats)
{
- $target = $adminURL."/browse.php?env=".BuildEnv();
+ $target = $adminURL."/".$objSession->GetVariable('ReturnScript').'?env='.BuildEnv(); //$adminURL."/browse.php?env=".BuildEnv();
}
else
{
$next = $CatIndex+$CatsPerLoad;
if($next > $NumCats)
{
- $target = $adminURL."/browse.php?env=".BuildEnv();
+ $target = $adminURL."/".$objSession->GetVariable('ReturnScript').'?env='.BuildEnv(); //$adminURL."/browse.php?env=".BuildEnv();
}
else
$target = $_SERVER["PHP_SELF"]."?env=".BuildEnv()."&CatIndex=".$next."&NumCats=$NumCats";
}
//print "<A HREF=\"$target\">$target</A>";
print "<script language=\"javascript\">" ;
print "setTimeout(\"document.location='$target';\",40);";
print " </script>";
?>
<?php int_footer(); ?>
Property changes on: trunk/admin/category/category_maint.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/admin/category/addcategory.php
===================================================================
--- trunk/admin/category/addcategory.php (revision 122)
+++ trunk/admin/category/addcategory.php (revision 123)
@@ -1,381 +1,381 @@
<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
if(!strlen($pathtoroot))
{
$path=dirname(realpath($_SERVER['SCRIPT_FILENAME']));
if(strlen($path))
{
/* determine the OS type for path parsing */
$pos = strpos($path,":");
if ($pos === false)
{
$gOS_TYPE="unix";
$pathchar = "/";
}
else
{
$gOS_TYPE="win";
$pathchar="\\";
}
$p = $path.$pathchar;
/*Start looking for the root flag file */
while(!strlen($pathtoroot) && strlen($p))
{
$sub = substr($p,strlen($pathchar)*-1);
if($sub==$pathchar)
{
$filename = $p."root.flg";
}
else
$filename = $p.$pathchar."root.flg";
if(file_exists($filename))
{
$pathtoroot = $p;
}
else
{
$parent = realpath($p.$pathchar."..".$pathchar);
if($parent!=$p)
{
$p = $parent;
}
else
$p = "";
}
}
if(!strlen($pathtoroot))
$pathtoroot = ".".$pathchar;
}
else
{
$pathtoroot = ".".$pathchar;
}
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
//echo $pathtoroot;
require_once($pathtoroot."kernel/startup.php");
//admin only util
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
//$pathtolocal = $pathtoroot."in-news/";
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
//require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
unset($objEditItems);
if($_REQUEST['item'])
{
// smulate like normal edit button pressed
$tmp_cat =& $objCatList->GetItemByField('ResourceId', $_REQUEST['item']);
$_POST['catlist'][] = $tmp_cat->UniqueId();
}
$objEditItems = new clsCatList();
$objEditItems->SourceTable = $objSession->GetEditTable("Category");
$objCustomFields = new clsCustomFieldList(1);
$objCustomDataList = new clsCustomDataList();
$objRelList = new clsRelationshipList();
$objImages = new clsImageList();
//Multiedit init
if ($_GET["new"] == 1)
{
$c = new clsCategory(NULL);
$c->Set("CreatedOn", time());
$c->Set("EndOn", time());
$c->Set("ParentId",$objCatList->CurrentCategoryID());
$c->Set("NewItem",2); //auto
$c->Set("Status",2); //pending
$en = 0;
$action = "m_add_category";
$objCatList->CreateEmptyEditTable("CategoryId");
$objRelList->CreateEmptyEditTable("RelationshipId");
$objCustomDataList->CreateEmptyEditTable("CustomDataId");
$objImages->CreateEmptyEditTable("ResourceId");
$TitleVerb = prompt_language("la_Text_Adding");
}
else
{
if(isset($_POST["catlist"]))
{
$cats = $_POST["catlist"];
$objCatList->CopyToEditTable("CategoryId",$cats);
$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable);
/* make a copy of the relationship records */
$ids = $objEditItems->GetResourceIDList();
$objRelList->CopyToEditTable("SourceId", $ids);
$objCustomDataList->CopyToEditTable("ResourceId",$ids);
$objImages->CopyToEditTable("ResourceId", $ids);
$c = $objEditItems->GetItemByIndex(0);
$itemcount=$objEditItems->NumItems();
$en = 0;
}
else
{
if($_GET["item"])
{
/*shortcut to edit link */
$objCatList->CopyToEditTable("ResourceId",$_GET["item"]);
$backurl = $_GET["return"];
}
//Multiedit init
$en = (int)$_GET["en"];
$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable);
//$ids = $objEditItems->GetResourceIDList();
//$objRelList->CopyToEditTable("SourceId", $ids);
//$objCustomDataList->CopyToEditTable("ResourceId",$ids);
//$objImages->CopyToEditTable("ResourceId", $ids);
$itemcount=$objEditItems->NumItems();
$c = $objEditItems->GetItemByIndex($en);
}
if($itemcount>1)
{
if ($en+1 == $itemcount)
$en_next = -1;
else
$en_next = $en+1;
if ($en == 0)
$en_prev = -1;
else
$en_prev = $en-1;
}
$action = "m_edit_category";
$TitleVerb = prompt_language("la_Text_Editing");
}
$envar = "env=" . BuildEnv() . "&en=$en";
$section = 'in-portal:editcategory_general';
if (strlen($c->Get("Name")))
$editing_category_title = "'".$c->Get("Name")."' ";
else
$editing_category_title = "";
$title = $TitleVerb." ".prompt_language("la_Text_Category")." $editing_category_title- ".prompt_language("la_tab_General");
//$saveURL = $admin."/browse.php";
$saveURL = $admin."/category/category_maint.php";
-$cancelURL = $admin."/browse.php";
+$cancelURL = $admin."/".$objSession->GetVariable('ReturnScript');
//Display header
$sec = $objSections->GetSection($section);
$objCatToolBar = new clsToolBar();
$objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('category','CatEditStatus','$saveURL',1,'');","tool_select.gif");
$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('category','CatEditStatus','$cancelURL',2,'');","tool_cancel.gif");
if ( isset($en_prev) || isset($en_next) )
{
$url = $RootUrl.$admin."/category/addcategory.php";
$StatusField = "CatEditStatus";
$form = "category";
MultiEditButtons($objCatToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'','la_PrevCategory','la_NextCategory');
}
int_header($objCatToolBar,NULL,$title);
if ($objSession->GetVariable("HasChanges") == 1) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Save_Item")); ?>
</td>
</tr>
</table>
<?php } ?>
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
<form ID="category" name="category" action="" method=POST>
<tr <?php int_table_color(1); ?>>
<td valign="top" colspan="3"><?php echo prompt_language("la_prompt_Enable_HTML"); ?>
<input type="checkbox" name="html_enable" value="1" checked>
<br>
<?php int_hint(prompt_language("la_Warning_Enable_HTML")); ?>
</td>
</tr>
<?php int_subsection_title(prompt_language("la_Text_Category")); ?>
<?php if( $c->Get("CategoryId") > 0 ) { ?>
<tr <?php int_table_color(); ?>>
<td valign="top"><span class="text"><?php echo prompt_language("la_prompt_CategoryId"); ?></span></td>
<td valign="top"><span class="text"><?php echo $c->Get("CategoryId"); ?></span></td>
<td><span class="text">&nbsp;</span></td>
</tr>
<?php } ?>
<tr <?php int_table_color(); ?>>
<td valign="top"><span ID="prompt_cat_name" class="text"><?php echo prompt_language("la_prompt_Name"); ?></span></td>
<td>
<input type="text" name="cat_name" ValidationType="exists" tabindex="1" class="text" size="30" value="<?php echo $c->parsetag("cat_name"); ?>">
</td>
<td></td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span ID="prompt_cat_desc" class="text"><?php echo prompt_language("la_prompt_Description"); ?></span>
<br />
<a href="#">
<img src="<?php echo $rootURL; ?>admin/icons/icon24_link_editor.gif" style="cursor:hand" border="0"
ONCLICK="document.forms[0].elements[0].checked=true; OpenEditor('&section=<?php echo $section; ?>','category','cat_desc');">
</a>
</td>
<td>
<textarea name="cat_desc" tabindex="2" ValidationType="exists" cols="60" rows="5" class="text"><?php echo inp_textarea_unescape($c->parsetag("cat_desc")); ?></textarea>
</td>
<td></td>
</tr>
<?php int_subsection_title(prompt_language("la_tab_Properties")); ?>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_status" class="text"><?php echo prompt_language("la_prompt_Status"); ?></span></td>
<td>
<input type="radio" tabindex="3" name="status" class="text" value="1" <?php if($c->Get("Status") == 1) echo "checked"; ?>><?php echo prompt_language("la_val_Active"); ?>
<input type="radio" tabindex="3" name="status" class="text" value="2" <?php if($c->Get("Status") == 2) echo "checked"; ?>><?php echo prompt_language("la_val_Pending"); ?>
<input type="radio" tabindex="3" name="status" class="text" value="0" <?php if($c->Get("Status") == 0) echo "checked"; ?>><?php echo prompt_language("la_val_Disabled"); ?>
</td>
<td class="text">&nbsp;</td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_itemnew" class="text"><?php echo prompt_language("la_prompt_New"); ?></span></td>
<td>
<input type="radio" tabindex="4" name="itemnew" class="text" value="2" <?php if($c->Get("NewItem") == 2) echo "checked"; ?>><?php echo prompt_language("la_val_Auto"); ?>
<input type="radio" tabindex="4" name="itemnew" class="text" value="1" <?php if($c->Get("NewItem") == 1) echo "checked"; ?>><?php echo prompt_language("la_val_Always"); ?>
<input type="radio" tabindex="4" name="itemnew" class="text" value="0" <?php if($c->Get("NewItem") == 0) echo "checked"; ?>><?php echo prompt_language("la_val_Never"); ?>
</td>
<td class="text">&nbsp;</td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_cat_pick" class="text"><?php echo prompt_language("la_prompt_EditorsPick"); ?></span></td>
<td>
<input type="checkbox" tabindex="5" name="cat_pick" class="text" value="1" <?php if($c->Get("EditorsPick") == 1) echo "checked"; ?>>
</td>
<td class="text">&nbsp;</td>
</tr>
<TR <?php int_table_color(); ?> >
<TD><span id="prompt_Priority" class="text"><?php echo prompt_language("la_prompt_Priority"); ?></span></TD>
<TD><input type=text SIZE="5" tabindex="6" NAME="Priority" VALUE="<?php echo $c->Get("Priority"); ?>"></TD>
<TD>&nbsp;</TD>
</TR>
<tr <?php int_table_color(); ?>>
<td valign="top" ID="prompt_cat_date" class="text"> <?php echo prompt_language("la_prompt_CreatedOn"); ?> </td>
<td>
<input type="text" ValidationType="date,exists" tabindex="7" name="cat_date" id="cat_date_selector" datepickerIcon="../images/ddarrow.gif" class="text" size="20" value="<?php echo $c->parsetag("cat_date"); ?>">
<span class="small"><?php echo prompt_language("la_prompt_DateFormat"); ?></span></td>
<td></td>
</tr>
<?php int_subsection_title(prompt_language("la_Sectionheader_MetaInformation")); ?>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_meta_keywords" class="text"><?php echo prompt_language("la_prompt_MetaKeywords"); ?></span></td>
<td>
<input type="text" name="meta_keywords" tabindex="8" class="text" size="30" value="<?php echo $c->parsetag("cat_metakeywords"); ?>">
</td>
<td class="text">&nbsp;</td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_meta_desc" class="text"><?php echo prompt_language("la_prompt_MetaDescription"); ?></span></td>
<td>
<textarea name="meta_desc" tabindex="9" cols="60" rows="2" class="text"><?php echo inp_textarea_unescape($c->parsetag("cat_metadesc")); ?></textarea>
</td>
<td class="text">&nbsp;</td>
</tr>
<?php
$CustomFieldUI = $objCustomFields->GetFieldUIList(TRUE);
if($CustomFieldUI->NumItems()>0)
{
$objCustomDataList->SourceTable = $objSession->GetEditTable("CustomMetaData");
if((int)$c->Get("ResourceId")>0)
{
$objCustomDataList->LoadResource($c->Get("ResourceId"));
}
$headings = $CustomFieldUI->GetHeadingList();
//echo "<PRE>";print_r($objCustomFields); echo "</PRE>";
for($i=0;$i<=count($headings);$i++)
{
$h = $headings[$i];
if(strlen($h))
{
int_subsection_title(prompt_language($h));
$Items = $CustomFieldUI->GetHeadingItems($h);
foreach($Items as $f)
{
$n = substr($f->name,1);
$cfield = $objCustomFields->GetItemByField("FieldName",$n,FALSE);
if(is_object($cfield))
{
$cv = $objCustomDataList->GetDataItem($cfield->Get("CustomFieldId"));
if(is_object($cv))
{
$f->default_value = $cv->Get("Value");
}
}
print "<tr ".int_table_color_ret().">\n";
print " <td valign=\"top\" class=\"text\">".$f->GetPrompt()."</td>\n";
print " <td nowrap>".$f->ItemFormElement()."</TD>";
if(is_object($f->NextItem))
{
$n = $f->NextItem;
print " <td>".$n->ItemFormElement()."</TD>";
}
else
print " <td><span class=\"text\">&nbsp;</span></td>\n";
print "</tr>\n";
}
}
}
}
?>
<input type="hidden" name="ParentId" value="<?php echo $c->Get("ParentId"); ?>">
<input type="hidden" name="CategoryId" value="<?php echo $c->parsetag("cat_id"); ?>">
<input type="hidden" name="Action" value="<?php echo $action; ?>">
<input type="hidden" name="CatEditStatus" VALUE="0">
</FORM>
</table>
<script src="<?php echo $adminURL; ?>/include/calendar.js"></script>
<SCRIPT language="JavaScript">
initCalendar("cat_date_selector", CalDateFormat);
</SCRIPT>
<FORM method="POST" NAME="save_edit" ID="save_edit">
<input type="hidden" name="CatEditStatus" VALUE="0">
</FORM>
<?php
MarkFields('category');
int_footer();
?>
Property changes on: trunk/admin/category/addcategory.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property
Index: trunk/admin/category/addcategory_relations.php
===================================================================
--- trunk/admin/category/addcategory_relations.php (revision 122)
+++ trunk/admin/category/addcategory_relations.php (revision 123)
@@ -1,434 +1,434 @@
<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
if(!strlen($pathtoroot))
{
$path=dirname(realpath($_SERVER['SCRIPT_FILENAME']));
if(strlen($path))
{
/* determine the OS type for path parsing */
$pos = strpos($path,":");
if ($pos === false)
{
$gOS_TYPE="unix";
$pathchar = "/";
}
else
{
$gOS_TYPE="win";
$pathchar="\\";
}
$p = $path.$pathchar;
/*Start looking for the root flag file */
while(!strlen($pathtoroot) && strlen($p))
{
$sub = substr($p,strlen($pathchar)*-1);
if($sub==$pathchar)
{
$filename = $p."root.flg";
}
else
$filename = $p.$pathchar."root.flg";
if(file_exists($filename))
{
$pathtoroot = $p;
}
else
{
$parent = realpath($p.$pathchar."..".$pathchar);
if($parent!=$p)
{
$p = $parent;
}
else
$p = "";
}
}
if(!strlen($pathtoroot))
$pathtoroot = ".".$pathchar;
}
else
{
$pathtoroot = ".".$pathchar;
}
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
//echo $pathtoroot;
require_once($pathtoroot."kernel/startup.php");
//admin only util
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
//$pathtolocal = $pathtoroot."in-news/";
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
//require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");
$m = GetModuleArray();
foreach($m as $key => $value)
{
$path = $pathtoroot.$value."admin/include/parser.php";
if( file_exists($path) ) include_once($path);
}
/* ------------------------------------- Edit Table --------------------------------------------------- */
unset($objEditItems);
$objEditItems = new clsCatList();
$objEditItems->SourceTable = $objSession->GetEditTable("Category");
//Multiedit init
$en = (int)$_GET["en"];
$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable);
$itemcount=$objEditItems->NumItems();
$c = $objEditItems->GetItemByIndex($en);
if($itemcount>1)
{
if ($en+1 == $itemcount)
$en_next = -1;
else
$en_next = $en+1;
if ($en == 0)
$en_prev = -1;
else
$en_prev = $en-1;
}
$action = "m_edit_category";
/* -------------------------------------- Section configuration ------------------------------------------- */
$envar = "env=" . BuildEnv() . "&en=$en";
$section = 'in-portal:editcategory_relations';
$title = admin_language("la_Text_Editing")." ".admin_language("la_Text_Category")." '".$c->Get("Name")."' - ".admin_language("la_tab_Relations");
$SortFieldVar = "Relation_LV_Sortfield";
$SortOrderVar = "Relation_LV_Sortorder";
$DefaultSortField = "ItemName";
$PerPageVar = "Perpage_Relations";
$CurrentPageVar = "Page_Relations";
$CurrentFilterVar = "CatRel_View";
$ListForm = "permlistform";
$CheckClass = "PermChecks";
$saveURL = $admin."/category/category_maint.php";
-
+$cancelURL = $admin."/".$objSession->GetVariable('ReturnScript');
//echo $envar."<br>\n";
/* ------------------------------------- Configure the toolbar ------------------------------------------- */
$objListToolBar = new clsToolBar();
$objListToolBar->Add("img_save", "la_Save","","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('save_edit_buttons','CatEditStatus','$saveURL',1);","tool_select.gif");
-$objListToolBar->Add("img_cancel", "la_Cancel","","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('save_edit_buttons','CatEditStatus','".$admin."/browse.php',2);","tool_cancel.gif");
+$objListToolBar->Add("img_cancel", "la_Cancel","","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('save_edit_buttons','CatEditStatus','".$cancelURL."',2);","tool_cancel.gif");
if($itemcount == 1) $objListToolBar->Add("divider");
$objListToolBar->Set("section",$section);
$objListToolBar->Set("load_menu_func","");
$objListToolBar->Set("CheckClass",$CheckClass);
$objListToolBar->Set("CheckForm",$ListForm);
//Display header
$sec = $objSections->GetSection($section);
if ( isset($en_prev) || isset($en_next) )
{
$url = $RootUrl.$admin."/category/addcategory_relations.php";
$StatusField = "CatEditStatus";
$form = "category";
MultiEditButtons($objListToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'','la_PrevCategory','la_NextCategory');
$objListToolBar->Add("divider");
}
$listImages = array();
//$img, $alt, $link, $onMouseOver, $onMouseOut, $onClick
$objListToolBar->Add("new_rel", "la_ToolTip_New_Relation","#".$envar,"swap('new_rel','toolbar/tool_new_relation_f2.gif');",
"swap('new_rel', 'toolbar/tool_new_relation.gif');",
"OpenItemSelector('$envar&source=addcategory_relations&CatId=".$c->Get("CategoryId")."&destform=popup&destfield=itemlist&Selector=radio');",
"tool_new_relation.gif",FALSE,FALSE);
$objListToolBar->Add("rel_edit","la_ToolTip_Edit","#", "if (PermChecks.itemChecked()) swap('rel_edit','toolbar/tool_edit_f2.gif');",
"if (PermChecks.itemChecked()) swap('rel_edit', 'toolbar/tool_edit.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addrelation', '');",
"tool_edit.gif",TRUE,TRUE);
$listImages[] = "PermChecks.addImage('rel_edit','$imagesURL/toolbar/tool_edit.gif','$imagesURL/toolbar/tool_edit_f3.gif',1); ";
$objListToolBar->Add("rel_del","la_ToolTip_Delete","#", "if (PermChecks.itemChecked()) swap('rel_del','toolbar/tool_delete_f2.gif');",
"if (PermChecks.itemChecked()) swap('rel_del', 'toolbar/tool_delete.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addcategory_relations', 'm_rel_delete');",
"tool_delete.gif",FALSE,TRUE);
$listImages[] = "PermChecks.addImage('rel_del','$imagesURL/toolbar/tool_delete.gif','$imagesURL/toolbar/tool_delete_f3.gif',1); ";
$objListToolBar->Add("divider");
$objListToolBar->Add("rel_move_up","la_ToolTip_Move_Up","#", "if (PermChecks.itemChecked()) swap('rel_move_up','toolbar/tool_move_up_f2.gif');",
"if (PermChecks.itemChecked()) swap('rel_move_up', 'toolbar/tool_move_up.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addcategory_relations', 'm_rel_move_up');",
"tool_move_up.gif",FALSE,TRUE);
$listImages[] = "PermChecks.addImage('rel_move_up','$imagesURL/toolbar/tool_move_up.gif','$imagesURL/toolbar/tool_move_up_f3.gif',1); ";
$objListToolBar->Add("rel_move_down","la_ToolTip_Move_Down","#", "if (PermChecks.itemChecked()) swap('rel_move_down','toolbar/tool_move_down_f2.gif');",
"if (PermChecks.itemChecked()) swap('rel_move_down', 'toolbar/tool_move_down.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addcategory_relations', 'm_rel_move_down');",
"tool_move_down.gif",FALSE,TRUE);
$listImages[] = "PermChecks.addImage('rel_move_down','$imagesURL/toolbar/tool_move_down.gif','$imagesURL/toolbar/tool_move_down_f3.gif',1); ";
$objListToolBar->Add("divider");
$objListToolBar->Add("viewmenubutton", "la_ToolTip_View","#","swap('viewmenubutton','toolbar/tool_view_f2.gif'); ",
"swap('viewmenubutton', 'toolbar/tool_view.gif');",
"ShowViewMenu();","tool_view.gif");
$objListToolBar->AddToInitScript($listImages);
/* ----------------------------------------- Set the View Filter ---------------------------------------- */
$Rel_AllValue = 255;
$Bit_Categories = 1;
$Bit_Links = 2;
$Bit_News = 4;
$Bit_Topics = 8;
$Bit_OneWay = 16;
$Bit_Recip = 32;
$Bit_Enabled=64;
$Bit_Disabled=128;
$FilterLabels[0] = admin_language("la_Text_Category");
$FilterLabels[1] = admin_language("la_Text_Links");
$FilterLabels[2] = admin_language("la_Text_Articles");
$FilterLabels[3] = admin_language("la_Text_Topics");
$FilterLabels[4] = admin_language("la_Text_OneWay");
$FilterLabels[5] = admin_language("la_Text_Reciprocal");
$FilterLabels[6] = admin_language("la_Text_Enabled");
$FilterLabels[7] = admin_language("la_Text_Disabled");
$RelView = $objConfig->Get($CurrentFilterVar);
if(!is_numeric($RelView))
{
$RelView = $Rel_AllValue;
}
else
{
$RelTypes = array();
if($RelView & $Bit_Categories)
$RelTypes[] = 1;
if($RelView & $Bit_Links)
$RelTypes[] = 4;
if($RelView & $Bit_News)
$RelTypes[] = 2;
if($RelView & $Bit_Topics)
$RelTypes[] = 3;
$RelFilters = array();
if(count($RelTypes))
{
$TypeFilter = "rel.TargetType IN (".implode(",",$RelTypes).")";
}
$RelTypes = array();
if($RelView & $Bit_OneWay)
$RelTypes[] = 0;
if($RelView & $Bit_Recip)
$RelTypes[] = 1;
if(count($RelTypes))
$RelFilters[] = "rel.Type IN (".implode(",",$RelTypes).")";
if($RelView & $Bit_Enabled)
$RelFilters[] = "rel.Enabled=1";
if($RelView & $Bit_Disabled)
$RelFilters[] = "rel.Enabled=0";
if(count($RelFilters))
{
$RelFilter = $TypeFilter." AND (". implode(" OR ",$RelFilters).")";
}
else
$RelFilter = $TypeFilter;
}
//$r =& $c->RelationObject();
$objRelList = new clsRelationshipList();
$objRelList->SourceTable = $objSession->GetEditTable("Relationship");
$reltable = $objRelList->SourceTable;
// ==== build sql depending on modules installed: begin ====
$prefix = GetTablePrefix();
$modules = $objModules->GetModuleList();
$sql_source = $objModules->ExecuteFunction('GetModuleInfo', 'rel_list');
$sql_templates['ItemName'] = 'IFNULL('.$prefix."%s.%s,' ')";
$sql_templates['TableJoin'] = 'LEFT JOIN '.$prefix."%1\$s ON ".$prefix."%1\$s.ResourceId = rel.TargetId";
$sql_templates['TargetName'] = "IF(rel.TargetType = %s, '%s', %s)";
$sql = "SELECT TRIM(CONCAT(%s)) AS ItemName, %s AS ItemType,".
GetELT('rel.Type+1', Array('la_Text_OneWay','la_Text_Reciprocal')).' AS RelationType,'.
"RelationshipId, rel.Priority AS Priority, rel.Type as Type, rel.Enabled as Enabled,".
GetELT('rel.Enabled+1', Array('la_Text_Disabled','la_Text_Enabled')).' AS Status '.
'FROM '.$reltable.' AS rel %s WHERE rel.SourceId = '.$c->Get('ResourceId');
$sql_parts = Array();
$sql_parts['TargetName'] = "''";
foreach($modules as $module)
{
$sql_parts['ItemName'][] = sprintf($sql_templates['ItemName'], $sql_source[$module]['MainTable'], $sql_source[$module]['ItemNameField']);
$sql_parts['TableJoin'][] = sprintf($sql_templates['TableJoin'], $sql_source[$module]['MainTable']);
$sql_parts['TargetName'] = sprintf( $sql_templates['TargetName'],
$sql_source[$module]['TargetType'],
admin_language($sql_source[$module]['ItemNamePhrase']),
$sql_parts['TargetName']);
}
$sql = sprintf($sql, implode(', ',$sql_parts['ItemName']), $sql_parts['TargetName'], implode(' ',$sql_parts['TableJoin']));
// ==== build sql depending on modules installed: end ====
if(strlen($RelFilter))
{
$sql .= " AND (".$RelFilter.")";
}
$SearchWords = $objSession->GetVariable("CatRelSearchWord");
if(strlen($SearchWords))
{
$where = $objRelList->AdminSearchWhereClause($SearchWords);
}
else
$where = "";
if(strlen($where))
$sql .= " AND ($where)";
if(strlen(trim($objConfig->Get($SortFieldVar))))
{
$order = " ORDER BY rel.Priority DESC, ".$objConfig->Get($SortFieldVar)." ".$objConfig->Get($SortOrderVar);
}
else
$order = " ORDER BY rel.Priority DESC";
if($objConfig->Get($CurrentPageVar)>0)
{
$objRelList->Page = $objConfig->Get($CurrentPageVar);
}
if($objConfig->Get($PerPageVar)>0)
{
$objListView->PerPage = $objConfig->Get($PerPageVar);
}
$sql .= $order." ".$objRelList->GetLimitSQL();
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
$objRelList->Query_Item($sql);
/* ---------------------------------------- Configure the list view ---------------------------------------- */
$objListView = new clsListView($objListToolBar,$objRelList);
$objListView->IdField = "RelationshipId";
$objListView->ColumnHeaders->Add("ItemName",admin_language("la_ColHeader_Item"),1,0,$order,"width=\"30%\"",$SortFieldVar,$SortOrderVar,"ItemName");
$objListView->ColumnHeaders->Add("ItemType",admin_language("la_ColHeader_ItemType"),1,0,$order,"width=\"20%\"",$SortFieldVar,$SortOrderVar,"ItemType");
$objListView->ColumnHeaders->Add("RelationType",admin_language("la_prompt_RelationType"),1,0,$order,"width=\"10%\"",$SortFieldVar,$SortOrderVar,"RelationType");
$objListView->ColumnHeaders->Add("Status",admin_language("la_prompt_Status"),1,0,$order,"width=\"10%\"",$SortFieldVar,$SortOrderVar,"Status");
$objListView->ColumnHeaders->SetSort($objConfig->Get($SortFieldVar), $objConfig->Get($SortOrderVar));
$objListView->PrintToolBar = FALSE;
$objListView->SearchBar = TRUE;
$objListView->SearchKeywords = $SearchWords;
$objListView->SearchAction="m_rel_search";
$objListView->CurrentPageVar = $CurrentPageVar;
$objListView->PerPageVar = $PerPageVar;
$objListView->CheckboxName = "itemlist[]";
$objListView->ConfigureViewMenu($SortFieldVar,$SortOrderVar,$DefaultSortField,
$CurrentFilterVar,$RelView,$Rel_AllValue);
foreach($FilterLabels as $Bit=>$Label)
{
$objListView->AddViewMenuFilter($Label,$Bit);
}
for($i=0;$i<count($objRelList->Items);$i++)
{
$rel =& $objRelList->GetItemRefByIndex($i);
$objListView->RowIcons[] = $rel->Admin_Icon();
}
$objListToolBar->AddToInitScript("fwLoadMenus();\n");
$h = "\n\n<SCRIPT Language=\"JavaScript1.2\">\n".$objListView->GetViewMenu($imagesURL)."\n</SCRIPT>\n";
int_header($objListToolBar,NULL, $title,NULL,$h);
if ($objSession->GetVariable("HasChanges") == 1) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Save_Item")); ?>
</td>
</tr>
</table>
<?php } ?>
<FORM method="POST" ACTION="" NAME="<?php echo $ListForm; ?>" ID="<?php echo $ListForm; ?>">
<?php
print $objListView->PrintList();
?>
<input type="hidden" name="Action" value="">
<INPUT TYPE="hidden" NAME="CategoryId" VALUE="<?php echo $c->Get("CategoryId"); ?>">
<INPUT TYPE="hidden" NAME="SourceId" VALUE = "<?php echo $c->Get("ResourceId"); ?>">
</FORM>
<FORM NAME="popup" ID="popup" METHOD="POST" ACTION="addrelation.php?<?php echo $envar; ?>">
<INPUT TYPE="hidden" NAME="TargetId"><INPUT TYPE="hidden" NAME="TargetType">
<INPUT TYPE="hidden" NAME="Action" value="m_add_relation_form">
</FORM>
<!-- CODE FOR VIEW MENU -->
<form ID="viewmenu" method="post" action="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>" name="viewmenu">
<input type="hidden" name="fieldname" value="">
<input type="hidden" name="varvalue" value="">
<input type="hidden" name="varvalue2" value="">
<input type="hidden" name="Action" value="">
</form>
<FORM NAME="save_edit_buttons" ID="save_edit_buttons" method="POST" ACTION="">
<tr <?php int_table_color(); ?>>
<td colspan="3">
<input type=hidden NAME="Action" VALUE="save_category_edit">
<input type="hidden" name="CatEditStatus" VALUE="0">
</td>
</tr>
</FORM>
<FORM ID="ListSearchForm" NAME="ListSearchForm" method="POST" action="<?php echo $_SERVER["PHP_SELF"]."?env=".BuildEnv(); ?>">
<INPUT TYPE="HIDDEN" NAME="Action" VALUE="">
<INPUT TYPE="HIDDEN" NAME="list_search">
</FORM>
<script src="<?php echo $adminURL; ?>/listview/listview.js"></script>
<script>
initSelectiorContainers();
<?php echo $objListToolBar->Get("CheckClass").".setImages();"; ?>
</script>
<!-- END CODE-->
<?php int_footer(); ?>
\ No newline at end of file
Property changes on: trunk/admin/category/addcategory_relations.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/admin/advanced_view.php
===================================================================
--- trunk/admin/advanced_view.php (nonexistent)
+++ trunk/admin/advanced_view.php (revision 123)
@@ -0,0 +1,377 @@
+<?php
+##############################################################
+##In-portal ##
+##############################################################
+## In-portal ##
+## Intechnic Corporation ##
+## All Rights Reserved, 1998-2002 ##
+## ##
+## No portion of this code may be copied, reproduced or ##
+## otherwise redistributed without proper written ##
+## consent of Intechnic Corporation. Violation will ##
+## result in revocation of the license and support ##
+## privileges along maximum prosecution allowed by law. ##
+##############################################################
+//$pathtoroot="";
+
+$b_topmargin = "0";
+//$b_header_addon = "<DIV style='position:relative; z-Index: 1; background-color: #ffffff; padding-top:1px;'><div style='position:absolute; width:100%;top:0px;' align='right'><img src='images/logo_bg.gif'></div><img src='images/spacer.gif' width=1 height=15><br><div style='z-Index:1; position:relative'>";
+
+if(!strlen($pathtoroot))
+{
+ $path=dirname(realpath($_SERVER['SCRIPT_FILENAME']));
+ if(strlen($path))
+ {
+ /* determine the OS type for path parsing */
+ $pos = strpos($path,":");
+ if ($pos === false)
+ {
+ $gOS_TYPE="unix";
+ $pathchar = "/";
+ }
+ else
+ {
+ $gOS_TYPE="win";
+ $pathchar="\\";
+ }
+ $p = $path.$pathchar;
+ /*Start looking for the root flag file */
+ while(!strlen($pathtoroot) && strlen($p))
+ {
+ $sub = substr($p,strlen($pathchar)*-1);
+ if($sub==$pathchar)
+ {
+ $filename = $p."root.flg";
+ }
+ else
+ $filename = $p.$pathchar."root.flg";
+ if(file_exists($filename))
+ {
+ $pathtoroot = $p;
+ }
+ else
+ {
+ $parent = realpath($p.$pathchar."..".$pathchar);
+ if($parent!=$p)
+ {
+ $p = $parent;
+ }
+ else
+ $p = "";
+ }
+ }
+ if(!strlen($pathtoroot))
+ $pathtoroot = ".".$pathchar;
+ }
+ else
+ {
+ $pathtoroot = ".".$pathchar;
+ }
+}
+
+$sub = substr($pathtoroot,strlen($pathchar)*-1);
+if($sub!=$pathchar)
+{
+ $pathtoroot = $pathtoroot.$pathchar;
+}
+//echo $pathtoroot;
+
+require_once($pathtoroot."kernel/startup.php");
+
+if (!admin_login())
+{
+ if(!headers_sent())
+ setcookie("sid"," ",time()-3600);
+ $objSession->Logout();
+ header("Location: ".$adminURL."/login.php");
+ die();
+ //require_once($pathtoroot."admin/login.php");
+}
+
+$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
+$admin = $objConfig->Get("AdminDirectory");
+if(!strlen($admin))
+ $admin = "admin";
+
+$localURL=$rootURL."kernel/";
+$adminURL = $rootURL.$admin;
+$imagesURL = $adminURL."/images";
+$browseURL = $adminURL."/browse";
+$cssURL = $adminURL."/include";
+
+$indexURL = $rootURL."index.php";
+
+$m_var_list_update["cat"] = 0;
+$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');";
+unset($m_var_list_update["cat"]);
+
+$envar = "env=" . BuildEnv();
+
+if($objCatList->CurrentCategoryID()>0)
+{
+ $c = $objCatList->CurrentCat();
+ $upURL = "javascript:AdminCatNav('".$c->Admin_Parent_Link()."');";
+}
+else
+ $upURL = $_SERVER["PHP_SELF"]."?".$envar;
+
+//admin only util
+
+$pathtolocal = $pathtoroot."kernel/";
+require_once ($pathtoroot.$admin."/include/elements.php");
+//require_once ($pathtoroot."kernel/admin/include/navmenu.php");
+require_once ($pathtolocal."admin/include/navmenu.php");
+require_once($pathtoroot.$admin."/browse/toolbar.php");
+
+$m = GetModuleArray();
+foreach($m as $key=>$value)
+{
+ $path = $pathtoroot.$value."admin/include/parser.php";
+ if(file_exists($path))
+ {
+ //echo "<!-- $path -->";
+ @include_once($path);
+ }
+}
+if(!$is_install)
+{
+ if (!admin_login())
+ {
+ if(!headers_sent())
+ setcookie("sid"," ",time()-3600);
+ $objSession->Logout();
+ header("Location: ".$adminURL."/login.php");
+ die();
+ //require_once($pathtoroot."admin/login.php");
+ }
+}
+//Set Section
+$section = 'in-portal:advanced_view';
+
+//Set Environment Variable
+
+// save last category visited
+$objSession->SetVariable('prev_category', $objSession->GetVariable('last_category') );
+$objSession->SetVariable('last_category', $objCatList->CurrentCategoryID() );
+
+$objSession->SetVariable("HasChanges", 0);
+// where should all edit popups submit changes
+$objSession->SetVariable("ReturnScript", basename($_SERVER['PHP_SELF']) );
+
+
+// common "Advanced View" tab php functions: begin
+function GetAdvView_SearchWord($prefix)
+{
+ global $objSession;
+ return $objSession->GetVariable($prefix.'_adv_view_search');
+}
+
+function SaveAdvView_SearchWord($prefix)
+{
+ global $objSession;
+ $SearchWord = $objSession->GetVariable($prefix.'_adv_view_search');
+ if( isset($_REQUEST['SearchWord']) )
+ {
+ $SearchWord = $_REQUEST['SearchWord'];
+ $objSession->SetVariable($prefix.'_adv_view_search', $SearchWord);
+ }
+}
+
+function ResetAdvView_SearchWord($prefix)
+{
+ global $objSession;
+ $objSession->SetVariable($prefix.'_adv_view_search', '');
+}
+
+function ShowSearchForm($prefix, $envar)
+{
+ global $imagesURL;
+ $btn_prefix = $imagesURL.'/toolbar/icon16_search';
+ $SearchWord = GetAdvView_SearchWord($prefix);
+ echo '<form method="post" action="'.$_SERVER["PHP_SELF"].'?'.$envar.'" name="'.$prefix.'_adv_view_search" id="'.$prefix.'_adv_view_search">
+ <input type="hidden" name="Action" value="">
+ <table cellspacing="0" cellpadding="0">
+ <tr>
+ <td>'.admin_language('la_SearchLabel').'&nbsp;</td>
+ <td><input id="SearchWord" type="text" value="'.$SearchWord.'" name="SearchWord" size="10" style="border-width: 1; border-style: solid; border-color: 999999"></td>
+ <td>
+ <img
+ id="imgSearch"
+ src="'.$btn_prefix.'.gif"
+ alt="'.admin_language("la_ToolTip_Search").'"
+ align="absMiddle"
+ onclick="SubmitSearch(\''.$prefix.'_adv_view_search\',\''.$prefix.'_adv_view_search\');"
+ onmouseover="this.src=\''.$btn_prefix.'_f2.gif\'"
+ onmouseout="this.src=\''.$btn_prefix.'.gif\'"
+ style="cursor:hand"
+ width="22"
+ height="22"
+ >
+ <img
+ id="imgSearchReset"
+ src="'.$btn_prefix.'_reset.gif"
+ alt="'.admin_language("la_ToolTip_Search").'"
+ align="absMiddle"
+ onclick="SubmitSearch(\''.$prefix.'_adv_view_search\',\''.$prefix.'_adv_view_search_reset\');"
+ onmouseover="this.src=\''.$btn_prefix.'_reset_f2.gif\'"
+ onmouseout="this.src=\''.$btn_prefix.'_reset.gif\'"
+ style="cursor:hand"
+ width="22"
+ height="22"
+ >&nbsp;
+
+
+ </td>
+ </tr>
+ </table>
+ </form>';
+}
+// common "Advanced View" tab php functions: end
+
+/* page header */
+print <<<END
+<html>
+<head>
+ <title>In-portal</title>
+ <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="Pragma" content="no-cache">
+ <script language="JavaScript">
+ imagesPath='$imagesURL'+'/';
+ </script>
+
+END;
+
+ require_once($pathtoroot.$admin."/include/mainscript.php");
+
+print <<<END
+<script type="text/javascript">
+ if (window.opener != null) {
+ theMainScript.CloseAndRefreshParent();
+ }
+</script>
+END;
+
+print <<<END
+ <script src="$browseURL/toolbar.js"></script>
+ <script src="$browseURL/checkboxes_new.js"></script>
+ <script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
+ <link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
+ <link rel="stylesheet" type="text/css" href="$cssURL/style.css">
+ <link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
+END;
+load_module_styles();
+if( !isset($list) ) $list = '';
+
+int_SectionHeader();
+
+$filter = false;
+$sessVars = $objConfig->GetSessionValues(0);
+//print_pre($sessVars);
+foreach ($sessVars as $key => $value) {
+ if (strstr($key, '_View')) {
+ //echo "$value<br>";
+ if ($value != 1) {
+ $filter = true;
+ }
+ }
+}
+
+?>
+</div>
+<!-- alex mark -->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+ <tbody>
+ <tr>
+ <td>
+ <div name="toolBar" id="mainToolBar">
+ <tb:button action="edit" alt="<?php echo admin_language("la_ToolTip_Edit"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="delete" alt="<?php echo admin_language("la_ToolTip_Delete"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="approve" alt="<?php echo admin_language("la_ToolTip_Approve"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="decline" alt="<?php echo admin_language("la_ToolTip_Decline"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="print" alt="<?php echo admin_language("la_ToolTip_Print"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="view" alt="<?php echo admin_language("la_ToolTip_View"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ </div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+
+<?php if ($filter) { ?>
+<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
+ <tr>
+ <td valign="top">
+ <?php int_hint_red(admin_language("la_Warning_Filter")); ?>
+ </td>
+ </tr>
+</table>
+<?php } ?>
+<br>
+ <!-- CATEGORY DIVIDER -->
+
+</DIV>
+</div>
+<DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index:0" id="firstContainer">
+ <DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index:2" id="secondContainer">
+
+
+
+ <?php
+
+ print $ItemTabs->TabRow();
+
+ if(count($ItemTabs->Tabs))
+ {
+ ?>
+ <div class="divider" id="tabsDevider"><img width=1 height=1 src="images/spacer.gif"></div>
+ <?php
+ }
+ ?>
+ </DIV>
+
+ <?php
+ unset($m);
+ $m = GetModuleArray("admin");
+
+
+ foreach($m as $key=>$value)
+ {
+ $path = $pathtoroot.$value."admin/advanced_view.php";
+ //echo "Including File: $path<br>";
+ if(file_exists($path))
+ {
+ //echo "\n<!-- $path -->\n";
+ include_once($path);
+ }
+ }
+ ?>
+ <form method="post" action="advanced_view.php?env=<?php echo BuildEnv(); ?>" name="viewmenu">
+ <input type="hidden" name="fieldname" value="">
+ <input type="hidden" name="varvalue" value="">
+ <input type="hidden" name="varvalue2" value="">
+ <input type="hidden" name="Action" value="">
+ </form>
+</DIV>
+<!-- END CODE-->
+<script language="JavaScript">
+ InitPage();
+
+ tabs_on = theMainScript.GetCookie('tabs_on');
+ if (tabs_on == '1' || tabs_on == null) {
+ if(default_tab.length == 0 || default_tab == 'categories' )
+ {
+ cookie_start = theMainScript.GetCookie('active_tab');
+ if (cookie_start != null) start_tab = cookie_start;
+ if(start_tab!=null) {
+ toggleTabB(start_tab, true);
+ }
+ }
+ else
+ {
+ toggleTabB(default_tab,true);
+ }
+ }
+
+</script>
+<?php int_footer(); ?>
\ No newline at end of file
Property changes on: trunk/admin/advanced_view.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/admin/toolbar.php
===================================================================
--- trunk/admin/toolbar.php (revision 122)
+++ trunk/admin/toolbar.php (revision 123)
@@ -1,304 +1,303 @@
<?php
##############################################################
## In-portal :: Administration Interfaces :: Tool Bar ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
class clsToolBarItem
{
var $m_img;
var $m_alt;
var $link;
var $onMouseOver;
var $onMouseOut;
var $onClick;
var $filename;
function clsToolBarItem()
{
}
function GetItem()
{
global $imagesURL;
$o = "";
if ($this->img=="divider")
{
$o .= "<img src=\"".$imagesURL."/toolbar/tool_divider.gif\" width=\"4\" height=\"32\" border=\"0\">\n";
}
else
{
if(strlen($this->link)>1)
{
$o .= "<a href=\"".$this->link."\" onMouseOut=\"".$this->onMouseOut."\"";
$o .= " onMouseOver=\"".$this->onMouseOver."\" onClick=\"".$this->onClick."\">\n";
$o .= "<img ID=\"".$this->img."\" alt=\"".language($this->alt)."\" src=\"".$this->filename."\" width=\"32\" height=\"32\" border=\"0\">";
$o .= "</a>\n";
}
else
{
$o .= "<img ID=\"".$this->img."\" alt=\"".language($this->alt)."\" src=\"".$this->filename."\" width=\"32\" height=\"32\" border=\"0\"";
$o .= " onMouseOut=\"".$this->onMouseOut."\"";
$o .= " onMouseOver=\"".$this->onMouseOver."\" onClick=\"".$this->onClick."\">";
}
}
return $o;
}
}
class clsToolBar
{
var $Items;
var $m_section;
var $m_load_menu_func;
var $m_CheckClass;
var $m_CheckForm;
var $InitScript;
var $DoubleClickAction;
var $ContextMenu;
function clsToolBar()
{
$this->Items = array();
$this->InitScript = array();
$this->ContextMenu = array();
}
function Get($name)
{
$var = "m_" . $name;
return $this->$var;
}
function Set($name, $value)
{
if (is_array($name))
{
for ($i=0; $i<sizeof($name); $i++)
{ $var = "m_" . $name[$i];
$this->$var = $value[$i];
$this->m_dirtyFieldsMap[$name[$i]] = $value[$i];
echo "$var = ".$value[$i]."<br>\n";
}
}
else
{
$var = "m_" . $name;
$this->$var = $value;
$this->m_dirtyFieldsMap[$name] = $value;
}
}
function Add($img,$alt="",$link="",$MouseOver="",$MouseOut="",$onClick="", $filename="",$IsDblClick=FALSE,$ContextMenu=FALSE)
{
global $imagesURL;
$t = new clsToolBarItem();
$t->img = $img;
$t->alt = $alt;
$t->link = $link;
$t->onMouseOver = $MouseOver;
$t->onMouseOut = $MouseOut;
$t->onClick = $onClick;
if(strlen($filename)==0)
{
$t->filename = $imagesURL."/toolbar/tool_".$img.".gif";
}
else
{
if(substr($filename,0,4)=="http")
{
$t->filename = $filename;
}
else
{
if(substr($filename,0,8)!="toolbar/")
$filename = "toolbar/".$filename;
if(substr($filename,0,1)!="/")
$filename = "/".$filename;
$t->filename = $imagesURL.$filename;
}
}
array_push($this->Items,$t);
if($IsDblClick)
$this->DoubleClickAction=$onClick;
if($ContextMenu)
$this->ContextMenu[] = "contextMenu.addMenuItem('".admin_language($alt)."',\"$onClick\",\"\");";
return $t;
}
function AddToInitScript($s)
{
if(is_array($s))
{
for($i=0;$i<count($s);$i++)
array_push($this->InitScript,$s[$i]);
}
else
array_push($this->InitScript,$s);
}
function GetInitScript()
{
global $envar;
$s="";
if(count($this->InitScript)>0)
$s = implode("\n",$this->InitScript);
if(strlen($this->Get("CheckClass")))
{
$c = $this->Get("CheckClass")." = new CheckArray();\n";
$c .=$this->Get("CheckClass").".formname='".$this->Get("CheckForm")."';\n";
$c .=$this->Get("CheckClass").".envar='$envar';\n";
$s = $c.$s;
}
$s .= "\n".$this->GetActionHandlerScript();
// $s .= "\n".$this->Get("CheckClass").".setImages();\n";
return "<SCRIPT language=\"JavaScript\">$s</SCRIPT>";
}
function GetActionHandlerScript()
{
$o = '';
if(strlen($this->DoubleClickAction)>0)
{
$o .= "function handleDoubleClick()\n{\n";
$o .= " ".$this->DoubleClickAction."\n";
$o .= "}\n\n";
}
if(count($this->ContextMenu))
{
$o .= "function initContextMenu()\n{\n";
$o .= " window.contextMenu = new Menu(\"Context\");";
for($x=0;$x<count($this->ContextMenu);$x++)
{
$o .= " ".$this->ContextMenu[$x]."\n";
}
$o .= " window.triedToWriteMenus = false;\n window.contextMenu.writeMenus();\n return true;\n}\n";
}
return $o;
}
function Build()
{
global $imagesURL;
$o = "<table border=0 cellpadding=0 cellspacing=0 width=\"100%\" class=\"toolbar\">";
$o .= "<tr><td><img alt="|" src=\"".$imagesURL."/toolbar_start.gif\" width=10 height=50 border=0></td>\n";
foreach($this->Items as $t)
{
$o .= "<TD>".$t->GetItem()."</TD>";
}
$o .= "<TD width=\"100%\"></TD></TR></TABLE>";
return $o;
}
function onLoadString()
{
return "";
}
}
class clsItemTabs
{
var $Tabs;
var $ItemCount;
function clsItemTabs()
{
$this->Tabs = array();
$this->ItemCount = array();
}
function SetItemCount($divname,$Value)
{
$this->ItemCount[$divname] = $Value;
}
function GetItemCount($divname)
{
return (int)$this->ItemCount[$divname];
}
function AddTab($Caption,$divname,$ItemCount,$selected,$numfunc="")
{
$t["caption"]=$Caption;
$t["divname"]=$divname;
$this->SetItemCount($divname,$ItemCount);
$t["selected"]=$selected;
$t["numfunc"]=$numfunc;
$this->Tabs[] = $t;
}
function TabItem($i)
{
global $imagesURL;
$t = $this->Tabs[$i];
if($t["selected"]==1)
{
$divimage="/divider_up.gif";
}
else
$divimage="/divider_dn.gif";
$div = $t["divname"];
$o .= "<td width=\"138\" height=\"22\" noWrap";
$o .= " background=\"".$imagesURL."/itemtabs/tab_inactive.gif\" ";
$o .= "tabHeaderOf=\"$div\" ";
$o .= "onclick=\"toggleTab('$div');\" style=\"cursor:hand\">\n";
$o .= " <img height=\"20\" src=\"".$imagesURL."/itemtabs/divider_empty.gif\" ";
$o .= "width=\"20\" border=\"0\" align=\"middle\">";
$o .= $t["caption"]."<span class=\"cats_stats\">";
$func = $t["numfunc"];
if(is_numeric($func))
{
$total = $func;
}
else
{
if(function_exists($func))
{
$total = $func();
}
}
if(!is_numeric($total))
$total = $this->GetItemCount($div);
if($total==$this->GetItemCount($div))
{
$o .= "(".$this->GetItemCount($div).")</span></td>\n";
}
else
$o .= "(".$this->GetItemCount($div)." / ".$total.")</span></td>\n";
return $o;
}
function tabRow()
{
-
$o = "<table width=\"100%\" border=0 cellspacing=0 cellpadding=0>";
$o .= "<tr>";
for($i=0;$i<count($this->Tabs);$i++)
{
$o .= $this->TabItem($i);
}
$o .= "<td width=\"100%\"></td>";
//$o .= "<tr class=\"divider\">";
//$o .= "<td colspan=4><img src=\"".$imagesURL."/spacer.gif\" border=0 width=1 height=1></td>";
$o .= "</tr></table>";
return $o;
}
}
?>
Property changes on: trunk/admin/toolbar.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/admin/help/credits.txt
===================================================================
--- trunk/admin/help/credits.txt (revision 122)
+++ trunk/admin/help/credits.txt (revision 123)
@@ -1,42 +1,43 @@
Intechnic Corporation would like to thank a number of people who have helped us to develop this product.<br>
<br>
Development Team:<br>
Dmitry Andrejev<br>
David Chen<br>
Peter Droppa<br>
+Eugene Hohlov<br>
Maris Kocins<br>
Pavel Kharitonov<br>
Jurij Kirilov<br>
Dmitry Kucher<br>
Andrew Kucheriavy<br>
Sergey Mesropyan<br>
-Alexandr Obuhovich<br>
+Alexander Obuhovich<br>
Arnis Pridans<br>
Max Strelchenko<br>
Konstantin Tjuterev<br>
Stoyan Vlaikov<br>
Chis Walker<br>
<br>
Beta Testing Team:<br>
ali<br>
anthony<br>
bnove<br>
charlie<br>
d00m2k<br>
federico<br>
jimid<br>
media<br>
nick_85<br>
philipp<br>
ricomtelecom<br>
stefan<br>
synoo<br>
<br>
Special thanks to:<br>
Gene Averbuch<br>
Artjoms Milovs<br>
Robert Murata<br>
Franck Nussbaumer aka side<br>
Darin Sakas<br>
Jim VanNatta<br>
Ivan Vasiljev<br>
\ No newline at end of file
Property changes on: trunk/admin/help/credits.txt
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/admin/templates/cat_tab_element.tpl
===================================================================
--- trunk/admin/templates/cat_tab_element.tpl (nonexistent)
+++ trunk/admin/templates/cat_tab_element.tpl (revision 123)
@@ -0,0 +1,17 @@
+<TD>
+<div inportalType="category">
+ <input type="checkbox" value="<inp:cat _field="id" />" name="catlist[]">
+
+ <img src="<inp:cat _field="admin_icon"/>" border="0" align="absMiddle">
+ <span class="priority"><sup><inp:cat _field="priority"/></sup></span>
+ <span class="link"><b><inp:cat _field="name"/></b></span>:
+ <span class="cat_pick"><inp:cat _field="pick"/></SPAN>
+ <span class="cat_new"><inp:cat _field="new"/></SPAN>
+ <span class="cats_stats">(<inp:cat _Field="subcatcount" /> / <inp:cat _field="totalitems"/>)</span>
+ <br>
+ <div style="padding-left:3px">
+ <span class="cat_desc"><inp:cat _field="description"/></SPAN><br>
+ <span class="cats_stats">(<inp:cat _field="date" />)</span>
+ </div>
+</div>
+</TD>
\ No newline at end of file
Property changes on: trunk/admin/templates/cat_tab_element.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Event Timeline