Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Tue, Jun 24, 11:29 PM

in-portal

Index: branches/unlabeled/unlabeled-1.3.2/kernel/units/sections/sections_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/kernel/units/sections/sections_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/kernel/units/sections/sections_config.php (revision 7648)
@@ -0,0 +1,355 @@
+<?php
+
+ $config = Array(
+ 'Prefix' => 'inportal-sections',
+ 'EventHandlerClass' => Array('class' => 'kEventHandler', 'file' => '', 'build_event' => 'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),
+
+// 'SectionPrefix' => 'u',
+ 'Sections' => Array(
+ 'in-portal:root' => Array(
+ 'parent' => null,
+ 'icon' => 'in-portal:site',
+ 'label' => $this->Application->ConfigValue('Site_Name'),
+ 'url' => Array('t' => 'sections_list', 'pass' => 'm', 'pass_section' => true, 'no_amp' => 1),
+ 'permissions' => Array('advanced:admin_login', 'advanced:front_login'),
+ 'priority' => 0,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:site' => Array(
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:struct',
+ 'label' => 'la_tab_Site_Structure',
+ 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'c',
+ ),
+
+ 'in-portal:browse' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:catalog',
+ 'label' => 'la_tab_Browse',
+ 'url' => Array('t' => 'in-portal/catalog', 'pass' => 'm'),
+ 'late_load' => Array('t' => 'in-portal/xml/tree_categories', 'pass' => 'm', 'm_cat_id' => 0),
+ 'onclick' => 'checkCatalog(0)',
+ 'permissions' => Array('view'),
+ 'priority' => 0.1,
+ 'type' => stTREE,
+ ),
+ 'in-portal:advanced_view' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:advanced_view',
+ 'label' => 'la_tab_AdvancedView',
+ 'url' => Array('t' => 'in-portal/advanced_view', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 0.2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:reviews' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:reviews',
+ 'label' => 'la_tab_Reviews',
+ 'url' => Array('index_file' => 'reviews.php', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configure_categories' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:cat_settings',
+ 'label' => 'la_tab_Settings',
+ 'url' => Array('t' => 'config/config_universal', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configuration_search' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:settings_search',
+ 'label' => 'la_tab_ConfigSearch',
+ 'url' => Array('t' => 'in-portal/config/config_search', 'module_key' => 'category', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configuration_email' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:settings_email',
+ 'label' => 'la_tab_ConfigE-mail',
+ 'url' => Array('t' => 'in-portal/config/config_email', 'module' => 'In-Portal:Category', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configuration_custom' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:settings_custom',
+ 'label' => 'la_tab_ConfigCustom',
+ 'url' => Array('t' => 'in-portal/custom_fields/custom_fields_list', 'cf_type' => 1, 'pass_section' => true, 'pass' => 'm,cf'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
+ 'priority' => 7,
+ 'type' => stTREE,
+ ),
+
+
+ 'in-portal:users' => Array(
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:community',
+ 'label' => 'la_tab_Community',
+ 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'u',
+ ),
+
+ 'in-portal:user_list' => Array(
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:users',
+ 'label' => 'la_tab_User_List',
+ 'url' => Array('index_file' => 'users/user_list.php', 'pass' => 'm', 'resetpage' => 1),
+ 'permissions' => Array('view', 'add', 'edit', 'delete', 'advanced:ban', 'advanced:send_email', /*'advanced:add_favorite', 'advanced:remove_favorite',*/),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:k4_user_list' => Array(
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:users',
+ 'label' => 'la_title_K4Users',
+ 'url' => Array('t' => 'in-portal/users/users_list', 'pass' => 'm'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete', 'advanced:ban', 'advanced:send_email', /*'advanced:add_favorite', 'advanced:remove_favorite',*/),
+ 'priority' => 1.5,
+ 'debug_only' => true,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_groups' => Array(
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:usergroups',
+ 'label' => 'la_tab_User_Groups',
+ 'url' => Array('t' => 'in-portal/groups/groups_list', 'pass' => 'm'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete', 'advanced:send_email', 'advanced:manage_permissions'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+
+
+ 'in-portal:configure_users' => Array(
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:users_settings',
+ 'label' => 'la_tab_ConfigSettings',
+ 'url' => Array('t' => 'config/config_universal', 'module' => 'In-Portal:Users', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_email' => Array(
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:settings_email',
+ 'label' => 'la_tab_ConfigE-mail',
+ 'url' => Array('t' => 'config/config_email', 'module' => 'In-Portal:Users', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_custom' => Array(
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:settings_custom',
+ 'label' => 'la_tab_ConfigCustom',
+ 'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 6, 'pass_section' => true, 'pass' => 'm,cf'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_banlist' => Array(
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:banlist',
+ 'label' => 'la_tab_BanList',
+ 'url' => Array('index_file' => 'config/edit_banlist.php', 'DataType' => 6, 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ ),
+
+ // "Help" section
+ 'in-portal:help' => Array(
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:help',
+ 'label' => 'la_tab_Help',
+ 'url' => Array('index_file' => 'help/manual.pdf', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 7,
+ 'type' => stTREE,
+ ),
+
+ // "Summary & Logs" section
+ 'in-portal:reports' => Array(
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:summary_logs',
+ 'label' => 'la_tab_Reports',
+ 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:log_summary' => Array(
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:summary',
+ 'label' => 'la_tab_Summary',
+ 'url' => Array('index_file' => 'logs/summary.php', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:searchlog' => Array(
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:search_log',
+ 'label' => 'la_tab_SearchLog',
+ 'url' => Array('index_file' => 'logs/searchlog.php', 'pass' => 'm'),
+ 'permissions' => Array('view', 'delete'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:sessionlog' => Array(
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:sessions_log',
+ 'label' => 'la_tab_SessionLog',
+ 'url' => Array('index_file' => 'logs/session_list.php', 'pass' => 'm'),
+ 'permissions' => Array('view', 'delete'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:emaillog' => Array(
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:email_log',
+ 'label' => 'la_tab_EmailLog',
+ 'url' => Array('index_file' => 'logs/email_log.php', 'pass' => 'm'),
+ 'permissions' => Array('view', 'delete'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:visits' => Array(
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:visits',
+ 'label' => 'la_tab_Visits',
+ 'url' => Array('t' => 'in-portal/visits/visits_list', 'pass' => 'm'),
+ 'permissions' => Array('view', 'delete'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ // "Configuration" section
+ 'in-portal:system' => Array(
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:conf',
+ 'label' => 'la_tab_Sys_Config',
+ 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:configure_general' => Array(
+ 'parent' => 'in-portal:system',
+ 'icon' => 'in-portal:conf_general',
+ 'label' => 'la_tab_General',
+ 'url' => Array('t' => 'config/config_universal', 'pass_section' => true, 'module' => 'In-Portal', 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configure_themes' => Array(
+ 'parent' => 'in-portal:system',
+ 'icon' => 'in-portal:conf_themes',
+ 'label' => 'la_tab_Themes',
+ 'url' => Array('index_file' => 'config/config_theme.php', 'pass' => 'm'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ // "Tools" section
+ 'in-portal:tools' => Array(
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:tools',
+ 'label' => 'la_tab_Tools',
+ 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:backup' => Array(
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_backup',
+ 'label' => 'la_tab_Backup',
+ 'url' => Array('index_file' => 'backup/backup1.php', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:restore' => Array(
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_restore',
+ 'label' => 'la_tab_Restore',
+ 'url' => Array('index_file' => 'backup/restore1.php', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:main_import' => Array(
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_import',
+ 'label' => 'la_tab_ImportData',
+ 'url' => Array('index_file' => 'import/step1.php', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:sql_query' => Array(
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_import',
+ 'label' => 'la_tab_QueryDB',
+ 'url' => Array('index_file' => 'tools/sql_query.php', 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:server_info' => Array(
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:server_info',
+ 'label' => 'la_tab_ServerInfo',
+ 'url' => Array('index_file' => 'tools/server_info.php', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ ),
+ ),
+ );
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.2/kernel/units/sections/sections_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/kernel/include/globals.php
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/kernel/include/globals.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/kernel/include/globals.php (revision 7648)
@@ -0,0 +1,2039 @@
+<?php
+
+if (!function_exists('parse_portal_ini')) {
+ function parse_portal_ini($file, $parse_section = false) {
+
+ if (!file_exists($file)) return false;
+
+ if(file_exists($file) && !is_readable($file))
+ die('Could Not Open Ini File');
+
+ $contents = file($file);
+
+ $retval = array();
+
+ $section = '';
+ $ln = 1;
+ $resave = false;
+ foreach($contents as $line) {
+ if ($ln == 1 && $line != '<'.'?'.'php die() ?'.">\n") {
+ $resave = true;
+ }
+ $ln++;
+ $line = trim($line);
+ $line = eregi_replace(';[.]*','',$line);
+ if(strlen($line) > 0) {
+ //echo $line . " - ";
+ if(eregi('^[[a-z]+]$',str_replace(' ', '', $line))) {
+ //echo 'section';
+ $section = substr($line,1,(strlen($line)-2));
+ if ($parse_section) {
+ $retval[$section] = array();
+ }
+ continue;
+ } elseif(eregi('=',$line)) {
+ //echo 'main element';
+ list($key,$val) = explode(' = ',$line);
+ if (!$parse_section) {
+ $retval[trim($key)] = str_replace('"', '', $val);
+ }
+ else {
+ $retval[$section][trim($key)] = str_replace('"', '', $val);
+ }
+ } //end if
+ //echo '<br />';
+ } //end if
+ } //end foreach
+ if ($resave) {
+ $fp = fopen($file, "w");
+ reset($contents);
+ fwrite($fp,'<'.'?'.'php die() ?'.">\n\n");
+ foreach($contents as $line) fwrite($fp,"$line");
+ fclose($fp);
+ }
+
+ return $retval;
+ }
+}
+
+ $vars = parse_portal_ini(FULL_PATH.'/config.php');
+ if ($vars) {
+ foreach ($vars as $config_key => $config_value) {
+ $GLOBALS['g_'.$config_key] = $config_value;
+ }
+ unset($config_key, $config_value);
+ }
+
+/*list the tables which contain item data */
+$ItemTables = array();
+
+$KeywordIgnore = array();
+global $debuglevel;
+
+$debuglevel = 0;
+//$GLOBALS['debuglevel'] = 0;
+
+/*New, Hot, Pop field values */
+define('NEVER', 0);
+define('ALWAYS', 1);
+define('AUTO', 2);
+
+/*Status Values */
+if( !defined('STATUS_DISABLED') ) define('STATUS_DISABLED', 0);
+if( !defined('STATUS_ACTIVE') ) define('STATUS_ACTIVE', 1);
+if( !defined('STATUS_PENDING') ) define('STATUS_PENDING', 2);
+
+$LogLevel = 0;
+$LogFile = NULL;
+
+/**
+ * Returns reference to database connection
+ *
+ * @param bool $new_type Return Kernel4 or in-portal connection object
+ * @return kDBConnection
+ */
+function &GetADODBConnection($new_type = false)
+{
+ static $DB = null;
+
+ global $g_DBType, $g_DBHost, $g_DBUser, $g_DBUserPassword, $g_DBName, $g_DebugMode;
+ global $ADODB_FETCH_MODE, $ADODB_COUNTRECS, $ADODB_CACHE_DIR, $pathtoroot;
+
+ if ($new_type) {
+ $application =& kApplication::Instance();
+ return $application->GetADODBConnection();
+ }
+
+ if( !isset($DB) && strlen($g_DBType) > 0 )
+ {
+ $DB = ADONewConnection($g_DBType);
+ $connected = $DB->Connect($g_DBHost, $g_DBUser, $g_DBUserPassword, $g_DBName);
+ if(!$connected) die("Error connecting to database $g_DBHost <br>\n");
+
+ $ADODB_CACHE_DIR = $pathtoroot."cache";
+ $ADODB_FETCH_MODE = 2;
+ $ADODB_COUNTRECS = false;
+ $DB->debug = defined('ADODB_OUTP') ? 1 : 0;
+ $DB->cacheSecs = 3600;
+ $DB->Execute('SET SQL_BIG_SELECTS = 1');
+ }
+ elseif( !strlen($g_DBType) )
+ {
+ global $rootURL;
+ echo 'In-Portal is probably not installed, or configuration file is missing.<br>';
+ echo 'Please use the installation script to fix the problem.<br><br>';
+ if ( !preg_match('/admin/', __FILE__) ) $ins = 'admin/';
+
+ echo '<a href="'.$rootURL.$ins.'install.php">Go to installation script</a><br><br>';
+ flush();
+ exit;
+ }
+ return $DB;
+}
+
+function GetNextResourceId($Increment=1)
+{
+ global $objModules, $pathtoroot;
+ $table_name = GetTablePrefix().'IdGenerator';
+
+ $db = &GetADODBConnection();
+
+ // dummy protection: get maximal resource id used actually and fix last_id used
+ $max_resourceid = 0;
+
+ $m = GetModuleArray();
+ foreach($m as $key=>$value)
+ {
+ $path = $pathtoroot. $value."admin/include/parser.php";
+ if(file_exists($path))
+ {
+ include_once($path);
+ }
+ }
+
+ $table_info = $objModules->ExecuteFunction('GetModuleInfo', 'dupe_resourceids');
+ $sql_template = 'SELECT MAX(ResourceId) FROM '.GetTablePrefix().'%s';
+
+ foreach($table_info as $module_name => $module_info)
+ {
+ foreach($module_info as $module_sub_info)
+ {
+ $sql = sprintf($sql_template,$module_sub_info['Table']);
+ $tmp_resourceid = $db->GetOne($sql);
+ if($tmp_resourceid > $max_resourceid) $max_resourceid = $tmp_resourceid;
+ }
+ }
+
+ // update lastid to be next resourceid available
+ $db->Execute('LOCK TABLES '.$table_name.' WRITE');
+
+ $last_id = $db->GetOne('SELECT lastid FROM '.$table_name);
+ if ($last_id - 1 > $max_resourceid) $max_resourceid = $last_id - 1;
+
+ $id_diff = $db->GetOne('SELECT '.$max_resourceid.' + 1 - lastid FROM '.$table_name);
+ if($id_diff) $Increment += $id_diff;
+
+ $sql = 'UPDATE '.$table_name.' SET lastid = lastid + '.$Increment; // set new id in db
+ $db->Execute($sql);
+
+ $val = $db->GetOne('SELECT lastid FROM '.$table_name);
+ if($val === false)
+ {
+ $db->Execute('INSERT INTO '.$table_name.' (lastid) VALUES ('.$Increment.')');
+ $val = $Increment;
+ }
+ $db->Execute('UNLOCK TABLES');
+
+ return $val - $Increment + $id_diff; // return previous free id (-1) ?
+}
+
+function AddSlash($s)
+{
+ if(substr($s,-1) != "/")
+ {
+ return $s."/";
+ }
+ else
+ return $s;
+}
+
+function StripNewline($s)
+{
+ $bfound = false;
+ while (strlen($s)>0 && !$bfound)
+ {
+ if(ord(substr($s,-1))<32)
+ {
+ $s = substr($s,0,-1);
+ }
+ else
+ $bfound = true;
+ }
+ return $s;
+}
+
+function DeleteElement($array, $indice)
+{
+ for($i=$indice;$i<count($array)-1;$i++)
+ $array[$i] = $array[$i+1];
+ unset($array[count($array)-1]);
+ return $array;
+}
+
+function DeleteElementValue($needle, &$haystack)
+{
+ while(($gotcha = array_search($needle,$haystack)) > -1)
+ unset($haystack[$gotcha]);
+}
+
+function TableCount($TableName, $where="",$JoinCats=1)
+{
+ $db = &GetADODBConnection();
+ if(!$JoinCats)
+ {
+ $sql = "SELECT count(*) as TableCount FROM $TableName";
+ }
+ else
+ $sql = "SELECT count(*) as TableCount FROM $TableName INNER JOIN ".GetTablePrefix()."CategoryItems ON ".GetTablePrefix()."CategoryItems.ItemResourceId=$TableName.ResourceId";
+ if(strlen($where)>0)
+ $sql .= " WHERE ".$where;
+
+ $rs = $db->Execute($sql);
+
+// echo "SQL TABLE COUNT: ".$sql."<br>\n";
+
+ $res = $rs->fields["TableCount"];
+ return $res;
+}
+
+Function QueryCount($sql)
+{
+ $sql = preg_replace('/SELECT(.*)FROM[ \n\r](.*)/is','SELECT COUNT(*) AS TableCount FROM $2', $sql);
+ $sql = preg_replace('/(.*)[ \n\r]LIMIT[ \n\r](.*)/is','$1', $sql);
+ $sql = preg_replace('/(.*)ORDER BY(.*)/is','$1', $sql);
+
+ //echo $sql;
+
+ $db =& GetADODBConnection();
+ return $db->GetOne($sql);
+}
+
+function GetPageCount($ItemsPerPage,$NumItems)
+{
+ if($ItemsPerPage==0 || $NumItems==0)
+ {
+ return 1;
+ }
+ $value = $NumItems/$ItemsPerPage;
+ return ceil($value);
+}
+
+
+/**
+ * @return string
+ * @desc Returns database table prefix entered while installation
+*/
+function GetTablePrefix()
+{
+ global $g_TablePrefix;
+
+ return $g_TablePrefix;
+}
+
+function TableHasPrefix($t)
+{
+ $pre = GetTablePrefix();
+
+ if(strlen($pre)>0)
+ {
+ if(substr($t,0,strlen($pre))==$pre)
+ {
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
+ else
+ return TRUE;
+}
+
+function AddTablePrefix($t)
+{
+ if(!TableHasPrefix($t))
+ $t = GetTablePrefix().$t;
+
+ return $t;
+}
+
+function ThisDomain()
+{
+ global $objConfig, $g_Domain;
+
+ if($objConfig->Get("DomainDetect"))
+ {
+ $d = $_SERVER['HTTP_HOST'];
+ }
+ else
+ $d = $g_Domain;
+
+ return $d;
+}
+
+function GetIndexUrl($secure=0)
+{
+ global $indexURL, $rootURL, $secureURL;
+
+ if ( class_exists('kApplication') )
+ {
+ $application =& kApplication::Instance();
+ return $application->BaseURL().'index.php';
+ }
+
+ switch($secure)
+ {
+ case 0:
+ $ret = $indexURL;
+ break;
+
+ case 1:
+ $ret = $secureURL."index.php";
+ break;
+
+ case 2:
+ $ret = $rootURL."index.php";
+ break;
+
+ default:
+ $ret = $i;
+ break;
+ }
+ return $ret;
+}
+
+function GetLimitSQL($Page,$PerPage)
+{
+ if($Page<1)
+ $Page=1;
+
+ if(is_numeric($PerPage))
+ {
+ if($PerPage==0)
+ $PerPage = 20;
+ $Start = ($Page-1)*$PerPage;
+ $limit = "LIMIT ".$Start.",".$PerPage;
+ }
+ else
+ $limit = NULL;
+ return $limit;
+}
+
+function filelist ($currentdir, $startdir=NULL,$ext=NULL)
+{
+ global $pathchar;
+
+ //chdir ($currentdir);
+
+ // remember where we started from
+ if (!$startdir)
+ {
+ $startdir = $currentdir;
+ }
+
+ $d = @opendir($currentdir);
+
+ $files = array();
+ if(!$d)
+ return $files;
+ //list the files in the dir
+ while (false !== ($file = readdir($d)))
+ {
+ if ($file != ".." && $file != ".")
+ {
+ if (is_dir($currentdir."/".$file))
+ {
+ // If $file is a directory take a look inside
+ $a = filelist ($currentdir."/".$file, $startdir,$ext);
+ if(is_array($a))
+ $files = array_merge($files,$a);
+ }
+ else
+ {
+ if($ext!=NULL)
+ {
+ $extstr = stristr($file,".".$ext);
+ if(strlen($extstr))
+ $files[] = $currentdir."/".$file;
+ }
+ else
+ $files[] = $currentdir.'/'.$file;
+ }
+ }
+ }
+
+ closedir ($d);
+
+ return $files;
+}
+
+function DecimalToBin($dec,$WordLength=8)
+{
+ $bits = array();
+
+ $str = str_pad(decbin($dec),$WordLength,"0",STR_PAD_LEFT);
+ for($i=$WordLength;$i>0;$i--)
+ {
+ $bits[$i-1] = (int)substr($str,$i-1,1);
+ }
+ return $bits;
+}
+/*
+function inp_escape($in, $html_enable=0)
+{
+ $out = stripslashes($in);
+ $out = str_replace("\n", "\n^br^", $out);
+ if($html_enable==0)
+ {
+ $out=ereg_replace("<","&lt;",$out);
+ $out=ereg_replace(">","&gt;",$out);
+ $out=ereg_replace("\"","&quot;",$out);
+ $out = str_replace("\n^br^", "\n<br />", $out);
+ }
+ else
+ $out = str_replace("\n^br^", "\n", $out);
+ $out=addslashes($out);
+
+ return $out;
+}
+*/
+function inp_escape($var,$html=0)
+{
+ if($html)return $var;
+ if(is_array($var))
+ foreach($var as $k=>$v)
+ $var[$k]=inp_escape($v);
+ else
+// $var=htmlspecialchars($var,ENT_NOQUOTES);
+ $var=strtr($var,Array('<'=>'&lt;','>'=>'&gt;',));
+ return $var;
+}
+function inp_striptags($var,$html=0)
+{
+ if($html)return $var;
+ if(is_array($var))
+ foreach($var as $k=>$v)
+ $var[$k]=inp_striptags($v);
+ else
+ $var=strip_tags($var);
+ return $var;
+}
+
+function inp_unescape($in)
+{
+// if (get_magic_quotes_gpc())
+ return $in;
+ $out=stripslashes($in);
+ return $out;
+}
+
+function inp_textarea_unescape($in)
+{
+// if (get_magic_quotes_gpc())
+ return $in;
+ $out=stripslashes($in);
+ $out = str_replace("\n<br />", "\n", $out);
+ return $out;
+}
+
+function HighlightKeywords($Keywords, $html, $OpenTag="", $CloseTag="")
+{
+ global $objConfig;
+
+ if(!strlen($OpenTag))
+ $OpenTag = "<B>";
+ if(!strlen($CloseTag))
+ $CloseTag = "</B>";
+
+ $r = preg_split('((>)|(<))', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
+
+ foreach ($Keywords as $k) {
+ for ($i = 0; $i < count($r); $i++) {
+ if ($r[$i] == "<") {
+ $i++; continue;
+ }
+ $r[$i] = preg_replace('/('.preg_quote($k, '/').')/i', "$OpenTag\\1$CloseTag", $r[$i]);
+ }
+ }
+ return join("", $r);
+}
+
+/*
+function HighlightKeywords($Keywords,$html, $OpenTag="", $CloseTag="")
+{
+ global $objConfig;
+
+ if(!strlen($OpenTag))
+ $OpenTag = "<B>";
+ if(!strlen($CloseTag))
+ $CloseTag = "</B>";
+ $ret = strip_tags($html);
+
+ foreach ($Keywords as $k)
+ {
+ if(strlen($k))
+ {
+ //$html = str_replace("<$k>", ":#:", $html);
+ //$html = str_replace("</$k>", ":##:", $html);
+ //$html = strip_tags($html);
+ if ($html = preg_replace("/($k)/Ui","$OpenTag\\1$CloseTag", $html))
+ //if ($html = preg_replace("/(>[^<]*)($k)([^<]*< )/Ui","$OpenTag\\1$CloseTag", $html))
+ $ret = $html;
+ //$ret = str_replace(":#:", "<$k>", $ret);
+ //$ret = str_replace(":##:", "</$k>", $ret);
+ }
+ }
+ return $ret;
+}
+*/
+function ExtractDatePart($part, $datestamp)
+{
+ if ($datestamp <= 0) return '';
+
+ $formats = Array( 'month' => 'm', 'day' => 'd', 'year' => 'Y',
+ 'time_24hr' => 'H:i', 'time_12hr' => 'g:i a', 'time' => GetTimeFormat(), 'date' => GetDateFormat() );
+
+ $format = isset($formats[$part]) ? $formats[$part] : $part;
+ return adodb_date($format, $datestamp);
+}
+
+function GetLocalTime($TimeStamp, $TargetZone = null)
+{
+ global $objConfig;
+
+ if ($TargetZone == null) {
+ $TargetZone = $objConfig->Get('Config_Site_Time');
+ }
+
+ $server = $objConfig->Get('Config_Server_Time');
+ if ($TargetZone != $server) {
+ $offset = ($server - $TargetZone) * -1;
+ $TimeStamp = $TimeStamp + (3600 * $offset);
+ }
+
+ return $TimeStamp;
+}
+
+function _unhtmlentities ($string)
+{
+ $trans_tbl = get_html_translation_table (HTML_ENTITIES);
+ $trans_tbl = array_flip ($trans_tbl);
+ return strtr ($string, $trans_tbl);
+}
+
+function getLastStr($hay, $need){
+ $getLastStr = 0;
+ $pos = strpos($hay, $need);
+ if (is_int ($pos)){ //this is to decide whether it is "false" or "0"
+ while($pos) {
+ $getLastStr = $getLastStr + $pos + strlen($need);
+ $hay = substr ($hay , $pos + strlen($need));
+ $pos = strpos($hay, $need);
+ }
+ return $getLastStr - strlen($need);
+ } else {
+ return -1; //if $need wasn´t found it returns "-1" , because it could return "0" if it´s found on position "0".
+ }
+}
+
+// --- bbcode processing function: begin ----
+function PreformatBBCodes($text)
+{
+ // convert phpbb url bbcode to valid in-bulletin's format
+ // 1. urls
+ $text = preg_replace('/\[url=(.*)\](.*)\[\/url\]/Ui','[url href="$1"]$2[/url]',$text);
+ $text = preg_replace('/\[url\](.*)\[\/url\]/Ui','[url href="$1"]$1[/url]',$text);
+ // 2. images
+ $text = preg_replace('/\[img\](.*)\[\/img\]/Ui','[img src="$1" border="0"][/img]',$text);
+ // 3. color
+ $text = preg_replace('/\[color=(.*)\](.*)\[\/color\]/Ui','[font color="$1"]$2[/font]',$text);
+ // 4. size
+ $text = preg_replace('/\[size=(.*)\](.*)\[\/size\]/Ui','[font size="$1"]$2[/font]',$text);
+ // 5. lists
+ $text = preg_replace('/\[list(.*)\](.*)\[\/list\]/Uis','[ul]$2[/ul]',$text);
+ // 6. email to link
+ $text = preg_replace('/\[email\](.*)\[\/email\]/Ui','[url href="mailto:$1"]$1[/url]',$text);
+ //7. b tag
+ $text = preg_replace('/\[(b|i|u):(.*)\](.*)\[\/(b|i|u):(.*)\]/Ui','[$1]$3[/$4]',$text);
+ //8. code tag
+ $text = preg_replace('/\[code:(.*)\](.*)\[\/code:(.*)\]/Uis','[code]$2[/code]',$text);
+ return $text;
+}
+
+/**
+ * @return string
+ * @param string $BBCode
+ * @param string $TagParams
+ * @param string $TextInside
+ * @param string $ParamsAllowed
+ * @desc Removes not allowed params from tag and returns result
+*/
+function CheckBBCodeAttribs($BBCode, $TagParams, $TextInside, $ParamsAllowed)
+{
+ // $BBCode - bbcode to check, $TagParams - params string entered by user
+ // $TextInside - text between opening and closing bbcode tag
+ // $ParamsAllowed - list of allowed parameter names ("|" separated)
+ $TagParams=str_replace('\"','"',$TagParams);
+ $TextInside=str_replace('\"','"',$TextInside);
+ if( $ParamsAllowed && preg_match_all('/ +([^=]*)=["\']?([^ "\']*)["\']?/is',$TagParams,$params,PREG_SET_ORDER) )
+ {
+ $ret = Array();
+ foreach($params as $param)
+ {
+ // remove spaces in both parameter name & value & lowercase parameter name
+ $param[1] = strtolower(trim($param[1])); // name lowercased
+ if(($BBCode=='url')&&($param[1]=='href'))
+ if(false!==strpos(strtolower($param[2]),'script:'))
+ return $TextInside;
+// $param[2]='about:blank';
+ if( isset($ParamsAllowed[ $param[1] ]) )
+ $ret[] = $param[1].'="'.$param[2].'"';
+ }
+ $ret = count($ret) ? ' '.implode(' ',$ret) : '';
+ return '<'.$BBCode.$ret.'>'.$TextInside.'</'.$BBCode.'>';
+ }
+ else
+ return '<'.$BBCode.'>'.$TextInside.'</'.$BBCode.'>';
+ return false;
+}
+function ReplaceBBCode($text)
+{
+ global $objConfig;
+ // convert phpbb bbcodes to in-bulletin bbcodes
+ $text = PreformatBBCodes($text);
+
+// $tag_defs = 'b:;i:;u:;ul:type|align;font:color|face|size;url:href;img:src|border';
+
+ $tags_defs = $objConfig->Get('BBTags');
+ foreach(explode(';',$tags_defs) as $tag)
+ {
+ $tag = explode(':',$tag);
+ $tag_name = $tag[0];
+ $tag_params = $tag[1]?array_flip(explode('|',$tag[1])):0;
+ $text = preg_replace('/\['.$tag_name.'(.*)\](.*)\[\/'.$tag_name.' *\]/Uise','CheckBBCodeAttribs("'.$tag_name.'",\'$1\',\'$2\',$tag_params);', $text);
+ }
+
+ // additional processing for [url], [*], [img] bbcode
+ $text = preg_replace('/<url>(.*)<\/url>/Usi','<url href="$1">$1</url>',$text);
+ $text = preg_replace('/<font>(.*)<\/font>/Usi','$1',$text); // skip empty fonts
+ $text = str_replace( Array('<url','</url>','[*]'),
+ Array('<a target="_blank"','</a>','<li>'),
+ $text);
+
+ // bbcode [code]xxx[/code] processing
+ $text = preg_replace('/\[code\](.*)\[\/code\]/Uise', "ReplaceCodeBBCode('$1')", $text);
+ return $text;
+}
+function leadSpace2nbsp($x)
+{
+ return "\n".str_repeat('&nbsp;',strlen($x));
+}
+function ReplaceCodeBBCode($input_string)
+{
+ $input_string=str_replace('\"','"',$input_string);
+ $input_string=$GLOBALS['objSmileys']->UndoSmileys(_unhtmlentities($input_string));
+ $input_string=trim($input_string);
+ $input_string=inp_htmlize($input_string);
+ $input_string=str_replace("\r",'',$input_string);
+ $input_string = str_replace("\t", " ", $input_string);
+ $input_string = preg_replace('/\n( +)/se',"leadSpace2nbsp('$1')",$input_string);
+ $input_string='<div style="border:1px solid #888888;width:100%;background-color:#eeeeee;margin-top:6px;margin-bottom:6px"><div style="padding:10px;"><code>'.$input_string.'</code></div></div>';
+// $input_string='<textarea wrap="off" style="border:1px solid #888888;width:100%;height:200px;background-color:#eeeeee;">'.inp_htmlize($input_string).'</textarea>';
+ return $input_string;
+
+ if(false!==strpos($input_string,'<'.'?'))
+ {
+ $input_string=str_replace('<'.'?','<'.'?php',$input_string);
+ $input_string=str_replace('<'.'?phpphp','<'.'?php',$input_string);
+ $input_string=@highlight_string($input_string,1);
+ }
+ else
+ {
+ $input_string = @highlight_string('<'.'?php'.$input_string.'?'.'>',1);
+ $input_string = str_replace('&lt;?php', '', str_replace('?&gt;', '', $input_string));
+ }
+ return str_replace('<br />','',$input_string);
+
+}
+
+
+// --- bbcode processing function: end ----
+
+function GetMinValue($Table,$Field, $Where=NULL)
+{
+ $ret = 0;
+ $sql = "SELECT min($Field) as val FROM $Table ";
+ if(strlen($where))
+ $sql .= "WHERE $Where";
+ $ado = &GetADODBConnection();
+ $rs = $ado->execute($sql);
+ if($rs)
+ $ret = (int)$rs->fields["val"];
+ return $ret;
+}
+
+
+if (!function_exists( 'getmicrotime' ) ) {
+ function getmicrotime()
+ {
+ list($usec, $sec) = explode(" ",microtime());
+ return ((float)$usec + (float)$sec);
+ }
+}
+
+function SetMissingDataErrors($f)
+{
+ global $FormError;
+
+ $count = 0;
+ if(is_array($_POST))
+ {
+ if(is_array($_POST["required"]))
+ {
+ foreach($_POST["required"] as $r)
+ {
+ $found = FALSE;
+ if(is_array($_FILES))
+ {
+ if( isset($_FILES[$r]) && $_FILES[$r]['size'] > 0 ) $found = TRUE;
+ }
+
+ if(!strlen(trim($_POST[$r])) && !$found)
+ {
+ $count++;
+
+ if (($r == "dob_day") || ($r == "dob_month") || ($r == "dob_year"))
+ $r = "dob";
+
+ $tag = isset($_POST["errors"]) ? $_POST["errors"][$r] : '';
+ if(!strlen($tag))
+ $tag = "lu_ferror_".$f."_".$r;
+ $FormError[$f][$r] = language($tag);
+ }
+ }
+ }
+ }
+ return $count;
+}
+
+function makepassword($length=10)
+{
+ $pass_length=$length;
+
+ $p1=array('b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z');
+ $p2=array('a','e','i','o','u');
+ $p3=array('1','2','3','4','5','6','7','8','9');
+ $p4=array('(','&',')',';','%'); // if you need real strong stuff
+
+ // how much elements in the array
+ // can be done with a array count but counting once here is faster
+
+ $s1=21;// this is the count of $p1
+ $s2=5; // this is the count of $p2
+ $s3=9; // this is the count of $p3
+ $s4=5; // this is the count of $p4
+
+ // possible readable combinations
+
+ $c1='121'; // will be like 'bab'
+ $c2='212'; // will be like 'aba'
+ $c3='12'; // will be like 'ab'
+ $c4='3'; // will be just a number '1 to 9' if you dont like number delete the 3
+// $c5='4'; // uncomment to active the strong stuff
+
+ $comb='4'; // the amount of combinations you made above (and did not comment out)
+
+
+
+ for ($p=0;$p<$pass_length;)
+ {
+ mt_srand((double)microtime()*1000000);
+ $strpart=mt_rand(1,$comb);
+ // checking if the stringpart is not the same as the previous one
+ if($strpart<>$previous)
+ {
+ $pass_structure.=${'c'.$strpart};
+
+ // shortcutting the loop a bit
+ $p=$p+strlen(${'c'.$strpart});
+ }
+ $previous=$strpart;
+ }
+
+
+ // generating the password from the structure defined in $pass_structure
+ for ($g=0;$g<strlen($pass_structure);$g++)
+ {
+ mt_srand((double)microtime()*1000000);
+ $sel=substr($pass_structure,$g,1);
+ $pass.=${'p'.$sel}[mt_rand(0,-1+${'s'.$sel})];
+
+ }
+ return $pass;
+}
+
+function LogEntry($text,$writefile=FALSE)
+{
+ global $g_LogFile,$LogFile, $LogData, $LogLevel, $timestart;
+
+ static $last;
+
+ if(strlen($g_LogFile))
+ {
+ $el = str_pad(getmicrotime()- $timestart,10," ");
+ if($last>0)
+ $elapsed = getmicrotime() - $last;
+
+ if(strlen($el)>10)
+ $el = substr($el,0,10);
+ $indent = str_repeat(" ",$LogLevel);
+ $text = str_pad($text,$LogLevel,"==",STR_PAD_LEFT);
+ $LogData .= "$el:". round($elapsed,6).":$indent $text";
+ $last = getmicrotime();
+ if($writefile==TRUE && is_writable($g_LogFile))
+ {
+ if(!$LogFile)
+ {
+ if(file_exists($g_LogFile))
+ unlink($g_LogFile);
+ $LogFile=@fopen($g_LogFile,"w");
+ }
+ if($LogFile)
+ {
+ fputs($LogFile,$LogData);
+ }
+ }
+ }
+}
+
+function ValidEmail($email)
+{
+ if (eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $email))
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
+function language($phrase,$LangId=0)
+{
+ global $objSession, $objLanguageCache, $objLanguages;
+
+ if ($LangId == 0) {
+ $LangId = $objSession->Get('Language');
+ }
+
+ if ($LangId == 0) {
+ $LangId = $objLanguages->GetPrimary();
+ }
+
+ return $objLanguageCache->GetTranslation($phrase,$LangId);
+}
+
+function admin_language($phrase,$lang=0,$LinkMissing=FALSE)
+{
+ global $objSession, $objLanguageCache, $objLanguages;
+
+ //echo "Language passed: $lang<br>";
+
+ if($lang==0)
+ $lang = $objSession->Get("Language");
+
+ //echo "Language from session: $lang<br>";
+
+ if($lang==0)
+ $lang = $objLanguages->GetPrimary();
+
+ //echo "Language after primary: $lang<br>";
+ //echo "Phrase: $phrase<br>";
+ $translation = $objLanguageCache->GetTranslation($phrase,$lang);
+ if($LinkMissing && substr($translation,0,1)=="!" && substr($translation,-1)=="!")
+ {
+ $res = "<A href=\"javascript:OpenPhraseEditor('&direct=1&label=$phrase'); \">$translation</A>";
+ return $res;
+ }
+ else
+ return $translation;
+}
+
+function prompt_language($phrase,$lang=0)
+{
+ return admin_language($phrase,$lang,TRUE);
+}
+
+function GetPrimaryTranslation($Phrase)
+{
+ global $objLanguages;
+
+ $l = $objLanguages->GetPrimary();
+ return language($Phrase,$l);
+}
+
+function CategoryNameCount($ParentId,$Name)
+{
+ $cat_table = GetTablePrefix()."Category";
+ $sql = "SELECT Name from $cat_table WHERE ParentId=$ParentId AND ";
+ $sql .="(Name LIKE '".addslashes($Name)."' OR Name LIKE 'Copy of ".addslashes($Name)."' OR Name LIKE 'Copy % of ".addslashes($Name)."')";
+
+ $ado = &GetADODBConnection();
+ $rs = $ado->Execute($sql);
+ $ret = array();
+ while($rs && !$rs->EOF)
+ {
+ $ret[] = $rs->fields["Name"];
+ $rs->MoveNext();
+ }
+ return $ret;
+}
+
+function CategoryItemNameCount($CategoryId,$Table,$Field,$Name)
+{
+ $Name=addslashes($Name);
+ $cat_table = GetTablePrefix()."CategoryItems";
+ $sql = "SELECT $Field FROM $Table INNER JOIN $cat_table ON ($Table.ResourceId=$cat_table.ItemResourceId) ";
+ $sql .=" WHERE ($Field LIKE 'Copy % of $Name' OR $Field LIKE '$Name' OR $Field LIKE 'Copy of $Name') AND CategoryId=$CategoryId";
+ //echo $sql."<br>\n ";
+ $ado = &GetADODBConnection();
+ $rs = $ado->Execute($sql);
+ $ret = array();
+ while($rs && !$rs->EOF)
+ {
+ $ret[] = $rs->fields[$Field];
+ $rs->MoveNext();
+ }
+ return $ret;
+}
+
+function &GetItemCollection($ItemName)
+{
+ global $objItemTypes;
+
+ if(is_numeric($ItemName))
+ {
+ $item = $objItemTypes->GetItem($ItemName);
+ }
+ else
+ $item = $objItemTypes->GetTypeByName($ItemName);
+ if(is_object($item))
+ {
+ $module = $item->Get("Module");
+ $prefix = ModuleTagPrefix($module);
+ $func = $prefix."_ItemCollection";
+ if(function_exists($func))
+ {
+ $var =& $func();
+ }
+ }
+ return $var;
+}
+
+
+function UpdateCategoryCount($item_type,$CategoriesIds,$ListType='')
+{
+ global $objCountCache, $objItemTypes;
+ $db=&GetADODBConnection();
+ if( !is_numeric($item_type) )
+ {
+ $sql = 'SELECT ItemType FROM '.$objItemTypes->SourceTable.' WHERE ItemName=\''.$item_type.'\'';
+ $item_type=$db->GetOne($sql);
+ }
+ $objCountCache->EraseGlobalTypeCache($item_type);
+ if($item_type)
+ {
+ if(is_array($CategoriesIds))
+ {
+ $CategoriesIds=implode(',',$CategoriesIds);
+ }
+ if (!$CategoriesIds)
+ {
+
+ }
+
+ if(!is_array($ListType)) $ListType=Array($ListType=>'opa');
+
+ $sql = 'SELECT ParentPath FROM '.GetTablePrefix().'Category WHERE CategoryId IN ('.$CategoriesIds.')';
+ $rs = $db->Execute($sql);
+ $parents = Array();
+ while (!$rs->EOF)
+ {
+ $tmp=$rs->fields['ParentPath'];
+ $tmp=substr($tmp,1,strlen($tmp)-2);
+ $tmp=explode('|',$tmp);
+ foreach ($tmp as $tmp_cat_id) {
+ $parents[$tmp_cat_id]=1;
+ }
+ $rs->MoveNext();
+ }
+ $parents=array_keys($parents);
+ $list_types=array_keys($ListType);
+ foreach($parents as $ParentCategoryId)
+ {
+ foreach ($list_types as $list_type) {
+ $objCountCache->DeleteValue($list_type, $item_type, $ParentCategoryId, 0); // total count
+ $objCountCache->DeleteValue($list_type, $item_type, $ParentCategoryId, 1); // total count today
+ }
+ }
+ }
+ else
+ {
+ die('wrong item type passed to "UpdateCategoryCount"');
+ }
+
+/* if(is_object($item))
+ {
+ $ItemType = $item->Get("ItemType");
+
+ $sql = "DELETE FROM ".$objCountCache->SourceTable." WHERE ItemType=$ItemType";
+ if( is_numeric($ListType) ) $sql .= " AND ListType=$ListType";
+ $objCountCache->adodbConnection->Execute($sql);
+ } */
+}
+
+function ResetCache($CategoryId)
+{
+ global $objCountCache;
+ $db =& GetADODBConnection();
+ $sql = 'SELECT ParentPath FROM '.GetTablePrefix().'Category WHERE CategoryId = '.$CategoryId;
+ $parents = $db->GetOne($sql);
+ $parents = substr($parents,1,strlen($parents)-2);
+ $parents = explode('|',$parents);
+ foreach($parents as $ParentCategoryId)
+ {
+ $objCountCache->DeleteValue('_', TYPE_TOPIC, $ParentCategoryId, 0); // total topic count
+ $objCountCache->DeleteValue('_', TYPE_TOPIC, $ParentCategoryId, 1); // total
+ }
+}
+
+function UpdateModifiedCategoryCount($ItemTypeName,$CatId=NULL,$Modifier=0,$ExtraId=NULL)
+{
+}
+
+function UpdateGroupCategoryCount($ItemTypeName,$CatId=NULL,$Modifier=0,$GroupId=NULL)
+{
+}
+
+function GetTagCache($module,$tag,$attribs,$env)
+{
+ global $objSystemCache, $objSession, $objConfig;
+
+ if($objConfig->Get("SystemTagCache") && !$objSession->Get('PortalUserId'))
+ {
+ $name = $tag;
+ if(is_array($attribs))
+ {
+ foreach($attribs as $n => $val)
+ {
+ $name .= "-".$val;
+ }
+ }
+ $CachedValue = $objSystemCache->GetContextValue($name,$module,$env, $objSession->Get("GroupList"));
+ }
+ else
+ $CachedValue="";
+ return $CachedValue;
+}
+
+function SaveTagCache($module, $tag, $attribs, $env, $newvalue)
+{
+ global $objSystemCache, $objSession, $objConfig;
+
+ if($objConfig->Get("SystemTagCache"))
+ {
+ $name = $tag;
+ if(is_array($attribs))
+ {
+ foreach($attribs as $a => $val)
+ {
+ $name .= "-".$val;
+ }
+ }
+ $objSystemCache->EditCacheItem($name,$newvalue,$module,0,$env,$objSession->Get("GroupList"));
+ }
+}
+
+function DeleteTagCache($name,$extraparams, $env="")
+{
+ global $objSystemCache, $objConfig;
+
+ if($objConfig->Get("SystemTagCache"))
+ {
+ $where = "Name LIKE '$name%".$extraparams."'";
+ if(strlen($env))
+ $where .= " AND Context LIKE $env";
+ $objSystemCache->DeleteCachedItem($where);
+ }
+}
+
+/**
+ * Deletes whole tag cache for
+ * selected module
+ *
+ * @param string $module
+ * @param string $name
+ * @access public
+ */
+function DeleteModuleTagCache($module, $tagname='')
+{
+ global $objSystemCache, $objConfig;
+
+ if($objConfig->Get("SystemTagCache"))
+ {
+ $where = 'Module LIKE \''.$module.'\'';
+ if(strlen($tagname))
+ {
+ $where .= ' AND Name LIKE \''.$tagname.'\'';
+ }
+ $objSystemCache->DeleteCachedItem($where);
+ }
+}
+
+
+
+/*function ClearTagCache()
+{
+ global $objSystemCache, $objConfig;
+
+ if($objConfig->Get("SystemTagCache"))
+ {
+ $where = '';
+ $objSystemCache->DeleteCachedItem($where);
+ }
+}*/
+
+/*function EraseCountCache()
+{
+// global $objSystemCache, $objConfig;
+
+ $db =& GetADODBConnection();
+ $sql = 'DELETE * FROM '.GetTablePrefix().'CountCache';
+ return $db->Execute($sql) ? true : false;
+}*/
+
+
+function ParseTagLibrary()
+{
+ $objTagList = new clsTagList();
+ $objTagList->ParseInportalTags();
+ unset($objTagList);
+}
+
+ function GetDateFormat($LangId = 0, $is_input = false)
+ {
+ global $objLanguages;
+
+ if (!$LangId) {
+ $LangId = $objLanguages->GetPrimary();
+ }
+
+ $l = $objLanguages->GetItem($LangId);
+ $fmt = is_object($l) ? $l->Get(($is_input ? 'Input' : '').'DateFormat') : 'm-d-Y';
+
+ if (getArrayValue($GLOBALS, 'FrontEnd')) {
+ return $fmt;
+ }
+ return preg_replace('/y+/i','Y', $fmt);
+ }
+
+ function GetTimeFormat($LangId = 0, $is_input = false)
+ {
+ global $objLanguages;
+
+ if (!$LangId) {
+ $LangId = $objLanguages->GetPrimary();
+ }
+ $l = $objLanguages->GetItem($LangId);
+
+ $fmt = is_object($l) ? $l->Get(($is_input ? 'Input' : '').'TimeFormat') : 'H:i:s';
+ return $fmt;
+ }
+
+/**
+ * Gets one of currently selected language options
+ *
+ * @param string $optionName
+ * @param int $LangId
+ * @return string
+ * @access public
+ */
+function GetRegionalOption($optionName,$LangId=0)
+{
+ global $objLanguages, $objSession;
+
+ if(!$LangId) $LangId=$objSession->Get('Language');
+ if(!$LangId) $LangId=$objLanguages->GetPrimary();
+ $l = $objLanguages->GetItem($LangId);
+ return is_object($l)?$l->Get($optionName):false;
+}
+
+/**
+ * Returns formatted timestamp
+ *
+ * @param int $TimeStamp
+ * @param int $LangId
+ * @param bool $is_input use input date format instead of display date format
+ * @return string
+ */
+function LangDate($TimeStamp = null, $LangId = 0, $is_input = false)
+{
+ $fmt = GetDateFormat($LangId, $is_input);
+ return adodb_date($fmt, $TimeStamp);
+}
+
+/**
+ * Returns formatted timestamp
+ *
+ * @param int $TimeStamp
+ * @param int $LangId
+ * @param bool $is_input use input time format instead of display time format
+ * @return string
+ */
+function LangTime($TimeStamp = null, $LangId = 0, $is_input = false)
+{
+ $fmt = GetTimeFormat($LangId, $is_input);
+ return adodb_date($fmt, $TimeStamp);
+}
+
+function LangNumber($Num,$DecPlaces=NULL,$LangId=0)
+{
+ global $objLanguages;
+
+ if(!$LangId)
+ $LangId= $objLanguages->GetPrimary();
+ $l = $objLanguages->GetItem($LangId);
+ if(is_object($l))
+ {
+ $ret = number_format($Num,$DecPlaces,$l->Get("DecimalPoint"),$l->Get("ThousandSep"));
+ }
+ else
+ $ret = $num;
+
+ return $ret;
+}
+
+function replacePngTags($x, $spacer="images/spacer.gif")
+{
+ global $rootURL,$pathtoroot;
+
+ // make sure that we are only replacing for the Windows versions of Internet
+ // Explorer 5+, and not Opera identified as MSIE
+ $msie='/msie\s([5-9])\.?[0-9]*.*(win)/i';
+ $opera='/opera\s+[0-9]+/i';
+ if(!isset($_SERVER['HTTP_USER_AGENT']) ||
+ !preg_match($msie,$_SERVER['HTTP_USER_AGENT']) ||
+ preg_match($opera,$_SERVER['HTTP_USER_AGENT']))
+ return $x;
+
+ // find all the png images in backgrounds
+ preg_match_all('/background-image:\s*url\(\'(.*\.png)\'\);/Uis',$x,$background);
+ for($i=0;$i<count($background[0]);$i++){
+ // simply replace:
+ // "background-image: url('image.png');"
+ // with:
+ // "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(
+ // enabled=true, sizingMethod=scale src='image.png');"
+ // haven't tested to see if background-repeat styles work...
+ $x=str_replace($background[0][$i],'filter:progid:DXImageTransform.'.
+ 'Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale'.
+ ' src=\''.$background[1][$i].'\');',$x);
+ }
+
+ // OK, time to find all the IMG tags with ".png" in them
+ preg_match_all('/(<img.*\.png.*>|<input.*type=([\'"])image\\2.*\.png.*>)/Uis',$x,$images);
+ while(list($imgnum,$v)=@each($images[0])){
+ $original=$v;
+ $atts=''; $width=0; $height=0;
+ // If the size is defined by styles, find
+ preg_match_all('/style=".*(width: ([0-9]+))px.*'.
+ '(height: ([0-9]+))px.*"/Ui',$v,$arr2);
+ if(is_array($arr2) && count($arr2[0])){
+ // size was defined by styles, get values
+ $width=$arr2[2][0];
+ $height=$arr2[4][0];
+ }
+ // size was not defined by styles, get values
+ preg_match_all('/width=\"?([0-9]+)\"?/i',$v,$arr2);
+ if(is_array($arr2) && count($arr2[0])){
+ $width=$arr2[1][0];
+ }
+ preg_match_all('/height=\"?([0-9]+)\"?/i',$v,$arr2);
+ if(is_array($arr2) && count($arr2[0])){
+ $height=$arr2[1][0];
+ }
+ preg_match_all('/src=\"([^\"]+\.png)\"/i',$v,$arr2);
+ if(isset($arr2[1][0]) && !empty($arr2[1][0]))
+ $image=$arr2[1][0];
+ else
+ $image=NULL;
+
+ // We do this so that we can put our spacer.gif image in the same
+ // directory as the image
+ $tmp=split('[\\/]',$image);
+ array_pop($tmp);
+ $image_path=join('/',$tmp);
+ if(substr($image,0,strlen($rootURL))==$rootURL)
+ {
+ $path = str_replace($rootURL,$pathtoroot,$image);
+ }
+ else
+ {
+ $path = $pathtoroot."themes/telestial/$image";
+ }
+// echo "Sizing $path.. <br>\n";
+// echo "Full Tag: ".htmlentities($image)."<br>\n";
+ //if(!$height || !$width)
+ //{
+
+ $g = imagecreatefrompng($path);
+ if($g)
+ {
+ $height = imagesy($g);
+ $width = imagesx($g);
+ }
+ //}
+ if(strlen($image_path)) $image_path.='/';
+
+ // end quote is already supplied by originial src attribute
+ $replace_src_with=$spacer.'" style="width: '.$width.
+ 'px; height: '.$height.'px; filter: progid:DXImageTransform.'.
+ 'Microsoft.AlphaImageLoader(src=\''.$image.'\', sizingMethod='.
+ '\'scale\')';
+
+ // now create the new tag from the old
+ $new_tag=str_replace($image,$replace_src_with,$original);
+
+ // now place the new tag into the content
+ $x=str_replace($original,$new_tag,$x);
+ }
+ return $x;
+}
+
+function GetOptions($field) // by Alex
+{
+ // get dropdown values from custom field
+ $tmp =& new clsCustomField();
+
+ $tmp->LoadFromDatabase($field, 'FieldName');
+ $tmp_values = $tmp->Get('ValueList');
+ unset($tmp);
+ $tmp_values = explode(',', $tmp_values);
+
+ foreach($tmp_values as $mixed)
+ {
+ $elem = explode('=', trim($mixed));
+ $ret[ $elem[0] ] = $elem[1];
+ }
+ return $ret;
+}
+
+function ResetPage($module_prefix, $page_variable = 'p')
+{
+ // resets page in specific module when category is changed
+ global $objSession;
+ if( !is_object($objSession) ) // when changing pages session doesn't exist -> InPortal BUG
+ {
+ global $var_list, $SessionQueryString, $FrontEnd;
+ $objSession = new clsUserSession($var_list["sid"],($SessionQueryString && $FrontEnd==1));
+ }
+
+ $last_cat = $objSession->GetVariable('last_category');
+ $prev_cat = $objSession->GetVariable('prev_category');
+ //echo "Resetting Page [$prev_cat] -> [$last_cat]<br>";
+
+ if($prev_cat != $last_cat) $GLOBALS[$module_prefix.'_var_list'][$page_variable] = 1;
+}
+
+if( !function_exists('GetVar') )
+{
+ /**
+ * @return string
+ * @param string $name
+ * @param bool $post_priority
+ * @desc Get's variable from http query
+ */
+ function GetVar($name, $post_priority = false)
+ {
+ if(!$post_priority) // follow gpc_order in php.ini
+ return isset($_REQUEST[$name]) ? $_REQUEST[$name] : false;
+ else // get variable from post 1stly if not found then from get
+ return isset($_POST[$name]) && $_POST[$name] !== false ? $_POST[$name] : ( isset($_GET[$name]) && $_GET[$name] ? $_GET[$name] : false );
+ }
+}
+
+function SetVar($VarName, $VarValue)
+{
+ $_REQUEST[$VarName] = $VarValue;
+ $_POST[$VarName] = $VarValue;
+ $_GET[$VarName] = $VarValue;
+}
+
+function PassVar(&$source)
+{
+ // source array + any count of key names in passed array
+ $params = func_get_args();
+ array_shift($params);
+
+ if( count($params) )
+ {
+ $ret = Array();
+ foreach($params as $var_name)
+ if( isset($source[$var_name]) )
+ $ret[] = $var_name.'='.$source[$var_name];
+ $ret = '&'.implode('&', $ret);
+ }
+ return $ret;
+}
+
+function GetSubmitVariable(&$array, $postfix)
+{
+ // gets edit status of module
+ // used in case if some modules share
+ // common action parsed by kernel parser,
+ // but each module uses own EditStatus variable
+
+ $modules = Array('In-Link' => 'Link', 'In-News' => 'News', 'In-Bulletin' => 'Topic', 'In-Portal'=>'Review');
+ foreach($modules as $module => $prefix)
+ if( isset($array[$prefix.$postfix]) )
+ return Array('Module' => $module, 'variable' => $array[$prefix.$postfix]);
+ return false;
+}
+
+function GetModuleByAction()
+{
+ $prefix2module = Array('m' => 'In-Portal', 'l' => 'In-Link', 'n' => 'In-News', 'bb' => 'In-Bulletin');
+ $action = GetVar('Action');
+ if($action)
+ {
+ $module_prefix = explode('_', $action);
+ return $prefix2module[ $module_prefix[0] ];
+ }
+ else
+ return false;
+}
+
+function dir_size($dir) {
+ // calculates folder size based on filesizes inside it (recursively)
+ $totalsize=0;
+ if ($dirstream = @opendir($dir)) {
+ while (false !== ($filename = readdir($dirstream))) {
+ if ($filename!="." && $filename!="..")
+ {
+ if (is_file($dir."/".$filename))
+ $totalsize+=filesize($dir."/".$filename);
+
+ if (is_dir($dir."/".$filename))
+ $totalsize+=dir_size($dir."/".$filename);
+ }
+ }
+ }
+ closedir($dirstream);
+ return $totalsize;
+}
+
+function size($bytes) {
+ // shows formatted file/directory size
+ $types = Array("la_bytes","la_kilobytes","la_megabytes","la_gigabytes","la_terabytes");
+ $current = 0;
+ while ($bytes > 1024) {
+ $current++;
+ $bytes /= 1024;
+ }
+ return round($bytes,2)." ".language($types[$current]);
+}
+
+function echod($str)
+{
+ // echo debug output
+ echo str_replace( Array('[',']'), Array('[<b>', '</b>]'), $str).'<br>';
+}
+
+
+function PrepareParams($source, $to_lower, $mapping)
+{
+ // prepare array with form values to use with item
+ $result = Array();
+ foreach($to_lower as $field)
+ $result[ $field ] = $source[ strtolower($field) ];
+
+ if( is_array($mapping) )
+ {
+ foreach($mapping as $field_from => $field_to)
+ $result[$field_to] = $source[$field_from];
+ }
+
+ return $result;
+}
+
+function GetELT($field, $phrases = Array())
+{
+ // returns FieldOptions equivalent in In-Portal
+ $ret = Array();
+ foreach($phrases as $phrase)
+ $ret[] = admin_language($phrase);
+ $ret = "'".implode("','", $ret)."'";
+ return 'ELT('.$field.','.$ret.')';
+}
+
+function GetModuleImgPath($module)
+{
+ global $rootURL, $admin;
+ return $rootURL.$module.'/'.$admin.'/images';
+}
+
+function ActionPostProcess($StatusField, $ListClass, $ListObjectName = '', $IDField = null)
+{
+ // each action postprocessing stuff from admin
+ if( !isset($_REQUEST[$StatusField]) ) return false;
+
+ $list =& $GLOBALS[$ListObjectName];
+ if( !is_object($list) ) $list = new $ListClass();
+ $SFValue = $_REQUEST[$StatusField]; // status field value
+ switch($SFValue)
+ {
+ case 1: // User hit "Save" button
+ $list->CopyFromEditTable($IDField);
+ break;
+ case 2: // User hit "Cancel" button
+ $list->PurgeEditTable($IDField);
+ break;
+ }
+ if( function_exists('SpecificProcessing') ) SpecificProcessing($StatusField, $SFValue);
+ if($SFValue == 1 || $SFValue == 2) $list->Clear();
+}
+
+function MakeHTMLTag($element, $attrib_prefix)
+{
+ $result = Array();
+ $ap_length = strlen($attrib_prefix);
+ foreach($element->attributes as $attib_name => $attr_value)
+ if( substr($attib_name, $ap_length) == $ap_length )
+ $result[] = substr($attib_name, $ap_length, strlen($attib_name)).'="'.$attr_value.'"';
+ return count($result) ? implode(' ', $result) : false;
+}
+
+function GetImportScripts()
+{
+ // return currently installed import scripts
+ static $import_scripts = Array();
+ if( count($import_scripts) == 0 )
+ {
+
+ $sql = 'SELECT imp.* , m.LoadOrder
+ FROM '.TABLE_PREFIX.'ImportScripts imp
+ LEFT JOIN '.TABLE_PREFIX.'Modules m ON m.Name = imp.is_Module
+ WHERE m.Loaded = 1
+ ORDER BY m.LoadOrder';
+
+ $db =& GetADODBConnection();
+ $rs = $db->Execute($sql);
+ if ($rs && $rs->RecordCount() > 0) {
+ while (!$rs->EOF) {
+ $rec =& $rs->fields;
+ $import_scripts[ $rec['is_id'] ] = Array( 'label' => $rec['is_label'], 'url' => $rec['is_script'],
+ 'enabled' => $rec['is_enabled'], 'field_prefix' => $rec['is_field_prefix'],
+ 'id' => $rec['is_string_id'], 'required_fields' => $rec['is_requred_fields'],
+ 'module' => strtolower($rec['is_Module']) );
+ $rs->MoveNext();
+ }
+ }
+ else {
+ $import_scripts = Array();
+ }
+ }
+ return $import_scripts;
+}
+
+function GetImportScript($id)
+{
+ $scripts = GetImportScripts();
+ return isset($scripts[$id]) ? $scripts[$id] : false;
+}
+function GetNextTemplate($current_template)
+{
+ // used on front, returns next template to make
+ // redirect to
+ $dest = GetVar('dest', true);
+ if(!$dest) $dest = GetVar('DestTemplate', true);
+ return $dest ? $dest : $current_template;
+}
+
+
+// functions for dealign with enviroment variable construction
+function GenerateModuleEnv($prefix, $var_list)
+{
+ // globalize module varible arrays
+ $main =& $GLOBALS[$prefix.'_var_list'];
+ $update =& $GLOBALS[$prefix.'_var_list_update'];
+ //echo "VAR: [$main]; VAR_UPDATE: [$update]<br>";
+
+ // if update var count is zero, then do nothing
+ if( !is_array($update) || count($update) == 0 ) return '';
+
+ // ensure that we have no empty values in enviroment variable
+ foreach($update as $vl_key => $vl_value) {
+ if(!$vl_value) $update[$vl_key] = '0'; // unset($update[$vl_key]);
+ }
+
+ foreach($main as $vl_key => $vl_value) {
+ if(!$vl_value) $main[$vl_key] = '0'; // unset($main[$vl_key]);
+ }
+
+ $ret = Array();
+ foreach($var_list as $var_name) {
+ $value = GetEnvVar($prefix, $var_name);
+ if(!$value && $var_name == 'id') $value = '0';
+ $ret[] = $value;
+ }
+
+ // Removing all var_list_udpate
+ $keys = array_keys($update);
+ foreach ($keys as $key) {
+ unset($update[$key]);
+ }
+
+ return ':'.$prefix.implode('-',$ret);
+}
+
+// functions for dealign with enviroment variable construction
+function GenerateModuleEnv_NEW($prefix, $var_list)
+{
+ // globalize module varible arrays
+ $main =& $GLOBALS[$prefix.'_var_list'];
+ $update =& $GLOBALS[$prefix.'_var_list_update'];
+ //echo "VAR: [$main]; VAR_UPDATE: [$update]<br>";
+
+ if ( isset($update) && $update )
+ {
+ // ensure that we have no empty values in enviroment variable
+ foreach($update as $vl_key => $vl_value) {
+ if(!$vl_value) $update[$vl_key] = '0'; // unset($update[$vl_key]);
+ }
+
+ $app =& kApplication::Instance();
+ $passed = $app->GetVar('prefixes_passed');
+ $passed[] = $prefix;
+ $app->SetVar('prefixes_passed', $passed);
+ }
+ else
+ {
+ return Array();
+ }
+
+ if ($main) {
+ foreach($main as $vl_key => $vl_value) {
+ if(!$vl_value) $main[$vl_key] = '0'; // unset($main[$vl_key]);
+ }
+ }
+
+ $ret = Array();
+ foreach($var_list as $src_name => $dst_name) {
+ $ret[$dst_name] = GetEnvVar($prefix, $src_name);
+ }
+
+ // Removing all var_list_udpate
+ if ( isset($update) && $update )
+ {
+ $keys = array_keys($update);
+ foreach ($keys as $key) unset($update[$key]);
+ }
+ return $ret;
+}
+
+function GetEnvVar($prefix, $name)
+{
+ // get variable from template variable's list
+ // (used in module parsers to build env string)
+ $main =& $GLOBALS[$prefix.'_var_list'];
+ $update =& $GLOBALS[$prefix.'_var_list_update'];
+
+ // if part of env found in POST, then use it first
+ $submit_value = GetVar($prefix.'_'.$name);
+ if ($submit_value !== false) {
+ return $submit_value;
+ }
+
+ return isset($update[$name]) ? $update[$name] : ( isset($main[$name]) ? $main[$name] : '');
+}
+
+/**
+ * Checks if debug mode is active
+ *
+ * @return bool
+ */
+function IsDebugMode($check_debugger = true)
+{
+ $application =& kApplication::Instance();
+ return $application->isDebugMode($check_debugger);
+}
+
+/**
+ * Checks if we are in admin
+ *
+ * @return bool
+ */
+function IsAdmin()
+{
+ $application =& kApplication::Instance();
+ return $application->IsAdmin();
+}
+
+/**
+ * Two strings in-case-sensitive compare.
+ * Returns >0, when string1 > string2,
+ * <0, when string1 > string2,
+ * 0, when string1 = string2
+ *
+ * @param string $string1
+ * @param string $string2
+ * @return int
+ */
+function stricmp ($string1, $string2) {
+ return strcmp(strtolower($string1), strtolower($string2));
+}
+
+/**
+ * Generates unique code
+ *
+ * @return string
+ */
+function GenerateCode()
+{
+ list($usec, $sec) = explode(" ",microtime());
+
+ $id_part_1 = substr($usec, 4, 4);
+ $id_part_2 = mt_rand(1,9);
+ $id_part_3 = substr($sec, 6, 4);
+ $digit_one = substr($id_part_1, 0, 1);
+ if ($digit_one == 0) {
+ $digit_one = mt_rand(1,9);
+ $id_part_1 = ereg_replace("^0","",$id_part_1);
+ $id_part_1=$digit_one.$id_part_1;
+ }
+ return $id_part_1.$id_part_2.$id_part_3;
+}
+
+function bracket_comp($elem1, $elem2)
+{
+ if( ($elem1['End']>$elem2['End'] || $elem1['End'] == -1) && $elem2['End'] != -1 )
+ {
+ return 1;
+ }
+ elseif ( ($elem1['End']<$elem2['End'] || $elem2['End'] == -1) && $elem1['End'] != -1 )
+ {
+ return -1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+function bracket_id_sort($first_id, $second_id)
+{
+ $first_abs = abs($first_id);
+ $second_abs = abs($second_id);
+ $first_sign = ($first_id == 0) ? 0 : $first_id / $first_abs;
+ $second_sign = ($second_id == 0) ? 0 : $second_id / $second_abs;
+ if($first_sign != $second_sign)
+ {
+ if($first_id > $second_id) {
+ $bigger =& $first_abs;
+ $smaller =& $second_abs;
+ }
+ else {
+ $bigger =& $second_abs;
+ $smaller =& $first_abs;
+ }
+ $smaller = $bigger + $smaller;
+ }
+
+ if($first_abs > $second_abs) {
+ return 1;
+ }
+ elseif ($first_abs < $second_abs)
+ {
+ return -1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+function ap_bracket_comp($elem1, $elem2)
+{
+
+ if ($elem1['FromAmount']!="" && $elem1['ToAmount']=="" && $elem2['FromAmount']!="" && $elem2['ToAmount']!="") return 1;
+ if ($elem1['FromAmount']!="" && $elem1['ToAmount']=="" && $elem2['FromAmount']=="" && $elem2['ToAmount']=="") return -1;
+
+
+ if ($elem1['ToAmount']=="" && $elem2['ToAmount']!="") return 1;
+ if ($elem1['ToAmount']!="" && $elem2['ToAmount']=="") return -1;
+
+
+ if( ($elem1['ToAmount']>$elem2['ToAmount'] && $elem2['ToAmount']!=-1) || ($elem1['ToAmount'] == -1 && $elem2['ToAmount'] != -1 ))
+ {
+ return 1;
+ }
+ elseif ( ($elem1['ToAmount']<$elem2['ToAmount']) || ($elem2['ToAmount'] == -1 && $elem1['ToAmount'] != -1 ))
+ {
+ return -1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+ function inp_htmlize($var, $strip = 0)
+ {
+ if( is_array($var) )
+ {
+ foreach($var as $k => $v) $var[$k] = inp_htmlize($v, $strip);
+ }
+ else
+ {
+ $var = htmlspecialchars($strip ? stripslashes($var) : $var);
+ }
+ return $var;
+ }
+
+ /**
+ * Sets in-portal cookies, that will not harm K4 to breath free :)
+ *
+ * @param string $name
+ * @param mixed $value
+ * @param int $expire
+ * @author Alex
+ */
+ function set_cookie($name, $value, $expire = 0, $cookie_path = null)
+ {
+ if (!isset($cookie_path))
+ {
+ $cookie_path = IsAdmin() ? rtrim(BASE_PATH, '/').'/admin' : BASE_PATH;
+ }
+ setcookie($name, $value, $expire, $cookie_path, $_SERVER['HTTP_HOST']);
+ }
+
+ /**
+ * If we are on login required template, but we are not logged in, then logout user
+ *
+ * @return bool
+ */
+ function require_login($condition = null, $redirect_params = 'logout=1', $pass_env = false)
+ {
+ if( !isset($condition) ) $condition = !admin_login();
+ if(!$condition) return false;
+
+ global $objSession, $adminURL;
+ if( !headers_sent() ) set_cookie(SESSION_COOKIE_NAME, ' ', adodb_mktime() - 3600);
+ $objSession->Logout();
+ if($pass_env) $redirect_params = 'env='.BuildEnv().'&'.$redirect_params;
+ header('Location: '.$adminURL.'/index.php?'.$redirect_params);
+ exit;
+ }
+
+ /**
+ * Builds up K4 url from data supplied by in-portal
+ *
+ * @param string $t template
+ * @param Array $params
+ * @param string $index_file
+ * @return string
+ */
+ function HREF_Wrapper($t = '', $params = null, $index_file = null)
+ {
+ $url_params = BuildEnv_NEW();
+ if( isset($params) ) $url_params = array_merge_recursive2($url_params, $params);
+ if(!$t)
+ {
+ $t = $url_params['t'];
+ unset($url_params['t']);
+ }
+ $app =& kApplication::Instance();
+ return $app->HREF($t, '', $url_params, $index_file);
+ }
+
+ /**
+ * Set url params based on tag params & mapping hash passed
+ *
+ * @param Array $url_params - url params before change
+ * @param Array $tag_attribs - tag attributes
+ * @param Array $params_map key - tag_param, value - url_param
+ */
+ function MapTagParams(&$url_params, $tag_attribs, $params_map)
+ {
+ foreach ($params_map as $tag_param => $url_param)
+ {
+ if( getArrayValue($tag_attribs, $tag_param) ) $url_params[$url_param] = $tag_attribs[$tag_param];
+ }
+ }
+
+ function ExtractParams($params_str, $separator = '&')
+ {
+ if(!$params_str) return Array();
+
+ $ret = Array();
+ $parts = explode($separator, trim($params_str, $separator) );
+ foreach ($parts as $part)
+ {
+ list($var_name, $var_value) = explode('=', $part);
+ $ret[$var_name] = $var_value;
+ }
+ return $ret;
+ }
+
+ function &recallObject($var_name, $class_name)
+ {
+ if (!isset($GLOBALS[$var_name]) || !is_object($GLOBALS[$var_name]))
+ {
+ $GLOBALS[$var_name] = new $class_name();
+ }
+ return $GLOBALS[$var_name];
+ }
+
+ /**
+ * Returns true in case of AM/PM time
+ *
+ * @return bool
+ */
+ function is12HourMode()
+ {
+ return preg_match('/(a|A)/', GetTimeFormat() );
+ }
+
+ /**
+ * Saves custom fields for old in-portal items
+ *
+ * @param string $prefix K4 prefix of item
+ * @param int $resource_id resource id of item
+ * @param int $item_type type of custom fields
+ */
+ function saveCustomFields($prefix, $resource_id, $item_type)
+ {
+ $objCustomEdit = new clsCustomDataList();
+ $CustomFields = new clsCustomFieldList($item_type);
+
+ $data_changed = false;
+ for ($i = 0; $i < $CustomFields->NumItems(); $i++) {
+ $objField =& $CustomFields->GetItemRefByIndex($i);
+ $field_name = $objField->Get('FieldName');
+ $element_type = $objField->Get('ElementType');
+
+ $value = getCustomValue($field_name);
+
+ if ($element_type == 'checkbox' && $value === false) {
+ // unchecked checkboxes are not submitted
+ $value = 0;
+ }
+
+ if ($value !== false) {
+ $objCustomEdit->SetFieldValue($objField->Get('CustomFieldId'), $resource_id, $value);
+ $data_changed = true;
+ }
+ }
+
+ if ($data_changed) {
+ $objCustomEdit->SaveData($prefix, $resource_id);
+ }
+ }
+
+ /**
+ * Returns custom field value from submit
+ *
+ * @param string $field_name
+ * @return mixed
+ */
+ function getCustomValue($field_name)
+ {
+ if (IsAdmin()) {
+ $field_name = '_'.$field_name;
+ }
+ elseif (isset($_POST[strtolower($field_name)])) {
+ $field_name = strtolower($field_name);
+ }
+ return GetVar($field_name);
+ }
+
+ function checkActionPermission($action_mapping, $action, $system = 0)
+ {
+ $application =& kApplication::Instance();
+
+ if (!isset($action_mapping[$action])) {
+ // if no permission mapping defined, then action is allowed in any case
+ return true;
+ }
+
+ $perm_status = false;
+ $action_mapping = explode('|', $action_mapping[$action]);
+ foreach ($action_mapping as $perm_name) {
+ $perm_status = $application->CheckPermission($perm_name, $system);
+ if ($perm_status) {
+ break;
+ }
+ }
+
+ if (!$perm_status) {
+ $application->Redirect($application->IsAdmin() ? 'no_permission' : $application->ConfigValue('NoPermissionTemplate'), null, '', 'index.php');
+ }
+ return true;
+ }
+
+ function checkViewPermission($section_name, $system = 1)
+ {
+ $application =& kApplication::Instance();
+ $application->InitParser();
+ $application->ProcessParsedTag('m', 'RequireLogin', Array('permissions' => $section_name.'.view', 'system' => $system, 'index_file' => 'index.php'));
+ }
+
+?>
Property changes on: branches/unlabeled/unlabeled-1.3.2/kernel/include/globals.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/kernel/utility/formatters/multilang_formatter.php
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/kernel/utility/formatters/multilang_formatter.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/kernel/utility/formatters/multilang_formatter.php (revision 7648)
@@ -0,0 +1,129 @@
+<?php
+
+class kMultiLanguage extends kFormatter
+{
+
+ /**
+ * Returns ML field equivalent to field name specifed
+ *
+ * @param string $field_name
+ * @param bool $from_primary use primary/current language for name custruction
+ * @return string
+ */
+ function LangFieldName($field_name, $from_primary = false)
+ {
+ $lang = $from_primary ? $this->Application->GetDefaultLanguageId() : $this->Application->GetVar('m_lang');
+ if (!$lang) $lang = $this->Application->GetDefaultLanguageId();
+ return 'l'.$lang.'_'.$field_name;
+ }
+
+ function PrepareOptions($field_name, &$field_options, &$object)
+ {
+ if (getArrayValue($object->Fields, $field_name, 'master_field')) return;
+
+ $lang_field_name = $this->LangFieldName($field_name);
+
+ //substitude title field
+ $title_field = $this->Application->getUnitOption($object->Prefix, 'TitleField');
+ if ($title_field == $field_name) {
+ $this->Application->setUnitOption($object->Prefix, 'TitleField', $lang_field_name);
+ }
+
+ //substitude fields
+ $fields = $this->Application->getUnitOption($object->Prefix, 'Fields');
+ if ( isset($fields[$field_name]) ) {
+
+ $fields[$lang_field_name] = $fields[$field_name];
+ $fields[$lang_field_name]['master_field'] = $field_name;
+ $object->Fields[$lang_field_name] = $fields[$lang_field_name];
+ $fields[$field_name]['required'] = false;
+ $object->Fields[$field_name]['required'] = false;
+ $object->VirtualFields[$field_name] = $object->Fields[$field_name];
+ }
+ $this->Application->setUnitOption($object->Prefix, 'Fields', $fields);
+
+ //substitude virtual fields
+ $virtual_fields = $this->Application->getUnitOption($object->Prefix, 'VirtualFields');
+ if ( isset($virtual_fields[$field_name]) ) {
+ $virtual_fields[$lang_field_name] = $virtual_fields[$field_name];
+ $virtual_fields[$lang_field_name]['master_field'] = $field_name;
+ $object->VirtualFields[$lang_field_name] = $virtual_fields[$lang_field_name];
+ $virtual_fields[$field_name]['required'] = false;
+ $object->VirtualFields[$field_name]['required'] = false;
+ }
+ $this->Application->setUnitOption($object->Prefix, 'VirtualFields', $virtual_fields);
+
+ //substitude grid fields
+ $grids = $this->Application->getUnitOption($object->Prefix, 'Grids', Array());
+ foreach ($grids as $name => $grid) {
+ if ( getArrayValue($grid, 'Fields', $field_name) ) {
+ array_rename_key($grids[$name]['Fields'], $field_name, $lang_field_name);
+ }
+ }
+ $this->Application->setUnitOption($object->Prefix, 'Grids', $grids);
+
+ //substitude default sortings
+ $sortings = $this->Application->getUnitOption($object->Prefix, 'ListSortings', Array());
+ foreach ($sortings as $special => $the_sortings) {
+ if (isset($the_sortings['ForcedSorting'])) {
+ array_rename_key($sortings[$special]['ForcedSorting'], $field_name, $lang_field_name);
+ }
+ if (isset($the_sortings['Sorting'])) {
+ array_rename_key($sortings[$special]['Sorting'], $field_name, $lang_field_name);
+ }
+ }
+ $this->Application->setUnitOption($object->Prefix, 'ListSortings', $sortings);
+
+ //TODO: substitude possible language-fields sortings after changing language
+ }
+
+ /*function UpdateSubFields($field, $value, &$options, &$object)
+ {
+
+ }
+
+ function UpdateMasterFields($field, $value, &$options, &$object)
+ {
+
+ }*/
+
+ function Format($value, $field_name, &$object, $format=null)
+ {
+ $master_field = getArrayValue($object->Fields, $field_name, 'master_field');
+ if (!$master_field) { // if THIS field is master it does NOT have reference to it's master_field
+ $lang = $this->Application->GetVar('m_lang');
+ $value = $object->GetDBField('l'.$lang.'_'.$field_name); //getting value of current language
+ $master_field = $field_name; // THIS is master_field
+ }
+ $options = $object->GetFieldOptions($field_name);
+ $format = isset($format) ? $format : ( isset($options['format']) ? $options['format'] : null);
+
+ if ( $value == '' && $format != 'no_default') { // try to get default language value
+ $def_lang_value = $object->GetDBField('l'.$this->Application->GetDefaultLanguageId().'_'.$master_field);
+ if ($def_lang_value == '') return NULL;
+ return $def_lang_value; //return value from default language
+ }
+ return $value;
+ }
+
+ function Parse($value, $field_name, &$object)
+ {
+ $lang = $this->Application->GetVar('m_lang');
+ $def_lang = $this->Application->GetDefaultLanguageId();
+ $master_field = getArrayValue($object->Fields, $field_name, 'master_field');
+
+ if ( getArrayValue($object->Fields, $field_name, 'required') && ( (string) $value == '' ) ) {
+ $object->FieldErrors[$master_field]['pseudo'] = 'required';
+ };
+
+ if (!$this->Application->GetVar('allow_translation') && $lang != $def_lang && getArrayValue($object->Fields, $field_name, 'required')) {
+ $def_lang_field = 'l'.$def_lang.'_'.$master_field;
+ if ( !$object->ValidateRequired($def_lang_field, $object->Fields[$field_name]) ) {
+ $object->FieldErrors[$master_field]['pseudo'] = 'primary_lang_required';
+ }
+ }
+
+ if ($value == '') return NULL;
+ return $value;
+ }
+}
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/kernel/utility/formatters/multilang_formatter.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/units/images/image_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/units/images/image_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/units/images/image_event_handler.php (revision 7648)
@@ -0,0 +1,334 @@
+<?php
+class ImageEventHandler extends kDBEventHandler {
+
+ function mapEvents()
+ {
+ parent::mapEvents(); // ensure auto-adding of approve/decine and so on events
+ $image_events = Array(
+ 'OnAfterCopyToTemp'=>'ImageAction',
+ 'OnBeforeDeleteFromLive'=>'ImageAction',
+ 'OnBeforeCopyToLive'=>'ImageAction',
+ 'OnBeforeItemDelete'=>'ImageAction',
+ 'OnAfterClone'=>'ImageAction',
+ );
+
+ $this->eventMethods = array_merge($this->eventMethods, $image_events);
+ }
+
+ function customProcessing(&$event, $type)
+ {
+ $object =& $event->GetObject();
+ switch ($type)
+ {
+ case 'before' :
+ if ($object->GetDBField('LocalImage'))
+ {
+ $object->SetDBField('Url', '');
+ }
+ else
+ {
+ $object->SetDBField('LocalPath', '');
+ }
+
+ if ($object->GetDBField('LocalThumb'))
+ {
+ $object->SetDBField('ThumbUrl', '');
+ }
+ else
+ {
+ $object->SetDBField('ThumbPath', '');
+ }
+
+ if ($object->GetDBField('SameImages'))
+ {
+ $object->SetDBField('LocalImage', 1);
+ $object->SetDBField('LocalPath', '');
+ $object->SetDBField('Url', '');
+ }
+ break;
+ case 'after' :
+ if ($object->GetDBField('DefaultImg') )
+ {
+ $sql = 'UPDATE '.$object->TableName.' SET DefaultImg=0 WHERE ResourceId='.
+ $object->GetDBField('ResourceId').' AND ImageId<>'.
+ $object->GetId();
+ $res = $this->Conn->Query($sql);
+ }
+ break;
+ default:
+ }
+ }
+
+ function ImageAction(&$event)
+ {
+ $id = $event->getEventParam('id');
+ $object =& $this->Application->recallObject($event->Prefix.'.-item', $event->Prefix);
+ if (in_array($event->Name, Array('OnBeforeDeleteFromLive','OnAfterClone')) ) {
+ $object->SwitchToLive();
+ }
+ elseif ($event->Name == 'OnBeforeItemDelete') {
+ // keep current table
+ }
+ else {
+ $object->SwitchToTemp();
+ }
+
+ $object->Load($id);
+
+ $fields = Array('LocalPath' => 'LocalImage', 'ThumbPath' => 'LocalThumb');
+ foreach ($fields as $a_field => $mode_field) {
+ $file = $object->GetField($a_field);
+ if (!$file) continue;
+ $source_file = FULL_PATH.$file;
+
+ switch ($event->Name) {
+ // Copy image files to pending dir and update corresponding fields in temp record
+ // Checking for existing files and renaming if nessessary - two users may upload same pending files at the same time!
+ case 'OnAfterCopyToTemp':
+ $new_file = IMAGES_PENDING_PATH . $this->ValidateFileName(FULL_PATH.IMAGES_PENDING_PATH, basename($file));
+ $dest_file = FULL_PATH.$new_file;
+ copy($source_file, $dest_file);
+ $object->Fields[$a_field]['skip_empty'] = false;
+ $object->SetDBField($a_field, $new_file);
+ break;
+
+ // Copy image files to live dir (checking if fileexists and renameing if nessessary)
+ // and update corresponding fields in temp record (which gets copied to live automatically)
+ case 'OnBeforeCopyToLive':
+ if ( $object->GetDBField($mode_field) ) { // if image is local
+ // rename file if it exists in live folder
+ $new_file = IMAGES_PATH . $this->ValidateFileName(FULL_PATH.IMAGES_PATH, basename($file));
+ $dest_file = FULL_PATH.$new_file;
+ rename($source_file, $dest_file);
+ }
+ else { // if image is remote url - remove local file (if any), update local file field with empty value
+ if (file_exists($source_file)) @unlink($source_file);
+ $new_file = '';
+ }
+ $object->Fields[$a_field]['skip_empty'] = false;
+ $object->SetDBField($a_field, $new_file);
+ break;
+
+ case 'OnBeforeDeleteFromLive': // Delete image files from live folder before copying over from temp
+ case 'OnBeforeItemDelete': // Delete image files when deleteing Image object
+ @unlink(FULL_PATH.$file);
+ break;
+
+ case 'OnAfterClone': // Copy files when cloning objects, renaming it on the fly
+ $path_info = pathinfo($file);
+ $new_file = $path_info['dirname'].'/'.$this->ValidateFileName(FULL_PATH.$path_info['dirname'], $path_info['basename']);
+ $dest_file = FULL_PATH . $new_file;
+ copy($source_file, $dest_file);
+ $object->Fields[$a_field]['skip_empty'] = false;
+ $object->SetDBField($a_field, $new_file);
+ break;
+ }
+ }
+ if ( in_array($event->Name, Array('OnAfterClone', 'OnBeforeCopyToLive', 'OnAfterCopyToTemp')) ) {
+ $object->Update(null, true);
+ }
+ }
+
+ function ValidateFileName($path, $name)
+ {
+ $parts = pathinfo($name);
+ $ext = '.'.$parts['extension'];
+ $filename = substr($parts['basename'], 0, -strlen($ext));
+ $new_name = $filename.$ext;
+ while ( file_exists($path.'/'.$new_name) )
+ {
+ if ( preg_match("/({$filename}_)([0-9]*)($ext)/", $new_name, $regs) ) {
+ $new_name = $regs[1].($regs[2]+1).$regs[3];
+ }
+ else {
+ $new_name = $filename.'_1'.$ext;
+ }
+ }
+ return $new_name;
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnSetPrimary(&$event)
+ {
+ $object =& $event->getObject();
+ $object->SetDBField('DefaultImg', 1);
+ $object->Update();
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemUpdate(&$event)
+ {
+ $object =& $event->getObject();
+// $parent_info = $object->getLinkedInfo();
+ $id = $object->GetDBField('ResourceId');
+// $id = $parent_info['ParentId'] ? $parent_info['ParentId'] : $this->Application->GetVar('p_id');
+ $sql = 'SELECT ImageId FROM '.$object->TableName.' WHERE ResourceId='.$id.' AND DefaultImg=1';
+ if(!$this->Conn->GetOne($sql))
+ {
+ $object->SetDBField('DefaultImg', 1);
+ }
+ if($object->GetDBField('DefaultImg') && $object->Validate())
+ {
+
+ $sql = 'UPDATE '.$object->TableName.'
+ SET DefaultImg = 0
+ WHERE ResourceId = '.$id.' AND ImageId <> '.$object->GetDBField('ImageId');
+ $this->Conn->Query($sql);
+ $object->SetDBField('Enabled', 1);
+ }
+ }
+
+ function OnAfterItemCreate(&$event)
+ {
+ $event->CallSubEvent('OnBeforeItemUpdate');
+ $object =& $event->getObject();
+ $object->Update();
+ }
+
+ /**
+ * Deletes all selected items.
+ * Automatically recurse into sub-items using temp handler, and deletes sub-items
+ * by calling its Delete method if sub-item has AutoDelete set to true in its config file
+ *
+ * @param kEvent $event
+ */
+ function OnMassDelete(&$event)
+ {
+ $event->status=erSUCCESS;
+
+ $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
+
+ $event->setEventParam('ids', $this->StoreSelectedIDs($event) );
+ $this->customProcessing($event, 'before');
+ $ids = $event->getEventParam('ids');
+
+ $object =& $event->getObject();
+ $sql = 'SELECT ImageId FROM '.$object->TableName.' WHERE DefaultImg=1';
+ $primary = $this->Conn->GetOne($sql);
+ if( $primary && ($key = array_search($primary, $ids)) )
+ {
+ $sql = 'SELECT ImageId FROM '.$object->TableName.' WHERE DefaultImg=0';
+ $res = $this->Conn->Query($sql);
+ if($res)
+ {
+ unset($ids[$key]);
+ }
+ }
+
+ if($ids)
+ {
+ $temp->DeleteItems($event->Prefix, $event->Special, $ids);
+ }
+ $this->clearSelectedIDs($event);
+ }
+
+ /*function OnAfterItemLoad(&$event)
+ {
+ $object =& $event->getObject();
+
+ if ( $object->GetDBField('ThumbPath') || $object->GetDBField('SameImages') )
+ {
+ // return local image or url
+ $path = $object->GetDBField('LocalThumb') ? PROTOCOL.SERVER_NAME.BASE_PATH.$object->GetDBField('ThumbPath') : $object->GetDBField('ThumbUrl');
+ if ( $object->GetDBField('LocalThumb') && !file_exists(FULL_PATH.$object->GetDBField('ThumbPath')) ) $path = '';
+ }
+ else { // if we need full which is not the same as thumb
+ $path = $object->GetDBField('LocalImage') ? PROTOCOL.SERVER_NAME.BASE_PATH.$object->GetDBField('LocalPath') : $object->GetDBField('Url');
+ if ( $object->GetDBField('LocalImage') && !file_exists(FULL_PATH.$object->GetDBField('LocalPath')) ) $path = '';
+ }
+
+ $object->SetDBField('ImageUrl', $path);
+ }*/
+
+ function SetCustomQuery(&$event)
+ {
+ parent::SetCustomQuery($event);
+
+ $types=$event->getEventParam('types');
+ $except_types=$event->getEventParam('except');
+ $object =& $event->getObject();
+ $type_clauses = Array();
+
+ if( !$this->Application->IsAdmin() )
+ {
+ $object->addFilter('active', '%1$s.Enabled = 1');
+ }
+
+ if($product_id = $event->getEventParam('product_id'))
+ {
+ $object->removeFilter('parent_filter');
+ $sql = 'SELECT ResourceId FROM '.$this->Application->getUnitOption('p', 'TableName').'
+ WHERE ProductId = '.$product_id;
+ $resource_id = (int) $this->Conn->GetOne($sql);
+ $object->addFilter('product_images', '%1$s.ResourceId = '.$resource_id);
+ }
+
+ $type_clauses['additional']['include'] = '%1$s.DefaultImg != 1';
+ $type_clauses['additional']['except'] = '%1$s.DefaultImg = 1';
+ $type_clauses['additional']['having_filter'] = false;
+
+ /********************************************/
+
+ $includes_or_filter =& $this->Application->makeClass('kMultipleFilter');
+ $includes_or_filter->setType(FLT_TYPE_OR);
+
+ $excepts_and_filter =& $this->Application->makeClass('kMultipleFilter');
+ $excepts_and_filter->setType(FLT_TYPE_AND);
+
+ $includes_or_filter_h =& $this->Application->makeClass('kMultipleFilter');
+ $includes_or_filter_h->setType(FLT_TYPE_OR);
+
+ $excepts_and_filter_h =& $this->Application->makeClass('kMultipleFilter');
+ $excepts_and_filter_h->setType(FLT_TYPE_AND);
+
+ $except_types_array=explode(',', $types);
+
+ if ($types){
+ $types_array=explode(',', $types);
+ for ($i=0; $i<sizeof($types_array); $i++){
+ $type=trim($types_array[$i]);
+ if (isset($type_clauses[$type])){
+ if ($type_clauses[$type]['having_filter']){
+ $includes_or_filter_h->removeFilter('filter_'.$type);
+ $includes_or_filter_h->addFilter('filter_'.$type, $type_clauses[$type]['include']);
+ }else{
+ $includes_or_filter->removeFilter('filter_'.$type);
+ $includes_or_filter->addFilter('filter_'.$type, $type_clauses[$type]['include']);
+ }
+ }
+ }
+ }
+
+ if ($except_types){
+ $except_types_array=explode(',', $except_types);
+ for ($i=0; $i<sizeof($except_types_array); $i++){
+ $type=trim($except_types_array[$i]);
+ if (isset($type_clauses[$type])){
+ if ($type_clauses[$type]['having_filter']){
+ $excepts_and_filter_h->removeFilter('filter_'.$type);
+ $excepts_and_filter_h->addFilter('filter_'.$type, $type_clauses[$type]['except']);
+ }else{
+ $excepts_and_filter->removeFilter('filter_'.$type);
+ $excepts_and_filter->addFilter('filter_'.$type, $type_clauses[$type]['except']);
+ }
+ }
+ }
+ }
+
+ $object->addFilter('includes_filter', $includes_or_filter);
+ $object->addFilter('excepts_filter', $excepts_and_filter);
+
+ $object->addFilter('includes_filter_h', $includes_or_filter_h, HAVING_FILTER);
+ $object->addFilter('excepts_filter_h', $excepts_and_filter_h, HAVING_FILTER);
+ }
+}
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/units/images/image_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/units/sections/sections_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/units/sections/sections_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/units/sections/sections_config.php (revision 7648)
@@ -0,0 +1,355 @@
+<?php
+
+ $config = Array(
+ 'Prefix' => 'inportal-sections',
+ 'EventHandlerClass' => Array('class' => 'kEventHandler', 'file' => '', 'build_event' => 'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),
+
+// 'SectionPrefix' => 'u',
+ 'Sections' => Array(
+ 'in-portal:root' => Array(
+ 'parent' => null,
+ 'icon' => 'in-portal:site',
+ 'label' => $this->Application->ConfigValue('Site_Name'),
+ 'url' => Array('t' => 'sections_list', 'pass' => 'm', 'pass_section' => true, 'no_amp' => 1),
+ 'permissions' => Array('advanced:admin_login', 'advanced:front_login'),
+ 'priority' => 0,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:site' => Array(
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:struct',
+ 'label' => 'la_tab_Site_Structure',
+ 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'c',
+ ),
+
+ 'in-portal:browse' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:catalog',
+ 'label' => 'la_tab_Browse',
+ 'url' => Array('t' => 'in-portal/catalog', 'pass' => 'm'),
+ 'late_load' => Array('t' => 'in-portal/xml/tree_categories', 'pass' => 'm', 'm_cat_id' => 0),
+ 'onclick' => 'checkCatalog(0)',
+ 'permissions' => Array('view'),
+ 'priority' => 0.1,
+ 'type' => stTREE,
+ ),
+ 'in-portal:advanced_view' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:advanced_view',
+ 'label' => 'la_tab_AdvancedView',
+ 'url' => Array('t' => 'in-portal/advanced_view', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 0.2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:reviews' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:reviews',
+ 'label' => 'la_tab_Reviews',
+ 'url' => Array('index_file' => 'reviews.php', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configure_categories' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:cat_settings',
+ 'label' => 'la_tab_Settings',
+ 'url' => Array('t' => 'config/config_universal', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configuration_search' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:settings_search',
+ 'label' => 'la_tab_ConfigSearch',
+ 'url' => Array('t' => 'in-portal/config/config_search', 'module_key' => 'category', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configuration_email' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:settings_email',
+ 'label' => 'la_tab_ConfigE-mail',
+ 'url' => Array('t' => 'in-portal/config/config_email', 'module' => 'In-Portal:Category', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configuration_custom' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:settings_custom',
+ 'label' => 'la_tab_ConfigCustom',
+ 'url' => Array('t' => 'in-portal/custom_fields/custom_fields_list', 'cf_type' => 1, 'pass_section' => true, 'pass' => 'm,cf'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
+ 'priority' => 7,
+ 'type' => stTREE,
+ ),
+
+
+ 'in-portal:users' => Array(
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:community',
+ 'label' => 'la_tab_Community',
+ 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'u',
+ ),
+
+ 'in-portal:user_list' => Array(
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:users',
+ 'label' => 'la_tab_User_List',
+ 'url' => Array('index_file' => 'users/user_list.php', 'pass' => 'm', 'resetpage' => 1),
+ 'permissions' => Array('view', 'add', 'edit', 'delete', 'advanced:ban', 'advanced:send_email', /*'advanced:add_favorite', 'advanced:remove_favorite',*/),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:k4_user_list' => Array(
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:users',
+ 'label' => 'la_title_K4Users',
+ 'url' => Array('t' => 'in-portal/users/users_list', 'pass' => 'm'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete', 'advanced:ban', 'advanced:send_email', /*'advanced:add_favorite', 'advanced:remove_favorite',*/),
+ 'priority' => 1.5,
+ 'debug_only' => true,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_groups' => Array(
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:usergroups',
+ 'label' => 'la_tab_User_Groups',
+ 'url' => Array('t' => 'in-portal/groups/groups_list', 'pass' => 'm'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete', 'advanced:send_email', 'advanced:manage_permissions'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+
+
+ 'in-portal:configure_users' => Array(
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:users_settings',
+ 'label' => 'la_tab_ConfigSettings',
+ 'url' => Array('t' => 'config/config_universal', 'module' => 'In-Portal:Users', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_email' => Array(
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:settings_email',
+ 'label' => 'la_tab_ConfigE-mail',
+ 'url' => Array('t' => 'config/config_email', 'module' => 'In-Portal:Users', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_custom' => Array(
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:settings_custom',
+ 'label' => 'la_tab_ConfigCustom',
+ 'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 6, 'pass_section' => true, 'pass' => 'm,cf'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_banlist' => Array(
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:banlist',
+ 'label' => 'la_tab_BanList',
+ 'url' => Array('index_file' => 'config/edit_banlist.php', 'DataType' => 6, 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ ),
+
+ // "Help" section
+ 'in-portal:help' => Array(
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:help',
+ 'label' => 'la_tab_Help',
+ 'url' => Array('index_file' => 'help/manual.pdf', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 7,
+ 'type' => stTREE,
+ ),
+
+ // "Summary & Logs" section
+ 'in-portal:reports' => Array(
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:summary_logs',
+ 'label' => 'la_tab_Reports',
+ 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:log_summary' => Array(
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:summary',
+ 'label' => 'la_tab_Summary',
+ 'url' => Array('index_file' => 'logs/summary.php', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:searchlog' => Array(
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:search_log',
+ 'label' => 'la_tab_SearchLog',
+ 'url' => Array('index_file' => 'logs/searchlog.php', 'pass' => 'm'),
+ 'permissions' => Array('view', 'delete'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:sessionlog' => Array(
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:sessions_log',
+ 'label' => 'la_tab_SessionLog',
+ 'url' => Array('index_file' => 'logs/session_list.php', 'pass' => 'm'),
+ 'permissions' => Array('view', 'delete'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:emaillog' => Array(
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:email_log',
+ 'label' => 'la_tab_EmailLog',
+ 'url' => Array('index_file' => 'logs/email_log.php', 'pass' => 'm'),
+ 'permissions' => Array('view', 'delete'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:visits' => Array(
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:visits',
+ 'label' => 'la_tab_Visits',
+ 'url' => Array('t' => 'in-portal/visits/visits_list', 'pass' => 'm'),
+ 'permissions' => Array('view', 'delete'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ // "Configuration" section
+ 'in-portal:system' => Array(
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:conf',
+ 'label' => 'la_tab_Sys_Config',
+ 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:configure_general' => Array(
+ 'parent' => 'in-portal:system',
+ 'icon' => 'in-portal:conf_general',
+ 'label' => 'la_tab_General',
+ 'url' => Array('t' => 'config/config_universal', 'pass_section' => true, 'module' => 'In-Portal', 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configure_themes' => Array(
+ 'parent' => 'in-portal:system',
+ 'icon' => 'in-portal:conf_themes',
+ 'label' => 'la_tab_Themes',
+ 'url' => Array('index_file' => 'config/config_theme.php', 'pass' => 'm'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ // "Tools" section
+ 'in-portal:tools' => Array(
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:tools',
+ 'label' => 'la_tab_Tools',
+ 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:backup' => Array(
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_backup',
+ 'label' => 'la_tab_Backup',
+ 'url' => Array('index_file' => 'backup/backup1.php', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:restore' => Array(
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_restore',
+ 'label' => 'la_tab_Restore',
+ 'url' => Array('index_file' => 'backup/restore1.php', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:main_import' => Array(
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_import',
+ 'label' => 'la_tab_ImportData',
+ 'url' => Array('index_file' => 'import/step1.php', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:sql_query' => Array(
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_import',
+ 'label' => 'la_tab_QueryDB',
+ 'url' => Array('index_file' => 'tools/sql_query.php', 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:server_info' => Array(
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:server_info',
+ 'label' => 'la_tab_ServerInfo',
+ 'url' => Array('index_file' => 'tools/server_info.php', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ ),
+ ),
+ );
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/units/sections/sections_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/units/email_messages/email_messages_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/units/email_messages/email_messages_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/units/email_messages/email_messages_config.php (revision 7648)
@@ -0,0 +1,88 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'emailmessages',
+ 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
+ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
+ 'EventHandlerClass' => Array('class'=>'EmailMessagesEventHandler','file'=>'email_messages_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),
+ 'AutoLoad' => true,
+
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ 4 => 'mode',
+ ),
+
+ 'IDField' => 'EmailMessageId',
+
+ 'TitleField' => 'Subject',
+
+ 'TableName' => TABLE_PREFIX.'EmailMessage',
+
+ 'ListSQLs' => Array(
+ ''=>'
+ SELECT %1$s.* %2$s
+ FROM %1$s
+ LEFT JOIN '.TABLE_PREFIX.'Events
+ ON '.TABLE_PREFIX.'Events.EventId = %1$s.EventId
+ '
+ ),
+
+ 'ItemSQLs' => Array(
+ ''=>'
+ SELECT %1$s.* %2$s
+ FROM %1$s
+ LEFT JOIN '.TABLE_PREFIX.'Events
+ ON '.TABLE_PREFIX.'Events.EventId = %1$s.EventId
+ '
+ ),
+
+ 'ForeignKey' => 'LanguageId',
+ 'ParentTableKey' => 'LanguageId',
+ 'ParentPrefix' => 'lang',
+ 'AutoDelete' => true,
+ 'AutoClone' => true,
+
+ 'CalculatedFields' => array(
+ '' => array(
+ 'Description' => TABLE_PREFIX.'Events.Description',
+ 'Module' => TABLE_PREFIX.'Events.Module',
+ 'Type' => TABLE_PREFIX.'Events.Type',
+ ),
+ ),
+
+ 'Fields' => Array(
+ 'EmailMessageId' => Array(),
+ 'Template' => Array('type' => 'string','default' => ''),
+ 'MessageType' => Array('type' => 'string', 'formatter'=>'kOptionsFormatter', 'options'=>Array('text'=>'la_Text','html'=>'la_Html'), 'not_null' => '1','default' => 'text'),
+ 'LanguageId' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'EventId' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'Subject' => Array('type'=>'string'),
+ ),
+
+ 'VirtualFields' => Array(
+ 'Headers' => Array('type'=>'string'),
+ 'Body' => Array('type'=>'string'),
+ 'Description' => Array('type'=>'string', 'sql_filter_type'=>'having'),
+ 'Module' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'Type' => Array('formatter'=>'kOptionsFormatter', 'options' => Array (1 => 'la_Text_Admin', 0 => 'la_Text_User'), 'use_phrases' => 1, 'default' => 0, 'not_null' => 1),
+ ),
+
+ 'Grids' => Array(
+ 'Default' => Array(
+ 'Icons' => Array('default'=>'icon16_custom.gif'),
+ 'Fields' => Array(
+ 'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'label_grid_checkbox_td'),
+ 'Subject' => Array( 'title'=>'la_col_Subject'),
+ 'Type' => Array( 'title'=>'la_col_Type'),
+ ),
+
+ ),
+ ),
+
+
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/units/email_messages/email_messages_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/regional/languages_list.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/regional/languages_list.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/regional/languages_list.tpl (revision 7648)
@@ -0,0 +1,69 @@
+<inp2:m_RequireLogin permissions="in-portal:configure_lang.view" system="1"/>
+<inp2:m_include t="incs/header"/>
+<inp2:m_ParseBlock name="section_header" icon="icon46_conf_regional" title="!la_title_Regional!"/>
+
+<inp2:m_ParseBlock name="blue_bar" prefix="lang" title_preset="languages_list" module="in-portal" icon="icon46_conf_regional"/>
+
+<!-- ToolBar --->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <script type="text/javascript">
+ //do not rename - this function is used in default grid for double click!
+ function edit()
+ {
+ std_edit_item('lang', 'regional/languages_edit');
+ }
+
+ var a_toolbar = new ToolBar();
+ a_toolbar.AddButton( new ToolBarButton('new_language', '<inp2:m_phrase label="la_ToolTip_NewLanguage" escape="1"/>::<inp2:m_phrase label="la_Add" escape="1"/>',
+ function() {
+ std_precreate_item('lang', 'regional/languages_edit')
+ } ) );
+
+ a_toolbar.AddButton( new ToolBarButton('edit', '<inp2:m_phrase label="la_ToolTip_Edit" escape="1"/>::<inp2:m_phrase label="la_ShortToolTip_Edit" escape="1"/>', edit) );
+ a_toolbar.AddButton( new ToolBarButton('delete', '<inp2:m_phrase label="la_ToolTip_Delete" escape="1"/>',
+ function() {
+ std_delete_items('lang')
+ } ) );
+
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep1') );
+
+ a_toolbar.AddButton( new ToolBarButton('primary_language', '<inp2:m_phrase label="la_ToolTip_SetPrimaryLanguage" escape="1"/>::<inp2:m_phrase label="la_ShortToolTip_SetPrimary" escape="1"/>', function() {
+ submit_event('lang','OnSetPrimary');
+ }
+ ) );
+
+
+ a_toolbar.AddButton( new ToolBarButton('import_language', '<inp2:m_phrase label="la_ToolTip_ImportLanguage" escape="1"/>::<inp2:m_phrase label="la_ShortToolTip_Import" escape="1"/>', function() {
+ redirect('<inp2:m_t t="regional/languages_import" phrases.import_event="OnNew" m_opener="d" pass="all,m,phrases.import" />');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarButton('export_language', '<inp2:m_phrase label="la_ToolTip_ExportLanguage" escape="1"/>::<inp2:m_phrase label="la_ShortToolTip_Export" escape="1"/>', function() {
+ submit_event('lang','OnExportLanguage');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep2') );
+
+ a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View" escape="1"/>', function() {
+ show_viewmenu(a_toolbar,'view');
+ }
+ ) );
+
+ a_toolbar.Render();
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<inp2:m_ParseBlock name="grid" PrefixSpecial="lang" IdField="LanguageId" grid="Default" menu_filters="yes"/>
+<script type="text/javascript">
+ Grids['lang'].SetDependantToolbarButtons( new Array('edit','delete','primary_language','export_language') );
+</script>
+
+<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/regional/languages_list.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/regional/phrases_edit.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/regional/phrases_edit.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/regional/phrases_edit.tpl (revision 7648)
@@ -0,0 +1,60 @@
+<inp2:adm_SetPopupSize width="888" height="415"/>
+<inp2:m_RequireLogin permissions="in-portal:configure_lang.view" system="1"/>
+<inp2:m_include t="incs/header"/>
+<inp2:m_ParseBlock name="section_header" icon="icon46_conf_regional" title="!la_title_RegionalSettings!"/>
+
+<inp2:m_ParseBlock name="blue_bar" prefix="phrases" title_preset="phrase_edit" module="in-portal" icon="icon46_conf_regional"/>
+
+<!-- ToolBar --->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <script type="text/javascript">
+ a_toolbar = new ToolBar();
+ a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
+ submit_event('phrases','<inp2:phrases_SaveEvent/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
+ cancel_edit('phrases','OnCancelEdit','<inp2:phrases_SaveEvent/>','<inp2:m_Phrase label="la_FormCancelConfirmation" escape="1"/>');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarButton('reset_edit', '<inp2:m_phrase label="la_ToolTip_Reset" escape="1"/>', function() {
+ reset_form('phrases', 'OnReset', '<inp2:m_Phrase label="la_FormResetConfirmation" escape="1"/>');
+ }
+ ) );
+
+ a_toolbar.Render();
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<inp2:phrases_SaveWarning name="grid_save_warning"/>
+<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
+ <input type="hidden" id="phrases_label" name="phrases_label" value="<inp2:m_get name="phrases_label"/>">
+ <inp2:m_DefineElement name="phrase_element">
+ <tr class="subsectiontitle">
+ <td colspan="3"><inp2:phrases_Field name="Phrase"/></td>
+ </tr>
+
+ <inp2:m_ParseBlock name="inp_edit_hidden" prefix="phrases" field="LanguageId"/>
+ <inp2:m_ParseBlock name="inp_label" prefix="phrases" field="PrimaryTranslation" title="!la_fld_PrimaryTranslation!"/>
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="phrases" field="Phrase" title="!la_fld_Phrase!" size="60"/>
+ <inp2:m_ParseBlock name="inp_edit_textarea" prefix="phrases" field="Translation" title="!la_fld_Translation!" rows="7" cols="50" allow_html="0"/>
+
+ <inp2:m_ParseBlock name="inp_edit_radio" prefix="phrases" field="PhraseType" title="!la_fld_PhraseType!"/>
+ <inp2:m_ParseBlock name="inp_edit_options" prefix="phrases" field="Module" title="!la_fld_Module!"/>
+ </inp2:m_DefineElement>
+
+ <inp2:m_if check="m_GetEquals" name="phrases_label" value="ALEX, FIX IT!">
+ <inp2:phrases_MultipleEditing render_as="phrase_element"/>
+ <inp2:m_else/>
+ <inp2:m_RenderElement name="phrase_element"/>
+ </inp2:m_if>
+</table>
+
+<inp2:m_include t="incs/footer"/>
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/regional/phrases_edit.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/sections_list.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/sections_list.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/sections_list.tpl (revision 7648)
@@ -0,0 +1,56 @@
+<inp2:adm_CheckPermCache cache_update_t="in-portal/categories/cache_updater"/>
+<inp2:m_include t="incs/header"/>
+
+<link rel="stylesheet" rev="stylesheet" href="<inp2:adm_ModulePath module="In-portal"/>incs/sections_list.css" type="text/css" />
+
+<inp2:m_DefineElement name="section_list_header" icon_module="">
+ <!-- section header -->
+ <table cellpadding="0" cellspacing="0" border="0" width="100%">
+ <tr style="background: url(<inp2:$SectionPrefix_ModulePath module="#session#"/>img/logo_bg.gif) no-repeat top right;">
+ <td valign="top" class="admintitle" align="left" style="padding-top: 2px; padding-bottom: 2px;">
+ <inp2:m_if check="m_RecallEquals" name="section" value="in-portal:root">
+ <img width="46" height="46" src="<inp2:$SectionPrefix_ModulePath module="$icon_module"/>img/icons/<inp2:adm_GetSectionIcon icon="icon46_{$icon}"/>.gif" align="absmiddle" title="<inp2:adm_GetSectionTitle phrase="$label" default="$label"/>">&nbsp;<inp2:adm_GetSectionTitle phrase="$label" default="$label"/>
+ <inp2:m_else/>
+ <img width="46" height="46" src="<inp2:$SectionPrefix_ModulePath module="$icon_module"/>img/icons/<inp2:adm_GetSectionIcon icon="icon46_{$icon}"/>.gif" align="absmiddle" title="<inp2:adm_GetSectionTitle phrase="$label"/>">&nbsp;<inp2:adm_GetSectionTitle phrase="$label"/>
+ </inp2:m_if>
+ </td>
+ </tr>
+ </table>
+
+ <inp2:m_ParseBlock name="blue_bar" prefix="$SectionPrefix" title_preset="tree_#section#" icon="icon46_{$icon}"/>
+</inp2:m_DefineElement>
+
+<inp2:adm_PrintSection section_name="#session#" render_as="section_list_header"/>
+
+<table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td valign="top" width="100%">
+ <table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
+ <inp2:m_DefineElement name="section_element" icon_module="">
+ <tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
+ <td class="subitem_icon">
+ <img src="<inp2:$SectionPrefix_ModulePath module="$icon_module"/>img/icons/icon46_list_<inp2:m_param name="icon"/>.gif" border="0" alt="<inp2:m_phrase name="$label"/>" align="absmiddle"/>
+ </td>
+ <td class="subitem_description">
+ <a href="<inp2:m_param name="section_url"/>" class="dLink" title="<inp2:m_phrase name="$label"/>" target="main"><inp2:m_phrase name="$label"/></a>
+ <inp2:m_if check="m_ParamEquals" name="is_tab" value="1">
+ <inp2:m_phrase name="la_Description_{$parent}"/>
+ <inp2:m_else/>
+ <inp2:m_phrase name="la_Description_{$section_name}"/>
+ </inp2:m_if>
+ </td>
+ </tr>
+ </inp2:m_DefineElement>
+
+ <inp2:m_set odd_even="table_color1"/>
+ <inp2:adm_PrintSections block="section_element" section_name="#session#"/>
+ </table>
+ </td>
+
+ <td valign="top" align="right">
+ <inp2:adm_ModuleInclude template="summary/#section#"/>
+ </td>
+ </tr>
+</table>
+
+<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/sections_list.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/config/config_universal.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/config/config_universal.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/config/config_universal.tpl (revision 7648)
@@ -0,0 +1,92 @@
+<inp2:m_RequireLogin perm_event="conf:OnLoad" system="1"/>
+<inp2:m_include t="incs/header"/>
+
+<inp2:m_Get var="section" result_to_var="section"/>
+<inp2:conf_InitList name="default" per_page="-1" />
+<inp2:m_RenderElement name="combined_header" section="$section" prefix="conf" title_preset=""/>
+
+<!-- ToolBar --->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <script type="text/javascript">
+
+ function ValidatePassFld(fieldId){
+ var passFld=document.getElementById(fieldId);
+ var passVerifyFld=document.getElementById('verify_'+fieldId);
+ if (passFld && passVerifyFld && passFld.value == passVerifyFld.value) {
+ return true;
+ }
+ else {
+ var passErrorCell=document.getElementById('error_'+fieldId);
+ if (passErrorCell){
+ passErrorCell.innerHTML='<inp2:m_phrase name="la_error_PasswordMatch" />';
+ }
+ return false;
+ }
+ }
+
+ function ValidatePassFields(){
+ var el=false;
+ var validated=true;
+ for (var i=0; i<document.forms.kernel_form.elements.length; i++){
+ el=document.forms.kernel_form.elements[i];
+ if (el.getAttribute('primarytype')=='password'){
+ if (!ValidatePassFld(el.id)){
+ validated=false;
+ }
+ }
+ }
+ return validated;
+ }
+
+ function toggle_section($label) {
+ var $table = document.getElementById('config_table');
+ var $row = null;
+ var $is_visible = false;
+
+ for (var $i = 0; $i < $table.rows.length; $i++) {
+ $row = $table.rows[$i];
+ if ($row.getAttribute('header_label') != $label) {
+ continue;
+ }
+
+ if (!$row.style.display) {
+ $row.style.display = document.all ? 'block' : 'table-row';
+ }
+
+ $is_visible = !($row.style.display == 'none');
+ $row.style.display = $is_visible ? 'none' : (document.all ? 'block' : 'table-row');
+
+ document.getElementById('toggle_mark['+$label+']').innerHTML = '[' + ($is_visible ? '+' : '-') + ']';
+ }
+ }
+
+ var a_toolbar = new ToolBar();
+ a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
+ if (ValidatePassFields()){
+ submit_event('conf','<inp2:conf_SaveEvent/>');
+ }
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
+ submit_event('conf','OnCancel');
+ }
+ ) );
+
+ a_toolbar.Render();
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<inp2:m_include t="incs/config_blocks"/>
+
+<inp2:conf_SaveWarning name="grid_save_warning"/>
+<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder" id="config_table">
+ <inp2:conf_PrintList list_name="default" block="config_block" full_block="config_block" half_block1="config_block1" half_block2="config_block2"/>
+</table>
+
+<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/config/config_universal.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/incs/grid_blocks.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/incs/grid_blocks.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/incs/grid_blocks.tpl (revision 7648)
@@ -0,0 +1,478 @@
+<inp2:m_block name="current_page"/>
+ <span class="current_page"><inp2:m_param name="page"/></span>
+<inp2:m_blockend/>
+
+<inp2:m_block name="page"/>
+ <a href="javascript:go_to_page('<inp2:m_param name="PrefixSpecial"/>', <inp2:m_param name="page"/>, <inp2:m_param name="ajax"/>)" class="nav_url"><inp2:m_param name="page"/></a>
+<inp2:m_blockend/>
+
+<inp2:m_block name="next_page"/>
+ <a href="javascript:go_to_page('<inp2:m_param name="PrefixSpecial"/>', <inp2:m_param name="page"/>, <inp2:m_param name="ajax"/>)" class="nav_url">&gt;</a>
+<inp2:m_blockend/>
+
+<inp2:m_block name="prev_page"/>
+ <a href="javascript:go_to_page('<inp2:m_param name="PrefixSpecial"/>', <inp2:m_param name="page"/>, <inp2:m_param name="ajax"/>)" class="nav_url">&lt;</a>
+<inp2:m_blockend/>
+
+<inp2:m_block name="next_page_split"/>
+ <a href="javascript:go_to_page('<inp2:m_param name="PrefixSpecial"/>', <inp2:m_param name="page"/>, <inp2:m_param name="ajax"/>)" class="nav_url">&gt;&gt;</a>
+<inp2:m_blockend/>
+
+<inp2:m_block name="prev_page_split"/>
+ <a href="javascript:go_to_page('<inp2:m_param name="PrefixSpecial"/>', <inp2:m_param name="page"/>, <inp2:m_param name="ajax"/>)" class="nav_url">&lt;&lt;</a>
+<inp2:m_blockend/>
+
+
+<inp2:m_DefineElement name="search_main_toolbar">
+</inp2:m_DefineElement>
+
+<inp2:m_block name="grid_pagination" SearchPrefixSpecial="" ajax="0"/>
+<table cellspacing="0" cellpadding="0" width="100%" bgcolor="#E0E0DA" border="0" class="<inp2:m_if prefix="m" function="ParamEquals" name="no_toolbar" value="no_toolbar"/>tableborder_full_kernel<inp2:m_else/>pagination_bar<inp2:m_endif/>">
+ <tbody>
+ <tr id="MY_ID">
+ <td>
+ <img height="15" src="img/arrow.gif" width="15" align="absmiddle" border="0">
+ <b class=text><inp2:m_phrase name="la_Page"/></b>
+ <inp2:$PrefixSpecial_PrintPages active_block="current_page" split="10" inactive_block="page" prev_page_block="prev_page" next_page_block="next_page" prev_page_split_block="prev_page_split" next_page_split_block="next_page_split" main_special="$main_special" ajax="$ajax" grid="$grid"/>
+ </td>
+ <inp2:m_if check="m_ParamEquals" param="search" value="on">
+ <inp2:m_if check="m_ParamEquals" name="SearchPrefixSpecial" value="">
+ <inp2:m_RenderElement name="grid_search" grid="$grid" PrefixSpecial="$PrefixSpecial" ajax="$ajax"/>
+ <inp2:m_else />
+ <inp2:m_RenderElement name="grid_search" grid="$grid" PrefixSpecial="$SearchPrefixSpecial" ajax="$ajax"/>
+ </inp2:m_if>
+ </inp2:m_if>
+ <td>
+ </tr>
+ </tbody>
+</table>
+<inp2:m_blockend/>
+
+<inp2:m_DefineElement name="grid_search" ajax="0">
+ <td align="right" class="search-cell">
+ <table cellspacing="0" cellpadding="0">
+ <tr>
+ <td><inp2:m_phrase name="la_Search"/>:&nbsp;</td>
+ <td>
+ <input type="text" id="<inp2:m_param name="PrefixSpecial"/>_search_keyword" name="<inp2:m_param name="PrefixSpecial"/>_search_keyword" value="<inp2:m_recall var="{$PrefixSpecial}_search_keyword" no_null="no_null" special="1"/>" onkeydown="search_keydown(event, '<inp2:m_param name="PrefixSpecial"/>', '<inp2:m_param name="grid"/>', <inp2:m_param name="ajax"/>);" style="border: 1px solid grey;" />
+ <input type="text" style="display: none"; />
+ </td>
+ <td style="white-space: nowrap" id="search_buttons[<inp2:m_param name="PrefixSpecial"/>]">
+ <div style="white-space: nowrap;"></div>
+ <script type="text/javascript">
+ <inp2:m_RenderElement name="grid_search_buttons" pass_params="true"/>
+ </script>
+
+ </td>
+ </tr>
+ </table>
+ </td>
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="grid_search_buttons" PrefixSpecial="" grid="" ajax="1">
+ Toolbars['<inp2:m_param name="PrefixSpecial"/>_search'] = new ToolBar('icon16_');
+ Toolbars['<inp2:m_param name="PrefixSpecial"/>_search'].UseLabels = false;
+ Toolbars['<inp2:m_param name="PrefixSpecial"/>_search'].AddButton(
+ new ToolBarButton(
+ 'search',
+ '<inp2:m_phrase name="la_ToolTip_Search" escape="1"/>',
+ function() { search('<inp2:m_param name="PrefixSpecial"/>','<inp2:m_param name="grid"/>', <inp2:m_param name="ajax"/>) },
+ null,
+ '<inp2:m_param name="PrefixSpecial"/>') );
+ Toolbars['<inp2:m_param name="PrefixSpecial"/>_search'].AddButton(
+ new ToolBarButton(
+ 'search_reset',
+ '<inp2:m_phrase name="la_ToolTip_SearchReset" escape="1"/>',
+ function() { search_reset('<inp2:m_param name="PrefixSpecial"/>','<inp2:m_param name="grid"/>', <inp2:m_param name="ajax"/>) },
+ null,
+ '<inp2:m_param name="PrefixSpecial"/>') );
+ Toolbars['<inp2:m_param name="PrefixSpecial"/>_search'].Render(document.getElementById('search_buttons[<inp2:m_param name="PrefixSpecial"/>]'));
+</inp2:m_DefineElement>
+
+<inp2:m_block name="grid_column_title" use_phrases="1"/>
+ <td nowrap="nowrap">
+ <a href="javascript:resort_grid('<inp2:m_param name="PrefixSpecial"/>','<inp2:m_param name="sort_field"/>', <inp2:m_param name="ajax"/>);" class="columntitle_small"><IMG alt="" src="img/list_arrow_<inp2:$PrefixSpecial_order field="$sort_field"/>.gif" border="0" align="absmiddle"><inp2:m_if check="m_ParamEquals" name="use_phrases" value="1"><inp2:m_phrase name="$title"/><inp2:m_else/><inp2:m_param name="title"/></inp2:m_if></a>
+ </td>
+<inp2:m_blockend/>
+
+<inp2:m_block name="grid_column_title_no_sorting" use_phrases="1"/>
+ <td nowrap="nowrap">
+ <inp2:m_if check="m_ParamEquals" name="use_phrases" value="1"><inp2:m_phrase name="$title"/><inp2:m_else/><inp2:m_param name="title"/></inp2:m_if>
+ </td>
+<inp2:m_blockend/>
+
+<inp2:m_block name="grid_checkbox_td" format="" module="" />
+ <td valign="top" class="text">
+ <table border="0" cellpadding="0" cellspacing="0" class="grid_id_cell">
+ <tr>
+ <td><input type="checkbox" name="<inp2:$PrefixSpecial_InputName field="$IdField" IdField="$IdField"/>" id="<inp2:$PrefixSpecial_InputName field="$IdField" IdField="$IdField"/>"></td>
+ <td><img src="<inp2:ModulePath module="$module"/>img/itemicons/<inp2:$PrefixSpecial_ItemIcon grid="$grid"/>"></td>
+ <td><inp2:Field field="$field" no_special="no_special" format="$format"/></td>
+ </tr>
+ </table>
+ </td>
+<inp2:m_blockend />
+
+<inp2:m_block name="grid_checkbox_td_no_icon" format="" />
+ <td valign="top" class="text">
+ <table border="0" cellpadding="0" cellspacing="0" class="grid_id_cell">
+ <tr>
+ <td><input type="checkbox" name="<inp2:$PrefixSpecial_InputName field="$IdField" IdField="$IdField"/>" id="<inp2:$PrefixSpecial_InputName field="$IdField" IdField="$IdField"/>"></td>
+ <td><inp2:$PrefixSpecial_field field="$field" no_special="no_special" format="$format"/></td>
+ </tr>
+ </table>
+ </td>
+<inp2:m_blockend />
+
+<inp2:m_block name="label_grid_checkbox_td" format="" module="" />
+ <td valign="top" class="text">
+ <table border="0" cellpadding="0" cellspacing="0" class="grid_id_cell">
+ <tr>
+ <td><input type="checkbox" name="<inp2:$PrefixSpecial_InputName field="$IdField" IdField="$IdField"/>" id="<inp2:$PrefixSpecial_InputName field="$IdField" IdField="$IdField"/>"></td>
+ <td><img src="<inp2:ModulePath module="$module"/>img/itemicons/<inp2:$PrefixSpecial_ItemIcon grid="$grid"/>"></td>
+ <td><inp2:$PrefixSpecial_field field="$field" no_special="no_special" as_label="as_label" format="$format"/></td>
+ </tr>
+ </table>
+ </td>
+<inp2:m_blockend />
+
+<inp2:m_block name="grid_icon_td" format="" module="" />
+ <td valign="top" class="text">
+ <table border="0" cellpadding="0" cellspacing="0" class="grid_id_cell">
+ <tr>
+ <td><img src="<inp2:ModulePath module="$module"/>img/itemicons/<inp2:$PrefixSpecial_ItemIcon grid="$grid"/>"></td>
+ <td><inp2:$PrefixSpecial_field field="$field" no_special="no_special" format="$format"/></td>
+ </tr>
+ </table>
+ </td>
+<inp2:m_blockend />
+
+<inp2:m_block name="grid_radio_td" format="" module=""/>
+ <td valign="top" class="text">
+ <table border="0" cellpadding="0" cellspacing="0" class="grid_id_cell">
+ <tr>
+ <td><input type="radio" name="<inp2:$PrefixSpecial_InputName field="$IdField" IdField="$IdField"/>" id="<inp2:$PrefixSpecial_InputName field="$IdField" IdField="$IdField"/>"></td>
+ <td><img src="<inp2:ModulePath module="$module"/>img/itemicons/<inp2:$PrefixSpecial_ItemIcon grid="$grid"/>"></td>
+ <td><inp2:Field field="$field" no_special="no_special" format="$format"/></td>
+ </tr>
+ </table>
+ </td>
+<inp2:m_blockend />
+
+<inp2:m_block name="grid_data_td" format="" no_special="" nl2br="" first_chars="" td_style="" currency=""/>
+ <td valign="top" class="text" style="<inp2:m_param name="td_style"/>"><inp2:$PrefixSpecial_field field="$field" first_chars="$first_chars" currency="$currency" nl2br="$nl2br" grid="$grid" no_special="$no_special" format="$format"/></td>
+<inp2:m_blockend />
+
+<inp2:m_block name="grid_edit_td" format="" />
+ <td valign="top" class="text"><input type="text" id="<inp2:$PrefixSpecial_InputName field="$field"/>" name="<inp2:$PrefixSpecial_InputName field="$field"/>" value="<inp2:$PrefixSpecial_field field="$field" grid="$grid" format="$format"/>"></td>
+<inp2:m_blockend />
+
+<inp2:m_block name="grid_data_label_td" />
+ <td valign="top" class="text"><inp2:$PrefixSpecial_field field="$field" grid="$grid" plus_or_as_label="1" no_special="no_special" format="$format"/></td>
+<inp2:m_blockend />
+
+<inp2:m_block name="grid_data_label_ml_td" format="" />
+ <td valign="top" class="text">
+ <span class="<inp2:m_if check="{$SourcePrefix}_HasError" field="$virtual_field">error</inp2:m_if>">
+ <inp2:$PrefixSpecial_Field field="$field" grid="$grid" as_label="1" no_special="no_special" format="$format"/>
+ </span><inp2:m_if check="{$SourcePrefix}_IsRequired" field="$virtual_field"/><span class="error"> *</span></inp2:m_if>:<br />
+ <inp2:m_if check="FieldEquals" field="$ElementTypeField" value="textarea">
+ <a href="javascript:PreSaveAndOpenTranslatorCV('<inp2:m_param name="SourcePrefix"/>,<inp2:m_param name="SourcePrefix"/>-cdata', '<inp2:m_param name="SourcePrefix"/>-cdata:cust_<inp2:Field name="CustomFieldId"/>', 'popups/translator', <inp2:$SourcePrefix_Field field="ResourceId"/>, 1);" title="<inp2:m_Phrase label="la_Translate" escape="1"/>"><img src="img/icons/icon24_translate.gif" style="cursor:hand;" border="0"></a>
+ <inp2:m_else/>
+ <a href="javascript:PreSaveAndOpenTranslatorCV('<inp2:m_param name="SourcePrefix"/>,<inp2:m_param name="SourcePrefix"/>-cdata', '<inp2:m_param name="SourcePrefix"/>-cdata:cust_<inp2:Field name="CustomFieldId"/>', 'popups/translator', <inp2:$SourcePrefix_Field field="ResourceId"/>);" title="<inp2:m_Phrase label="la_Translate" escape="1"/>"><img src="img/icons/icon24_translate.gif" style="cursor:hand;" border="0"></a>
+ </inp2:m_if>
+ </td>
+<inp2:m_blockend />
+
+<inp2:m_DefineElement name="grid_column_filter">
+ <td>&nbsp;</td>
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="grid_options_filter" use_phrases="0">
+ <td>
+ <select <inp2:m_if check="SearchField" field="$filter_field" filter_type="options" grid="$grid">class="filter"</inp2:m_if> name="<inp2:SearchInputName field="$filter_field" filter_type="options" grid="$grid"/>">
+ <inp2:m_if prefix="m" function="ParamEquals" name="use_phrases" value="1"/>
+ <inp2:PredefinedSearchOptions field="$filter_field" block="inp_option_phrase" selected="selected" has_empty="1" empty_value="" filter_type="options" grid="$grid"/>
+ <inp2:m_else/>
+ <inp2:PredefinedSearchOptions field="$filter_field" block="inp_option_item" selected="selected" has_empty="1" empty_value="" filter_type="options" grid="$grid"/>
+ <inp2:m_endif/>
+ </select>
+ </td>
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="grid_like_filter">
+ <td>
+ <input type="text" class="flat-input<inp2:m_if check="SearchField" field="$filter_field" filter_type="like" grid="$grid"> filter</inp2:m_if>" name="<inp2:SearchInputName field="$filter_field" filter_type="like" grid="$grid"/>" value="<inp2:SearchField field="$filter_field" filter_type="like" grid="$grid"/>" onkeydown="search_keydown(event, '<inp2:m_param name="PrefixSpecial"/>', '<inp2:m_param name="grid"/>', <inp2:m_param name="ajax"/>);"/>
+
+ </td>
+</inp2:m_DefineElement>
+<inp2:m_DefineElement name="grid_equals_filter">
+ <td>
+ <input type="text" class="flat-input<inp2:m_if check="SearchField" field="$filter_field" filter_type="equals" grid="$grid"> filter</inp2:m_if>" name="<inp2:SearchInputName field="$filter_field" filter_type="equals" grid="$grid"/>" value="<inp2:SearchField field="$filter_field" filter_type="equals" grid="$grid"/>" onkeydown="search_keydown(event, '<inp2:m_param name="PrefixSpecial"/>', '<inp2:m_param name="grid"/>', <inp2:m_param name="ajax"/>);"/>
+ </td>
+</inp2:m_DefineElement>
+<inp2:m_DefineElement name="grid_range_filter">
+ <td>
+ <input type="text" class="flat-input<inp2:m_if check="SearchField" field="$filter_field" filter_type="range" type="from" grid="$grid"> filter</inp2:m_if>" name="<inp2:SearchInputName field="$filter_field" filter_type="range" type="from" grid="$grid"/>" value="<inp2:SearchField field="$filter_field" filter_type="range" type="from" grid="$grid"/>" size="5" onkeydown="search_keydown(event, '<inp2:m_param name="PrefixSpecial"/>', '<inp2:m_param name="grid"/>', <inp2:m_param name="ajax"/>);"/><br />
+ <input type="text" class="flat-input<inp2:m_if check="SearchField" field="$filter_field" filter_type="range" type="to" grid="$grid"> filter</inp2:m_if>" name="<inp2:SearchInputName field="$filter_field" filter_type="range" type="to" grid="$grid"/>" value="<inp2:SearchField field="$filter_field" filter_type="range" type="to" grid="$grid"/>" size="5" onkeydown="search_keydown(event, '<inp2:m_param name="PrefixSpecial"/>', '<inp2:m_param name="grid"/>', <inp2:m_param name="ajax"/>);"/><br />
+ </td>
+</inp2:m_DefineElement>
+<inp2:m_DefineElement name="grid_float_range_filter">
+ <td>
+ <input type="text" class="flat-input<inp2:m_if check="SearchField" field="$filter_field" filter_type="float_range" type="from" grid="$grid"> filter</inp2:m_if>" name="<inp2:SearchInputName field="$filter_field" filter_type="float_range" type="from" grid="$grid"/>" value="<inp2:SearchField field="$filter_field" filter_type="float_range" type="from" grid="$grid"/>" size="5" onkeydown="search_keydown(event, '<inp2:m_param name="PrefixSpecial"/>', '<inp2:m_param name="grid"/>', <inp2:m_param name="ajax"/>);"/><br />
+ <input type="text" class="flat-input<inp2:m_if check="SearchField" field="$filter_field" filter_type="float_range" type="to" grid="$grid"> filter</inp2:m_if>" name="<inp2:SearchInputName field="$filter_field" filter_type="float_range" type="to" grid="$grid"/>" value="<inp2:SearchField field="$filter_field" filter_type="float_range" type="to" grid="$grid"/>" size="5" onkeydown="search_keydown(event, '<inp2:m_param name="PrefixSpecial"/>', '<inp2:m_param name="grid"/>', <inp2:m_param name="ajax"/>);"/><br />
+ </td>
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="grid_date_range_filter">
+ <td>
+ <input type="text" class="flat-input<inp2:m_if check="SearchField" field="$filter_field" filter_type="date_range" type="from" grid="$grid"> filter</inp2:m_if>" name="<inp2:SearchInputName field="$filter_field" filter_type="date_range" type="from" grid="$grid"/>" id="<inp2:SearchInputName field="$filter_field" filter_type="date_range" type="from" grid="$grid"/>" value="<inp2:SearchField field="$filter_field" filter_type="date_range" type="from" grid="$grid"/>" size="15" datepickerIcon="img/calendar_icon.gif" onkeydown="search_keydown(event, '<inp2:m_param name="PrefixSpecial"/>', '<inp2:m_param name="grid"/>', <inp2:m_param name="ajax"/>);"/><br />
+ <input type="text" class="flat-input<inp2:m_if check="SearchField" field="$filter_field" filter_type="date_range" type="to" grid="$grid"> filter</inp2:m_if>" name="<inp2:SearchInputName field="$filter_field" filter_type="date_range" type="to" grid="$grid"/>" id="<inp2:SearchInputName field="$filter_field" filter_type="date_range" type="to" grid="$grid"/>" value="<inp2:SearchField field="$filter_field" filter_type="date_range" type="to" grid="$grid"/>" size="15" datepickerIcon="img/calendar_icon.gif" onkeydown="search_keydown(event, '<inp2:m_param name="PrefixSpecial"/>', '<inp2:m_param name="grid"/>', <inp2:m_param name="ajax"/>);"/><br />
+ </td>
+ <script type="text/javascript">
+ initCalendar("<inp2:SearchInputName field="$filter_field" filter_type="date_range" type="from" grid="$grid"/>", "<inp2:Format field="{$sort_field}_date" input_format="1"/>");
+ initCalendar("<inp2:SearchInputName field="$filter_field" filter_type="date_range" type="to" grid="$grid"/>", "<inp2:Format field="{$sort_field}_date" input_format="1"/>");
+ </script>
+</inp2:m_DefineElement>
+
+<inp2:m_block name="viewmenu_sort_block"/>
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_sorting_menu'].addMenuItem('<inp2:m_phrase name="$title" escape="1"/>','direct_sort_grid("<inp2:m_param name="PrefixSpecial"/>","<inp2:m_param name="sort_field"/>","<inp2:$PrefixSpecial_OrderInfo type="direction" pos="1"/>", null, <inp2:m_param name="ajax"/>);','<inp2:m_if prefix="$PrefixSpecial" function="IsOrder" field="$sort_field" pos="1"/>2<inp2:m_endif/>');
+<inp2:m_blockend/>
+
+<inp2:m_block name="viewmenu_filter_block"/>
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_filter_menu'].addMenuItem('<inp2:m_param name="label" js_escape="1"/>','<inp2:m_param name="filter_action"/>','<inp2:m_param name="filter_status"/>');
+<inp2:m_blockend/>
+
+<inp2:m_block name="viewmenu_filter_separator"/>
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_filter_menu'].addMenuSeparator();
+<inp2:m_blockend/>
+
+<inp2:m_block name="viewmenu_declaration" menu_filters="no" menu_sorting="yes" menu_perpage="yes" menu_select="yes" ajax="0"/>
+ // define ViewMenu
+ $fw_menus['<inp2:m_param name="PrefixSpecial"/>'+'_view_menu'] = function()
+ {
+ <inp2:m_if check="m_ParamEquals" name="menu_filters" value="yes">
+ // filtring menu
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_filter_menu'] = new Menu('<inp2:m_phrase name="la_Text_View" escape="1"/>');
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_filter_menu'].addMenuItem('All','filters_remove_all("<inp2:m_param name="PrefixSpecial"/>", <inp2:m_param name="ajax"/>);');
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_filter_menu'].addMenuItem('None','filters_apply_all("<inp2:m_param name="PrefixSpecial"/>", <inp2:m_param name="ajax"/>);');
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_filter_menu'].addMenuSeparator();
+ <inp2:$PrefixSpecial_DrawFilterMenu old_style="1" item_block="viewmenu_filter_block" spearator_block="viewmenu_filter_separator" ajax="$ajax"/>
+ </inp2:m_if>
+
+ <inp2:m_if check="m_ParamEquals" name="menu_sorting" value="yes">
+ // sorting menu
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_sorting_menu'] = new Menu('<inp2:m_phrase name="la_Text_Sort" escape="1"/>');
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_sorting_menu'].addMenuItem('<inp2:m_phrase name="la_common_ascending" escape="1"/>','direct_sort_grid("<inp2:m_param name="PrefixSpecial"/>","<inp2:$PrefixSpecial_OrderInfo type="field" pos="1"/>","asc",null,<inp2:m_param name="ajax"/>);','<inp2:m_if prefix="$PrefixSpecial" function="IsOrder" direction="asc" pos="1"/>2<inp2:m_endif/>');
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_sorting_menu'].addMenuItem('<inp2:m_phrase name="la_common_descending" escape="1"/>','direct_sort_grid("<inp2:m_param name="PrefixSpecial"/>","<inp2:$PrefixSpecial_OrderInfo type="field" pos="1"/>","desc",null,<inp2:m_param name="ajax"/>);','<inp2:m_if prefix="$PrefixSpecial" function="IsOrder" direction="desc" pos="1"/>2<inp2:m_endif/>');
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_sorting_menu'].addMenuSeparator();
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_sorting_menu'].addMenuItem('<inp2:m_phrase name="la_Text_Default" escape="1"/>','reset_sorting("<inp2:m_param name="PrefixSpecial"/>");');
+ <inp2:$PrefixSpecial_IterateGridFields grid="$grid" mode="header" block="viewmenu_sort_block" ajax="$ajax"/>
+ </inp2:m_if>
+
+ <inp2:m_if check="m_ParamEquals" name="menu_perpage" value="yes">
+ // per page menu
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_perpage_menu'] = new Menu('<inp2:m_phrase name="la_prompt_PerPage" escape="1"/>');
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_perpage_menu'].addMenuItem('10','set_per_page("<inp2:m_param name="PrefixSpecial"/>",10,<inp2:m_param name="ajax"/>);','<inp2:m_if prefix="$PrefixSpecial" function="PerPageEquals" value="10"/>2<inp2:m_endif/>');
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_perpage_menu'].addMenuItem('20','set_per_page("<inp2:m_param name="PrefixSpecial"/>",20,<inp2:m_param name="ajax"/>);','<inp2:m_if prefix="$PrefixSpecial" function="PerPageEquals" value="20"/>2<inp2:m_endif/>');
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_perpage_menu'].addMenuItem('50','set_per_page("<inp2:m_param name="PrefixSpecial"/>",50,<inp2:m_param name="ajax"/>);','<inp2:m_if prefix="$PrefixSpecial" function="PerPageEquals" value="50"/>2<inp2:m_endif/>');
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_perpage_menu'].addMenuItem('100','set_per_page("<inp2:m_param name="PrefixSpecial"/>",100,<inp2:m_param name="ajax"/>);','<inp2:m_if prefix="$PrefixSpecial" function="PerPageEquals" value="100"/>2<inp2:m_endif/>');
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_perpage_menu'].addMenuItem('500','set_per_page("<inp2:m_param name="PrefixSpecial"/>",500,<inp2:m_param name="ajax"/>);','<inp2:m_if prefix="$PrefixSpecial" function="PerPageEquals" value="500"/>2<inp2:m_endif/>');
+ </inp2:m_if>
+
+ <inp2:m_if check="m_ParamEquals" name="menu_select" value="yes">
+ // select menu
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_select_menu'] = new Menu('<inp2:m_phrase name="la_Text_Select" escape="1"/>');
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_select_menu'].addMenuItem('<inp2:m_phrase name="la_Text_All" escape="1"/>','Grids["<inp2:m_param name="PrefixSpecial"/>"].SelectAll();');
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_select_menu'].addMenuItem('<inp2:m_phrase name="la_Text_Unselect" escape="1"/>','Grids["<inp2:m_param name="PrefixSpecial"/>"].ClearSelection();');
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_select_menu'].addMenuItem('<inp2:m_phrase name="la_Text_Invert" escape="1"/>','Grids["<inp2:m_param name="PrefixSpecial"/>"].InvertSelection();');
+ </inp2:m_if>
+
+ processHooks('ViewMenu', hBEFORE, '<inp2:m_param name="PrefixSpecial"/>');
+
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_view_menu'] = new Menu('<inp2:$PrefixSpecial_GetItemName/>');
+ <inp2:m_if check="m_ParamEquals" name="menu_filters" value="yes">
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_view_menu'].addMenuItem( $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_filter_menu'] );
+ </inp2:m_if>
+ <inp2:m_if check="m_ParamEquals" name="menu_sorting" value="yes">
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_view_menu'].addMenuItem( $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_sorting_menu'] );
+ </inp2:m_if>
+ <inp2:m_if check="m_ParamEquals" name="menu_perpage" value="yes">
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_view_menu'].addMenuItem( $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_perpage_menu'] );
+ </inp2:m_if>
+ <inp2:m_if check="m_ParamEquals" name="menu_select" value="yes">
+ $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_view_menu'].addMenuItem( $Menus['<inp2:m_param name="PrefixSpecial"/>'+'_select_menu'] );
+ </inp2:m_if>
+
+ processHooks('ViewMenu', hAFTER, '<inp2:m_param name="PrefixSpecial"/>');
+ }
+<inp2:m_blockend/>
+
+<inp2:m_include template="incs/menu_blocks"/>
+
+<inp2:m_block name="grid_save_warning" />
+ <table width="100%" border="0" cellspacing="0" cellpadding="4" class="table_border_<inp2:m_if prefix="m" function="ParamEquals" name="no_toolbar" value="no_toolbar"/>nobottom<inp2:m_else/>notop<inp2:m_endif/>">
+ <tr>
+ <td valign="top" class="hint_red">
+ <inp2:m_phrase name="la_Warning_Save_Item"/>
+ </td>
+ </tr>
+ </table>
+ <script type="text/javascript">
+ $edit_mode = <inp2:m_if check="m_ParamEquals" name="edit_mode" value="1">true<inp2:m_else />false</inp2:m_if>;
+// window.parent.document.title += ' - MODE: ' + ($edit_mode ? 'EDIT' : 'LIVE');
+ </script>
+<inp2:m_blockend/>
+
+
+
+<inp2:m_DefineElement name="grid" main_prefix="" per_page="" main_special="" no_toolbar="" grid_filters="" search="on" header_block="grid_column_title" filter_block="grid_column_filter" data_block="grid_data_td" totals_block="grid_total_td" row_block="_row" ajax="0" totals="0">
+<!--
+ grid_filters - show individual filters for each column
+ has_filters - draw filter section in "View" menu in toolbar
+-->
+
+ <inp2:InitList pass_params="1"/> <!-- this is to avoid recalling prefix as an item in first iterate grid, by col-picker for instance -->
+
+ <inp2:$PrefixSpecial_SaveWarning name="grid_save_warning" main_prefix="$main_prefix" no_toolbar="$no_toolbar"/>
+ <inp2:m_if check="m_RecallEquals" var="{$PrefixSpecial}_search_keyword" value="" inverse="inverse">
+ <table width="100%" border="0" cellspacing="0" cellpadding="4" class="table_border_<inp2:m_if prefix="m" function="ParamEquals" name="no_toolbar" value="no_toolbar"/>nobottom<inp2:m_else/>notop<inp2:m_endif/>">
+ <tr>
+ <td valign="top" class="hint_red">
+ <inp2:m_phrase name="la_Warning_Filter"/>
+ </td>
+ </tr>
+ </table>
+ </inp2:m_if>
+
+ <inp2:m_if check="m_ParamEquals" name="per_page" value="-1" inverse="1">
+ <inp2:m_ParseBlock name="grid_pagination" grid="$grid" PrefixSpecial="$PrefixSpecial" main_special="$main_special" search="$search" no_toolbar="$no_toolbar" ajax="$ajax"/>
+ </inp2:m_if>
+ <table width="100%" cellspacing="0" cellpadding="4" class="tableborder">
+
+ <inp2:m_if check="m_ParamEquals" name="grid_filters" value="1">
+ <tr class="pagination_bar">
+ <inp2:$PrefixSpecial_IterateGridFields grid="$grid" mode="filter" block="$filter_block" ajax="$ajax"/>
+ </tr>
+ </inp2:m_if>
+
+ <tr class="subsectiontitle">
+ <inp2:$PrefixSpecial_IterateGridFields grid="$grid" mode="header" block="$header_block" ajax="$ajax"/>
+ </tr>
+
+ <inp2:m_DefineElement name="_row" td_style="">
+ <tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>" id="<inp2:m_param name="PrefixSpecial"/>_<inp2:Field field="$IdField"/>" sequence="<inp2:m_get param="{$PrefixSpecial}_sequence"/>"><inp2:m_inc param="{$PrefixSpecial}_sequence" by="1"/>
+ <inp2:IterateGridFields grid="$grid" mode="data" block="$data_block"/>
+ </tr>
+ </inp2:m_DefineElement>
+ <inp2:m_set {$PrefixSpecial}_sequence="1" odd_even="table_color1"/>
+ <inp2:$PrefixSpecial_PrintList block="$row_block" per_page="$per_page" main_special="$main_special" />
+
+ <inp2:m_DefineElement name="grid_total_td">
+ <inp2:m_if check="m_Param" name="total">
+ <td style="<inp2:m_param name="td_style"/>">
+ <inp2:FieldTotal name="$field" function="$total"/>
+ </td>
+ <inp2:m_else/>
+ <td style="<inp2:m_param name="td_style"/>">&nbsp;</td>
+ </inp2:m_if>
+ </inp2:m_DefineElement>
+
+ <inp2:m_if check="m_ParamEquals" name="totals" value="1">
+ <tr class="totals-row"/>
+ <inp2:IterateGridFields grid="$grid" mode="data" block="$totals_block"/>
+ </tr>
+ </inp2:m_if>
+ </table>
+
+ <inp2:m_if check="m_ParamEquals" name="ajax" value="0">
+ <inp2:m_if check="m_GetEquals" name="fw_menu_included" value="">
+ <script type="text/javascript" src="incs/fw_menu.js"></script>
+
+ <link rel="stylesheet" rev="stylesheet" href="incs/nlsmenu.css" type="text/css" />
+ <script type="text/javascript" src="js/nlsmenu.js"></script>
+ <script type="text/javascript" src="js/nlsmenueffect_1_2_1.js"></script>
+
+ <script type="text/javascript">
+ var menuMgr = new NlsMenuManager("mgr");
+ menuMgr.timeout = 500;
+ menuMgr.flowOverFormElement = true;
+ </script>
+
+ <inp2:m_set fw_menu_included="1"/>
+ </inp2:m_if>
+
+ <script type="text/javascript">
+ <inp2:m_RenderElement name="grid_js" selected_class="selected_div" tag_name="tr" pass_params="true"/>
+ </script>
+ </inp2:m_if>
+
+ <input type="hidden" id="<inp2:m_param name="PrefixSpecial"/>_Sort1" name="<inp2:m_param name="PrefixSpecial"/>_Sort1" value="">
+ <input type="hidden" id="<inp2:m_param name="PrefixSpecial"/>_Sort1_Dir" name="<inp2:m_param name="PrefixSpecial"/>_Sort1_Dir" value="asc">
+</inp2:m_DefineElement>
+
+
+
+
+<inp2:m_DefineElement name="grid_js" ajax="1">
+ <inp2:m_if check="m_ParamEquals" name="no_init" value="no_init" inverse="inverse">
+ Grids['<inp2:m_param name="PrefixSpecial"/>'] = new Grid('<inp2:m_param name="PrefixSpecial"/>', '<inp2:m_param name="selected_class"/>', ':original', edit, a_toolbar);
+ Grids['<inp2:m_param name="PrefixSpecial"/>'].AddItemsByIdMask('<inp2:m_param name="tag_name"/>', /^<inp2:m_param name="PrefixSpecial"/>_([\d\w-]+)/, '<inp2:m_param name="PrefixSpecial"/>[$$ID$$][<inp2:m_param name="IdField"/>]');
+ Grids['<inp2:m_param name="PrefixSpecial"/>'].InitItems();
+ </inp2:m_if>
+
+ <inp2:m_RenderElement name="nlsmenu_declaration" pass_params="true"/>
+
+ $ViewMenus = new Array('<inp2:m_param name="PrefixSpecial"/>');
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="white_grid" main_prefix="" per_page="" main_special="" no_toolbar="" search="on" render_as="" columns="2" direction="V" empty_cell_render_as="wg_empty_cell" ajax="0">
+ <inp2:$PrefixSpecial_SaveWarning name="grid_save_warning" main_prefix="$main_prefix" no_toolbar="$no_toolbar"/>
+ <inp2:m_if check="m_RecallEquals" var="{$PrefixSpecial}_search_keyword" value="" inverse="inverse">
+ <table width="100%" border="0" cellspacing="0" cellpadding="4" class="table_border_<inp2:m_if prefix="m" function="ParamEquals" name="no_toolbar" value="no_toolbar"/>nobottom<inp2:m_else/>notop<inp2:m_endif/>">
+ <tr>
+ <td valign="top" class="hint_red">
+ <inp2:m_phrase name="la_Warning_Filter"/>
+ </td>
+ </tr>
+ </table>
+ </inp2:m_if>
+ <inp2:m_if check="m_ParamEquals" name="per_page" value="-1" inverse="1">
+ <inp2:m_ParseBlock name="grid_pagination" grid="$grid" PrefixSpecial="$PrefixSpecial" main_special="$main_special" search="$search" no_toolbar="$no_toolbar" ajax="$ajax"/>
+ </inp2:m_if>
+ <br />
+
+ <inp2:m_DefineElement name="wg_empty_cell">
+ <td width="<inp2:m_param name="column_width"/>%">&nbsp;</td>
+ </inp2:m_DefineElement>
+
+ <table width="100%" border="0" cellspacing="2" cellpadding="4">
+ <inp2:m_set {$PrefixSpecial}_sequence="1" odd_even="table_color1"/>
+ <inp2:$PrefixSpecial_PrintList2 pass_params="true"/>
+ </table>
+
+ <inp2:m_if check="m_ParamEquals" name="ajax" value="0">
+ <inp2:m_if check="m_GetEquals" name="fw_menu_included" value="">
+ <script type="text/javascript" src="incs/fw_menu.js"></script>
+
+ <link rel="stylesheet" rev="stylesheet" href="incs/nlsmenu.css" type="text/css" />
+ <script type="text/javascript" src="js/nlsmenu.js"></script>
+ <script type="text/javascript" src="js/nlsmenueffect_1_2_1.js"></script>
+
+ <script type="text/javascript">
+ var menuMgr = new NlsMenuManager("mgr");
+ menuMgr.timeout = 500;
+ menuMgr.flowOverFormElement = true;
+ </script>
+
+ <inp2:m_set fw_menu_included="1"/>
+ </inp2:m_if>
+
+ <script type="text/javascript">
+ <inp2:m_RenderElement name="grid_js" selected_class="table_white_selected" tag_name="td" pass_params="true"/>
+ </script>
+ </inp2:m_if>
+
+ <input type="hidden" id="<inp2:m_param name="PrefixSpecial"/>_Sort1" name="<inp2:m_param name="PrefixSpecial"/>_Sort1" value="">
+ <input type="hidden" id="<inp2:m_param name="PrefixSpecial"/>_Sort1_Dir" name="<inp2:m_param name="PrefixSpecial"/>_Sort1_Dir" value="asc">
+</inp2:m_DefineElement>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/incs/grid_blocks.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/incs/header.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/incs/header.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/incs/header.tpl (revision 7648)
@@ -0,0 +1,58 @@
+<inp2:m_DefaultParam body_properties=""/>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+<title><inp2:m_GetConfig var="Site_Name"/> - <inp2:m_Phrase label="la_AdministrativeConsole"/></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 type="text/javascript" src="js/is.js"></script>
+<script type="text/javascript" src="js/ajax.js"></script>
+<script type="text/javascript" src="js/script.js"></script>
+<script type="text/javascript" src="js/in-portal.js"></script>
+<script type="text/javascript" src="js/toolbar.js"></script>
+<script type="text/javascript" src="js/grid.js"></script>
+<script type="text/javascript" src="js/calendar.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/';
+
+NumberFormatter.ThousandsSep = '<inp2:lang.current_Field name="ThousandSep" js_escape="1"/>';
+NumberFormatter.DecimalSep = '<inp2:lang.current_Field name="DecimalPoint" js_escape="1"/>';
+
+<inp2:m_if check="m_GetEquals" name="m_wid" value="" inverse="inverse">
+ window.name += '_<inp2:m_get name="m_wid"/>';
+</inp2:m_if>
+
+var $use_popups = <inp2:m_if check="adm_UsePopups">true<inp2:m_else/>false</inp2:m_if>;
+var $use_toolbarlabels = <inp2:m_if check="adm_UseToolbarLabels">true<inp2:m_else/>false</inp2:m_if>;
+</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 <inp2:m_param name="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.3.2/core/admin_templates/incs/header.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/incs/footer.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/incs/footer.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/incs/footer.tpl (revision 7648)
@@ -0,0 +1,43 @@
+<inp2:m_if check="adm_UsePopups">
+ <script type="text/javascript">
+ var o = '';
+ var el = document.getElementById('scroll_container');
+ if (el) {
+ document.body.style.overflow = 'hidden';
+ document.body.style.height = '100%';
+ document.body.scroll = 'no'
+ o += '<div style="position: relative; overflow: auto; width: 100%; height: 100%;">';
+ o += el.innerHTML + '</div>';
+ el.innerHTML = o;
+ execJS(el)
+ MakeHeight100();
+ addEvent(window, 'resize', function() {MakeHeight100()})
+ }
+
+ function MakeHeight100(id)
+ {
+ if (!id) id = 'scroll_container';
+ var el = document.getElementById(id);
+ var h = (document.all ? window.document.body.offsetHeight : window.innerHeight) - el.offsetTop + 'px';
+ var w = (document.all ? window.document.body.offsetWidth : window.innerWidth) - el.offsetLeft + 'px';
+// alert('h: '+h)
+ el.style.height = h;
+// el.style.width=w;
+ }
+
+ </script>
+<inp2:m_else/>
+ <inp2:m_if check="adm_TemplateMatches" templates="head,tree" inverse="inverse">
+ <br /><br />
+ </inp2:m_if>
+</inp2:m_if>
+
+<inp2:adm_AfterScript/>
+
+<inp2:m_if check="m_ParamEquals" name="noform" value="yes" inverse="inverse">
+ <inp2:m_ParseBlock name="kernel_form_end"/>
+</inp2:m_if>
+
+<div id="nlsMenuPlace"></div>
+</body>
+</html>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/incs/footer.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/grid.js
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/grid.js (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/grid.js (revision 7648)
@@ -0,0 +1,464 @@
+var $GridManager = new GridManager();
+
+function GridManager () {
+ this.Grids = Grids; // get all from global variable, in future replace all references to it with $GridManager.Grids
+ this.AlternativeGrids = new Array();
+}
+
+GridManager.prototype.AddAlternativeGrid = function ($source_grid, $destination_grid, $reciprocal)
+{
+ if ($source_grid == $destination_grid) {
+ return false;
+ }
+
+ if (typeof(this.AlternativeGrids[$source_grid]) == 'undefined') {
+ // alternative grids not found, create empty list
+ this.AlternativeGrids[$source_grid] = new Array();
+ }
+
+ if (!in_array($destination_grid, this.AlternativeGrids[$source_grid])) {
+ // alternative grids found, check if not added already
+ this.AlternativeGrids[$source_grid].push($destination_grid);
+ }
+
+ if ($reciprocal) {
+ this.AddAlternativeGrid($destination_grid, $source_grid);
+ }
+}
+
+GridManager.prototype.ClearAlternativeGridsSelection = function ($source_prefix)
+{
+ if (!this.AlternativeGrids[$source_prefix]) return false;
+
+ var $i = 0;
+ var $destination_prefix = '';
+ while ($i < this.AlternativeGrids[$source_prefix].length) {
+ $destination_prefix = this.AlternativeGrids[$source_prefix][$i];
+ if (this.Grids[$destination_prefix]) {
+ // alternative grid set, but not yet loaded by ajax
+ this.Grids[$destination_prefix].ClearSelection();
+ }
+ $i++;
+ }
+}
+
+GridManager.prototype.CheckDependencies = function ($prefix) {
+ if (typeof(this.Grids[$prefix]) != 'undefined') {
+ this.Grids[$prefix].CheckDependencies('GridManager.CheckDependencies');
+ }
+}
+
+function GridItem(grid, an_element, cb, item_id, class_on, class_off)
+{
+ this.Grid = grid;
+ this.selected = false;
+ this.id = an_element.id;
+ this.ItemId = item_id;
+ this.sequence = parseInt(an_element.getAttribute('sequence'));
+// this.class_on = class_on;
+
+ if (class_off == ':original') {
+ this.class_off = an_element.className;
+ }
+ else
+ this.class_off = class_off;
+
+ if (class_on.match(/(.*):(.*)/)) {
+ var even = RegExp.$2;
+ var odd = RegExp.$1;
+ this.class_on = this.class_off.match(/even/) ? even : odd
+ }
+ else {
+ this.class_on = class_on
+ }
+
+ this.HTMLelement = an_element;
+
+ if (document.getElementById('left_'+an_element.id)) {
+ this.LeftElement = document.getElementById('left_'+an_element.id);
+ }
+ else {
+ this.LeftElement = false;
+ }
+
+ this.CheckBox = cb;
+
+ this.value = this.ItemId;
+ this.ItemType = 11;
+}
+
+GridItem.prototype.Init = function ()
+{
+ this.HTMLelement.GridItem = this;
+ this.HTMLelement.onclick = function(ev) {
+ this.GridItem.Click(ev);
+ };
+ this.HTMLelement.ondblclick = function(ev) {
+ this.GridItem.DblClick(ev);
+ }
+ if ( this.LeftElement ) {
+ this.LeftElement.GridItem = this;
+ this.LeftElement.onclick = function(ev) {
+ this.GridItem.Click(ev);
+ };
+ this.LeftElement.ondblclick = function(ev) {
+ this.GridItem.DblClick(ev);
+ }
+ }
+ if ( isset(this.CheckBox) ) {
+ this.CheckBox.GridItem = this;
+ this.CheckBox.onclick = function(ev) {
+ this.GridItem.cbClick(ev);
+ };
+ this.CheckBox.ondblclick = function(ev) {
+ this.GridItem.DblClick(ev);
+ }
+ }
+}
+
+GridItem.prototype.DisableClicking = function ()
+{
+ this.HTMLelement.onclick = function(ev) {
+ return false;
+ };
+ this.HTMLelement.ondblclick = function(ev) {
+ return false;
+ }
+ if ( this.LeftElement ) {
+ this.LeftElement.onclick = function(ev) {
+ return false;
+ };
+ this.LeftElement.ondblclick = function(ev) {
+ return false;
+ }
+ }
+ if ( isset(this.CheckBox) ) {
+ this.CheckBox.onclick = function(ev) {
+ return false;
+ };
+ }
+}
+
+GridItem.prototype.Select = function ()
+{
+ if (this.selected) return;
+ this.selected = true;
+ this.HTMLelement.className = this.class_on;
+ if ( this.LeftElement ) {
+ this.LeftElement.className = this.class_on;
+ }
+ if ( isset(this.CheckBox) ) {
+ this.CheckBox.checked = true;
+ }
+ this.Grid.LastSelectedId = this.ItemId;
+ this.Grid.SelectedCount++;
+
+ // this is for in-portal only (used in relation select)
+ LastCheckedItem = this;
+ if (typeof (this.Grid.OnSelect) == 'function' ) {
+ this.Grid.OnSelect(this.ItemId);
+ }
+}
+
+GridItem.prototype.UnSelect = function ( force )
+{
+ if ( !this.selected && !force) return;
+ this.selected = false;
+ this.HTMLelement.className = this.class_off;
+ if ( this.LeftElement ) {
+ this.LeftElement.className = this.class_off;
+ }
+ if ( isset(this.CheckBox) ) {
+ this.CheckBox.checked = false;
+ }
+ this.Grid.SelectedCount--;
+ if (typeof (this.Grid.OnUnSelect) == 'function' ) {
+ this.Grid.OnUnSelect(this.ItemId);
+ }
+ this.Grid.LastSelectedId = null;
+}
+
+GridItem.prototype.ClearBrowserSelection = function() {
+ ClearBrowserSelection();
+}
+
+GridItem.prototype.Click = function (ev)
+{
+ //this.ClearBrowserSelection();
+ this.Grid.ClearAlternativeGridsSelection('GridItem.Click');
+
+ var e = !is.ie ? ev : window.event;
+
+ if (e.shiftKey && !this.Grid.RadioMode) {
+ this.ClearBrowserSelection();
+ this.Grid.SelectRangeUpTo(this.sequence);
+ }
+ else {
+ if (e.ctrlKey && !this.Grid.RadioMode) {
+ this.Toggle()
+ }
+ else {
+ if (!(this.Grid.RadioMode && this.Grid.LastSelectedId == this.ItemId && this.selected)) {
+ // don't clear selection if item same as current is selected
+ if (!this.Grid.StickySelection) {
+ this.Grid.ClearSelection(null,'GridItem.Click');
+ }
+ else {
+ if (this.Grid.LastSelectedId == this.ItemId) {
+ return;
+ }
+ }
+ this.Toggle();
+ }
+ }
+ }
+ this.Grid.CheckDependencies('GridItem.Click');
+ e.cancelBubble = true;
+}
+
+GridItem.prototype.cbClick = function (ev)
+{
+ var e = is.ie ? window.event : ev;
+ if (this.Grid.RadioMode) this.Grid.ClearSelection(null,'GridItem.cbClick');
+ this.Grid.ClearAlternativeGridsSelection('GridItem.cbClick');
+ this.Toggle();
+ this.Grid.CheckDependencies('GridItem.cbClick');
+ e.cancelBubble = true;
+}
+
+GridItem.prototype.DblClick = function (ev)
+{
+ var e = is.ie ? window.event : ev;
+ this.Grid.Edit();
+}
+
+GridItem.prototype.Toggle = function ()
+{
+ if (this.selected) this.UnSelect()
+ else {
+ this.Grid.LastSelectedSequence = this.sequence;
+ this.Select();
+ }
+}
+
+GridItem.prototype.FallsInRange = function (from, to)
+{
+ return (from <= to) ?
+ (this.sequence >= from && this.sequence <= to) :
+ (this.sequence >= to && this.sequence <= from);
+}
+
+
+function Grid(prefix, class_on, class_off, dbl_click, toolbar)
+{
+ this.prefix = prefix;
+ this.class_on = class_on;
+ this.class_off = class_off;
+ this.Items = new Array();
+ this.LastSelectedSequence = 1;
+ this.LastSelectedId = null;
+ this.DblClick = dbl_click;
+ this.ToolBar = toolbar;
+ this.SelectedCount = 0;
+ this.AlternativeGrids = new Array();
+ this.DependantButtons = new Array();
+ this.RadioMode = false;
+
+ // K3-style sticky selection, selection an item does not unselect currently selected
+ // even w/o Ctrl key pressed
+ this.StickySelection = false;
+}
+
+Grid.prototype.AddItem = function( an_item ) {
+ this.Items[an_item.id] = an_item;
+}
+
+Grid.prototype.AddItemsByIdMask = function ( tag, mask, cb_mask ) {
+ var $item_id=0;
+ elements = document.getElementsByTagName(tag.toUpperCase());
+ for (var i=0; i < elements.length; i++) {
+ if ( typeof(elements[i].id) == 'undefined') {
+ continue;
+ }
+ if ( !elements[i].id.match(mask)) continue;
+ $item_id=RegExp.$1;
+
+ cb_name = cb_mask.replace('$$ID$$',$item_id);
+
+ cb = document.getElementById(cb_name);
+ if (typeof(cb) == 'undefined') alert ('No Checkbox defined for item '+elements[i].id);
+
+ this.AddItem( new GridItem( this, elements[i], cb, $item_id, this.class_on, this.class_off ) );
+ }
+}
+
+Grid.prototype.InitItems = function() {
+ for (var i in this.Items) {
+ this.Items[i].Init();
+ }
+ this.ClearSelection( true,'Grid.InitItems' );
+
+ var a_Grid = this;
+ addEvent(document, 'keyup', function(ev) {
+ var e = !is.ie ? ev : window.event;
+ switch (e.keyCode) {
+ case 65:
+ if (!e.ctrlKey) break;
+ a_Grid.SelectAll();
+ ClearBrowserSelection()
+// window.setTimeout(ClearBrowserSelection, 500);
+ break;
+ case 27:
+ a_Grid.ClearSelection();
+ break;
+ case 33:
+ case 37:
+ //alert('<-') // go to prev page here
+ break;
+ case 34:
+ case 39:
+ // alert('->') // go to next page here
+ break;
+ case 88:
+ ClearBrowserSelection();
+ break;
+ }
+ });
+}
+
+Grid.prototype.DisableClicking = function() {
+ for (var i in this.Items) {
+ this.Items[i].DisableClicking();
+ }
+ this.ClearSelection( true, 'Grid.DisableClicking' );
+}
+
+Grid.prototype.ClearSelection = function( force, called_from ) {
+// alert('selection clear. force: '+force+'; called_from: '+called_from);
+ if (typeof(force) == 'undefined') force = false;
+ if (this.CountSelected() == 0 && !force) return;
+ for (var i in this.Items) {
+ this.Items[i].UnSelect(force);
+ }
+ this.SelectedCount = 0;
+ this.CheckDependencies('Grid.ClearSelection');
+}
+
+Grid.prototype.GetSelected = function() {
+ var $ret = new Array();
+ for (var i in this.Items) {
+ if (this.Items[i].selected) {
+ $ret[$ret.length] = this.Items[i].ItemId;
+ }
+
+ }
+ return $ret;
+}
+
+Grid.prototype.InvertSelection = function() {
+ for (var i in this.Items)
+ {
+ if( this.Items[i].selected )
+ {
+ this.Items[i].UnSelect();
+ }
+ else
+ {
+ this.Items[i].Select();
+ }
+ }
+ this.CheckDependencies('Grid.InvertSelection');
+}
+
+Grid.prototype.SelectAll = function() {
+ for (var i in this.Items) {
+ this.Items[i].Select();
+ }
+ this.CheckDependencies('Grid.SelectAll');
+ this.ClearAlternativeGridsSelection('Grid.SelectAll');
+}
+
+Grid.prototype.SelectRangeUpTo = function( last_sequence ) {
+ for (var i in this.Items) {
+ if (this.Items[i].FallsInRange(this.LastSelectedSequence, last_sequence)) {
+ this.Items[i].Select();
+ }
+ }
+}
+
+Grid.prototype.CountSelected = function ()
+{
+ return this.SelectedCount;
+}
+
+Grid.prototype.Edit = function() {
+ if ( this.CountSelected() == 0 ) return;
+ this.DblClick();
+}
+
+Grid.prototype.SetDependantToolbarButtons = function($buttons, $direct, $mode) {
+ if (!isset($direct)) $direct = true; // direct (use false for invert mode)
+ if (!isset($mode)) $mode = 1; // enable/disable (use 2 for show/hide mode)
+ for (var i in $buttons) {
+ this.DependantButtons.push(new Array($buttons[i], $direct, $mode));
+ }
+ //this.DependantButtons = buttons;
+ this.CheckDependencies('Grid.SetDependantToolbarButtons');
+}
+
+Grid.prototype.CheckDependencies = function($called_from)
+{
+// alert('prefix: ' + this.prefix + '; ' + $called_from + ' -> Grid.CheckDependencies');
+ var enabling = (this.CountSelected() > 0);
+ for (var i in this.DependantButtons) {
+ if (this.DependantButtons[i][0].match("portal:(.*)")) {
+ button_name = RegExp.$1;
+ if (toolbar) {
+ if (enabling == this.DependantButtons[i][1]) {
+ toolbar.enableButton(button_name, true);
+ }
+ else
+ {
+ toolbar.disableButton(button_name, true);
+ }
+ }
+ }
+ else {
+ if (this.DependantButtons[i][2] == 1) {
+ this.ToolBar.SetEnabled(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]);
+ }
+ else {
+ this.ToolBar.SetVisible(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]);
+ }
+ }
+ }
+ //if (enabling) this.ClearAlternativeGridsSelection('Grid.CheckDependencies');
+
+}
+
+Grid.prototype.ClearAlternativeGridsSelection = function (called_from)
+{
+ $GridManager.ClearAlternativeGridsSelection(this.prefix);
+}
+
+Grid.prototype.AddAlternativeGrid = function (alt_grid, reciprocal)
+{
+ var $dst_prefix = typeof('alt_grid') == 'string' ? alt_grid : alt_grid.prefix;
+ $GridManager.AddAlternativeGrid(this.prefix, $dst_prefix, reciprocal);
+}
+
+Grid.prototype.FirstSelected = function ()
+{
+ min_sequence = null;
+ var res = null
+ for (var i in this.Items) {
+ if (!this.Items[i].selected) continue;
+ if (min_sequence == null)
+ min_sequence = this.Items[i].sequence;
+ if (this.Items[i].sequence <= min_sequence) {
+ res = this.Items[i].ItemId;
+ min_sequence = this.Items[i].sequence;
+ }
+ }
+ return res;
+}
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/grid.js
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/grid_scroller.js
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/grid_scroller.js (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/grid_scroller.js (revision 7648)
@@ -0,0 +1,732 @@
+var sheetRules; // all rules in stylesheet Set by initStyleChange()
+var currentRule; // which rule are we editing? Set by assignRule()
+var defaultStyles = new Array();
+
+
+function StyleManager() {}
+
+StyleManager.InitStyles = function() {
+ if (!document.styleSheets) return;
+ var sheets = document.styleSheets;
+
+ this.Map = new Object();
+// alert('total '+sheets.length+' sheets')
+ for (var i=0;i<sheets.length;i++) {
+ var currentSheet = sheets[i];
+ if (currentSheet.cssRules)
+ sheetRules = currentSheet.cssRules
+ else if (currentSheet.rules)
+ sheetRules = currentSheet.rules;
+ else {
+// alert('bad sheet '+currentSheet.href);
+ continue;
+ }
+
+// alert('sheet: '+currentSheet.href)
+
+ for (var ii=0;ii<sheetRules.length;ii++) {
+ var value = sheetRules[ii].selectorText;
+ if (value.match(',')) { // Mozilla does not break comma-separated selectors into separate rules...
+ var subselectors = value.split(',');
+ for (var sub in subselectors) {
+ var real_name = subselectors[sub].replace(/^[ \t]*(.*)[ \t]*/, '$1');
+ this.Map[real_name] = sheetRules[ii]
+ }
+ }
+ else {
+ this.Map[value.toLowerCase()] = sheetRules[ii];
+ }
+ }
+ }
+ this.Inited = true;
+// preg_print_pre(this.Map, /last/);
+}
+
+StyleManager.ChangeStyle = function(selector, style, value)
+{
+ if (!this.Inited) this.InitStyles()
+ rule = this.Map[selector.toLowerCase()];
+ if (!rule) {
+ alert('rule '+selector+' not found')
+ return;
+ }
+ rule.style[style] = value;
+}
+
+function preg_print_pre(obj, reg)
+{
+ if (!reg) reg = /.*/;
+ var p = ''
+ for (var prop in obj) {
+ if (prop.match(reg) ) {
+ p += prop + ': '+obj[prop] + '\n'
+ }
+ }
+ alert(p)
+}
+
+function findPos(obj) {
+ var curleft = curtop = 0;
+ if (obj.offsetParent) {
+ curleft = obj.offsetLeft
+ curtop = obj.offsetTop
+ while (obj = obj.offsetParent) {
+ curleft += obj.offsetLeft
+ curtop += obj.offsetTop
+ }
+ }
+ return [curleft,curtop];
+}
+
+var startTime,endTime;
+
+function getDimensions(obj) {
+ var style
+ if (obj.currentStyle) {
+ style = obj.currentStyle;
+ }
+ else {
+ style = getComputedStyle(obj,'');
+ }
+ padding = [parseInt(style.paddingTop), parseInt(style.paddingRight), parseInt(style.paddingBottom), parseInt(style.paddingLeft)]
+ border = [parseInt(style.borderTopWidth), parseInt(style.borderRightWidth), parseInt(style.borderBottomWidth), parseInt(style.borderLeftWidth)]
+ for (var i in padding) if ( isNaN( padding[i] ) ) padding[i] = 0
+ for (var i in border) if ( isNaN( border[i] ) ) border[i] = 0
+
+ var result = new Object();
+ result.innerHeight = obj.clientHeight - padding[0] - padding[2];
+ result.innerWidth = obj.clientWidth - padding[1] - padding[3];
+ result.padding = padding;
+ result.borders = border;
+
+ return result;
+}
+
+var profile = 0;
+var profile_total = 0;
+var startTime = new Date().getTime();
+
+function Profile(message,force)
+{
+ if (profile || force) {
+ endTime = new Date().getTime();
+ var tmp = (endTime-startTime);
+ profile_total += tmp;
+ alert(message+' took '+tmp+' ms of '+profile_total)
+ startTime = new Date().getTime();
+ }
+}
+
+function ResetStart()
+{
+ startTime = new Date().getTime();
+ profile_total = 0;
+}
+
+function addLoadEvent(func) {
+ var oldonload = window.onload;
+ if (typeof window.onload != 'function') {
+ window.onload = func;
+ } else {
+ window.onload = function() {
+ if (oldonload) {
+ oldonload();
+ }
+ func();
+ }
+ }
+}
+
+function GridScroller(grid_id, w, h)
+{
+ this.GridId = grid_id
+
+ this.Footer = false;
+
+ this.LeftCells = 0;
+ this.LeftWidth = 0;
+
+ this.BottomOffset = 0;
+
+ this.Width = w;
+ this.Height = h;
+
+ this.AutoWidth = true;
+
+ this.ScrollerW = 0;
+ this.ScrollerH = 0;
+
+ this.MinWidths = [];
+ this.IDs = [];
+
+ this.Rendered = false;
+
+ this.PickerCRC = '';
+}
+
+GridScroller.prototype.Render = function(id)
+{
+ ResetStart();
+
+// var widths = this.PrepareWidths();
+// this.MinWidths = [40,null,null,250]
+ this.MinWidths = this.PrepareWidths(); // [50,70,90,150,150,110,70,111];
+
+ html = this.AltHTML();
+// Profile('Getting HTML',1);
+ if (id && id != '') {
+ document.getElementById(id).innerHTML = '<div id="main_div_'+this.GridId+'">'+html+'</div>';
+ execJS(document.getElementById(id))
+ }
+ else {
+ if (this.Rendered) {
+ this.Render('main_div_'+this.GridId);
+ return;
+ }
+ document.write('<div id="main_div_'+this.GridId+'">'+html+'</div>');
+ }
+ this.Rendered = true;
+ this.SetReferences()
+
+ document.body.style.height = '100%';
+ document.body.style.overflow = 'hidden';
+ document.body.scroll = 'no'
+
+ if (getFrame('head').ScrollerW) {
+ this.ScrollerW = getFrame('head').ScrollerW;
+ this.ScrollerH = getFrame('head').ScrollerH;
+ }
+ else {
+ this.ScrollerW = this.MainInner.offsetWidth - this.MainInner.clientWidth
+ this.ScrollerH = this.MainInner.offsetHeight - this.MainInner.clientHeight
+ getFrame('head').ScrollerW = this.ScrollerW
+ getFrame('head').ScrollerH = this.ScrollerH
+ }
+
+
+// Profile('Up to col widths',1);
+ if (!this.UpdateColWidths()) return;
+
+ if (this.Width == 'auto') {
+ this.Resize( this.GetAutoSize() );
+ }
+ else {
+ this.Resize();
+ }
+
+ this.TheGrid.style.visibility = 'visible'
+ this.MainScroller.style.visibility = 'visible'
+// Profile('Finalizng', 1);
+
+ var the_grid = this;
+ if (document.all) {
+ $status = window.attachEvent('onresize', function(ev) { the_grid.AutoResize() });
+ } else {
+ $status = window.addEventListener('resize', function(ev) { the_grid.AutoResize() }, true);
+ }
+ if (document.all) {
+ this.DataScroller.onmousewheel = function(ev) {
+ var e = document.all ? window.event : ev;
+ this.TheGrid.MainInner.scrollTop += -e.wheelDelta/2
+ this.TheGrid.SyncScroll();
+ }
+ }
+ else {
+ this.DataScroller.addEventListener("DOMMouseScroll", function(ev) {
+ var e = document.all ? window.event : ev;
+ this.TheGrid.MainInner.scrollTop += e.detail*10
+ this.TheGrid.SyncScroll();
+ }, false);
+ }
+
+ addLoadEvent( function() {the_grid.AutoResize()} );
+}
+
+
+GridScroller.prototype.SetReferences = function() {
+ this.MainOuter = document.getElementById('outer_main_'+this.GridId );
+ this.MainInner = document.getElementById('inner_main_'+this.GridId)
+ this.MainScroller = document.getElementById('main_scroller_'+this.GridId)
+ this.TheGrid = document.getElementById(this.GridId );
+
+ this.HeadTable = document.getElementById('header_'+this.GridId);
+ this.HeadScroller = document.getElementById('inner_header_'+this.GridId);
+ this.HeadOuter = document.getElementById('outer_header_'+this.GridId);
+
+ this.DataTable = document.getElementById('data_'+this.GridId);
+ this.DataScroller = document.getElementById('inner_data_'+this.GridId);
+ this.DataOuter = document.getElementById('outer_data_'+this.GridId);
+
+ if (this.HasFooter) {
+ this.FooterTable = document.getElementById('footer_'+this.GridId);
+ this.FooterScroller = document.getElementById('inner_footer_'+this.GridId);
+ this.FooterOuter = document.getElementById('outer_footer_'+this.GridId);
+ }
+
+ if (this.LeftCells != 0) {
+ this.LeftHeaderTable = document.getElementById('left_header_'+this.GridId);
+ this.LeftHeaderScroller = document.getElementById('inner_left_header_'+this.GridId);
+ this.LeftHeaderOuter = document.getElementById('outer_left_header_'+this.GridId);
+
+ this.LeftDataTable = document.getElementById('left_data_'+this.GridId);
+ this.LeftDataScroller = document.getElementById('inner_left_data_'+this.GridId);
+ this.LeftDataOuter = document.getElementById('outer_left_data_'+this.GridId);
+
+ if (this.HasFooter) {
+ this.LeftFooterTable = document.getElementById('left_footer_'+this.GridId);
+ this.LeftFooterScroller = document.getElementById('inner_left_footer_'+this.GridId);
+ this.LeftFooterOuter = document.getElementById('outer_left_footer_'+this.GridId);
+ }
+ }
+
+ this.DataScroller.TheGrid = this;
+ this.MainInner.TheGrid = this;
+ this.Dot = document.getElementById('dot_'+this.GridId)
+
+ this.MainOuter.className = 'grid-scrollable'
+ if (!is.ie) {
+ this.MainOuter.style.marginLeft = '-1px';
+ }
+}
+
+GridScroller.prototype.UpdateColWidths = function() {
+ pos = findPos(this.Dot)
+
+ this.TheGrid.style.left = (pos[0])+ 'px'
+ this.TheGrid.style.top = (pos[1]) + 'px'
+
+// alert('MinWidths: '+this.MinWidths.length + ' vs Data ' + this.Header[0].length)
+ if (this.MinWidths.length < this.Header[0].length) {
+ var widths = new Array();
+ var total = 0;
+
+ StyleManager.ChangeStyle('td.grid-header-last-cell', 'width', '123px')
+ StyleManager.ChangeStyle('td.grid-data-last-cell', 'width', 'auto')
+ if (this.HasFooter()) {
+ StyleManager.ChangeStyle('td.grid-footer-last-cell', 'width', 'auto')
+ }
+
+ if (this.LeftCells) {
+ widths.push(this.LeftHeaderTable.clientWidth)
+ }
+
+ var header_widths = this.GetWidths('header_'+this.GridId);
+// print_pre(header_widths)
+ var data_widths = this.GetWidths('data_'+this.GridId);
+// print_pre(data_widths)
+
+ for (var i=0; i<header_widths.length; i++)
+ {
+ target = data_widths[i] ? data_widths[i] : header_widths[i];
+ if (target < header_widths[i]+20) target = header_widths[i]+20;
+ widths.push(target);
+ total += target;
+ }
+
+ this.MinWidths = widths;
+
+// print_pre(this.MinWidths)
+
+ StyleManager.ChangeStyle('td.grid-header-last-cell', 'width', '100%')
+ StyleManager.ChangeStyle('td.grid-data-last-cell', 'width', '100%')
+ if (this.HasFooter()) {
+ StyleManager.ChangeStyle('td.grid-footer-last-cell', 'width', '100%')
+ }
+
+// this.Render();
+
+ return false;
+ }
+
+ if (this.LeftCells != 0) {
+ this.SetHeights('left_header_'+this.GridId, this.GetHeights('header_'+this.GridId));
+ this.SetHeights('left_data_'+this.GridId, this.GetHeights('data_'+this.GridId));
+ if (this.HasFooter()) {
+ this.SetHeights('left_footer_'+this.GridId, this.GetHeights('footer_'+this.GridId));
+ }
+ }
+
+ if (this.HasFooter()) {
+ this.FooterHeight = this.FooterTable.offsetHeight;
+ this.FooterOuter.style.height = this.FooterHeight + 'px'
+ }
+ else {
+ this.FooterHeight = 0;
+ }
+
+ this.HeadHeight = this.HeadTable.offsetHeight;
+ this.DataHeight = this.DataTable.offsetHeight;
+ this.HeadOuter.style.height = (this.HeadHeight) + 'px'
+
+ if (this.LeftCells != 0) {
+ this.LeftWidth = Math.max(this.LeftHeaderTable.offsetWidth, this.LeftDataTable.offsetWidth)
+ this.LeftHeaderOuter.style.height = (this.HeadHeight) + 'px'
+ if (this.HasFooter()) {
+ this.LeftFooterOuter.style.height = (this.FooterHeight) + 'px'
+ this.LeftWidth = Math.max(this.LeftWidth, this.LeftFooterTable.offsetWidth);
+ }
+ }
+
+ this.MainInner.onscroll = function() {
+ this.TheGrid.SyncScroll()
+ }
+
+ this.MainOuter.style.width = 'auto'
+
+ this.HeaderWidth = this.HeadTable.offsetWidth + this.LeftWidth;
+ this.DataTotalHeight = this.DataHeight + this.HeadHeight + this.FooterHeight;
+
+ return true;
+}
+
+GridScroller.prototype.SetHeights = function(table_id, heights)
+{
+ var table = document.getElementById(table_id);
+ for (var row=0; row<table.rows.length; row++)
+ {
+ var width = this.MinWidths[0] ? this.MinWidths[0] + 'px' : 'auto';
+ table.rows[row].cells[0].innerHTML = '<div style="background-color: inherit; display: table-cell; line-height: '+(heights[row])+'px; height: '+(heights[row]) +'px; width: '+width+'; overflow: hidden; background-color: inherit;">' + table.rows[row].cells[0].innerHTML + '</div>'
+ table.rows[row].cells[0].style.height = heights[row]+'px';
+// heights.push( table.rows[0].cells[0].offsetHeight )
+// alert('get ('+row+')'+table.rows[0].cells[0].innerHTML+' height '+table.rows[0].cells[0].offsetHeight)
+ }
+// return heights;
+}
+
+GridScroller.prototype.GetHeights = function(table_id)
+{
+ var table = document.getElementById(table_id);
+ var heights = new Array();
+ var height
+ for (var row=0; row<table.rows.length; row++)
+ {
+ height = getDimensions( table.rows[row].cells[0] ).innerHeight
+ heights.push( height )
+// alert('get ('+row+')'+table.rows[row].cells[0].innerHTML+' height (offset/client/computed (coorection)): '+table.rows[row].cells[0].offsetHeight + '/' + table.rows[row].cells[0].clientHeight + '/ ' +height + ' ('+correction+')')
+ }
+ return heights;
+}
+
+
+GridScroller.prototype.GetWidths = function(table_id)
+{
+ var table = document.getElementById(table_id);
+ table.style.width = 'auto'
+ var w = document.all ? window.document.body.offsetWidth : window.innerWidth
+ if (table.offsetWidth < screen.width * 0.8) {
+ table.style.width = Math.round( screen.width * 0.8 ) + 'px'
+ }
+ var widths = new Array();
+ var style;
+ if (!table.rows[0]) return [];
+ for (var col=0; col<table.rows[0].cells.length; col++)
+ {
+ widths.push( table.rows[0].cells[col].offsetWidth )
+ if (table_id.match(/^header_/)) {
+// alert('get ('+col+')'+table.rows[0].cells[col].innerHTML+' width '+table.rows[0].cells[col].offsetWidth)
+ }
+ }
+ return widths;
+}
+
+GridScroller.prototype.GetAutoSize = function()
+{
+ this.MainOuter.style.width = 'auto'
+ var w = this.MainInner.offsetWidth;
+ var h = document.body.clientHeight;
+
+ var pos = findPos(this.MainOuter);
+
+ var dim = getDimensions(this.MainOuter);
+
+ h -= pos[1] + dim.padding[0] + dim.padding[2] + dim.borders[0] + dim.borders[2] + this.BottomOffset;
+ return [w,h]
+}
+
+
+GridScroller.prototype.AutoResize = function()
+{
+ var obj = this;
+ if (this.ResizeHappening && this.ResizeTimer) {
+ window.clearTimeout(this.ResizeTimer);
+ this.ResizeTimer = false;
+ }
+ this.ResizeHappening = true;
+ this.ResizeTimer = window.setTimeout(function() {
+ obj.Resize( obj.GetAutoSize() );
+ obj.ResizeHappening = false;
+// alert('resized')
+ }, 300)
+}
+
+GridScroller.prototype.Resize = function(w,h)
+{
+ if (typeof(w) == 'object') {
+ h = w[1];
+ w = w[0];
+ }
+ if (w) this.Width = w;
+ if (h) this.Height = h;
+
+
+ pos = findPos(this.Dot)
+
+ this.TheGrid.style.left = (pos[0])+ 'px'
+ this.TheGrid.style.top = (pos[1]) + 'px'
+
+ this.MainOuter.style.height = (this.Height)+'px'
+ this.MainOuter.style.width = (this.Width)+'px'
+
+ scroller_height = this.HeaderWidth > this.Width ? this.ScrollerH : 0;
+ scroller_width = this.DataTotalHeight > this.Height - scroller_height ? this.ScrollerW : 0;
+ scroller_height = this.HeaderWidth > this.Width - scroller_width ? this.ScrollerH : 0;
+
+// alert('min: '+this.MinDataWidth+' pos: '+pos[0]+','+pos[1]+' scroller W x H: '+scroller_width+' x '+scroller_height+' will resize to '+this.Width+' x '+this.Height+' data: '+this.HeaderWidth+' x '+this.DataHeight)
+
+ this.HeadOuter.style.width = (this.Width -scroller_width -this.LeftWidth)+ 'px';
+ this.DataOuter.style.width = (this.Width -scroller_width -this.LeftWidth)+ 'px';
+
+ if (this.LeftCells != 0) {
+ this.LeftHeaderOuter.style.width = (this.LeftWidth) + 'px'
+ this.LeftDataOuter.style.width = (this.LeftWidth) + 'px'
+ if (this.HasFooter()) {
+ this.LeftFooterOuter.style.width = (this.LeftWidth) + 'px'
+ }
+ }
+
+ if (this.HasFooter()) {
+ this.FooterOuter.style.width = (this.Width -scroller_width -this.LeftWidth)+ 'px';
+ }
+
+ if (this.DataTotalHeight < this.Height - scroller_height) {
+ var adjusted_data_height = this.DataTotalHeight - this.HeadHeight - this.FooterHeight
+ }
+ else {
+ var adjusted_data_height = this.Height - this.HeadHeight - this.FooterHeight - scroller_height
+ }
+
+ this.DataOuter.style.height = adjusted_data_height + 'px'
+ if (this.LeftCells != 0) {
+ this.LeftDataOuter.style.height = adjusted_data_height + 'px'
+ }
+
+ this.MainScroller.style.width = (this.HeadTable.offsetWidth + this.LeftWidth)+'px'
+ this.MainScroller.style.height = ( this.DataHeight + this.HeadHeight + this.FooterHeight)+'px'
+
+ this.TheGrid.style.width = (this.Width - scroller_width) + 'px';
+ this.TheGrid.style.height = (this.Height - scroller_height) + 'px';
+}
+
+GridScroller.prototype.SyncScroll = function()
+{
+ this.HeadScroller.scrollLeft = this.MainInner.scrollLeft;
+ this.DataScroller.scrollLeft = this.MainInner.scrollLeft;
+ if (this.HasFooter()) {
+ this.FooterScroller.scrollLeft = this.MainInner.scrollLeft;
+ }
+
+ this.DataScroller.scrollTop = this.MainInner.scrollTop;
+ if (this.LeftCells != 0) {
+ this.LeftDataScroller.scrollTop = this.MainInner.scrollTop;
+ }
+}
+
+GridScroller.prototype.AltHTML = function()
+{
+ var o = '';
+
+ o += this.CreateScroller( '<div id="main_scroller_'+this.GridId+'" style="background-color: inherit; position: relative; width: auto; z-index: 20;"><img src="'+this.Spacer+'" id="dot_'+this.GridId+'" width="200" height="200"><br/><br/></div>', 100, 100, 'main_'+this.GridId, false, 1 );
+
+ o += '<div id="'+this.GridId+'" class="grid-container" style="background-color: inherit; top: 0px; visibility: hidden; z-index: 10; width: auto; height: '+300+'px; position: absolute; overflow: hidden;">';
+
+ var header_rows = this.Header.length;
+ var cols = this.Header[0].length;
+ var data_rows = this.Data.length;
+ var header = this.GetTableWithScroller(this.Header, [this.LeftCells, 0, cols, header_rows], 'header')
+ var data = this.GetTableWithScroller(this.Data, [this.LeftCells, 0, cols, data_rows], 'data', 'grid-data-row-even', '')
+ var footer = this.HasFooter() ? this.GetTableWithScroller(this.Footer, [this.LeftCells], 'footer') : '';
+
+ var left_header = this.GetTableWithScroller(this.Header, [0,0,this.LeftCells, header_rows], ['header','left_header'])
+ var left_data = this.GetTableWithScroller(this.Data, [0,0,this.LeftCells, data_rows], ['data','left_data'], 'grid-data-row-even', 'left_')
+ var left_footer = this.GetTableWithScroller(this.Footer, [0,0,this.LeftCells], ['footer','left_footer'])
+
+ /*var css = '';
+ for (var i=0;i<this.Header[0].length; i++) {
+ css += '.width-adj-grid-col-'+i+' {} ';
+ }
+ o += '<style type="text/css">'+css+'</style>';*/
+
+ if (this.LeftCells != 0) {
+ o += '<table style="background-color: inherit; width: 100%; border-collapse: collapse;">'
+ o += '<tr><td style="vertical-align: top; margin: 0px; padding: 0px;">' + left_header + '</td>'
+ o += '<td style="vertical-align: top; margin: 0px; padding: 0px;">' + header + '</td></tr>'
+ o += '<tr><td style="vertical-align: top; margin: 0px; padding: 0px">' + left_data + '</td>'
+ o += '<td style="vertical-align: top; margin: 0px; padding: 0px">' + data + '</td></tr>'
+ if (this.HasFooter()) {
+ o += '<tr><td style="vertical-align: top; margin: 0px; padding: 0px">' + left_footer + '</td>'
+ o += '<td style="vertical-align: top; margin: 0px; padding: 0px">' + footer + '</td></tr>'
+ }
+ o += '</table>'
+ }
+ else {
+ o += header + data + footer;
+ }
+ o += '</div>';
+ return o;
+}
+
+GridScroller.prototype.PrepareWidths = function()
+{
+ cache = getFrame('head').grid_widths_cache;
+
+ if (this.MinWidths.length == this.Header[0].length) {
+ var has_all_widths = true;
+ for (var i in this.MinWidths) {
+ if (isNaN(parseInt(this.MinWidths[i]))) has_all_widths = false;
+ }
+ if (has_all_widths) {
+ widths = this.MinWidths
+ cache[this.GridId+'_'+this.PickerCRC] = widths;
+ return widths;
+ }
+ }
+
+ if (cache[this.GridId+'_'+this.PickerCRC]) {
+ return cache[this.GridId+'_'+this.PickerCRC]
+ }
+
+ var o = '';
+ data = this.Header.concat(this.Data).concat(this.Footer);
+ o += this.GetTableCells(this.Header, [0,0,this.Header[0].length,this.Header.length], 'header', null, null, false, true)[0];
+ if (this.Data.length) {
+ o += this.GetTableCells(this.Data, [0,0,this.Data[0].length,this.Data.length], 'data', null, null, false, true)[0];
+ }
+ o = '<table style="visibility: hidden; width: auto; border-collapse: collapse" id="tmp_'+this.GridId+'">'+o+'</table>'
+
+ document.write(o)
+ widths = this.GetWidths('tmp_'+this.GridId);
+// print_pre(widths)
+
+ tmp_el = document.getElementById('tmp_'+this.GridId);
+ var p = tmp_el.parentNode;
+ p.removeChild(tmp_el);
+ cache[this.GridId+'_'+this.PickerCRC] = widths;
+ return widths;
+}
+
+GridScroller.prototype.GetTableWithScroller = function(source, dim, class_mode, even_class, id_prefix)
+{
+ var tmp = this.GetIdAndClassName(class_mode);
+ var id = tmp[1];
+ var cells = this.GetTableCells(source, dim, class_mode, even_class, id_prefix);
+ return this.CreateScroller('<table style="width: 100%" id="'+id+'_'+this.GridId+'">'+cells[0]+'</table>', cells[1], 100, id+'_'+this.GridId, true, 5);
+}
+
+GridScroller.prototype.GetIdAndClassName = function(class_mode)
+{
+ if (typeof(class_mode)=='object') {
+ var class_name = class_mode[0];
+ var id = class_mode[1]
+ }
+ else {
+ var class_name = class_mode;
+ var id = class_mode;
+ }
+ return [class_name, id]
+}
+
+GridScroller.prototype.GetTableCells = function(source, dim, class_mode, even_class, id_prefix, needs_last, no_inner_div)
+{
+ if (!source.length) return ['', 0];
+ var o = '';
+ var start_col = dim[0];
+ var start_row = dim[1];
+ var end_col = dim[2];
+ var end_row = dim[3];
+ var even = false;
+ if (!even_class) even_class = '';
+ var tmp = this.GetIdAndClassName(class_mode);
+ var class_name = tmp[0];
+ var id = tmp[1];
+ if (id_prefix==null) id_prefix = id;
+ var needs_last = needs_last == null ? (end_col == source[0].length) : needs_last;
+ var total_width = 0;
+ for (var row=start_row; row<end_row; row++) {
+ var rh = '';
+ var row_id = this.IDs[row] ? 'id="'+id_prefix+this.IDs[row]+'"' : '';
+ rh +='<tr '+row_id+' class="grid-'+class_name+'-row '+(even ? even_class : '')+' grid-'+class_name+'-row-'+row+'" sequence="'+(row+1)+'">'
+ even = !even;
+
+ total_width = 0;
+ for (var col=start_col; col<end_col; col++) {
+ if (is.gecko && id.match(/^header/)) {
+ var cursor_workaround = ['<div style="width: '+this.MinWidths[col]+'px; overflow: auto;">', '</div>'];
+ }
+ else {
+ var cursor_workaround = ['','']
+ }
+ width = this.MinWidths[col] ? this.MinWidths[col] + 'px' : 'auto';
+ total_width += this.MinWidths[col];
+ if (no_inner_div) {
+ rh += '<td class="grid-'+class_name+'-col-'+col+'">'+cursor_workaround[0]+source[row][col]+cursor_workaround[1]+'</td>'
+ }
+ else {
+ rh += '<td class="grid-'+class_name+'-col-'+col+'">'+cursor_workaround[0]+'<div class="grid-cell-div" style="width: '+width+';">'+source[row][col]+cursor_workaround[1]+'</div></td>'
+ }
+ }
+ if (needs_last) {
+ rh += '<td class="grid-'+class_name+'-last-cell"><img src="'+this.Spacer+'" width="1" height="1" alt=""/></td>'
+ }
+ rh += '</tr>'
+ o += rh;
+ }
+ return [o, total_width];
+}
+
+
+GridScroller.prototype.HasFooter = function()
+{
+ return (this.Footer != false)
+}
+
+GridScroller.prototype.CreateScroller = function(content, w, h, id, hidden, z)
+{
+ if (hidden) {
+ overflow = 'hidden'
+ }
+ else {
+ overflow = 'auto'
+ }
+ if (!z) {
+ z = 0;
+ }
+ if (id && id != '') {
+ outer_id = 'id="outer_'+id+'"';
+ inner_id = 'id="inner_'+id+'"';
+ }
+ else {
+ outer_id = '';
+ inner_id = '';
+ }
+ var o = '';
+ o += '<div '+outer_id+' class="scroller-outer" style="z-index: '+z+'; width: '+w+'px; height: '+h+'px;">'
+ o += '<div '+inner_id+' class="scroller-inner" style="z-index: '+z+'; width: 100%; height: 100%; overflow: '+overflow+'; position: relative">'
+ o += content
+ o += '</div></div>'
+ return o
+}
+
+GridScroller.prototype.SetData = function(a_data)
+{
+ this.Data = a_data;
+}
+
+GridScroller.prototype.SetHeader = function(a_header)
+{
+ this.Header = a_header;
+}
+
+GridScroller.prototype.SetFooter = function(a_footer)
+{
+ this.Footer = a_footer;
+}
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/grid_scroller.js
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/tree.js
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/tree.js (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/tree.js (revision 7648)
@@ -0,0 +1,596 @@
+var last_hightlighted = null;
+var last_highlighted_key = null;
+
+function TreeItem(title, url, icon, onclick, priority)
+{
+ this.Title = title;
+ this.Url = url;
+ this.Rendered = false;
+ this.Displayed = false;
+ this.Level = 0;
+ this.Icon = icon;
+ this.Onclick = onclick;
+ this.Priority = isset(priority) ? priority : false;
+ this.Children = false;
+}
+
+TreeItem.prototype.Render = function(before, force)
+{
+ if (!this.Rendered || force) {
+ if (!isset(before)) {before = null}
+
+ tr = document.createElement('tr');
+ this.ParentElement.insertBefore(tr, before);
+ if (!this.Displayed) { tr.style.display = 'none' }
+ td = document.createElement('td');
+ td.TreeElement = this;
+ tr.appendChild(td);
+
+ this.appendLevel(td);
+ if (this.ParentFolder != null) this.appendNodeImage(td);
+ this.appendIcon(td);
+ this.appendLink(td);
+
+ this.Tr = tr;
+ this.Rendered = true;
+// alert(this.Tr.innerHTML)
+ }
+}
+
+TreeItem.prototype.remove = function()
+{
+ var p = this.Tr.parentNode;
+ p.removeChild(this.Tr);
+}
+
+TreeItem.prototype.appendLevel = function(td)
+{
+ for (var i=0; i < this.Level; i++)
+ {
+ img = document.createElement('img');
+ img.src = TREE_ICONS_PATH+'/ftv2blank.gif';
+ img.style.verticalAlign = 'middle';
+ td.appendChild(img);
+ }
+}
+
+TreeItem.prototype.getNodeImage = function(is_last)
+{
+ return is_last ? TREE_ICONS_PATH+'/ftv2lastnode.gif' : TREE_ICONS_PATH+'/ftv2node.gif';
+}
+
+TreeItem.prototype.appendNodeImage = function(td)
+{
+ img = document.createElement('img');
+ img.src = this.getNodeImage();
+ img.style.verticalAlign = 'middle';
+ td.appendChild(img);
+}
+
+TreeItem.prototype.appendIcon = function (td)
+{
+ img = document.createElement('img');
+ if (this.Icon.indexOf('http://') != -1) {
+ img.src = this.Icon;
+ }
+ else {
+ img.src = this.Icon;
+ }
+ img.style.verticalAlign = 'middle';
+ td.appendChild(img);
+}
+
+TreeItem.prototype.appendLink = function (td)
+{
+ var $node_text = document.createElement('span');
+ $node_text.innerHTML = this.Title;
+ if (TREE_SHOW_PRIORITY && this.Priority !== false) {
+ $node_text.innerHTML += '<span class="priority"><sup>' + this.Priority + '</sup></span>';
+ }
+
+ link = document.createElement('a');
+ link.nodeValue = this.Title;
+ link.href = this.Url;
+ link.target = 'main';
+ link.appendChild($node_text);
+
+ link.treeItem = this;
+ //addEvent(link, 'click',
+
+ link.onclick =
+ function(ev) {
+ var e = is.ie ? window.event : ev;
+
+ res = true;
+ if (isset(this.treeItem.Onclick)) {
+ res = eval(this.treeItem.Onclick);
+ }
+ if (!res) { // if we need to cancel onclick action
+ if (is.ie) {
+ window.event.cancelBubble = true;
+ window.event.returnValue = false;
+ } else {
+ ev.preventDefault();
+ ev.stopPropagation();
+ }
+ return res;
+ }
+ else {
+ // ensures, that click is made before AJAX request will be sent
+ if (res === true) {
+ // only in case of "true" is returned, used in catalog
+ getFrame(link.target).location.href = this.href;
+ }
+
+ if (!this.treeItem.Expanded && typeof(this.treeItem.folderClick) == 'function') {
+ if (this.treeItem.folderClick());
+ }
+ this.treeItem.highLight();
+ return false;
+ }
+ }
+
+ td.appendChild(link);
+
+ /*
+ if (this.LateLoadURL) {
+ var span = document.createElement('span');
+ span.innerHTML = '&nbsp;Reload';
+ span.treeItem = this;
+ span.onclick = function(ev) {
+ this.treeItem.reload();
+ }
+ td.appendChild(span);
+ }
+ */
+}
+
+TreeItem.prototype.display = function()
+{
+ this.Tr.style.display = is.ie ? 'block' : 'table-row';
+ this.Displayed = true;
+
+ var do_sub = TreeManager.isExpanded(this.Key);
+ if (this.Children && do_sub && !this.Expanding) {
+ this.expand();
+ }
+}
+
+TreeItem.prototype.hide = function()
+{
+ this.Tr.style.display = 'none';
+ this.Displayed = false;
+}
+
+TreeItem.prototype.highLight = function()
+{
+ if (last_hightlighted) last_hightlighted.Tr.className = '';
+ if (this.Children && this.Children.length > 0 && this.Children[0].Url.replace('&amp;', '&') == this.Url.replace('&amp;', '&')) {
+ if (!this.Expanded) {
+ this.expand();
+ }
+ this.Children[0].highLight();
+ return;
+ }
+
+ this.Tr.className = "highlighted";
+ last_hightlighted = this;
+ last_highlighted_key = this.Key;
+ if (!this.Expanded) {
+ this.expand();
+ }
+}
+
+TreeItem.prototype.expand = function() { this.display() }
+
+TreeItem.prototype.collapse = function() { this.hide() }
+
+TreeItem.prototype.updateLastNodes = function(is_last, lines_pattern)
+{
+ if (!isset(is_last)) is_last = true;
+ if (!isset(this.Tr)) return;
+ if (!isset(lines_pattern)) { var lines_pattern = new Array() }
+
+ imgs = this.Tr.getElementsByTagName('img');
+ found = false;
+ for (var i=0; i<imgs.length; i++)
+ {
+ the_img = imgs.item(i);
+ if (in_array(i, lines_pattern) && the_img.src.indexOf('ftv2blank.gif') != -1) {
+ the_img.src = TREE_ICONS_PATH+'/ftv2vertline.gif';
+ }
+ if (this.isNodeImage(the_img))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ the_img.src = this.getNodeImage(is_last);
+ }
+ this.isLast = is_last;
+ return lines_pattern;
+}
+
+TreeItem.prototype.isNodeImage = function(img)
+{
+ return (
+ img.src.indexOf('ftv2node.gif') != -1 ||
+ img.src.indexOf('ftv2lastnode.gif') != -1
+ )
+
+}
+
+TreeItem.prototype.locateLastItem = function()
+{
+ return this;
+}
+
+TreeItem.prototype.locateItemByURL = function(url)
+{
+ if (this.Url == url) return this;
+ return false;
+}
+
+TreeItem.prototype.locateItemByKey = function(key)
+{
+ if (this.Key == key) return this;
+ return false;
+}
+
+TreeItem.prototype.reload = function()
+{
+}
+
+/* FOLDER */
+
+function TreeFolder(parent_id, title, url, icon, late_load_url, onclick, priority)
+{
+ var render = false;
+ if (isset(parent_id)) {
+ this.ParentElement = document.getElementById(parent_id);
+ render = true;
+ }
+ else {
+
+
+ }
+
+ this.Title = title;
+ this.Url = url;
+ this.Rendered = false;
+ this.Displayed = false;
+ this.Expanded = false;
+ this.Level = 0;
+ this.Id = 0;
+ this.Tr = null;
+ this.Icon = icon;
+ this.LateLoadURL = isset(late_load_url) ? late_load_url : false;
+ this.Loaded = false;
+ this.Onclick = onclick;
+ this.Priority = isset(priority) ? priority : false;
+
+ this.Children = new Array();
+ this.ChildIndex = 0;
+ if (render) {
+ this.Expanded = true;
+ this.Displayed = true;
+ this.Render();
+ this.expand();
+ }
+}
+
+TreeFolder.prototype = new TreeItem;
+
+TreeFolder.prototype.locateLastItem = function()
+{
+ if (this.Children.length == 0) return this;
+
+ for (var i=0; i<this.Children.length; i++)
+ {
+ last_item = this.Children[i].locateLastItem()
+ }
+ return last_item;
+}
+
+TreeFolder.prototype.locateItemByURL = function(url)
+{
+ last_item = false;
+ if (this.Url == url) {
+ return this;
+ }
+
+ for (var i=0; i<this.Children.length; i++)
+ {
+ last_item = this.Children[i].locateItemByURL(url)
+ if (last_item) return last_item;
+ }
+ return last_item;
+}
+
+TreeFolder.prototype.locateItemByKey = function(key)
+{
+ last_item = false;
+ if (this.Key == key) {
+ return this;
+ }
+
+ for (var i=0; i<this.Children.length; i++)
+ {
+ last_item = this.Children[i].locateItemByKey(key)
+ if (last_item) return last_item;
+ }
+ return last_item;
+}
+
+TreeFolder.prototype.locateTopItem = function()
+{
+ if (this.ParentFolder == null) return this;
+ return this.ParentFolder.locateTopItem();
+}
+
+TreeFolder.prototype.AddItem = function(an_item, render, display) {
+ an_item.ParentElement = this.ParentElement;
+ an_item.Level = this.ParentFolder != null ? this.Level + 1 : 0;
+ an_item.ParentFolder = this;
+
+ last_item = this.locateLastItem();
+ this.Children.push(an_item);
+ an_item.Id = this.Children.length;
+ an_item.Render(last_item.Tr.nextSibling);
+
+ var keys = new Array()
+ var tmp = an_item;
+ keys.push(tmp.Level + '_' + tmp.Id);
+ while (tmp.ParentFolder) {
+ tmp = tmp.ParentFolder
+ keys.push(tmp.Level + '_' + tmp.Id);
+ }
+ keys = keys.reverse();
+ key_str = keys.join('-');
+ an_item.Key = key_str;
+
+ if (this.Expanded)
+ {
+ an_item.display();
+ }
+
+ return an_item;
+}
+
+TreeFolder.prototype.AddFromXML = function(xml, render)
+{
+// start = new Date();
+ if (!isset(render)) render = true;
+ doc = getDocumentFromXML(xml);
+ this.LastFolder = this;
+ this.ProcessXMLNode(doc, render);
+// end = new Date();
+ this.locateTopItem().updateLastNodes();
+// alert('AddFromXML took: '+(end - start))
+}
+
+TreeFolder.prototype.ProcessXMLNode = function(node, render)
+{
+ if (!isset(render)) render = true;
+ if (!isset(this.LastFolder)) this.LastFolder = this;
+ for (var i=0; i<node.childNodes.length; i++)
+ {
+ child = node.childNodes.item(i);
+ if (child.tagName == 'folder') {
+ var backupLastFolder = this.LastFolder;
+ this.LastFolder = this.LastFolder.AddItem(new TreeFolder(null, child.getAttribute('name'), child.getAttribute('href'), child.getAttribute('icon'), child.getAttribute('load_url'), child.getAttribute('onclick'), child.getAttribute('priority')), render);
+ if (child.hasChildNodes) {
+ this.ProcessXMLNode(child);
+ }
+ this.LastFolder = backupLastFolder;
+ }
+ else if (child.tagName == 'item') {
+ this.LastFolder.AddItem(new TreeItem(child.firstChild.nodeValue, child.getAttribute('href'), child.getAttribute('icon'), child.getAttribute('onclick'), child.getAttribute('priority')), render)
+ }
+ else if (child.tagName == 'tree') {
+ this.LastFolder = this;
+ this.ProcessXMLNode(child);
+ }
+ }
+}
+
+TreeFolder.prototype.getNodeImage = function(is_last)
+{
+ if (is_last) {
+ return this.Expanded ? TREE_ICONS_PATH+'/ftv2mlastnode.gif' : TREE_ICONS_PATH+'/ftv2plastnode.gif';
+ }
+ else {
+ return this.Expanded ? TREE_ICONS_PATH+'/ftv2mnode.gif' : TREE_ICONS_PATH+'/ftv2pnode.gif';
+ }
+}
+
+TreeFolder.prototype.appendNodeImage = function(td, is_last)
+{
+ img = document.createElement('img');
+ img.src = this.getNodeImage(is_last);
+ img.style.cursor = 'hand';
+ img.style.cursor = 'pointer';
+ img.style.verticalAlign = 'middle';
+ img.onclick = function() { this.parentNode.TreeElement.folderClick(this) }
+ this.Img = img;
+ td.appendChild(img);
+}
+
+TreeFolder.prototype.updateLastNodes = function(is_last, lines_pattern)
+{
+ if (!isset(is_last)) is_last = true;
+ if (!isset(lines_pattern)) { var lines_pattern = new Array() }
+ if (!is_last && !in_array(this.Level, lines_pattern)) { lines_pattern.push(this.Level) }
+
+ lines_pattern = TreeItem.prototype.updateLastNodes.apply(this, new Array(is_last, lines_pattern))
+
+ for (var i=0; i<this.Children.length; i++)
+ {
+ lines_pattern = this.Children[i].updateLastNodes((i+1) == this.Children.length, lines_pattern)
+ }
+ lines_pattern[array_search(this.Level, lines_pattern)] = -1;
+ return lines_pattern;
+}
+
+TreeFolder.prototype.isNodeImage = function(img)
+{
+ return (
+ img.src.indexOf('ftv2mlastnode.gif') != -1 ||
+ img.src.indexOf('ftv2plastnode.gif') != -1 ||
+ img.src.indexOf('ftv2mnode.gif') != -1 ||
+ img.src.indexOf('ftv2pnode.gif') != -1
+ )
+
+}
+
+TreeFolder.prototype.folderClick = function(img)
+{
+ if (this.Expanded) {
+ this.collapse();
+ }
+ else {
+ this.expand();
+ }
+}
+
+TreeFolder.prototype.remove = function()
+{
+ this.removeChildren();
+ var p = this.Tr.parentNode;
+ p.removeChild(this.Tr);
+}
+
+TreeFolder.prototype.removeChildren = function()
+{
+ for (var i in this.Children) {
+ this.Children[i].remove();
+ }
+ this.Children = new Array();
+}
+
+TreeFolder.prototype.successCallback = function ($request, $params, $object) {
+ if ($params == 'reload') {
+ $object.removeChildren();
+ }
+ $object.Loaded = true;
+ $object.ProcessXMLNode($request.responseXML);
+ $object.Render();
+ $object.locateTopItem().updateLastNodes();
+ $object.expand();
+ if (last_highlighted_key) {
+ var fld = $object.locateItemByKey(last_highlighted_key)
+ if (fld) {
+ fld.highLight();
+ }
+ }
+}
+
+TreeFolder.prototype.reload = function()
+{
+ Request.headers['Content-type'] = 'text/xml';
+ Request.makeRequest(this.LateLoadURL, false, '', this.successCallback, this.errorCallback, 'reload', this);
+}
+
+TreeFolder.prototype.errorCallback = function($request, $params, $object) {
+ alert('AJAX ERROR: ' + Request.getErrorHtml($request));
+}
+
+TreeFolder.prototype.expand = function(mode)
+{
+ if (this.Expanding) {
+ return;
+ }
+ this.Expanding = true;
+
+ if (!isset(mode)) mode = 0;
+ this.display();
+ if (mode == 0 || this.Expanded ) {
+ for (var i=0; i<this.Children.length; i++)
+ {
+ this.Children[i].expand(mode+1);
+ }
+ }
+ if (mode == 0) {
+ if (this.LateLoadURL && !this.Loaded) {
+ Request.headers['Content-type'] = 'text/xml';
+ Request.makeRequest(this.LateLoadURL, false, '', this.successCallback, this.errorCallback, '', this);
+ }
+ this.Expanded = true;
+ TreeManager.markStatus(this.Key, 1)
+ if (isset(this.Img)) {
+ this.Img.src = this.getNodeImage(this.isLast);
+ }
+ }
+ this.Expanding = false;
+}
+
+TreeFolder.prototype.collapse = function(mode)
+{
+ if (!isset(mode)) mode = 0;
+ for (var i=0; i<this.Children.length; i++)
+ {
+ this.Children[i].collapse(mode+1);
+ this.Children[i].hide();
+ }
+ if (mode == 0) {
+ this.Expanded = false;
+ TreeManager.markStatus(this.Key, 0)
+ if (isset(this.Img)) {
+ this.Img.src = this.getNodeImage(this.isLast);
+ }
+ }
+}
+
+
+function TreeManager() {}
+
+TreeManager.ExpandStatus = [];
+
+TreeManager.markStatus = function(id, status)
+{
+ this.ExpandStatus[id] = status;
+ if (!status) {
+ for (var i in this.ExpandStatus) {
+ if (i.indexOf(id) == 0) { // if i starts with the same as id, meaning it is its child node
+ this.ExpandStatus[i] = 0;
+ }
+ }
+ }
+ TreeManager.saveStatus()
+}
+
+TreeManager.isExpanded = function(id)
+{
+ return (this.ExpandStatus[id] == 1);
+}
+
+TreeManager.saveStatus = function ()
+{
+ var cookieString = new Array();
+
+ for (var i in this.ExpandStatus) {
+ if (this.ExpandStatus[i] == 1) {
+ cookieString.push(i);
+ }
+ }
+ document.cookie = 'TreeExpandStatus=' + cookieString.join(':');
+}
+
+TreeManager.loadStatus = function ()
+{
+ var doc_cookies = document.cookie.split('; ');
+
+ for (var i=0; i < doc_cookies.length; i++) {
+ var pair = doc_cookies[i].split('=');
+ if ('TreeExpandStatus' == pair[0] && pair[1]) {
+ var expandedBranches = pair[1].split(':');
+ for (var j=0; j<expandedBranches.length; j++) {
+ this.ExpandStatus[expandedBranches[j]] = true;
+ }
+ }
+ }
+// print_pre(this.ExpandStatus)
+}
+
+TreeManager.loadStatus();
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/tree.js
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/ajax.js
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/ajax.js (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/ajax.js (revision 7648)
@@ -0,0 +1,324 @@
+function preg_print_pre(obj, reg)
+{
+ if (!reg) reg = /.*/;
+ var p = ''
+ for (var prop in obj) {
+ if (prop.match(reg) ) {
+ p += prop + ': '+obj[prop] + '\n'
+ }
+ }
+ alert(p)
+}
+
+
+// Main AJAX classs
+function Request() {}
+
+Request.timeout = 15000; //5 seconds
+Request.method = 'GET';
+Request.headers = new Array();
+Request.params = null;
+
+Request.makeRequest = function(p_url, p_busyReq, p_progId, p_successCallBack, p_errorCallBack, p_pass, p_object) {
+ //p_url: the web service url
+ //p_busyReq: is a request for this object currently in progress?
+ //p_progId: element id where progress HTML should be shown
+ //p_successCallBack: callback function for successful response
+ //p_errorCallBack: callback function for erroneous response
+ //p_pass: string of params to pass to callback functions
+ //p_object: object of params to pass to callback functions
+
+ if (p_busyReq) return;
+ var req = Request.getRequest();
+ if (req != null) {
+ p_busyReq = true;
+ Request.showProgress(p_progId);
+ req.onreadystatechange = function() {
+ if (req.readyState == 4) {
+ p_busyReq = false;
+ window.clearTimeout(toId);
+ try {
+ if (req.status == 200) {
+ // preg_print_pre(req)
+ p_successCallBack(req, p_pass, p_object);
+ } else {
+ p_errorCallBack(req, p_pass, p_object);
+ }
+ Request.hideProgress(p_progId);
+ }
+ catch (e) {
+// alert('AJAX error')
+ }
+ }
+ }
+ var $ajax_mark = (p_url.indexOf('?') ? '&' : '?') + 'ajax=yes';
+ req.open(Request.method, p_url + $ajax_mark, true);
+
+ if (Request.method == 'POST') {
+ Request.headers['Content-type'] = 'application/x-www-form-urlencoded';
+ Request.headers['referer'] = p_url;
+ }
+ else {
+ Request.headers['If-Modified-Since'] = 'Sat, 1 Jan 2000 00:00:00 GMT';
+ }
+
+ Request.sendHeaders(req);
+ if (Request.method == 'POST') {
+ req.send(Request.params);
+ Request.method = 'GET'; // restore method back to GET
+ }
+ else {
+ req.send(null);
+ }
+
+ var toId = window.setTimeout( function() {if (p_busyReq) req.abort();}, Request.timeout );
+ }
+}
+
+Request.sendHeaders = function($request) {
+ for (var $header_name in Request.headers) {
+ $request.setRequestHeader($header_name, Request.headers[$header_name]);
+ }
+ Request.headers = new Array(); // reset header afterwards
+}
+
+Request.getRequest = function() {
+ var xmlHttp;
+ try { xmlHttp = new ActiveXObject('MSXML2.XMLHTTP'); return xmlHttp; } catch (e) {}
+ try { xmlHttp = new ActiveXObject('Microsoft.XMLHTTP'); return xmlHttp; } catch (e) {}
+ try { xmlHttp = new XMLHttpRequest(); return xmlHttp; } catch(e) {}
+ return null;
+}
+
+Request.showProgress = function(p_id) {
+ if (p_id != '') {
+ Request.setOpacity(20, p_id);
+
+ if (!document.getElementById(p_id + '_progress')) {
+ document.body.appendChild(Request.getProgressObject(p_id));
+ }
+ else {
+ var $progress_div = document.getElementById(p_id + '_progress');
+ $progress_div.style.top = getRealTop(p_id) + 'px';
+ $progress_div.style.height = document.getElementById(p_id).clientHeight;
+ $progress_div.style.display = 'block';
+ }
+// document.getElementById(p_id).innerHTML = Request.getProgressHtml();
+ }
+}
+
+Request.hideProgress = function(p_id) {
+ if (p_id != '') {
+ document.getElementById(p_id + '_progress').style.display = 'none';
+ Request.setOpacity(100, p_id);
+ }
+}
+
+Request.setOpacity = function (opacity, id) {
+ var object = document.getElementById(id).style;
+ object.opacity = (opacity / 100);
+ object.MozOpacity = (opacity / 100);
+ object.KhtmlOpacity = (opacity / 100);
+ object.filter = "alpha(opacity=" + opacity + ")";
+}
+
+Request.getProgressHtml = function() {
+ return "<p class='progress'>" + Request.progressText + "<br /><img src='img/ajax_progress.gif' align='absmiddle' width='100' height='7' alt='" + Request.progressText + "'/></p>";
+}
+
+Request.getProgressObject = function($id) {
+ var $div = document.createElement('DIV');
+ var $parent_div = document.getElementById($id);
+
+ $div.id = $id + '_progress';
+
+ $div.style.width = $parent_div.clientWidth + 'px';
+ $div.style.height = '150px'; // default height if div is empty (first ajax request for div)
+ $div.style.left = getRealLeft($parent_div) + 'px';
+ $div.style.top = getRealTop($parent_div) + 'px';
+ $div.style.position = 'absolute';
+
+ /*$div.style.border = '1px solid green';
+ $div.style.backgroundColor = '#FF0000';*/
+
+ $div.innerHTML = '<table style="width: 100%; height: 100%;"><tr><td style="text-align: center;">'+Request.progressText+'<br /><img src="img/ajax_progress.gif" align="absmiddle" width="100" height="7" alt="'+escape(Request.progressText)+'" /></td></tr></table>';
+ return $div;
+}
+
+Request.getErrorHtml = function(p_req) {
+ //TODO: implement accepted way to handle request error
+ return '[status: ' + p_req.status + '; status_text: ' + p_req.statusText + '; responce_text: ' + p_req.responseText + ']';
+}
+
+Request.serializeForm = function(theform) {
+ if (typeof(theform) == 'string') {
+ theform = document.getElementById(theform);
+ }
+
+ var els = theform.elements;
+ var len = els.length;
+ var queryString = '';
+
+ Request.addField = function(name, value) {
+ if (queryString.length > 0) queryString += '&';
+ queryString += encodeURIComponent(name) + '=' + encodeURIComponent(value);
+ };
+
+ for (var i = 0; i<len; i++) {
+ var el = els[i];
+ if (el.disabled) continue;
+
+ switch(el.type) {
+ case 'text':
+ case 'password':
+ case 'hidden':
+ case 'textarea':
+ Request.addField(el.name, el.value);
+ break;
+
+ case 'select-one':
+ if (el.selectedIndex >= 0) {
+ Request.addField(el.name, el.options[el.selectedIndex].value);
+ }
+ break;
+
+ case 'select-multiple':
+ for (var j = 0; j < el.options.length; j++) {
+ if (!el.options[j].selected) continue;
+ Request.addField(el.name, el.options[j].value);
+ }
+ break;
+
+ case 'checkbox':
+ case 'radio':
+ if (!el.checked) continue;
+ Request.addField(el.name,el.value);
+ break;
+ }
+ }
+ return queryString;
+};
+
+// AJAX ProgressBar classs
+function AjaxProgressBar($url) {
+ this.WindowTitle = this.GetWindow().document.title;
+ this.URL = $url;
+ this.BusyRequest = false;
+ this.LastResponceTime = this.GetMicroTime();
+ this.ProgressPercent = 0; // progress percent
+ this.ProgressTime = new Array();
+ this.Query();
+}
+
+AjaxProgressBar.prototype.GetWindow = function() {
+ return window.parent ? window.parent : window;
+}
+
+AjaxProgressBar.prototype.GetMicroTime = function() {
+ var $now = new Date();
+ return Math.round($now.getTime() / 1000); // because miliseconds are returned too
+}
+
+AjaxProgressBar.prototype.Query = function() {
+// prompt('requestinng', this.URL);
+ Request.makeRequest(this.URL, this.BusyRequest, '', this.successCallback, this.errorCallback, '', this);
+}
+
+// return time needed for progress to finish
+AjaxProgressBar.prototype.GetEstimatedTime = function() {
+ return Math.ceil((100 - this.ProgressPercent) * Math.sum(this.ProgressTime) / this.ProgressPercent);
+}
+
+AjaxProgressBar.prototype.successCallback = function($request, $params, $object) {
+ var $responce = $request.responseText;
+ var $match_redirect = new RegExp('^#redirect#(.*)').exec($responce);
+ if ($match_redirect != null) {
+ $object.showProgress(100);
+ // redirect to external template requested
+ window.location.href = $match_redirect[1];
+ return false;
+ }
+
+ if ($object.showProgress($responce)) {
+ $object.Query();
+ }
+}
+
+AjaxProgressBar.prototype.errorCallback = function($request, $params, $object) {
+ alert('AJAX Error; class: AjaxProgressBar; ' + Request.getErrorHtml($request));
+}
+
+AjaxProgressBar.prototype.FormatTime = function ($seconds) {
+ $seconds = parseInt($seconds);
+
+ var $minutes = Math.floor($seconds / 60);
+ if ($minutes < 10) $minutes = '0' + $minutes;
+ $seconds = $seconds % 60;
+ if ($seconds < 10) $seconds = '0' + $seconds;
+
+ return $minutes + ':' + $seconds;
+}
+
+AjaxProgressBar.prototype.showProgress = function ($percent) {
+ this.ProgressPercent = $percent;
+ var $now = this.GetMicroTime();
+ this.ProgressTime[this.ProgressTime.length] = $now - this.LastResponceTime;
+ this.LastResponceTime = $now;
+
+ var $display_progress = parseInt(this.ProgressPercent);
+ this.GetWindow().document.title = $display_progress + '% - ' + this.WindowTitle;
+ document.getElementById('progress_display[percents_completed]').innerHTML = $display_progress + '%';
+ document.getElementById('progress_display[elapsed_time]').innerHTML = this.FormatTime( Math.sum(this.ProgressTime) );
+ document.getElementById('progress_display[Estimated_time]').innerHTML = this.FormatTime( this.GetEstimatedTime() );
+
+ document.getElementById('progress_bar[done]').style.width = $display_progress + '%';
+ document.getElementById('progress_bar[left]').style.width = (100 - $display_progress) + '%';
+ return $percent < 100 ? true : false;
+}
+
+// AJAX PopupManager class
+function AjaxPopupManager($url) {
+ this.URL = $url;
+ this.ResponceFunction = null;
+ this.PopupSizes = new Array();
+}
+
+AjaxPopupManager.prototype.GetSize = function ($template) {
+ if (this.ResponceFunction == null) {
+ alert ('Please define responce function first (type: '+typeof(this.ResponceFunction)+')');
+ }
+
+ if (!isset(this.PopupSizes[$template])) {
+ var $url = this.URL + '&type=GetPopupSize&template_name=' + $template;
+// alert('from ajax: '+$url);
+ Request.makeRequest($url, this.BusyRequest, '', this.successCallback, this.errorCallback, ['GetSize', $template], this);
+ }
+ else {
+// alert('from cache');
+ this.ResponceFunction(this.PopupSizes[$template]);
+ }
+}
+
+AjaxPopupManager.prototype.successCallback = function($request, $params, $object) {
+ var $responce = $request.responseText;
+ var $match_redirect = new RegExp('^#redirect#(.*)').exec($responce);
+ if ($match_redirect != null) {
+ // redirect to external template requested
+ window.location.href = $match_redirect[1];
+ return false;
+ }
+
+ switch ($params[0]) {
+ case 'GetSize':
+ // store responce to cache for future use
+ $object.PopupSizes[ $params[1] ] = $responce;
+ break;
+ }
+
+ $object.ResponceFunction($responce);
+ $object.ResponceFunction = null; // reset responce function
+}
+
+AjaxPopupManager.prototype.errorCallback = function($request, $params, $object) {
+ alert('AJAX Error; class: AjaxPopupManager; ' + Request.getErrorHtml($request));
+}
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/ajax.js
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.2/core/install/incs/install.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.3.2/core/install/incs/install.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.2/core/install/incs/install.tpl (revision 7648)
@@ -0,0 +1,153 @@
+<html>
+ <head>
+ <title>In-Portal Installation</title>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
+
+ <base href="<?php echo $this->baseURL; ?>"/>
+
+ <link rel="stylesheet" type="text/css" href="incs/style.css" />
+ <script type="text/javascript" src="incs/script.js"></script>
+ </head>
+
+ <body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" style="height: 100%">
+ <form enctype="multipart/form-data" id="install_form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
+
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
+ <!-- header: begin -->
+ <tr>
+ <td height="90">
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" height="90">
+ <tr>
+ <td rowspan="3" valign="top"><a href="http://www.in-portal.net" target="_top"><img title="In-portal" src="incs/img/globe.gif" width="84" height="91" border="0" alt="In-Portal"/></a></td>
+ <td rowspan="3" valign="top"><a href="http://www.in-portal.net" target="_top"><img title="In-portal" src="incs/img/logo.gif" width="150" height="91" border="0" alt="In-Portal"/></a></td>
+ <td rowspan="3" width="100%" align="right">&nbsp;</td>
+ <td width="400"><img title="" src="incs/img/blocks.gif" width="400" height="73" alt="blocks" /></td>
+ </tr>
+ <tr><td align="right" background="incs/img/version_bg.gif" class="head_version" valign="top"><img title="" src="incs/img/spacer.gif" width="1" height="14" alt=""/>In-Portal Version <?php echo $this->GetMaxModuleVersion('Core'); ?>: English US</td></tr>
+ <tr><td><img title="" src="incs/img/blocks2.gif" width="400" height="2" alt="blocks2"/><br /></td></tr>
+ <tr><td bgcolor="black" colspan="4"><img title="" src="incs/img/spacer.gif" width="1" height="1" alt=""/><br /></td></tr>
+ </table>
+ </td>
+ </tr>
+ <!-- header: end -->
+
+
+ <tr height="100%">
+ <td valign="top">
+ <table cellpadding=10 cellspacing=0 border=0 width="100%" height="100%">
+ <tr valign="top">
+ <td style="width: 200px; background: #009ff0 url(incs/img/bg_install_menu.gif) no-repeat bottom right; border-right: 1px solid #000">
+ <img src="incs/img/spacer.gif" width="180" height="1" border="0" alt="" /><br />
+ <span class="admintitle-white">Installation</span>
+
+ <ol class="install-steps">
+ <?php
+ echo $this->PrintSteps('<li class="current-step">%s</li>', '<li>%s</li>');
+ ?>
+ </ol>
+ </td>
+
+
+ <td>
+ <img src="incs/img/icon_install.gif" width="46" height="46" alt="" align="absmiddle" />&nbsp;<span class="admintitle"><?php echo $this->GetStepInfo('step_title'); ?></span><br /><br />
+
+ <!-- section header: begin -->
+ <table border="0" cellpadding="2" cellspacing="0" class="tableborder_full" width="100%" height="30">
+ <tr>
+ <td class="tablenav" width="580" nowrap background="incs/img/tabnav_left.jpg">
+ <span class="tablenav_link"><?php echo 'Step '.$this->GetStepNumber().' - '.$this->GetStepInfo('step_title'); ?></span>
+ </td>
+ <td align="right" class="tablenav" background="incs/img/tabnav_back.jpg" width="100%">
+ <a class="link" onclick="ShowHelp('in-portal:install');">
+ <img src="incs/img/blue_bar_help.gif" border="0">
+ </a>
+ </td>
+ </tr>
+ </table>
+ <!-- section header: end -->
+
+ <!-- toolbar: begin -->
+ <table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
+ <tr>
+ <td>
+ <a href="javascript:continue_install();">
+ <img border="0" src="incs/img/toolbar/tool_select.gif" id="img_Save" width="32" height="32" border="0" alt="Save" onmouseout="swap_image('img_Save', 'toolbar/tool_select.gif');" onmouseover="swap_image('img_Save','toolbar/tool_select_f2.gif');" /><br />
+ </a>
+ </td>
+ <td>
+ <img src="incs/img/toolbar/tool_cancel.gif" id="img_Cancel" width="32" height="32" border="0" alt="Cancel" onmouseout="swap_image('img_Cancel', 'toolbar/tool_cancel.gif');" onmouseover="swap_image('img_Cancel','toolbar/tool_cancel_f2.gif');" onclick="history.go(-1);" /><br />
+ </td>
+ <td width="100%">&nbsp;</td>
+ </tr>
+ </table>
+ <!-- toolbar: end -->
+
+ <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
+ <tr valign="top">
+ <td width="60%" bgcolor="#F0F0F0">
+ <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4">
+
+ <!-- step body: begin -->
+ <?php echo $this->GetStepBody(); ?>
+ <!-- step body: end -->
+
+ <!-- step error message: begin -->
+ <tr class="table_color2">
+ <td colspan="2">
+ <p class="error">
+ <?php echo $this->errorMessage; ?>
+ </p>
+ <br/>
+ </td>
+ </tr>
+ <!-- step error message: end -->
+
+ <!-- next, prev buttons: begin -->
+ <tr>
+ <td colspan="2">
+ <br />
+ <input type="submit" name="submit_form" value="Continue" class="button" />
+
+ <?php
+ if ($this->GetStepNumber() > 1 && $this->GetNextStep() != -1) {
+ echo '<input type="reset" name="cancel" value="Cancel" class="button" onclick="history.go(-1);" />';
+ }
+ ?>
+
+ <input type="hidden" name="step" value="<?php echo $this->currentStep; ?>"/>
+ <input type="hidden" name="preset" value="<?php echo $this->stepsPreset; ?>"/>
+ </td>
+ </tr>
+ <!-- next, prev buttons: end -->
+ </table>
+ </td>
+
+ <td width="40%" style="border-left: 1px solid #000; background: #f0f0f0">
+ <table width="100%" border="0" cellspacing="0" cellpadding="4">
+ <tr>
+ <td class="subsectiontitle" style="border-bottom: 1px solid #000000; background-color: #999"><?php echo $this->GetStepInfo('help_title'); ?></td>
+ </tr>
+ <tr>
+ <td class="text"><?php echo $this->GetStepInfo('help_body'); ?></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <br />
+ </td>
+ </tr>
+
+ <tr>
+ <td class="footer">
+ Powered by In-portal &copy; 1997-<?php echo date('Y'); ?>, Intechnic Corporation. All rights reserved.
+ <br /><img src="incs/img/spacer.gif" width="1" height="10" alt="" />
+ </td>
+ </tr>
+ </table>
+ </form>
+ </body>
+</html>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.2/core/install/incs/install.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Event Timeline