Index: trunk/kernel/admin_templates/img/logo.gif =================================================================== diff -u -N -r1566 -r4524 Binary files differ Index: trunk/kernel/units/languages/languages_item.php =================================================================== diff -u -N -r4169 -r4524 --- trunk/kernel/units/languages/languages_item.php (.../languages_item.php) (revision 4169) +++ trunk/kernel/units/languages/languages_item.php (.../languages_item.php) (revision 4524) @@ -21,6 +21,18 @@ WHERE '.$this->IDField.' = '.$this->GetID(); $this->Conn->Query($sql); } + + /** + * Allows to format number according to regional settings + * + * @param float $number + * @param int $precision + * @return float + */ + function formatNumber($number, $precision = null) + { + return number_format($number, $precision, $this->GetDBField('DecimalPoint'), $this->GetDBField('ThousandSep')); + } } ?> \ No newline at end of file Index: trunk/kernel/units/users/users_event_handler.php =================================================================== diff -u -N -r4490 -r4524 --- trunk/kernel/units/users/users_event_handler.php (.../users_event_handler.php) (revision 4490) +++ trunk/kernel/units/users/users_event_handler.php (.../users_event_handler.php) (revision 4524) @@ -920,6 +920,25 @@ $object->IgnoreValidation = true; $object->SetFieldsFromHash($fields); } + + /** + * Sets persistant variable + * + * @param kEvent $event + */ + function OnSetPersistantVariable(&$event) + { + $object =& $event->getObject(); + + $field = $this->Application->GetVar('field'); + $value = $this->Application->GetVar('value'); + $object->setPersistantVar($field, $value); + + $force_tab = $this->Application->GetVar('SetTab'); + if ($force_tab) { + $this->Application->StoreVar('force_tab', $force_tab); + } + } } ?> \ No newline at end of file Index: trunk/kernel/admin_templates/incs/footer.tpl =================================================================== diff -u -N -r4457 -r4524 --- trunk/kernel/admin_templates/incs/footer.tpl (.../footer.tpl) (revision 4457) +++ trunk/kernel/admin_templates/incs/footer.tpl (.../footer.tpl) (revision 4524) @@ -1,4 +1,7 @@ +

