Index: trunk/kernel/include/advsearch.php =================================================================== diff -u -N -r271 -r979 --- trunk/kernel/include/advsearch.php (.../advsearch.php) (revision 271) +++ trunk/kernel/include/advsearch.php (.../advsearch.php) (revision 979) @@ -17,7 +17,7 @@ var $PctPop; var $PctRating; - function clsAdvancedSearchResults($SearchSource,$DataClass) + function clsAdvancedSearchResults($SearchSource,$DataClass, $ItemType = 0) { global $objConfig, $objSearchConfig; @@ -38,7 +38,14 @@ if(!is_object($objSearchConfig)) $objSearchConfig = new clsSearchConfigList(); $objSearchConfig->Clear(); - $objSearchConfig->Query_Item("SELECT * FROM ".$objSearchConfig->SourceTable." WHERE TableName='$SearchSource' AND AdvancedSearch=1 ORDER BY DisplayOrder"); + + if ($ItemType == 0) { + $objSearchConfig->Query_Item("SELECT * FROM ".$objSearchConfig->SourceTable." WHERE TableName='$SearchSource' AND AdvancedSearch=1 ORDER BY DisplayOrder"); + } + else { + $sql = "SELECT sc.* FROM ".$objSearchConfig->SourceTable." AS sc LEFT JOIN ".GetTablePrefix()."CustomField AS cf ON sc.CustomFieldId = cf.CustomFieldId WHERE TableName='$table' OR (TableName='CustomField' AND cf.Type = $ItemType) AND AdvancedSearch=1 ORDER BY sc.DisplayOrder"; + $objSearchConfig->Query_Item($sql); + } } function SetResultTable($SearchSource,$DataClass) @@ -98,7 +105,8 @@ $join = $FieldConfig->Get("JoinClause"); $join = str_replace("{ForeignTable}",$Table,$join); $join = str_replace("{LocalTable}",AddTablePrefix($TableName),$join); - $this->AddRlationship($Table,$join); + $join = str_replace("{Table}", $this->SourceTable, $join); + $this->AddRelationship($Table,$join); $FieldItem["where"] = $FieldConfig->GetWhereClause($Verb,$Value); $FieldItem["Field"] = $FieldConfig->Get("ForeignField"); @@ -146,7 +154,7 @@ $PopField = $ctype->Get("PopField"); $RateField = $ctype->Get("RateField"); $typestr = str_pad($ItemType,2,"0",STR_PAD_LEFT); - $SelectSQL = "SELECT ".$this->SourceTable.".".$idField." as ItemId, ". $this->SourceTable.".Priority as Relevance, ResourceId, CONCAT($typestr) as ItemType, EditorsPick as EdPick FROM ".$this->SourceTable." "; + $SelectSQL = "SELECT ".$this->SourceTable.".".$idField." as ItemId, ". $this->SourceTable.".Priority as Relevance, ".$this->SourceTable.".ResourceId, CONCAT($typestr) as ItemType, EditorsPick as EdPick FROM ".$this->SourceTable." "; foreach($this->Relationships as $JoinTable=>$OnClause) { @@ -159,9 +167,9 @@ $SelectSQL .= " WHERE ".$WhereClause; } $SelectSQL .= " GROUP BY $idField "; + //echo $SelectSQL; $this->adodbConnection->Execute("DROP TABLE IF EXISTS ".$this->ResultTable); - $full_sql = "CREATE TABLE ".$this->ResultTable." ".$indexSQL.$SelectSQL; - + $full_sql = "CREATE TABLE ".$this->ResultTable." ".$indexSQL.$SelectSQL; $this->adodbConnection->Execute($full_sql); // if advanced seaech used, then delete simple search keywords $objSession->SetVariable('Search_Keywords', ''); Index: trunk/kernel/parser.php =================================================================== diff -u -N -r959 -r979 --- trunk/kernel/parser.php (.../parser.php) (revision 959) +++ trunk/kernel/parser.php (.../parser.php) (revision 979) @@ -1518,7 +1518,7 @@ $acl_where = "(FIND_IN_SET(0,acl))"; $objCatList->Clear(); $OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE); - $objCatList->LoadCategories("ParentId=$CategoryId AND Status=1",$OrderBy); + $objCatList->LoadCategories("ParentId=$CategoryId AND Status=1",$OrderBy, false); if ($objCatList->NumItems() == 0) { if($attribs["_dataexists"]) @@ -1727,7 +1727,57 @@ } return $o; } + /* + @description: Used in conjuction with l_list_cats. This function generates the page navigation + for the list. If this tag is called before the list tag, this function will load + the links. For that reason, the _ListType attribute is required if the pagnav + tag preceeds the l_list_links tag in the template. Generally, it is good practice to + duplicate all attributes set for l_list_links. + @attrib: _PagesToList:int: Number of pages to list (default is 10) + @attrib: _ShortList:bool: If set, uses the shortlist configuration value for links + @attrib: _label:lang: language tag to include in the output if there are pages to list. If there are no pages listed, this text will not be included (resulting in an empty output) + @attrib: _ListType::Determines the type of list to generate
+ Possible values: + +*/ +function l_cat_pagenav($attribs = array()) +{ + global $objCatList, $objSession; + + $DestTemplate = getArrayValue($attribs,'_template'); + $PagesToList = getArrayValue($attribs,'_pagestolist'); + $image = getArrayValue($attribs,'_PageIcon'); + if(!is_numeric($PagesToList)) + $PagesToList = 10; + + $CatId = getArrayValue($attribs,'_catid'); + if(!is_numeric($CatId)) + $CatId = $objCatList->CurrentCategoryID(); + + if($attribs["_shortlist"] == 1) + $objCatList->PerPageVar = "Perpage_Category_Short"; + + $ListType = getArrayValue($attribs,'_listtype'); + if(!strlen($ListType)) + $ListType="category"; +/* + if($objLinkList->ListType != $ListType) { + LoadLinkList($attribs); + } +*/ + $o = $objCatList->GetPageLinkList($DestTemplate); + if (strlen($image)) { + $o_i = ' '; + } + if(strlen($o) && strlen($attribs["_label"])) + $o = $o_i.language($attribs["_label"]).$o; + return $o; +} + +/* @description: Used in conjuction with m_search_list_cats. This function generates the page navigation for the list. If this tag is called before the list tag, this function will load the category list. Generally, it is good practice to duplicate all attributes set for @@ -1984,7 +2034,8 @@ $name = strtolower($Item->Get("ItemName")); $table = $Item->Get("SourceTable"); - $sql = "SELECT * FROM ".$objSearchConfig->SourceTable." WHERE TableName='$table' AND AdvancedSearch=1 ORDER BY DisplayOrder"; + //$sql = "SELECT * FROM ".$objSearchConfig->SourceTable." WHERE TableName='$table' AND AdvancedSearch=1 ORDER BY DisplayOrder"; + $sql = "SELECT sc.* FROM ".$objSearchConfig->SourceTable." AS sc LEFT JOIN ".GetTablePrefix()."CustomField AS cf ON sc.CustomFieldId = cf.CustomFieldId WHERE TableName='$table' OR (TableName='CustomField' AND cf.Type = $ItemType) AND AdvancedSearch=1 ORDER BY sc.DisplayOrder"; $objSearchConfig->Query_Item($sql); $row=0; if(is_array($objSearchConfig->Items)) Index: trunk/kernel/admin/include/toolbar/edituser_items.php =================================================================== diff -u -N -r881 -r979 --- trunk/kernel/admin/include/toolbar/edituser_items.php (.../edituser_items.php) (revision 881) +++ trunk/kernel/admin/include/toolbar/edituser_items.php (.../edituser_items.php) (revision 979) @@ -213,9 +213,9 @@ menu_sorting.addMenuItem(lang_Asc,"config_val('UserItem_LV_Sortorder','asc');",RadioIsSelected(Item_Sortorder,'asc')); menu_sorting.addMenuItem(lang_Desc,"config_val('UserItem_LV_Sortorder','desc');",RadioIsSelected(Item_Sortorder,'desc')); menu_sorting.addMenuSeparator(); - menu_sorting.addMenuItem(lang_Default,"config_val('UserItem_LV_Sortfield','ItemTypeStr');",""); + menu_sorting.addMenuItem(lang_Default,"config_val('UserItem_LV_Sortfield','ItemType');",""); menu_sorting.addMenuItem(lang_Name,"config_val('UserItem_LV_Sortfield','ItemName');",RadioIsSelected(Item_Sortfield,'ItemName')); - menu_sorting.addMenuItem(lang_Type,"config_val('UserItem_LV_Sortfield','ItemTypeStr');",RadioIsSelected(Item_Sortfield,'ItemTypeStr')); + menu_sorting.addMenuItem(lang_Type,"config_val('UserItem_LV_Sortfield','ItemType');",RadioIsSelected(Item_Sortfield,'ItemType')); window.menu_results = new Menu(lang_Items+' '+lang_PerPage); Index: trunk/kernel/include/searchconfig.php =================================================================== diff -u -N -r534 -r979 --- trunk/kernel/include/searchconfig.php (.../searchconfig.php) (revision 534) +++ trunk/kernel/include/searchconfig.php (.../searchconfig.php) (revision 979) @@ -375,14 +375,14 @@ } function &AddSearchField($Table,$FieldName,$Module,$Simple,$Adv,$Description,$DisplayName,$ConfigHeader,$DisplayOrder=0, - $Priority=0,$FieldType="text",$JoinClause=NULL,$IsWhere=NULL,$IsNotWhere=NULL,$ContainsWhere=NULL,$NotContainsWhere=NULL,$CustomId=0) + $Priority=0,$FieldType="text",$JoinClause=NULL,$IsWhere=NULL,$IsNotWhere=NULL,$ContainsWhere=NULL,$NotContainsWhere=NULL,$CustomId=0, $ForeignField = NULL) { $f = new clsSearchConfig(); if($DisplayOrder==0) $DisplayOrder = $this->GetNextDisplayOrder($Module); $f->Set(Array("TableName","ModuleName","SimpleSearch","AdvancedSearch","Description","DisplayName","ConfigHeader", - "DisplayOrder","Priority","FieldType","FieldName"), - Array($Table,$Module,$Simple,$Adv,$Description,$DisplayName,$ConfigHeader,$DisplayOrder,$Priority,$FieldType,$FieldName)); + "DisplayOrder","Priority","FieldType","FieldName", "ForeignField"), + Array($Table,$Module,$Simple,$Adv,$Description,$DisplayName,$ConfigHeader,$DisplayOrder,$Priority,$FieldType,$FieldName, $ForeignField)); $f->Set("CustomFieldId",$CustomId); if(strlen($JoinClause)) $f->Set("JoinClause",$JoinClause); Index: trunk/kernel/frontaction.php =================================================================== diff -u -N -r964 -r979 --- trunk/kernel/frontaction.php (.../frontaction.php) (revision 964) +++ trunk/kernel/frontaction.php (.../frontaction.php) (revision 979) @@ -860,7 +860,7 @@ { case 1: /* category */ //echo "Searching for categories
"; - $objAdvSearch = new clsAdvancedSearchResults("Category","clsCategory"); + $objAdvSearch = new clsAdvancedSearchResults("Category","clsCategory", $_GET["type"]); foreach($objSearchConfig->Items as $field) { @@ -918,7 +918,7 @@ $isExact = (substr($keywords, 0, 1) == '"' && substr($keywords, strlen($keywords) - 1, 1) == '"'); if ($isExact) { - $performSearch = (strlen(trim(str_replace('"', '', $keywords))) >= $length); + $performSearch = (strlen(trim(str_replace('\"', '', $keywords))) >= $length); } else { $key_arr = explode(' ', $keywords); Index: trunk/admin/logs/session_list.php =================================================================== diff -u -N -r943 -r979 --- trunk/admin/logs/session_list.php (.../session_list.php) (revision 943) +++ trunk/admin/logs/session_list.php (.../session_list.php) (revision 979) @@ -215,7 +215,7 @@ $sql .=" as us LEFT JOIN ".GetTablePrefix()."PortalUser as p USING (PortalUserId) "; $sql .="LEFT JOIN ".GetTablePrefix()."UserGroup as u ON (p.PortalUserId=u.PortalUserId AND u.PrimaryGroup=1) "; $sql .="LEFT JOIN ".GetTablePrefix()."PortalGroup as g ON (u.GroupId=g.GroupId) "; -$sql .= " WHERE us.Status = 1 "; +$sql .= " WHERE us.Status = 1 AND us.PortalUserId <> -1 "; if(strlen($where)) { $sql .= "AND ".$where; } Index: trunk/kernel/include/customfield.php =================================================================== diff -u -N -r667 -r979 --- trunk/kernel/include/customfield.php (.../customfield.php) (revision 667) +++ trunk/kernel/include/customfield.php (.../customfield.php) (revision 979) @@ -207,7 +207,10 @@ $dtable = GetTablePrefix()."CustomMetaData"; $Join = "($dtable.ResourceId={Table}.ResourceId)"; - $objSearchConfig->AddSearchField($Table,$FieldName,$Module,0,0,$FieldLabel,$desc,$Header,$NextOrder,0,"text",$Join,$f->Get("CustomFieldId")); + $objSearchConfig->AddSearchField($Table,$FieldName,$Module,0,0, + $FieldLabel,$desc,$Header,$NextOrder,0, + "text",$Join, NULL, NULL, NULL, NULL, + $f->Get("CustomFieldId"), "CustomMetaData.Value"); } return $f; //}