Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Tue, Jun 24, 11:27 PM

in-portal

Index: branches/unlabeled/unlabeled-1.19.2/kernel/admin_templates/incs/header.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.19.2/kernel/admin_templates/incs/header.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.19.2/kernel/admin_templates/incs/header.tpl (revision 6108)
@@ -0,0 +1,47 @@
+<!--DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">-->
+<html>
+<head>
+<title>In-Portal :: Administration Panel</title>
+
+<meta http-equiv="content-type" content="text/html; charset=<inp2:lang_GetCharset/>">
+<meta name="keywords" content="...">
+<meta name="description" content="...">
+<meta name="robots" content="all">
+<meta name="copyright" content="Copyright &#174; 2006 Test, Inc">
+<meta name="author" content="Intechnic Inc.">
+
+<inp2:m_base_ref/>
+
+<link rel="icon" href="img/favicon.ico" type="image/x-icon" />
+<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
+<link rel="stylesheet" rev="stylesheet" href="incs/style.css" type="text/css" />
+
+<script language="javascript" src="incs/is.js"></script>
+<script language="javascript" src="incs/script.js"></script>
+<script language="javascript" src="incs/in-portal.js"></script>
+<script language="javascript" src="incs/toolbar.js"></script>
+<script language="javascript" src="incs/grid.js"></script>
+<script language="javascript" src="incs/tabs.js"></script>
+<script language="javascript">
+var t = '<inp2:m_get param="t"/>';
+var popups = '1';
+var multiple_windows = '1';
+var main_title = '<inp2:m_GetConfig var="Site_Name" escape="1"/>';
+var tpl_changed = 0;
+var base_url = '<inp2:m_BaseURL/>';
+var $base_path = '<inp2:m_GetConst name="BASE_PATH"/>';
+var img_path = '<inp2:m_TemplatesBase module="#MODULE#"/>/img/';
+
+</script>
+</head>
+
+<inp2:m_include t="incs/blocks"/>
+<inp2:m_include t="incs/in-portal"/>
+
+<inp2:m_if check="m_ParamEquals" name="nobody" value="yes" inverse="inverse">
+ <body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" <inp2:m_get param="body_properties"/>>
+</inp2:m_if>
+
+<inp2:m_if check="m_ParamEquals" name="noform" value="yes" inverse="inverse">
+ <inp2:m_ParseBlock name="kernel_form"/>
+</inp2:m_if>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.19.2/kernel/admin_templates/incs/header.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.19
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.19.2/core/kernel/db/dblist.php
===================================================================
--- branches/unlabeled/unlabeled-1.19.2/core/kernel/db/dblist.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.19.2/core/kernel/db/dblist.php (revision 6108)
@@ -0,0 +1,803 @@
+<?php
+
+ /**
+ * System Having/Where filter
+ *
+ */
+ define('FLT_SYSTEM', 1);
+
+ /**
+ * User Having/Where filter
+ *
+ */
+ define('FLT_NORMAL', 2);
+
+ /**
+ * User "Search" Having/Where filter
+ *
+ */
+ define('FLT_SEARCH', 3);
+
+ /**
+ * User "View Menu" Having/Where filter
+ *
+ */
+ define('FLT_VIEW', 4);
+
+/**
+* DBList
+*
+* Desciption
+* @package kernel4
+*/
+class kDBList extends kDBBase {
+
+
+ /**
+ * Holds totals for fields specified in config
+ *
+ * @var Array
+ */
+ var $Totals = Array();
+
+ /**
+ * Description
+ *
+ * @var array
+ * @access public
+ */
+ var $OrderFields;
+
+ /**
+ * Holds counted total number of records in the query - without pagination (system+user filters)
+ *
+ * @var int
+ * @access public
+ */
+ var $RecordsCount;
+
+
+ /**
+ * Records count with system filters only applied
+ *
+ * @var int
+ * @access private
+ */
+ var $NoFilterCount = 0;
+
+ /**
+ * Record count selected to be
+ * showed on current page
+ *
+ * @var int
+ */
+ var $SelectedCount=0;
+
+ /**
+ * Array of records selected
+ *
+ * @var Array
+ * @access private
+ */
+ var $Records;
+
+ var $CurrentIndex = 0;
+
+ /**
+ * List items per-page
+ *
+ * @var int
+ * @access public
+ */
+ var $PerPage;
+
+ /**
+ * Pages count in list based on PerPage & RecordsCount attributes
+ *
+ * @var int
+ * @access public
+ */
+ var $TotalPages;
+
+ /**
+ * Description
+ *
+ * @var int
+ * @access public
+ */
+
+ var $Direction;
+ /**
+ * Holds current page number - used when forming LIMIT clause of SELECT statement
+ *
+ * @var int
+ * @access public
+ */
+ var $Page;
+
+ /**
+ * Holds offset for LIMIT clause, calculated in {@link kDBList::PerPage()}
+ *
+ * @var int
+ * @access private
+ */
+ var $Offset;
+
+ /**
+ * Count SQL was already issued on query
+ *
+ * @var bool
+ * @access private
+ */
+ var $hasCounted = false;
+
+ /**
+ * Holds list WHERE filter object
+ *
+ * @var kMultipleFilter
+ * @access private
+ */
+ var $WhereFilter = Array(FLT_SYSTEM => null, FLT_NORMAL => null, FLT_SEARCH => null, FLT_VIEW => null);
+
+ /**
+ * Holds list HAVING filter object
+ *
+ * @var kMultipleFilter
+ * @access private
+ */
+ var $HavingFilter = Array(FLT_SYSTEM => null, FLT_NORMAL => null, FLT_SEARCH => null, FLT_VIEW => null);
+
+ var $AggregateFilter = Array(FLT_SYSTEM => null, FLT_NORMAL => null);
+
+ var $GroupByFields = Array();
+
+ var $Queried = false;
+ var $Counted = false;
+ var $TotalsCalculated = false;
+
+ /**
+ * Creates kDBList
+ *
+ * @return kDBList
+ */
+ function kDBList()
+ {
+ parent::kDBBase();
+ $this->OrderFields = Array();
+
+ $this->WhereFilter[FLT_SYSTEM] =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_AND);
+ $this->WhereFilter[FLT_NORMAL] =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_OR);
+
+ $this->WhereFilter[FLT_SEARCH] =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_OR);
+ $this->WhereFilter[FLT_VIEW] =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_AND);
+
+ $this->HavingFilter[FLT_SYSTEM] =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_AND);
+ $this->HavingFilter[FLT_NORMAL] =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_OR);
+
+ $this->HavingFilter[FLT_SEARCH] =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_OR);
+ $this->HavingFilter[FLT_VIEW] =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_AND);
+
+ $this->AggregateFilter[FLT_SYSTEM] =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_AND);
+ $this->AggregateFilter[FLT_NORMAL] =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_OR);
+ $this->AggregateFilter[FLT_VIEW] =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_AND);
+
+ $this->PerPage = -1;
+ }
+
+ /**
+ * Adds new or replaces old filter with same name
+ *
+ * @param string $name filter name (for internal use)
+ * @param string $clause where/having clause part (no OR/AND allowed)
+ * @param int $filter_type is filter having filter or where filter
+ * @param int $filter_scope filter subtype: FLT_NORMAL,FLT_SYSTEM,FLT_SEARCH,FLT_VIEW
+ * @access public
+ */
+ function addFilter($name, $clause, $filter_type = WHERE_FILTER, $filter_scope = FLT_SYSTEM)
+ {
+ $filter_source = Array( WHERE_FILTER => 'WhereFilter',
+ HAVING_FILTER => 'HavingFilter',
+ AGGREGATE_FILTER => 'AggregateFilter');
+ $filter_name = $filter_source[$filter_type];
+
+ $filter =& $this->$filter_name;
+ $filter =& $filter[$filter_scope];
+ $filter->addFilter($name,$clause);
+ }
+
+ /**
+ * Removes specified filter from filters list
+ *
+ * @param string $name filter name (for internal use)
+ * @param int $filter_type is filter having filter or where filter
+ * @param int $filter_scope filter subtype: FLT_NORMAL,FLT_SYSTEM,FLT_SEARCH,FLT_VIEW
+ * @access public
+ */
+ function removeFilter($name, $filter_type = WHERE_FILTER, $filter_scope = FLT_SYSTEM)
+ {
+ $filter_source = Array( WHERE_FILTER => 'WhereFilter',
+ HAVING_FILTER => 'HavingFilter',
+ AGGREGATE_FILTER => 'AggregateFilter');
+ $filter_name = $filter_source[$filter_type];
+
+ $filter =& $this->$filter_name;
+ $filter =& $filter[$filter_scope];
+ $filter->removeFilter($name);
+ }
+
+ /**
+ * Clear list filters
+ *
+ * @param bool $user clear user filters
+ * @param bool $system clear system filters
+ */
+ function clearFilters($user=true,$system=true,$search=true,$view=true)
+ {
+ if ($system) {
+ $this->WhereFilter[FLT_SYSTEM]->clearFilters();
+ $this->HavingFilter[FLT_SYSTEM]->clearFilters();
+ $this->AggregateFilter[FLT_SYSTEM]->clearFilters();
+ }
+
+ if ($user) {
+ $this->WhereFilter[FLT_NORMAL]->clearFilters();
+ $this->HavingFilter[FLT_NORMAL]->clearFilters();
+ $this->AggregateFilter[FLT_NORMAL]->clearFilters();
+ }
+
+ if ($search) {
+ $this->WhereFilter[FLT_SEARCH]->clearFilters();
+ $this->HavingFilter[FLT_SEARCH]->clearFilters();
+ }
+
+ if ($view) {
+ $this->WhereFilter[FLT_VIEW]->clearFilters();
+ $this->HavingFilter[FLT_VIEW]->clearFilters();
+ }
+ }
+
+ /**
+ * Counts the total number of records base on the query resulted from {@link kDBList::GetSelectSQL()}
+ *
+ * The method modifies the query to substitude SELECT part (fields listing) with COUNT(*).
+ * Special care should be applied when working with lists based on grouped queries, all aggregate function fields
+ * like SUM(), AVERAGE() etc. should be added to CountedSQL by using {@link kDBList::SetCountedSQL()}
+ *
+ * @access public
+ * @param string
+ * @return void
+ */
+ function CountRecs()
+ {
+ $all_sql = $this->GetSelectSQL(true,false);
+ $sql = $this->getCountSQL($all_sql);
+
+ if( $this->GetGroupClause() )
+ {
+ $this->RecordsCount = count( $this->Conn->GetCol($sql) );
+ }
+ else
+ {
+ $this->RecordsCount = (int)$this->Conn->GetOne($sql);
+ }
+
+ $system_sql = $this->GetSelectSQL(true,true);
+ if($system_sql == $all_sql) //no need to query the same again
+ {
+ $this->NoFilterCount = $this->RecordsCount;
+ return;
+ }
+
+ $sql = $this->getCountSQL($system_sql);
+ if( $this->GetGroupClause() )
+ {
+ $this->NoFilterCount = count( $this->Conn->GetCol($sql) );
+ }
+ else
+ {
+ $this->NoFilterCount = (int)$this->Conn->GetOne($sql);
+ }
+
+ $this->Counted = true;
+ }
+
+ function getCountSQL($sql)
+ {
+ if ( preg_match("/DISTINCT(.*?)FROM(?!_)/is",$sql,$regs ) )
+ {
+ return preg_replace("/^.*SELECT DISTINCT(.*?)FROM(?!_)/is", "SELECT COUNT(DISTINCT ".$regs[1].") AS count FROM", $sql);
+ }
+ else
+ {
+ return preg_replace("/^.*SELECT(.*?)FROM(?!_)/is", "SELECT COUNT(*) AS count FROM ", $sql);
+ }
+ }
+
+ /**
+ * Queries the database with SQL resulted from {@link kDBList::GetSelectSQL()} and stores result in {@link kDBList::SelectRS}
+ *
+ * All the sorting, pagination, filtration of the list should be set prior to calling Query().
+ *
+ * @access public
+ * @param string
+ * @return void
+ */
+ function Query($force=false)
+ {
+ if (!$force && $this->Queried) return true;
+ $q = $this->GetSelectSQL();
+
+ //$rs = $this->Conn->SelectLimit($q, $this->PerPage, $this->Offset);
+
+ //in case we have not counted records try to select one more item to find out if we have something more than perpage
+ $limit = $this->Counted ? $this->PerPage : $this->PerPage+1;
+
+ $sql = $q.' '.$this->Conn->getLimitClause($this->Offset,$limit);
+
+ $this->Records = $this->Conn->Query($sql);
+ $this->SelectedCount = count($this->Records);
+ if (!$this->Counted) $this->RecordsCount = $this->SelectedCount;
+ if (!$this->Counted && $this->SelectedCount > $this->PerPage && $this->PerPage != -1) $this->SelectedCount--;
+
+ if ($this->Records === false) {
+ //handle errors here
+ return false;
+ }
+ $this->Queried = true;
+ return true;
+ }
+
+ function CalculateTotals()
+ {
+ $this->Totals = Array();
+
+ $fields = Array();
+ foreach($this->Fields as $field_name => $field_options)
+ {
+ $totals = getArrayValue($field_options, 'totals');
+ if(!$totals) continue;
+
+ $calculated_field = isset($this->CalculatedFields[$field_name]) && isset($this->VirtualFields[$field_name]);
+ $db_field = !isset($this->VirtualFields[$field_name]);
+
+ if($calculated_field || $db_field)
+ {
+ $field_expression = $calculated_field ? $this->CalculatedFields[$field_name] : '`'.$this->TableName.'`.`'.$field_name.'`';
+ $fields[$field_name] = $totals.'('.$field_expression.') AS '.$field_name.'_'.$totals;
+ }
+ }
+
+ if(!$fields) return false;
+
+ $sql = $this->GetSelectSQL(true, false);
+ $fields = implode(', ', $fields);
+
+ if ( preg_match("/DISTINCT(.*?)FROM(?!_)/is",$sql,$regs ) )
+ {
+ $sql = preg_replace("/^.*SELECT DISTINCT(.*?)FROM(?!_)/is", 'SELECT '.$fields.' FROM', $sql);
+ }
+ else
+ {
+ $sql = preg_replace("/^.*SELECT(.*?)FROM(?!_)/is", 'SELECT '.$fields.' FROM ', $sql);
+ }
+
+ $totals = $this->Conn->Query($sql);
+
+ foreach($totals as $totals_row)
+ {
+ foreach($totals_row as $total_field => $field_value)
+ {
+ if(!isset($this->Totals[$total_field])) $this->Totals[$total_field] = 0;
+ $this->Totals[$total_field] += $field_value;
+ }
+ }
+ $this->TotalsCalculated = true;
+ }
+
+ function getTotal($field, $total_function)
+ {
+ if (!$this->TotalsCalculated) $this->CalculateTotals();
+ return $this->Totals[$field.'_'.$total_function];
+ }
+
+ /**
+ * Builds full select query except for LIMIT clause
+ *
+ * @access public
+ * @return string
+ */
+ function GetSelectSQL($for_counting=false,$system_filters_only=false)
+ {
+ $q = parent::GetSelectSQL($this->SelectClause);
+ $q = !$for_counting ? $this->addCalculatedFields($q, 0) : str_replace('%2$s', '', $q);
+
+ $where = $this->GetWhereClause($for_counting,$system_filters_only);
+ $having = $this->GetHavingClause($for_counting,$system_filters_only);
+ $order = $this->GetOrderClause();
+ $group = $this->GetGroupClause();
+
+ if (!empty($where)) $q .= ' WHERE ' . $where;
+ if (!empty($group)) $q .= ' GROUP BY ' . $group;
+ if (!empty($having)) $q .= ' HAVING ' . $having;
+ if ( !$for_counting && !empty($order) ) $q .= ' ORDER BY ' . $order;
+
+ return $this->replaceModePrefix( str_replace('%1$s', $this->TableName, $q) );
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param string $clause where clause to extract calculated fields from
+ * @param int $aggregated 0 - having + aggregated, 1 - having only, 2 - aggregated only
+ * @return string
+ */
+ function extractCalculatedFields($clause, $aggregated = 1)
+ {
+ $fields = $this->getCalculatedFields($aggregated);
+ if (is_array($fields) && count($fields) > 0) {
+ foreach ($fields as $field_name => $field_expression) {
+ $clause = preg_replace('/[,` ]{1}'.$field_name.'[` ]{1}/', $field_expression, $clause);
+ }
+ }
+ return $clause;
+ }
+
+ /**
+ * Returns WHERE clause of the query
+ *
+ * @access public
+ * @param bool $for_counting merge where filters with having filters + replace field names for having fields with their values
+ * @return string
+ */
+ function GetWhereClause($for_counting=false,$system_filters_only=false)
+ {
+ $where =& $this->Application->makeClass('kMultipleFilter');
+
+ $where->addFilter('system_where', $this->WhereFilter[FLT_SYSTEM] );
+
+ if (!$system_filters_only) {
+ $where->addFilter('view_where', $this->WhereFilter[FLT_VIEW] );
+ $search_w = $this->WhereFilter[FLT_SEARCH]->getSQL();
+ if( $search_w || $for_counting ) // move search_having to search_where in case search_where isset or we are counting
+ {
+ $search_h = $this->extractCalculatedFields( $this->HavingFilter[FLT_SEARCH]->getSQL() );
+ $search_w = ($search_w && $search_h) ? $search_w.' OR '.$search_h : $search_w.$search_h;
+ $where->addFilter('search_where', $search_w );
+ }
+ }
+
+ if( $for_counting ) // add system_having and view_having to where
+ {
+ $where->addFilter('system_having', $this->extractCalculatedFields($this->HavingFilter[FLT_SYSTEM]->getSQL()) );
+ if (!$system_filters_only) $where->addFilter('view_having', $this->extractCalculatedFields( $this->HavingFilter[FLT_VIEW]->getSQL() ) );
+ }
+
+ return $where->getSQL();
+ }
+
+ /**
+ * Depricated method
+ *
+ * @param string $clause
+ * @todo REMOVE
+ */
+ function SetWhereClause($clause)
+ {
+ if( $this->Application->isDebugMode() )
+ {
+ global $debugger;
+ $debugger->appendTrace();
+ }
+ trigger_error('Depricated method <b>kDBList->SetWhereClause</b>. Use <b>kDBList->addFilter</b> instead.', E_USER_ERROR);
+ }
+
+ /**
+ * Returns HAVING clause of the query
+ *
+ * @param bool $for_counting don't return having filter in case if this is counting sql
+ * @param bool $system_filters_only return only system having filters
+ * @param int $aggregated 0 - aggregated and having, 1 - having only, 2 - aggregated only
+ * @return string
+ * @access public
+ */
+ function GetHavingClause($for_counting=false, $system_filters_only=false, $aggregated = 0)
+ {
+ if ($for_counting) {
+ $aggregate_filter =& $this->Application->makeClass('kMultipleFilter');
+ $aggregate_filter->addFilter('aggregate_system', $this->AggregateFilter[FLT_SYSTEM]);
+ if (!$system_filters_only) {
+ $aggregate_filter->addFilter('aggregate_view', $this->AggregateFilter[FLT_VIEW]);
+ }
+ return $this->extractCalculatedFields($aggregate_filter->getSQL(), 2);
+ }
+
+ $having =& $this->Application->makeClass('kMultipleFilter');
+
+ $having->addFilter('system_having', $this->HavingFilter[FLT_SYSTEM] );
+ if ($aggregated == 0) {
+ if (!$system_filters_only) {
+ $having->addFilter('view_aggregated', $this->AggregateFilter[FLT_VIEW] );
+ }
+ $having->addFilter('system_aggregated', $this->AggregateFilter[FLT_SYSTEM]);
+ }
+
+ if (!$system_filters_only) {
+ $having->addFilter('view_having', $this->HavingFilter[FLT_VIEW] );
+ $search_w = $this->WhereFilter[FLT_SEARCH]->getSQL();
+ if (!$search_w) {
+ $having->addFilter('search_having', $this->HavingFilter[FLT_SEARCH] );
+ }
+ }
+
+ return $having->getSQL();
+ }
+
+ /**
+ * Returns GROUP BY clause of the query
+ *
+ * @access public
+ * @return string
+ */
+ function GetGroupClause()
+ {
+ return $this->GroupByFields ? implode(',', $this->GroupByFields) : '';
+ }
+
+ function AddGroupByField($field)
+ {
+ $this->GroupByFields[$field] = $field;
+ }
+
+ function RemoveGroupByField($field)
+ {
+ unset($this->GroupByFields[$field]);
+ }
+
+ /**
+ * Adds order field to ORDER BY clause
+ *
+ * @access public
+ * @param string $field Field name
+ * @param string $direction Direction of ordering (asc|desc)
+ * @return void
+ */
+ function AddOrderField($field, $direction)
+ {
+ // original multilanguage field - convert to current lang field
+ if (getArrayValue($this->Fields, $field, 'formatter') == 'kMultiLanguage' && !getArrayValue($this->Fields, $field, 'master_field')) {
+ $lang = $this->Application->GetVar('m_lang');
+ $field = 'l'.$lang.'_'.$field;
+ }
+
+ if (!isset($this->Fields[$field]) && ($field != 'RAND()')) {
+ trigger_error('<span class="debug_error">Incorrect sorting</span> defined (field = <b>'.$field.'</b>; direction = <b>'.$direction.'</b>) in config for prefix <b>'.$this->Prefix.'</b>', E_USER_WARNING);
+ }
+
+ $this->OrderFields[] = Array($field, $direction);
+ }
+
+ /**
+ * Removes all order fields
+ *
+ * @access public
+ * @return void
+ */
+ function ClearOrderFields()
+ {
+ $this->OrderFields = Array();
+ }
+
+ /**
+ * Returns ORDER BY Clause of the query
+ *
+ * The method builds order by clause by iterating {@link kDBList::OrderFields} array and concatenating it.
+ *
+ * @access public
+ * @return string
+ */
+ function GetOrderClause()
+ {
+ $ret = '';
+ foreach ($this->OrderFields as $field) {
+
+ $name = $field[0];
+ $ret .= isset($this->Fields[$name]) && !isset($this->VirtualFields[$name]) ? '`'.$this->TableName.'`.' : '';
+ if ($field[0] == 'RAND()') {
+ $ret .= $field[0].' '.$field[1].',';
+ }
+ else {
+ $ret .= '`'.$field[0] . '` ' . $field[1] . ',';
+ }
+ }
+ $ret = rtrim($ret, ',');
+ return $ret;
+ }
+
+ function GetOrderField($pos=NULL)
+ {
+ if(!(isset($this->OrderFields[$pos]) && $this->OrderFields[$pos]) )
+ {
+ $pos = 0;
+ }
+ return isset($this->OrderFields[$pos][0]) ? $this->OrderFields[$pos][0] : '';
+ }
+
+ function GetOrderDirection($pos=NULL)
+ {
+ if( !getArrayValue($this->OrderFields, $pos) ) $pos = 0;
+ return getArrayValue($this->OrderFields, $pos, 1);
+ }
+
+ /**
+ * Return unformatted field value
+ *
+ * @param string
+ * @return mixed
+ * @access public
+ */
+ function GetDBField($name)
+ {
+ $row =& $this->getCurrentRecord();
+ return $row[$name];
+ }
+
+ function HasField($name)
+ {
+ $row =& $this->getCurrentRecord();
+ return isset($row[$name]);
+ }
+
+ function GetFieldValues()
+ {
+ return $this->getCurrentRecord();
+ }
+
+ function &getCurrentRecord()
+ {
+ return $this->Records[$this->CurrentIndex];
+ }
+
+ /**
+ * Description
+ *
+ * @access public
+ * @param string
+ * @return void
+ */
+ function GoFirst()
+ {
+ $this->CurrentIndex = 0;
+ }
+
+ /**
+ * Description
+ *
+ * @access public
+ * @return void
+ */
+ function GoNext()
+ {
+ $this->CurrentIndex++;
+ }
+
+ /**
+ * Description
+ *
+ * @access public
+ * @return void
+ */
+ function GoPrev()
+ {
+ if ($this->CurrentIndex>0)
+ $this->CurrentIndex--;
+ }
+
+ /**
+ * Description
+ *
+ * @access public
+ * @return bool
+ */
+ function EOL()
+ {
+ return ($this->CurrentIndex >= $this->SelectedCount);
+ }
+
+ /**
+ * Description
+ *
+ * @access public
+ * @param string
+ * @return void
+ */
+ function GetTotalPages()
+ {
+ if (!$this->Counted) $this->CountRecs();
+ if ($this->PerPage == -1) return 1;
+ $this->TotalPages = (($this->RecordsCount - ($this->RecordsCount % $this->PerPage)) / $this->PerPage) // integer part of division
+ + (($this->RecordsCount % $this->PerPage) != 0); // adds 1 if there is a reminder
+ return $this->TotalPages;
+ }
+
+ /**
+ * Sets number of records to query per page
+ *
+ * @access public
+ * @param int $per_page Number of records to display per page
+ * @return void
+ */
+ function SetPerPage($per_page)
+ {
+ $this->PerPage = $per_page;
+ }
+
+ function GetPerPage()
+ {
+ return $this->PerPage == -1 ? $this->RecordsCount : $this->PerPage;
+ }
+
+ /**
+ * Description
+ *
+ * @access public
+ * @param int $page
+ * @return void
+ */
+ function SetPage($page)
+ {
+ if ($this->PerPage == -1) {
+ $this->Page = 1;
+ return;
+ }
+ if ($page < 1) $page = 1;
+ $this->Offset = ($page-1)*$this->PerPage;
+ if ($this->Counted && $this->Offset > $this->RecordsCount) {
+ $this->SetPage(1);
+ }
+ else {
+ $this->Page = $page;
+ }
+ //$this->GoFirst();
+ }
+
+ /**
+ * Sets current item field value
+ * (doesn't apply formatting)
+ *
+ * @access public
+ * @param string $name Name of the field
+ * @param mixed $value Value to set the field to
+ * @return void
+ */
+ function SetDBField($name,$value)
+ {
+ $this->Records[$this->CurrentIndex][$name] = $value;
+ }
+
+ /**
+ * Apply where clause, that links this object to it's parent item
+ *
+ * @param string $special
+ * @access public
+ */
+ function linkToParent($special)
+ {
+ $parent_prefix = $this->Application->getUnitOption($this->Prefix, 'ParentPrefix');
+ if($parent_prefix)
+ {
+ $parent_table_key = $this->Application->getUnitOption($this->Prefix, 'ParentTableKey');
+ if (is_array($parent_table_key)) $parent_table_key = getArrayValue($parent_table_key, $parent_prefix);
+ $foreign_key_field = $this->Application->getUnitOption($this->Prefix, 'ForeignKey');
+ if (is_array($foreign_key_field)) $foreign_key_field = getArrayValue($foreign_key_field, $parent_prefix);
+
+ if (!$parent_table_key || !$foreign_key_field) return ;
+
+ $parent_object =& $this->Application->recallObject($parent_prefix.'.'.$special);
+ $parent_id = $parent_object->GetDBField($parent_table_key);
+
+ $this->addFilter('parent_filter', '`'.$this->TableName.'`.`'.$foreign_key_field.'` = '.$parent_id); // only for list in this case
+ }
+ }
+}
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.19.2/core/kernel/db/dblist.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.19
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.19.2/admin/users/user_list.php
===================================================================
--- branches/unlabeled/unlabeled-1.19.2/admin/users/user_list.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.19.2/admin/users/user_list.php (revision 6108)
@@ -0,0 +1,319 @@
+<?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. ##
+##############################################################
+
+// new startup: begin
+define('REL_PATH', 'admin/users');
+$relation_level = count( explode('/', REL_PATH) );
+define('FULL_PATH', realpath(dirname(__FILE__) . str_repeat('/..', $relation_level) ) );
+require_once FULL_PATH.'/kernel/startup.php';
+// new startup: end
+
+checkViewPermission('in-portal:user_list');
+
+require_login();
+
+$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."/toolbar.php");
+require_once($pathtoroot.$admin."/listview/listview.php");
+
+$pathtolocal = $pathtoroot;
+
+
+$objSession->SetVariable('ReturnScript', 'users/'.basename($_SERVER['PHP_SELF']) );
+
+/* -------------------------------------- Section configuration ------------------------------------------- */
+$section = 'in-portal:user_list';
+$envar = "env=" . BuildEnv();
+
+$SortFieldVar = "User_SortField";
+$SortOrderVar = "User_SortOrder";
+
+$DefaultSortField = "Login";
+$PerPageVar = "Perpage_User";
+$CurrentPageVar = "Page_UserList";
+$CurrentFilterVar = "User_View";
+
+$ListForm = "userlistform";
+$CheckClass = "UserChecks";
+
+/* ------------------------------------- Configure the toolbar ------------------------------------------- */
+$objListToolBar = new clsToolBar();
+
+$objListToolBar->Set("section",$section);
+$objListToolBar->Set("load_menu_func","");
+$objListToolBar->Set("CheckClass",$CheckClass);
+$objListToolBar->Set("CheckForm",$ListForm);
+
+$listImages = array();
+ //$img, $alt, $link, $onMouseOver, $onMouseOut, $onClick
+
+$objListToolBar->Add("new_user", "la_ToolTip_New_User",$adminURL."/users/adduser.php?$envar&new=1","swap('new_user','toolbar/tool_new_user_f2.gif');",
+ "swap('new_user', 'toolbar/tool_new_user.gif');","");
+
+$objListToolBar->Add("user_edit","la_ToolTip_Edit","#", "if (UserChecks.itemChecked()) swap('user_edit','toolbar/tool_edit_f2.gif');",
+ "if (UserChecks.itemChecked()) swap('user_edit', 'toolbar/tool_edit.gif');","if (UserChecks.itemChecked()) UserChecks.check_submit('adduser', '');",
+ "tool_edit.gif",TRUE,TRUE);
+$listImages[] = "UserChecks.addImage('user_edit','$imagesURL/toolbar/tool_edit.gif','$imagesURL/toolbar/tool_edit_f3.gif',1); ";
+
+$objListToolBar->Add("user_del","la_ToolTip_Delete","#", "if (UserChecks.itemChecked()) swap('user_del','toolbar/tool_delete_f2.gif');",
+ "if (UserChecks.itemChecked()) swap('user_del', 'toolbar/tool_delete.gif');","if (UserChecks.itemChecked()) UserChecks.check_submit('user_list', 'm_delete_user');",
+ "tool_delete.gif",FALSE,TRUE);
+$listImages[] = "UserChecks.addImage('user_del','$imagesURL/toolbar/tool_delete.gif','$imagesURL/toolbar/tool_delete_f3.gif',1); ";
+
+$objListToolBar->Add("user_primary","la_ToolTip_PrimaryGroup","#", "if (UserChecks.itemChecked()) swap('user_primary','toolbar/tool_primary_user_group_f2.gif');",
+ "if (UserChecks.itemChecked()) swap('user_primary', 'toolbar/tool_primary_user_group.gif');","if (UserChecks.itemChecked()) SelectPrimaryGroup();",
+ "tool_primary_user_group.gif",FALSE,TRUE);
+$listImages[] = "UserChecks.addImage('user_primary','$imagesURL/toolbar/tool_primary_user_group.gif','$imagesURL/toolbar/tool_primary_user_group_f3.gif',1); ";
+
+$objListToolBar->Add("divider");
+
+$objListToolBar->Add("user_app","la_ToolTip_Approve","#","if (UserChecks.itemChecked()) swap('user_app','toolbar/tool_approve_f2.gif');",
+ "if (UserChecks.itemChecked()) swap('user_app', 'toolbar/tool_approve.gif');","if (UserChecks.itemChecked()) UserChecks.check_submit('user_list', 'm_approve_user');",
+ "tool_approve.gif",FALSE,TRUE);
+$listImages[] = "UserChecks.addImage('user_app','$imagesURL/toolbar/tool_approve.gif','$imagesURL/toolbar/tool_approve_f3.gif',1); ";
+
+$objListToolBar->Add("user_deny","la_ToolTip_Deny","#","if (UserChecks.itemChecked()) swap('user_deny','toolbar/tool_decline_f2.gif');",
+ "if (UserChecks.itemChecked()) swap('user_deny', 'toolbar/tool_decline.gif');","if (UserChecks.itemChecked()) UserChecks.check_submit('user_list', 'm_deny_user');",
+ "tool_deny.gif",FALSE,TRUE);
+$listImages[] = "UserChecks.addImage('user_deny','$imagesURL/toolbar/tool_decline.gif','$imagesURL/toolbar/tool_decline_f3.gif',1); ";
+
+$objListToolBar->Add("user_ban","la_ToolTip_Ban","#","if (UserChecks.itemChecked()) swap('user_ban','toolbar/tool_ban_user_f2.gif');",
+ "if (UserChecks.itemChecked()) swap('user_ban', 'toolbar/tool_ban_user.gif');","if (UserChecks.itemChecked()) UserChecks.check_submit('banuser', '');",
+ "tool_deny.gif",FALSE,TRUE);
+$listImages[] = "UserChecks.addImage('user_ban','$imagesURL/toolbar/tool_ban_user.gif','$imagesURL/toolbar/tool_ban_user_f3.gif',1); ";
+
+$objListToolBar->Add("divider");
+
+$objListToolBar->Add("user_mail","la_ToolTip_SendMail","#", "if (UserChecks.itemChecked()) swap('user_mail','toolbar/tool_e-mail_f2.gif');",
+ "if (UserChecks.itemChecked()) swap('user_mail', 'toolbar/tool_e-mail.gif');","if (UserChecks.itemChecked()) openEmailPopup('','sendmail',$CheckClass);",
+ "tool_e-mail.gif",FALSE,TRUE);
+
+$listImages[] = "UserChecks.addImage('user_mail','$imagesURL/toolbar/tool_e-mail.gif','$imagesURL/toolbar/tool_e-mail_f3.gif',1); ";
+
+$objListToolBar->Add("user_print", "la_ToolTip_Print","#","swap('user_print','toolbar/tool_print_f2.gif');",
+ "swap('user_print', 'toolbar/tool_print.gif');","window.print();","tool_print.gif");
+
+$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 ---------------------------------------- */
+
+/* bit place holders for category view menu */
+$Bit_Pending=4;
+$Bit_Disabled=2;
+$Bit_Valid=1;
+$Bit_All = 7;
+
+$FilterLabels = array();
+
+$FilterLabels[0] = admin_language("la_Text_Enabled");
+$FilterLabels[1] = admin_language("la_Text_Disabled");
+$FilterLabels[2] = admin_language("la_Text_Pending");
+
+/* determine current view menu settings */
+$UserView = $objConfig->Get("User_View");
+
+if(!is_numeric($UserView))
+{
+ $UserView = $Bit_All; //Set all bits ON
+ $UserFilter = "";
+}
+ if($UserView & $Bit_Valid)
+ $Status[] = 1;
+
+ if($UserView & $Bit_Disabled)
+ $Status[] = 0;
+
+ if($UserView & $Bit_Pending)
+ $Status[] = 2;
+
+ if(count($Status)>0)
+ {
+ $UserFilter = "Status IN (".implode(",",$Status).")";
+ }
+ else
+ $UserFilter = "Status = -1";
+
+$order = $objConfig->Get($SortOrderVar);
+$SearchWords = $objSession->GetVariable("UserSearchWord");
+
+$where = '1';
+
+$SearchWhere = $SearchWords ? $objUsers->AdminSearchWhereClause($SearchWords) : '';
+if(strlen($SearchWhere))
+{
+ $where .= " AND (".$SearchWhere.")";
+}
+
+if(strlen($UserFilter))
+ $where .= " AND (".$UserFilter.")";
+
+
+/* ------------------------------------ Build the SQL statement to populate the list ---------------------------*/
+
+$sql = "SELECT u.*,g.Name as GroupName,ELT(u.status+1,'".admin_language("la_Text_Disabled")." ','".admin_language("la_Text_Enabled")." ','".admin_language("la_Text_Pending")."') as UserStatus, ";
+$sql .="FROM_UNIXTIME(u.CreatedOn,'%m-%d-%Y %H:%i:%s') as DateCreated FROM ".GetTablePrefix()."PortalUser as u ";
+$sql .="LEFT JOIN ".GetTablePrefix()."UserGroup as ug ON (u.PortalUserId=ug.PortalUserId) AND (ug.PrimaryGroup = 1) ";
+$sql .="LEFT JOIN ".GetTablePrefix()."PortalGroup as g ON (ug.GroupId=g.GroupId) WHERE $where";
+
+if(!strlen($objConfig->Get($SortFieldVar)))
+ $objConfig->Set($SortFieldVar,$DefaultSortField);
+
+$orderBy = trim($objConfig->Get($SortFieldVar)." ".$objConfig->Get($SortOrderVar));
+
+if(strlen($orderBy))
+ $sql .=" ORDER BY ".$orderBy;
+
+if( GetVar('resetpage') )
+{
+ $page = 1;
+ $objSession->SetVariable($CurrentPageVar,1);
+}
+else
+{
+ if( GetVar('lpn') )
+ {
+ $page = GetVar('lpn');
+ $objSession->SetVariable($CurrentPageVar, $page);
+ }
+ else
+ {
+ $page = $objSession->GetVariable($CurrentPageVar);
+ }
+}
+//$sql .=" ".GetLimitSQL($page,(int)$objConfig->Get($PerPageVar));
+
+$objSession->SetVariable("HasChanges", 0);
+
+if($objSession->HasSystemPermission("DEBUG.LIST"))
+ echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
+$objListView = new clsListView($objListToolBar);
+$objListView->CurrentPageVar = $CurrentPageVar;
+$objListView->PerPageVar = $PerPageVar;
+ //echo "SQL: $sql<br>";
+
+$objUsers->Query_Item($sql, false, 'set_first');
+$objSession->SetVariable($CurrentPageVar, 1);
+
+$itemcount = QueryCount($sql);
+//$title = prompt_language("la_Text_ShowingUsers")." (".$objUsers->NumItems().")";
+//removed by PSK 2004-10-21
+if(strlen($SearchWords))
+{
+ $title = prompt_language("la_Text_Search_Results")." (".$itemcount.")";
+ }
+else
+ $title = prompt_language("la_Text_ShowingUsers")." (".$itemcount.")";
+
+ $objListView->SetListItems($objUsers);
+/* ---------------------------------------- Configure the list view ---------------------------------------- */
+
+$objListView->IdField = "ResourceId";
+$objListView->PageLinkTemplate = $pathtoroot.$admin."/templates/user_page_link.tpl";
+
+$objListView->ColumnHeaders->Add("Login",admin_language("la_prompt_Username"),1,0,$order,"width=\"15%\"",$SortFieldVar,$SortOrderVar,"Login");
+$objListView->ColumnHeaders->Add("LastName",admin_language("la_prompt_Last_Name"),1,0,$order,"width=\"15%\"",$SortFieldVar,$SortOrderVar,"LastName");
+$objListView->ColumnHeaders->Add("FirstName",admin_language("la_prompt_First_Name"),1,0,$order,"width=\"15%\"",$SortFieldVar,$SortOrderVar,"FirstName");
+$objListView->ColumnHeaders->Add("Email",admin_language("la_prompt_Email"),1,0,$order,"width=\"20%\"",$SortFieldVar,$SortOrderVar,"Email");
+$objListView->ColumnHeaders->Add("GroupName",admin_language("la_prompt_PrimaryGroup"),1,0,$order,"width=\"20%\"",$SortFieldVar,$SortOrderVar,"GroupName");
+$objListView->ColumnHeaders->Add("DateCreated",admin_language("la_prompt_CreatedOn"),1,0,$order,"width=\"15%\"",$SortFieldVar,$SortOrderVar,"u.CreatedOn");
+
+$objListView->ColumnHeaders->SetSort($objConfig->Get($SortFieldVar), $objConfig->Get($SortOrderVar));
+
+$objListView->PrintToolBar = FALSE;
+$objListView->SearchBar = TRUE;
+$objListView->SearchKeywords = $SearchWords;
+$objListView->SearchAction="m_user_search";
+$objListView->CheckboxName = "itemlist[]";
+$objListView->TotalItemCount = $itemcount;
+
+ $objListView->ConfigureViewMenu($SortFieldVar,$SortOrderVar,$DefaultSortField,
+ $CurrentFilterVar,$UserView,$Bit_All);
+
+ foreach($FilterLabels as $Bit=>$Label)
+ {
+ $objListView->AddViewMenuFilter($Label,$Bit);
+ }
+
+for($i=0;$i<count($objUsers->Items);$i++)
+{
+ $u =& $objUsers->GetItemRefByIndex($i);
+ $objListView->RowIcons[] = $u->StatusIcon();
+}
+$objListToolBar->AddToInitScript("fwLoadMenus();");
+
+$filter = false; // always initialize variables before use
+if($objSession->GetVariable("UserSearchWord") != '') {
+ $filter = true;
+}
+else {
+ if ($UserView != $Bit_All) {
+ $filter = true;
+ }
+}
+
+$h = "\n\n<SCRIPT Language=\"JavaScript1.2\">\n".$objListView->GetViewMenu($imagesURL)."\n</SCRIPT>\n";
+int_header($objListToolBar,NULL, $title,NULL,$h);
+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 } ?>
+<FORM method="POST" ACTION="" NAME="userlistform" ID="userlistform">
+<?php
+ print $objListView->PrintList();
+?>
+<input type="hidden" name="Action" value="">
+</FORM>
+<FORM method=POST NAME="sendmail" ID="sendmail" target="sendmail" ACTION="<?php echo $adminURL."/email/sendmail.php?env=".BuildEnv(); ?>">
+ <INPUT TYPE="HIDDEN" NAME="idlist" ID="idlist" VALUE="">
+ <INPUT TYPE="hidden" NAME="idtype" ID="idtype" VALUE="user">
+</FORM>
+<!-- CODE FOR VIEW MENU -->
+<form ID="viewmenu" method="post" action="user_list.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>
+
+<form ID="popup" method="post" action="user_list.php?env=<?php echo BuildEnv(); ?>" name="popup">
+ <INPUT TYPE="hidden" NAME="grouplist">
+ <input TYPE="hidden" NAME="Action" VALUE="m_user_primarygroup">
+ <input type="hidden" NAME="userlist">
+</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(); ?>
Property changes on: branches/unlabeled/unlabeled-1.19.2/admin/users/user_list.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.19
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Event Timeline