+
+ Index: trunk/kernel/admin_templates/incs/script.js =================================================================== diff -u -N -r4477 -r4524 --- trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 4477) +++ trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 4524) @@ -114,6 +114,14 @@ submit_kernel_form(); } +function submit_action($url, $action) +{ + $form = document.getElementById($form_name); + $form.action = $url; + set_hidden_field('Action', $action); + submit_kernel_form(); +} + function show_form_data() { var $kf = document.getElementById($form_name); @@ -132,8 +140,8 @@ return; } submitted = true; + var $form = document.getElementById($form_name); - processHooks('SubmitKF', hBEFORE); if (typeof $form.onsubmit == "function") { $form.onsubmit(); @@ -891,6 +899,13 @@ } }; + function set_persistant_var($var_name, $var_value, $t, $form_action) + { + set_hidden_field('field', $var_name); + set_hidden_field('value', $var_value); + submit_event('u', 'OnSetPersistantVariable', $t, $form_action); + } + /*functionremoveEvent(el, evname, func) { if (Calendar.is_ie) { el.detachEvent("on" + evname, func); Index: trunk/core/units/users/users_item.php =================================================================== diff -u -N -r4065 -r4524 --- trunk/core/units/users/users_item.php (.../users_item.php) (revision 4065) +++ trunk/core/units/users/users_item.php (.../users_item.php) (revision 4524) @@ -15,11 +15,16 @@ { $this->persistantVars[$var_name] = $var_value; - $replace_hash = Array( 'PortalUserId' => $this->GetID(), - 'VariableName' => $var_name, - 'VariableValue' => $var_value - ); - $this->Conn->doInsert($replace_hash, TABLE_PREFIX.'PersistantSessionData', 'REPLACE'); + if ($this->GetID() > 0) { + $replace_hash = Array( 'PortalUserId' => $this->GetID(), + 'VariableName' => $var_name, + 'VariableValue' => $var_value + ); + $this->Conn->doInsert($replace_hash, TABLE_PREFIX.'PersistantSessionData', 'REPLACE'); + } + else { + $this->Application->StoreVar($var_name, $var_value); + } } function getPersistantVar($var_name) Index: trunk/core/units/categories/categories_config.php =================================================================== diff -u -N -r4471 -r4524 --- trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 4471) +++ trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 4524) @@ -23,6 +23,17 @@ 'IDField' => 'CategoryId', 'TitleField' => 'Name', // field, used in bluebar when editing existing item 'ItemType' => 1, // used for custom fields only + + 'StatisticsInfo' => Array( + 'pending' => Array( + 'icon' => 'icon16_cat_pending.gif', + 'label' => 'la_tab_Categories', + 'js_url' => "set_persistant_var('Category_View', 41, 'advanced_view', '#url#')", + 'url' => Array('t' => 'advanced_view', 'index_file' => 'advanced_view.php', 'SetTab' => 'category', 'pass' => 'm'), + 'status' => STATUS_PENDING, + ), + ), + 'TableName' => TABLE_PREFIX.'Category', 'ViewMenuPhrase' => 'la_text_Categories', Index: trunk/kernel/units/statistics/statistics_config.php =================================================================== diff -u -N --- trunk/kernel/units/statistics/statistics_config.php (revision 0) +++ trunk/kernel/units/statistics/statistics_config.php (revision 4524) @@ -0,0 +1,65 @@ + 'stat', + 'ItemClass' => Array('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'), + 'ListClass' => Array('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'), + 'EventHandlerClass' => Array('class' => 'StatisticsEventHandler', 'file' => 'statistics_event_handler.php', 'build_event' => 'OnBuild'), + 'TagProcessorClass' => Array('class' => 'StatisticsTagProcessor', 'file' => 'statistics_tag_processor.php', 'build_event' => 'OnBuild'), + + 'AutoLoad' => true, + + 'QueryString' => Array( + 1 => 'id', + 2 => 'page', + 3 => 'event', + 4 => 'mode', + ), + + 'IDField' => 'StatItemId', + + 'TitleField' => 'ListLabel', + + 'TitlePresets' => Array( + 'statistics_list' => Array('prefixes' => Array('stat_List'), 'format' => "!la_title_Statistics! (#stat_recordcount#)"), + ), + + 'TableName' => TABLE_PREFIX.'StatItem', + + 'ListSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), + 'ItemSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), + + 'ListSortings' => Array( + '' => Array( + 'Sorting' => Array('Priority' => 'asc'), + ) + ), + + 'Fields' => Array( + 'StatItemId' => Array(), + 'Module' => Array('type' => 'string','not_null' => '1','default' => ''), + 'ValueSQL' => Array('type' => 'string','default' => ''), + 'ResetSQL' => Array('type' => 'string','default' => ''), + 'ListLabel' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Priority' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'AdminSummary' => Array('type' => 'int','not_null' => '1','default' => '0'), + ), + + + + 'Grids' => Array( + 'Default' => Array( + 'Icons' => Array('default' => 'icon16_custom.gif'), + 'Fields' => Array( + 'Login' => Array('title' => 'la_col_Username', 'data_block' => 'grid_checkbox_td'), + 'LastName' => Array( 'title'=>'la_col_LastName'), + 'FirstName' => Array( 'title'=>'la_col_FirstName'), + ), + ), + + + ), + + ); + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/summary/usersbox_bg.gif =================================================================== diff -u -N -r1685 -r4524 Binary files differ Index: trunk/admin/install/install_lib.php =================================================================== diff -u -N -r4451 -r4524 --- trunk/admin/install/install_lib.php (.../install_lib.php) (revision 4451) +++ trunk/admin/install/install_lib.php (.../install_lib.php) (revision 4524) @@ -1016,7 +1016,7 @@ */ function linkCustomFields($module_name, $prefix, $item_type) { - $application = kApplication::Instance(); + $application =& kApplication::Instance(); $db =& $application->GetADODBConnection(); $sql = 'SELECT FieldName, CustomFieldId FROM '.TABLE_PREFIX.'CustomField @@ -1029,6 +1029,8 @@ $db->Query($sql); } + $application->refreshModuleInfo(); // this module configs are now processed + // because of configs was read only from installed before modules (in-portal), then reread configs $unit_config_reader =& $application->recallObject('kUnitConfigReader'); $unit_config_reader->scanModules(MODULES_PATH.'/'.strtolower($module_name)); Index: trunk/kernel/units/statistics/statistics_event_handler.php =================================================================== diff -u -N --- trunk/kernel/units/statistics/statistics_event_handler.php (revision 0) +++ trunk/kernel/units/statistics/statistics_event_handler.php (revision 4524) @@ -0,0 +1,19 @@ +Special == 'summary') { + $object =& $event->getObject(); + $object->addFilter('summary_filter', '%1$s.AdminSummary = 1'); + } + } + } + +?> \ No newline at end of file Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r4490 -r4524 --- trunk/core/kernel/application.php (.../application.php) (revision 4490) +++ trunk/core/kernel/application.php (.../application.php) (revision 4524) @@ -829,6 +829,34 @@ } /** + * Returns index file, that could be passed as parameter to method, as parameter to tag and as constant or not passed at all + * + * @param string $prefix + * @param string $index_file + * @param Array $params + * @return string + */ + function getIndexFile($prefix, $index_file, &$params) + { + if (isset($params['index_file'])) { + $index_file = $params['index_file']; + unset($params['index_file']); + return $index_file; + } + + if (isset($index_file)) { + return $index_file; + } + + if (defined('INDEX_FILE')) { + return INDEX_FILE; + } + + $cut_prefix = trim(BASE_PATH, '/').'/'.trim($prefix, '/'); + return trim(preg_replace('/'.preg_quote($cut_prefix, '/').'(.*)/', '\\1', $_SERVER['PHP_SELF']), '/'); + } + + /** * Return href for template * * @access public @@ -853,14 +881,9 @@ if ( $this->IsAdmin() && $prefix == '') $prefix = '/admin'; if ( $this->IsAdmin() && $prefix == '_FRONT_END_') $prefix = ''; - $index_file = isset($index_file) ? $index_file : (defined('INDEX_FILE') ? INDEX_FILE : basename($_SERVER['PHP_SELF'])); - - if( isset($params['index_file']) ) - { - $index_file = $params['index_file']; - unset($params['index_file']); - } - + + $index_file = $this->getIndexFile($prefix, $index_file, $params); + $ssl = isset($params['__SSL__']) ? $params['__SSL__'] : null; if ($ssl !== null) { $session =& $this->recallObject('Session'); Index: trunk/kernel/admin_templates/head.tpl =================================================================== diff -u -N -r4492 -r4524 --- trunk/kernel/admin_templates/head.tpl (.../head.tpl) (revision 4492) +++ trunk/kernel/admin_templates/head.tpl (.../head.tpl) (revision 4524) @@ -5,43 +5,40 @@ - - - - -
- +
- - - - - + - - - - - - - -
- " target="main"> + + " target="main"> - " target="main"> + + " target="main"> -   + - + + + + + + + + + +
+
+
+ + + " target="_parent"> +
- - - " target="_parent"> - +
+
-
- + Index: trunk/kernel/units/users/users_config.php =================================================================== diff -u -N -r4471 -r4524 --- trunk/kernel/units/users/users_config.php (.../users_config.php) (revision 4471) +++ trunk/kernel/units/users/users_config.php (.../users_config.php) (revision 4524) @@ -55,6 +55,16 @@ 'ItemType' => 6, // used for custom fields only (on user's case) + 'StatisticsInfo' => Array( + 'pending' => Array( + 'icon' => 'icon16_user_pending.gif', + 'label' => 'la_Text_Users', + 'js_url' => "set_persistant_var('User_View', 4, 'users/users_list', '#url#')", + 'url' => Array('t' => 'users/users_list', 'index_file' => 'users/user_list.php', 'pass' => 'm'), + 'status' => STATUS_PENDING, + ), + ), + 'TitlePresets' => Array( 'default' => Array( 'new_status_labels' => Array('u'=>'!la_title_Adding_User!'), 'edit_status_labels' => Array('u'=>'!la_title_Editing_User!'), Index: trunk/kernel/admin_templates/login.tpl =================================================================== diff -u -N -r4490 -r4524 --- trunk/kernel/admin_templates/login.tpl (.../login.tpl) (revision 4490) +++ trunk/kernel/admin_templates/login.tpl (.../login.tpl) (revision 4524) @@ -7,8 +7,8 @@
- -
+ +
@@ -25,18 +25,17 @@
- + - + @@ -50,9 +49,20 @@
- " onclick="submit_event('u', 'OnLogin');" class="button"> - " class="button"> - + " class="button"> + " class="button">
- "> + index"> + +
+ + + + + + + + + + + + + + + + +
+ + (xx) +
+ + " border="0" alt="" title="" /> + " class="userlink"> +
+
+ +
+ + + + + + + + + + + +
+ + +
+ + + + + + + + +
+ "> + + + +
+ "> + + + +
+
+ + + + + + + + + + + + + \ No newline at end of file Index: trunk/kernel/admin/include/toolbar/advanced_view.php =================================================================== diff -u -N -r4330 -r4524 --- trunk/kernel/admin/include/toolbar/advanced_view.php (.../advanced_view.php) (revision 4330) +++ trunk/kernel/admin/include/toolbar/advanced_view.php (.../advanced_view.php) (revision 4524) @@ -24,7 +24,14 @@ if( isset($_GET['SetTab']) ) $DefaultTab = $_GET["SetTab"]; +$application =& kApplication::Instance(); +$force_tab = $application->RecallVar('force_tab'); +if ($force_tab) { + $DefaultTab = $force_tab; + $application->RemoveVar('force_tab'); +} + // category list filtering stuff: begin $CategoryView = $objConfig->Get("Category_View"); Index: trunk/kernel/admin_templates/img/globe.gif =================================================================== diff -u -N -r1566 -r4524 Binary files differ Index: trunk/core/units/users/users_event_handler.php =================================================================== diff -u -N -r4490 -r4524 --- trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 4490) +++ trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 4524) @@ -920,6 +920,25 @@ $object->IgnoreValidation = true; $object->SetFieldsFromHash($fields); } + + /** + * Sets persistant variable + * + * @param kEvent $event + */ + function OnSetPersistantVariable(&$event) + { + $object =& $event->getObject(); + + $field = $this->Application->GetVar('field'); + $value = $this->Application->GetVar('value'); + $object->setPersistantVar($field, $value); + + $force_tab = $this->Application->GetVar('SetTab'); + if ($force_tab) { + $this->Application->StoreVar('force_tab', $force_tab); + } + } } ?> \ No newline at end of file Index: trunk/core/units/statistics/statistics_config.php =================================================================== diff -u -N --- trunk/core/units/statistics/statistics_config.php (revision 0) +++ trunk/core/units/statistics/statistics_config.php (revision 4524) @@ -0,0 +1,65 @@ + 'stat', + 'ItemClass' => Array('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'), + 'ListClass' => Array('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'), + 'EventHandlerClass' => Array('class' => 'StatisticsEventHandler', 'file' => 'statistics_event_handler.php', 'build_event' => 'OnBuild'), + 'TagProcessorClass' => Array('class' => 'StatisticsTagProcessor', 'file' => 'statistics_tag_processor.php', 'build_event' => 'OnBuild'), + + 'AutoLoad' => true, + + 'QueryString' => Array( + 1 => 'id', + 2 => 'page', + 3 => 'event', + 4 => 'mode', + ), + + 'IDField' => 'StatItemId', + + 'TitleField' => 'ListLabel', + + 'TitlePresets' => Array( + 'statistics_list' => Array('prefixes' => Array('stat_List'), 'format' => "!la_title_Statistics! (#stat_recordcount#)"), + ), + + 'TableName' => TABLE_PREFIX.'StatItem', + + 'ListSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), + 'ItemSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), + + 'ListSortings' => Array( + '' => Array( + 'Sorting' => Array('Priority' => 'asc'), + ) + ), + + 'Fields' => Array( + 'StatItemId' => Array(), + 'Module' => Array('type' => 'string','not_null' => '1','default' => ''), + 'ValueSQL' => Array('type' => 'string','default' => ''), + 'ResetSQL' => Array('type' => 'string','default' => ''), + 'ListLabel' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Priority' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'AdminSummary' => Array('type' => 'int','not_null' => '1','default' => '0'), + ), + + + + 'Grids' => Array( + 'Default' => Array( + 'Icons' => Array('default' => 'icon16_custom.gif'), + 'Fields' => Array( + 'Login' => Array('title' => 'la_col_Username', 'data_block' => 'grid_checkbox_td'), + 'LastName' => Array( 'title'=>'la_col_LastName'), + 'FirstName' => Array( 'title'=>'la_col_FirstName'), + ), + ), + + + ), + + ); + +?> \ No newline at end of file Index: trunk/kernel/units/users/users_item.php =================================================================== diff -u -N -r4065 -r4524 --- trunk/kernel/units/users/users_item.php (.../users_item.php) (revision 4065) +++ trunk/kernel/units/users/users_item.php (.../users_item.php) (revision 4524) @@ -15,11 +15,16 @@ { $this->persistantVars[$var_name] = $var_value; - $replace_hash = Array( 'PortalUserId' => $this->GetID(), - 'VariableName' => $var_name, - 'VariableValue' => $var_value - ); - $this->Conn->doInsert($replace_hash, TABLE_PREFIX.'PersistantSessionData', 'REPLACE'); + if ($this->GetID() > 0) { + $replace_hash = Array( 'PortalUserId' => $this->GetID(), + 'VariableName' => $var_name, + 'VariableValue' => $var_value + ); + $this->Conn->doInsert($replace_hash, TABLE_PREFIX.'PersistantSessionData', 'REPLACE'); + } + else { + $this->Application->StoreVar($var_name, $var_value); + } } function getPersistantVar($var_name) Index: trunk/kernel/admin/include/summary/root.php =================================================================== diff -u -N -r2432 -r4524 --- trunk/kernel/admin/include/summary/root.php (.../root.php) (revision 2432) +++ trunk/kernel/admin/include/summary/root.php (.../root.php) (revision 4524) @@ -207,7 +207,7 @@ - $pending_col_1 +$pending_col_1
Index: trunk/kernel/units/categories/categories_config.php =================================================================== diff -u -N -r4471 -r4524 --- trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 4471) +++ trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 4524) @@ -23,6 +23,17 @@ 'IDField' => 'CategoryId', 'TitleField' => 'Name', // field, used in bluebar when editing existing item 'ItemType' => 1, // used for custom fields only + + 'StatisticsInfo' => Array( + 'pending' => Array( + 'icon' => 'icon16_cat_pending.gif', + 'label' => 'la_tab_Categories', + 'js_url' => "set_persistant_var('Category_View', 41, 'advanced_view', '#url#')", + 'url' => Array('t' => 'advanced_view', 'index_file' => 'advanced_view.php', 'SetTab' => 'category', 'pass' => 'm'), + 'status' => STATUS_PENDING, + ), + ), + 'TableName' => TABLE_PREFIX.'Category', 'ViewMenuPhrase' => 'la_text_Categories', Index: trunk/core/units/statistics/statistics_event_handler.php =================================================================== diff -u -N --- trunk/core/units/statistics/statistics_event_handler.php (revision 0) +++ trunk/core/units/statistics/statistics_event_handler.php (revision 4524) @@ -0,0 +1,19 @@ +Special == 'summary') { + $object =& $event->getObject(); + $object->addFilter('summary_filter', '%1$s.AdminSummary = 1'); + } + } + } + +?> \ No newline at end of file Index: trunk/core/units/users/users_config.php =================================================================== diff -u -N -r4471 -r4524 --- trunk/core/units/users/users_config.php (.../users_config.php) (revision 4471) +++ trunk/core/units/users/users_config.php (.../users_config.php) (revision 4524) @@ -55,6 +55,16 @@ 'ItemType' => 6, // used for custom fields only (on user's case) + 'StatisticsInfo' => Array( + 'pending' => Array( + 'icon' => 'icon16_user_pending.gif', + 'label' => 'la_Text_Users', + 'js_url' => "set_persistant_var('User_View', 4, 'users/users_list', '#url#')", + 'url' => Array('t' => 'users/users_list', 'index_file' => 'users/user_list.php', 'pass' => 'm'), + 'status' => STATUS_PENDING, + ), + ), + 'TitlePresets' => Array( 'default' => Array( 'new_status_labels' => Array('u'=>'!la_title_Adding_User!'), 'edit_status_labels' => Array('u'=>'!la_title_Editing_User!'), Index: trunk/core/units/admin/admin_tag_processor.php =================================================================== diff -u -N -r4490 -r4524 --- trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 4490) +++ trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 4524) @@ -260,7 +260,7 @@ foreach ($section_data['children'] as $section_name) { $params['section_name'] = $section_name; $section_data =& $this->Tree[$section_name]; - $params['children_count'] = count($section_data['children']); + $params['children_count'] = isset($section_data['children']) ? count($section_data['children']) : 0; $template = $section_data['url']['t']; unset($section_data['url']['t']); @@ -284,6 +284,20 @@ return preg_replace("/\r\n|\n/", '', $ret); } + + function ModuleInclude($params) + { + foreach ($params as $param_name => $param_value) { + $params[$param_name] = replaceModuleSection($param_value); + } + + return $this->Application->ProcessParsedTag('m', 'ModuleInclude', $params); + } + + function TodayDate($params) + { + return date($params['format']); + } } ?> \ No newline at end of file Index: trunk/core/units/statistics/statistics_tag_processor.php =================================================================== diff -u -N --- trunk/core/units/statistics/statistics_tag_processor.php (revision 0) +++ trunk/core/units/statistics/statistics_tag_processor.php (revision 4524) @@ -0,0 +1,244 @@ +getObject($params); + $this->CurrentSQL = $object->GetDBField($params['field']); + + // 1. replace prefix to actual one + $this->CurrentSQL = str_replace("<%prefix%>", TABLE_PREFIX, $this->CurrentSQL); + + // 2. replace all pseudo-tags found in sql with their values + while ( ($tag = $this->FindTag()) != false ) { + $this->CurrentSQL = str_replace('<%'.$tag.'%>', $this->ProcessStatisticTag($tag), $this->CurrentSQL); + } + + // 3. query sql and process gathered data + $values = $this->Conn->GetCol($this->CurrentSQL); + if (!$values) return ''; + if (!$this->PostFormatting) return array_shift($values); + + + switch ($this->PostFormatting) { + case 'number': + // simple-specific postformatting + $lang =& $this->Application->recallObject('lang.current'); + $value = $lang->formatNumber($value, $this->PostFormattingParams['precision']); + break; + + case 'COUNT': + // extended postformatting + $value = count($values); + break; + + case 'SUM': + $value = 0; + foreach ($values as $cur_value) { + $value += $cur_value; + } + + if ($this->PostFormattingParams['format_as'] == 'file') { + $value = size($value); + } + break; + + // other type of information (not from db) + case 'SysFileSize': + $value = size( dir_size(FULL_PATH.'/') ); + break; + + default: // simple-default postformatting + $value = adodb_date($this->PostFormatting, array_shift($values)); + break; + } + $this->PostFormatting = false; + $this->PostFormattingParams = Array(); + + + return $value; + + } + + function FindTag() + { + // finds tag in current sql & returns it if found, false otherwise + $tagOpen = '<%'; $tagClose = '%>'; $tagOpenLen = strlen($tagOpen); + $startPos = strpos($this->CurrentSQL, $tagOpen); + if( $startPos !== false ) + { + $endPos = strpos($this->CurrentSQL, $tagClose, $startPos); + return ($endPos > $startPos) ? substr($this->CurrentSQL, $startPos + $tagOpenLen, $endPos - $startPos - $tagOpenLen) : false; + } + return false; + } + + function ProcessStatisticTag($tag) + { + $tag = trim($tag); + if (isset($this->TagCache[$tag])) { + return $this->TagCache[$tag]; + } + + $object =& $this->getObject(); + + list($tag_name, $tag_params) = explode(' ', $tag, 2); // 1st - function, 2nd .. nth - params + preg_match_all('/([\${}a-zA-Z0-9_.-]+)=(["\']{1,1})(.*?)(? $val){ + $tag_params[$val[1]] = str_replace(Array('\\' . $val[2], '+'), Array($val[2], ' '), $val[3]); + } + + switch ($tag_name) { + case 'm:config': + // m:config name="" + return $this->Application->ConfigValue($tag_params['name']); + break; + + case 'm:post_format': + // m:post_format field="" type="" precision="2" + $lang =& $this->Application->recallObject('lang.current'); + switch ($tag_params['type']) { + case 'date': + $this->PostFormatting = $lang->GetDBField('DateFormat'); + break; + + case 'time': + $this->PostFormatting = $lang->GetDBField('TimeFormat'); + break; + + case 'currency': + $this->PostFormatting = 'number'; + $this->PostFormattingParams['precision'] = $tag_params['precision']; + break; + } + return $tag_params['field']; + break; + + case 'm:custom_action': + // m:custom_action sql="empty" action="SysFileSize" + $this->PostFormatting = $tag_params['action']; + return ($tag_params['sql'] == 'empty') ? 'SELECT 1' : $tag_params['sql']; + break; + + case 'modules:get_current': + return $object->GetDBField('Module'); + break; + + case 'm:sql_action': + //m:sql_action sql="SHOW TABLES" action="COUNT" field="*" + $this->PostFormatting = $tag_params['action']; + $this->PostFormattingParams = $tag_params; + return $tag_params['sql']; + break; + + case 'link:hit_count': + if ($tag_params['type'] == 'top') {// by now only top is supported + $top_links_count = $this->Application->ConfigValue('Link_TopCount'); + + $sql = 'SELECT Hits + FROM '.TABLE_PREFIX.'Link + ORDER BY Hits DESC LIMIT 0, '.$top_links_count; + return $this->getLastRecord($sql, 'Hits'); + } + break; + + case 'article:hit_count': + if ($tag_params['type'] == 'top') {// by now only top is supported + $top_articles_count = $this->Application->ConfigValue('News_VotesToHot'); + $min_votes = $this->Application->ConfigValue('News_MinVotes'); + + $sql = 'SELECT CachedRating + FROM '.TABLE_PREFIX.'News + WHERE CachedVotesQty > '.$min_votes.' + ORDER BY CachedRating DESC LIMIT 0, '.$top_articles_count; + return $this->getLastRecord($sql, 'CachedRating'); + } + break; + + case 'topic:hit_count': + if ($tag_params['type'] == 'top') {// by now only top is supported + $top_posts_count = $this->Application->ConfigValue('Topic_PostsToPop'); + + $sql = 'SELECT Views + FROM '.TABLE_PREFIX.'Topic + ORDER BY Views DESC LIMIT 0, '.$top_posts_count; + return $this->getLastRecord($sql, 'Views'); + } + break; + + + } + } + + function getLastRecord($sql, $field) + { + $records = $this->Conn->GetCol($sql); + return count($records) ? array_pop($records) : 0; + } + + /** + * Allows to get pending item count for prefix + * + * @param Array $params + * @return int + */ + function CountPending($params) + { + $prefix = $params['prefix']; + + $statistics_info = $this->Application->getUnitOption($prefix.'.pending', 'StatisticsInfo'); + if (!$statistics_info) { + return 0; + } + + $table = $this->Application->getUnitOption($prefix, 'TableName'); + $status_field = array_shift( $this->Application->getUnitOption($prefix, 'StatusField') ); + $sql = 'SELECT COUNT(*) + FROM '.$table.' + WHERE '.$status_field.' = '.$statistics_info['status']; + return $this->Conn->GetOne($sql); + } + + function PrintPendingStatistics($params) + { + $sql = 'SELECT Prefix + FROM '.TABLE_PREFIX.'ItemTypes'; + $prefixes = $this->Conn->GetCol($sql); + + $block_params = Array('name' => $this->SelectParam($params, 'render_as,block') ); + + $ret = ''; + foreach ($prefixes as $prefix) { + $block_params['prefix'] = $prefix; + $statistics_info = $this->Application->getUnitOption($prefix.'.pending', 'StatisticsInfo'); + if (!$statistics_info) continue; + + $template = $statistics_info['url']['t']; + unset($statistics_info['url']['t']); + $url = $this->Application->HREF($template, '', $statistics_info['url']); + if ($statistics_info['js_url'] != '#url#') { + $statistics_info['js_url'] = 'javascript:'.$statistics_info['js_url']; + } + + $block_params['url'] = str_replace('#url#', $url, $statistics_info['js_url']); + $block_params['icon'] = $statistics_info['icon']; + $block_params['label'] = $statistics_info['label']; + $ret .= $this->Application->ParseBlock($block_params); + + } + return $ret; + } + + } + + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/sections_list.tpl =================================================================== diff -u -N -r4490 -r4524 --- trunk/kernel/admin_templates/sections_list.tpl (.../sections_list.tpl) (revision 4490) +++ trunk/kernel/admin_templates/sections_list.tpl (.../sections_list.tpl) (revision 4524) @@ -2,7 +2,7 @@ - + @@ -45,9 +45,8 @@ - - - + + Index: trunk/core/admin_templates/summary/root.tpl =================================================================== diff -u -N --- trunk/core/admin_templates/summary/root.tpl (revision 0) +++ trunk/core/admin_templates/summary/root.tpl (revision 4524) @@ -0,0 +1,137 @@ + + + + + + + + + + +
+ + + +
+ + Overview + +   +
+
+ + + + + + +
oInfooValue" align="center"> + + + + + +
+ : + + +
+
+ +
+ + + + + + + + + + + +
+ + +
+ + +
+ + +
+ + + + + + + + + + + +
+ + (xx) +
+ + " border="0" alt="" title="" /> + " class="userlink"> +
+
+ +
+ + + + + + + + + + + +
+ + +
+ + + + + + + + +
+ "> + + + +
+ "> + + + +
+
+ + + + + + + + + + + + + \ No newline at end of file Index: trunk/kernel/admin_templates/img/summary/searchbox_bg.gif =================================================================== diff -u -N -r1685 -r4524 Binary files differ