Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Mon, Feb 10, 5:32 PM

in-portal

Index: branches/5.0.x/themes/simple/designs/default_design.des.tpl
===================================================================
--- branches/5.0.x/themes/simple/designs/default_design.des.tpl (revision 12588)
+++ branches/5.0.x/themes/simple/designs/default_design.des.tpl (revision 12589)
@@ -1,131 +1,132 @@
<inp2:m_CheckSSL/>
<inp2:m_include template="elements/side_boxes.elm" strip_nl="1"/> <!--## includes system elements ##-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>
<inp2:st_PageInfo type="title"/> (<inp2:m_GetConfig name="Site_Name"/>)
</title>
+
+
<inp2:m_Include t="elements/html_head.elm" />
- <inp2:st_EditingScripts/>
</head>
<body>
<inp2:st_EditPage mode="start"/><!--## System tag please do not remove ##-->
<!-- Wrapper -->
<div id="wrapper">
<!-- Accessibility Navigation -->
<ol id="nav-accessibility">
<li><a href="#nav">Skip to navigation</a></li>
<li><a href="#content">Skip to content</a></li>
<li><a href="#content-sub">Skip to Secondary Content</a></li>
</ol>
<!-- /Accessibility Navigation -->
<!-- Masthead -->
<div id="masthead">
<!-- Branding -->
<h1 id="branding">
<a href="<inp2:m_Link t="index" />" title="<inp2:m_GetConfig name="Site_Name"/>"><inp2:m_GetConfig name="Site_Name"/></a>
</h1>
<!-- /Branding -->
<!-- Navigation -->
<inp2:m_include t="elements/navigation_menu.elm" />
<!-- /Navigation -->
<!-- Search -->
<inp2:m_include t="elements/search.elm" />
<!-- /Search -->
</div>
<!-- /Masthead -->
<!-- Breadcrumb -->
<inp2:m_include t="elements/navigation_bar.elm" />
<!-- /Breadcrumb -->
<!-- Content Tools -->
<inp2:m_include t="elements/content_tools.elm" />
<!-- /Content Tools -->
<!-- Content -->
<div id="content">
<div id="content-sec">
<inp2:m_DefineElement name="default_left_sidebar" no_editing="1">
<div class="movable-area">
<div class="movable-element">
<inp2:m_RenderElement name="elements/side_boxes/subscribe.elm" design="side_box"/>
</div>
</div>
</inp2:m_DefineElement>
<inp2:m_RenderElement name="left_sidebar" default_element="default_left_sidebar"/>
</div>
<!-- Main Content -->
<div id="content-main">
<div id="block-latest" class="block">
<div class="round-top"></div>
<div class="content">
<inp2:st_ContentBlock num="1"/>
</div>
<div class="round-bottom"></div>
</div>
</div>
<!-- /Main Content -->
<div id="content-ter">
<div class="movable-area">
<div class="movable-element">
<div class="block" id="side-box-plain">
<div class="round-top"></div>
<h3>Latest <strong>Podcasts</strong></h3>
<div>
<ul>
<li><a href="<inp2:m_Link t="index" />">Young Entrepreneurs in China and Australia: Be inspired by stories of success</a></li>
</ul>
</div>
<div class="content">
<p class="link-rss"><a href="http://harangue.lecture.unimelb.edu.au/lectopia/podcast.lasso?ut=1633&amp;feed=1&amp;key=2f346fec58ee22a6d2662a6a3f6e8ded" title="Podcast RSS">Subscribe to RSS</a></p>
<p class="link"><a href="http://www.asialink.unimelb.edu.au/subscribe">How to subscribe &gt;</a></p>
</div>
<div class="round-bottom"></div>
</div>
</div>
</div>
</div>
</div><!-- /Content -->
<inp2:m_include t="elements/footer.elm" />
</div><!-- /Wrapper -->
<inp2:st_EditPage mode="end"/> <!--## /System tag please do not remove ##-->
<inp2:m_include t="elements/tracking.elm" />
</body>
</html>
\ No newline at end of file
Index: branches/5.0.x/themes/simple/elements/html_head.elm.tpl
===================================================================
--- branches/5.0.x/themes/simple/elements/html_head.elm.tpl (revision 12588)
+++ branches/5.0.x/themes/simple/elements/html_head.elm.tpl (revision 12589)
@@ -1,24 +1,23 @@
<meta http-equiv="content-type" content="text/html; charset=<inp2:lang.current_Field name="Charset"/>" />
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="<inp2:m_TemplatesBase />inc/screen.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<inp2:m_TemplatesBase />inc/print.css" media="print" />
<link rel="stylesheet" type="text/css" href="<inp2:m_TemplatesBase />inc/override.css" media="all" />
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="<inp2:m_TemplatesBase module="In-Portal"/>inc/ie6.css" media="screen" />
<![endif]-->
<!-- JS -->
+<inp2:st_EditingScripts/>
-<!--##
-<script type="text/javascript" src="<inp2:m_TemplatesBase />inc/jquery/jquery.1.3.2.js"></script>
-##-->
-
-<script type="text/javascript" src="<inp2:m_TemplatesBase />inc/jquery/jquery.js"></script>
-
+<inp2:m_ifnot check="m_GetConst" name="EDITING_MODE">
+ <!--<script type="text/javascript" src="<inp2:m_TemplatesBase />inc/jquery/jquery.js"></script>-->
+ <script type="text/javascript" src="<inp2:m_TemplatesBase />inc/jquery/jquery.1.3.2.js"></script>
+</inp2:m_ifnot>
<script type="text/javascript" src="<inp2:m_TemplatesBase />inc/jquery/jcookie.js"></script>
-<script type="text/javascript" src="<inp2:m_TemplatesBase />inc/jquery/jquery.validate.js"></script>
+<!--<script type="text/javascript" src="<inp2:m_TemplatesBase />inc/jquery/jquery.validate.js"></script>-->
<script type="text/javascript" src="<inp2:m_TemplatesBase />inc/general.js"></script>
Index: branches/5.0.x/themes/simple/elements/side_boxes/subscribe.elm.tpl
===================================================================
--- branches/5.0.x/themes/simple/elements/side_boxes/subscribe.elm.tpl (revision 12588)
+++ branches/5.0.x/themes/simple/elements/side_boxes/subscribe.elm.tpl (revision 12589)
@@ -1,26 +1,26 @@
<inp2:m_Capture to_var="header">
<inp2:m_phrase name="lu_title_MailingList"/>
</inp2:m_Capture>
<script type="text/javascript">
- $(document).ready(function(){
+ /*$(document).ready(function(){
$("#subscribeform").validate();
- });
+ });*/
</script>
<form method="post" action="<inp2:m_FormAction />" id="subscribeform">
<div>
<input type="hidden" name="subscribe_template" value="mailing_list/subscribe"/>
<input type="hidden" name="unsubscribe_template" value="mailing_list/unsubscribe"/>
<fieldset>
<label for="subscribe-email">Enter email adress below</label>
<inp2:m_if check="u_HasError" field="any">
<span id="errormsg"><inp2:u_Error field="SubscribeEmail"/></span><br />
</inp2:m_if>
<span class="emailfield">
<input type="text" name="subscriber_email" class="required email" id="subscribe-email" />
</span>
<span class="submit"><input type="submit" name="events[u][OnSubscribeQuery]" value="Subscribe" /></span>
</fieldset>
</div>
</form>
Index: branches/5.0.x/themes/simple/elements/navigation_menu.elm.tpl
===================================================================
--- branches/5.0.x/themes/simple/elements/navigation_menu.elm.tpl (revision 12588)
+++ branches/5.0.x/themes/simple/elements/navigation_menu.elm.tpl (revision 12589)
@@ -1,24 +1,24 @@
<inp2:m_DefineElement name="menu_element" no_editing="1">
<li>
<a href="<inp2:m_if check='m_Param' name='external_url'><inp2:m_Param name='external_url'/><inp2:m_else/><inp2:m_Link template='$template' m_cat_id='$cat_id' m_cat_page='1'/></inp2:m_if>" title="<inp2:m_Param name="title"/>"><inp2:m_Param name="title"/></a>
<inp2:m_if check="m_Param" name="has_sub_menu">
<ul>
<inp2:st_CachedMenu render_as="sub_menu_element" category_id="$cat_id"/>
</ul>
</inp2:m_if>
</li>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="sub_menu_element" no_editing="1">
<li>
<a href="<inp2:m_if check='m_Param' name='external_url'><inp2:m_Param name='external_url'/><inp2:m_else/><inp2:m_Link template='$template' m_cat_id='$cat_id' m_cat_page='1'/></inp2:m_if>" title="<inp2:m_Param name="title"/>"><inp2:m_Param name="title"/></a>
</li>
</inp2:m_DefineElement>
<ul id="nav">
<li>
- <a href="<inp2:m_Link template='index' m_cat_id='0' m_cat_page='1'/>" title="<inp2:m_RootCategoryName/>"><inp2:m_RootCategoryName/></a>
+ <a href="<inp2:m_Link template='index' m_cat_id='0' m_cat_page='1'/>" title="<inp2:m_RootCategoryName no_editing='1'/>"><inp2:m_RootCategoryName/></a>
</li>
<inp2:st_CachedMenu render_as="menu_element" category_id="1"/>
</ul>
\ No newline at end of file
Index: branches/5.0.x/themes/simple/elements/side_boxes.elm.tpl
===================================================================
--- branches/5.0.x/themes/simple/elements/side_boxes.elm.tpl (revision 12588)
+++ branches/5.0.x/themes/simple/elements/side_boxes.elm.tpl (revision 12589)
@@ -1,9 +1,9 @@
<inp2:m_DefineElement name="side_box">
<div class="block" id="side-box">
- <h3><inp2:m_param name="header"/></h3>
+ <h3 class="movable-header"><inp2:m_param name="header"/></h3>
<div class="content">
<inp2:m_param name="content"/>
</div>
<div class="round-bottom"></div>
</div>
</inp2:m_DefineElement>
\ No newline at end of file
Index: branches/5.0.x/core/kernel/processors/main_processor.php
===================================================================
--- branches/5.0.x/core/kernel/processors/main_processor.php (revision 12588)
+++ branches/5.0.x/core/kernel/processors/main_processor.php (revision 12589)
@@ -1,1013 +1,1015 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.net/license/ for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class kMainTagProcessor extends kTagProcessor {
function Init($prefix, $special, $event_params = null)
{
parent::Init($prefix, $special, $event_params);
$actions =& $this->Application->recallObject('kActions');
$actions->Set('t', $this->Application->GetVar('t'));
$actions->Set('sid', $this->Application->GetSID());
$actions->Set('m_opener', $this->Application->GetVar('m_opener') );
}
/**
* Base folder for all template includes
*
* @param Array $params
* @return string
*/
function TemplatesBase($params)
{
static $cached = Array ();
$cache_key = crc32( serialize($params) );
if (!array_key_exists($cache_key, $cached)) {
$force_admin = array_key_exists('force_admin', $params) && $params['force_admin'];
$module = array_key_exists('module', $params) ? $params['module'] : 'core';
if ($this->Application->IsAdmin() || $force_admin) {
if ($module == 'in-portal') {
$module = 'kernel';
}
$path = $force_admin ? '/core/admin_templates' : THEMES_PATH;
$path = preg_replace('/\/(.*?)\/(.*)/', $module.'/\\2', $path); // remove leading slash + substitute module
}
else {
$path = mb_substr(THEMES_PATH, 1);
if (mb_strtolower($module) == 'in-portal') {
$module_folder = 'platform';
}
else {
$module_folder = $this->Application->findModule('Name', $module, 'TemplatePath');
}
$path .= rtrim('/' . trim($module_folder, '/'), '/') . '/';
}
$cached[$cache_key] = $this->Application->BaseURL() . $path;
}
return $cached[$cache_key];
}
/**
* Creates <base href ..> HTML tag for all templates
* affects future css, js files and href params of links
*
* @return string
* @access public
*/
function Base_Ref($params)
{
return '<base href="'.$this->TemplatesBase($params).'/" />';
}
/**
* Returns base url for web-site
*
* @return string
* @access public
*/
function BaseURL()
{
return $this->Application->BaseURL();
}
//for compatability with K3 tags
function Base($params)
{
return $this->TemplatesBase($params).'/';
}
function ProjectBase($params)
{
return $this->Application->BaseURL();
}
/*function Base($params)
{
return $this->Application->BaseURL().$params['add'];
}*/
/**
* Used to create link to any template.
* use "pass" paramter if "t" tag to specify
* prefix & special of object to be represented
* in resulting url
*
* @param Array $params
* @return string
* @access public
*/
function T($params)
{
//by default link to current template
$t = $this->SelectParam($params, 't,template');
unset($params['t']);
unset($params['template']);
$prefix=isset($params['prefix']) ? $params['prefix'] : ''; unset($params['prefix']);
$index_file = isset($params['index_file']) ? $params['index_file'] : null; unset($params['index_file']);
return $this->Application->HREF($t, $prefix, $params, $index_file);
}
function Link($params)
{
if (isset($params['template'])) {
$params['t'] = $params['template'];
unset($params['template']);
}
if (!isset($params['pass']) && !isset($params['no_pass'])) $params['pass'] = 'm';
if (isset($params['no_pass'])) unset($params['no_pass']);
if ( $this->Application->GetVar('admin') ) {
$params['admin'] = 1;
if (!array_key_exists('editing_mode', $params)) {
$params['editing_mode'] = EDITING_MODE;
}
}
return $this->T($params);
}
function Env($params)
{
$t = $params['template'];
unset($params['template']);
return $this->Application->BuildEnv($t, $params, 'm', null, false);
}
function FormAction($params)
{
$params['pass'] = 'all,m';
$params['pass_category'] = 1;
return $this->Application->HREF('', '', $params);
}
/*// NEEDS TEST
function Config($params)
{
return $this->Application->ConfigOption($params['var']);
}
function Object($params)
{
$name = $params['name'];
$method = $params['method'];
$tmp =& $this->Application->recallObject($name);
if ($tmp != null) {
if (method_exists($tmp, $method))
return $tmp->$method($params);
else
echo "Method $method does not exist in object ".get_class($tmp)." named $name<br>";
}
else
echo "Object $name does not exist in the appliaction<br>";
}*/
/**
* Tag, that always returns true.
* For parser testing purposes
*
* @param Array $params
* @return bool
* @access public
*/
function True($params)
{
return true;
}
/**
* Tag, that always returns false.
* For parser testing purposes
*
* @param Array $params
* @return bool
* @access public
*/
function False($params)
{
return false;
}
/**
* Returns block parameter by name (used only as "check" parameter value for "m_if" tag !)
*
* @param Array $params
* @return stirng
* @access public
*/
function Param($params)
{
$name = $params['name'];
/*if (isset($this->Application->LateParsed[$name])) {
$f = $this->Application->PreParsedBlocks['capture_'.$name.$this->Application->LateParsed[$name]];
$this->Application->Parser->SetParam($name, $f(array()));
}*/
$res = $this->Application->Parser->GetParam($params['name']);
if ($res === false) {
$res = '';
}
if (isset($params['plus'])) {
$res += $params['plus'];
}
return $res;
}
/**
* Compares block parameter with value specified
*
* @param Array $params
* @return bool
* @access public
*/
function ParamEquals($params)
{
$name = $this->SelectParam($params, 'name,var,param');
$value = $params['value'];
return ($this->Application->Parser->GetParam($name) == $value);
}
/*function PHP_Self($params)
{
return $HTTP_SERVER_VARS['PHP_SELF'];
}
*/
/**
* Returns session variable value by name
*
* @param Array $params
* @return string
* @access public
*/
function Recall($params)
{
$var_name = $this->SelectParam($params,'name,var,param');
if (isset($params['persistent']) && $params['persistent']) {
$ret = $this->Application->RecallPersistentVar($var_name);
}
else {
$ret = $this->Application->RecallVar($var_name);
}
$ret = ($ret === false && isset($params['no_null'])) ? '' : $ret;
if (getArrayValue($params, 'special') || getArrayValue($params, 'htmlchars')) {
$ret = htmlspecialchars($ret);
}
if (getArrayValue($params, 'urlencode')) {
$ret = urlencode($ret);
}
return $ret;
}
function RemoveVar($params)
{
$this->Application->RemoveVar( $this->SelectParam($params,'name,var,param') );
}
// bad style to store something from template to session !!! (by Alex)
// Used here only to test how session works, nothing more
function Store($params)
{
//echo"Store $params[name]<br>";
$name = $params['name'];
$value = $params['value'];
$this->Application->StoreVar($name,$value);
}
/**
* Sets application variable value(-s)
*
* @param Array $params
* @access public
*/
function Set($params)
{
foreach ($params as $param => $value) {
$this->Application->SetVar($param, $value);
}
}
/**
* Increment application variable
* specified by number specified
*
* @param Array $params
* @access public
*/
function Inc($params)
{
$this->Application->SetVar($params['param'], $this->Application->GetVar($params['param']) + $params['by']);
}
/**
* Retrieves application variable
* value by name
*
* @param Array $params
* @return string
* @access public
*/
function Get($params)
{
$ret = $this->Application->GetVar($this->SelectParam($params, 'name,var,param'), '');
return getArrayValue($params, 'htmlchars') ? htmlspecialchars($ret) : $ret;
}
/**
* Retrieves application constant
* value by name
*
* @param Array $params
* @return string
* @access public
*/
function GetConst($params)
{
$constant_name = $this->SelectParam($params, 'name,const');
return defined($constant_name) ? constant($constant_name) : '';
}
/**
* Retrieves configuration variable value by name
*
* @param Array $params
* @return string
* @access public
*/
function GetConfig($params)
{
$config_name = $this->SelectParam($params, 'name,var');
$ret = $this->Application->ConfigValue($config_name);
if( getArrayValue($params, 'escape') ) $ret = addslashes($ret);
return $ret;
}
function ConfigEquals($params)
{
$option = $this->SelectParam($params, 'name,option,var');
return $this->Application->ConfigValue($option) == getArrayValue($params, 'value');
}
/**
* Creates all hidden fields
* needed for kernel_form
*
* @param Array $params
* @return string
* @access public
*/
function DumpSystemInfo($params)
{
$actions =& $this->Application->recallObject('kActions');
$actions->Set('t', $this->Application->GetVar('t') );
$params = $actions->GetParams();
$o='';
foreach ($params AS $name => $val)
{
$o .= "<input type='hidden' name='$name' id='$name' value='$val'>\n";
}
return $o;
}
/**
* Used for search sidebox on front-end only
*
* @param Array $params
* @return string
* @author Alex
*/
function GetFormHiddens($params)
{
$t = $this->SelectParam($params, 'template,t');
unset($params['template']);
$form_fields = Array ();
if ($this->Application->RewriteURLs()) {
$session =& $this->Application->recallObject('Session');
if ($session->NeedQueryString()) {
$form_fields['sid'] = $this->Application->GetSID();
}
}
else {
$form_fields['env'] = $this->Application->BuildEnv($t, $params, 'm', null, false);
}
if ($this->Application->GetVar('admin') == 1) {
$form_fields['admin'] = 1;
}
$ret = '';
$field_tpl = '<input type="hidden" name="%1$s" id="%1$s" value="%2$s"/>'."\n";
foreach ($form_fields as $form_field => $field_value) {
$ret .= sprintf($field_tpl, $form_field, $field_value);
}
return $ret;
}
function Odd_Even($params)
{
$odd = $params['odd'];
$even = $params['even'];
if (!isset($params['var'])) {
$var = 'odd_even';
}
else {
$var = $params['var'];
}
if ($this->Application->GetVar($var) == 'even') {
if (!isset($params['readonly']) || !$params['readonly']) {
$this->Application->SetVar($var, 'odd');
}
return $even;
}
else {
if (!isset($params['readonly']) || !$params['readonly']) {
$this->Application->SetVar($var, 'even');
}
return $odd;
}
}
/**
* Returns phrase translation by name
*
* @param Array $params
* @return string
* @access public
*/
function Phrase($params)
{
// m:phrase name="phrase_name" default="Tr-alala" updated="2004-01-29 12:49"
$phrase_name = $this->SelectParam($params, 'label,name,title');
if (isset($params['source']) && $params['source']) {
$phrase_name = $this->Application->GetVar($phrase_name);
if (array_key_exists('default', $params) && !$phrase_name) {
$phrase_name = $params['default'];
}
}
$no_editing = array_key_exists('no_editing', $params) && $params['no_editing'];
$translation = $this->Application->Phrase($phrase_name, !$no_editing);
if (isset($params['escape']) && $params['escape']) {
$translation = htmlspecialchars($translation, ENT_QUOTES);
$translation = addslashes($translation);
}
return $translation;
}
// for tabs
function is_active($params)
{
$test_templ = $this->SelectParam($params, 'templ,template,t');
if ( !getArrayValue($params,'allow_empty') )
{
$if_true=getArrayValue($params,'true') ? $params['true'] : 1;
$if_false=getArrayValue($params,'false') ? $params['false'] : 0;
}
else
{
$if_true=$params['true'];
$if_false=$params['false'];
}
if ( preg_match("/^".str_replace('/', '\/', $test_templ)."/i", $this->Application->GetVar('t'))) {
return $if_true;
}
else {
return $if_false;
}
}
function IsNotActive($params)
{
return !$this->is_active($params);
}
function IsActive($params)
{
return $this->is_active($params);
}
function is_t_active($params)
{
return $this->is_active($params);
}
function CurrentTemplate($params)
{
return $this->is_active($params);
}
/**
* Checks if session variable
* specified by name value match
* value passed as parameter
*
* @param Array $params
* @return string
* @access public
*/
function RecallEquals($params)
{
$name = $this->SelectParam($params, 'name,var');
$value = $params['value'];
if (isset($params['persistent']) && $params['persistent']) {
return $this->Application->RecallPersistentVar($name) == $value;
}
return ($this->Application->RecallVar($name) == $value);
}
/**
* Checks if application variable
* specified by name value match
* value passed as parameter
*
* @param Array $params
* @return bool
* @access public
*/
function GetEquals($params)
{
$name = $this->SelectParam($params, 'var,name,param');
$value = $params['value'];
if ($this->Application->GetVar($name) == $value) {
return 1;
}
}
function ModuleInclude($params)
{
$ret = '';
$block_params = array_merge($params, Array('is_silent' => 2)); // don't make fatal errors in case if template is missing
$current_template = $this->Application->GetVar('t');
$replace_main = isset($params['replace_m']) && $params['replace_m'];
$skip_prefixes = isset($params['skip_prefixes']) ? explode(',', $params['skip_prefixes']) : Array();
$cms_mode = $this->Application->GetVar('admin');
foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
$module_key = mb_strtolower($module_name);
if ($module_name == 'In-Portal') {
if (!$cms_mode && $this->Application->IsAdmin()) {
// don't process In-Portal templates in admin
continue;
}
// Front-End still relies on In-Portal module
$module_prefix = $module_data['TemplatePath'];
}
else {
$module_prefix = $this->Application->IsAdmin() ? $module_key.'/' : rtrim($module_data['TemplatePath'], '/').'/';
}
$block_params['t'] = $module_prefix.$this->SelectParam($params, $module_key.'_template,'.$module_key.'_t,template,t');
$check_prefix = $module_data['Var'];
if ($check_prefix == 'adm' && $replace_main) {
$check_prefix = 'c';
}
if ($block_params['t'] == $current_template || in_array($check_prefix, $skip_prefixes)) {
continue;
}
$no_data = $this->SelectParam($params, $module_key.'_block_no_data,block_no_data');
if ($no_data) {
$block_params['block_no_data'] = $module_prefix.'/'.$no_data;
}
$ret .= $this->Application->Parser->IncludeTemplate($block_params, isset($block_params['is_silent']) ? 1 : 0);
}
return $ret;
}
function ModuleEnabled($params)
{
return $this->Application->isModuleEnabled( $params['module'] );
}
/**
* Checks if debug mode is on
*
* @param Array $params
* @return bool
* @access public
*/
function IsDebugMode($params)
{
return defined('DEBUG_MODE') && $this->Application->isDebugMode();
}
/*function MassParse($params)
{
$qty = $params['qty'];
$block = $params['block'];
$mode = $params['mode'];
$o = '';
if ($mode == 'func') {
$func = create_function('$params', '
$o = \'<tr>\';
$o.= \'<td>a\'.$params[\'param1\'].\'</td>\';
$o.= \'<td>a\'.$params[\'param2\'].\'</td>\';
$o.= \'<td>a\'.$params[\'param3\'].\'</td>\';
$o.= \'<td>a\'.$params[\'param4\'].\'</td>\';
$o.= \'</tr>\';
return $o;
');
for ($i=1; $i<$qty; $i++) {
$block_params['param1'] = rand(1, 10000);
$block_params['param2'] = rand(1, 10000);
$block_params['param3'] = rand(1, 10000);
$block_params['param4'] = rand(1, 10000);
$o .= $func($block_params);
}
return $o;
}
$block_params['name'] = $block;
for ($i=0; $i<$qty; $i++) {
$block_params['param1'] = rand(1, 10000);
$block_params['param2'] = rand(1, 10000);
$block_params['param3'] = rand(1, 10000);
$block_params['param4'] = rand(1, 10000);
$block_params['passed'] = $params['passed'];
$block_params['prefix'] = 'm';
$o.= $this->Application->ParseBlock($block_params, 1);
}
return $o;
}*/
function LoggedIn($params)
{
return $this->Application->LoggedIn();
}
/**
* Allows to check if permission exists directly in template and perform additional actions if required
*
* @param Array $params
* @return bool
*/
function CheckPermission($params)
{
$perm_helper =& $this->Application->recallObject('PermissionsHelper');
return $perm_helper->TagPermissionCheck($params);
}
/**
* Checks if user is logged in and if not redirects it to template passed
*
* @param Array $params
*/
function RequireLogin($params)
{
$t = $this->Application->GetVar('t');
if ($next_t = getArrayValue($params, 'next_template')) {
$t = $next_t;
}
// check by permissions: begin
if ((isset($params['perm_event']) && $params['perm_event']) ||
(isset($params['perm_prefix']) && $params['perm_prefix']) ||
(isset($params['permissions']) && $params['permissions'])) {
$perm_helper =& $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
$perm_status = $perm_helper->TagPermissionCheck($params);
if (!$perm_status) {
list($redirect_template, $redirect_params) = $perm_helper->getPermissionTemplate($params);
$this->Application->Redirect($redirect_template, $redirect_params);
}
else {
return ;
}
}
// check by permissions: end
// check by configuration value: begin
$condition = getArrayValue($params, 'condition');
if (!$condition) {
$condition = true;
}
else {
if (substr($condition, 0, 1) == '!') {
$condition = !$this->Application->ConfigValue(substr($condition, 1));
}
else {
$condition = $this->Application->ConfigValue($condition);
}
}
// check by configuration value: end
// check by belonging to group: begin
$group = $this->SelectParam($params, 'group');
$group_access = true;
if ($group) {
$conn =& $this->Application->GetADODBConnection();
$group_id = $conn->GetOne('SELECT GroupId FROM '.TABLE_PREFIX.'PortalGroup WHERE Name = '.$conn->qstr($group));
if ($group_id) {
$groups = explode(',', $this->Application->RecallVar('UserGroups'));
$group_access = in_array($group_id, $groups);
}
}
// check by belonging to group: end
if ((!$this->Application->LoggedIn() || !$group_access) && $condition) {
$redirect_params = $this->Application->HttpQuery->getRedirectParams(true);
$redirect_params['next_template'] = $t;
if (array_key_exists('pass_category', $params)) {
$redirect_params['pass_category'] = $params['pass_category'];
}
if ( $this->Application->LoggedIn() && !$group_access) {
$this->Application->Redirect( $params['no_group_perm_template'], $redirect_params);
}
$this->Application->Redirect($params['login_template'], $redirect_params);
}
}
function IsMember($params)
{
$group = getArrayValue($params, 'group');
$conn =& $this->Application->DB;
$group_id = $conn->GetOne('SELECT GroupId FROM '.TABLE_PREFIX.'PortalGroup WHERE Name = '.$conn->qstr($group));
if ($group_id) {
$groups = explode(',', $this->Application->RecallVar('UserGroups'));
$group_access = in_array($group_id, $groups);
}
return $group_access;
}
/**
* Checks if SSL is on and redirects to SSL URL if needed
* If SSL_URL is not defined in config - the tag does not do anything
* If for_logged_in_only="1" exits if user is not logged in.
* If called without params forces https right away. If called with by_config="1" checks the
* Require SSL setting from General Config and if it is ON forces https
*
* @param unknown_type $params
*/
function CheckSSL($params)
{
$ssl = $this->Application->IsAdmin() ? $this->Application->ConfigValue('AdminSSL_URL') : false;
if (!$ssl) {
// not in admin or admin ssl url is empty
$ssl = $this->Application->ConfigValue('SSL_URL');
}
if (!$ssl) return; //SSL URL is not set - no way to require SSL
$require = false;
if (isset($params['mode']) && $params['mode'] == 'required') {
$require = true;
if (isset($params['for_logged_in_only']) && $params['for_logged_in_only'] && !$this->Application->LoggedIn()) {
$require = false;
}
if (isset($params['condition'])) {
if (!$this->Application->ConfigValue($params['condition'])) {
$require = false;
}
}
}
$http_query =& $this->Application->recallObject('HTTPQuery');
$pass = $http_query->getRedirectParams();
if ($require) {
if (PROTOCOL == 'https://') {
$this->Application->SetVar('__KEEP_SSL__', 1);
return;
}
$this->Application->Redirect('', array_merge_recursive2($pass, Array('__SSL__' => 1)));
}
else {
if (PROTOCOL == 'https://' && $this->Application->ConfigValue('Force_HTTP_When_SSL_Not_Required')) {
if ($this->Application->GetVar('__KEEP_SSL__')) return;
// $pass_more = Array ('pass' => 'm', 'm_cat_id' => 0, '__SSL__' => 0);
$this->Application->Redirect('', array_merge_recursive2($pass, Array('__SSL__' => 0))); // $pass_more
}
}
}
function ConstOn($params)
{
$name = $this->SelectParam($params,'name,const');
return constOn($name);
}
function SetDefaultCategory($params)
{
$category_id = $this->Application->findModule('Name', $params['module'], 'RootCat');
$this->Application->SetVar('m_cat_id', $category_id);
}
function XMLTemplate($params)
{
safeDefine('DBG_SKIP_REPORTING', 1);
if (isset($params['cache']) && $params['cache']) {
$nextyear = intval(date('Y') + 1);
$format = "D, d M Y H:i:s";
$expiration = gmdate($format, mktime() + $params['cache']).' GMT';
$last_modified = mktime();
header ('Cache-Control: public, cache, max-age='.$params['cache']);
header ("Expires: $expiration");
header ('Pragma: public');
// Getting headers sent by the client.
$headers = request_headers();
// Checking if the client is validating his cache and if it is current.
if (isset($headers['If-Modified-Since']) && (strtotime($headers['If-Modified-Since']) > $last_modified-$params['cache'])) {
// Client's cache IS current, so we just respond '304 Not Modified'.
header('Last-Modified: '.date($format, strtotime($headers['If-Modified-Since'])).' GMT', true, 304);
exit();
} else {
// Image not cached or cache outdated, we respond '200 OK' and output the image.
header('Last-Modified: '.gmdate($format, $last_modified).' GMT', true, 200);
}
}
// xml documents are usually long
set_time_limit(0);
ini_set('memory_limit', -1);
return $this->Application->XMLHeader(getArrayValue($params, 'xml_version'));
}
function Header($params)
{
header($params['data']);
}
function NoDebug($params)
{
if (!$this->Application->GetVar('debug')) {
define('DBG_SKIP_REPORTING', 1);
}
}
function RootCategoryName($params)
{
- $root_phrase = $this->Application->ConfigValue('Root_Name');
- return $this->Application->Phrase($root_phrase);
+ $phrase_name = $this->Application->ConfigValue('Root_Name');
+ $no_editing = array_key_exists('no_editing', $params) && $params['no_editing'];
+
+ return $this->Application->Phrase($phrase_name, !$no_editing);
}
/**
* Allows to attach file directly from email event template
*
* @param Array $params
*/
function AttachFile($params)
{
$esender =& $application->recallObject('EmailSender'.(isset($params['special']) ? '.'.$params['special'] : ''));
/* @var $esender kEmailSendingHelper */
$path = FULL_PATH.'/'.$params['path'];
if (file_exists($path)) {
$esender->AddAttachment($path);
}
}
function CaptchaImage($params)
{
$this->NoDebug($params);
$this->Application->SetVar('skip_last_template', 1);
$captcha_helper =& $this->Application->recallObject('CaptchaHelper');
/* @var $captcha_helper kCaptchaHelper */
// generate captcha code
$code = $captcha_helper->prepareCode( $this->Application->GetVar('var') );
$captcha_helper->GenerateCaptchaImage($code, $this->Application->GetVar('w'), $this->Application->GetVar('h'), true);
}
function SID($params)
{
return $this->Application->GetSID();
}
function ModuleInfo($params)
{
return $this->Application->findModule($params['key'], $params['value'], $params['return']);
}
function Random($params)
{
return rand(1, 100000000);
}
/**
* Prints parser params, available at current deep level
*
* @param Array $params
* @return string
*/
function PrintCurrentParams($params)
{
$current_params = $this->Application->Parser->Params;
foreach ($current_params as $param_name => $param_value) {
$current_params[$param_name] = $param_name . ' = "' . $param_value . '"';
}
return '<pre>' . implode("\n", $current_params) . '</pre>';
}
/**
* Gets previously defined counter result
*
* @param Array $params
* @return int
*/
function GetCounter($params)
{
return $this->Application->getCounter($params['name'], $params);
}
/**
* Increments PageHit counter
*
* @param Array $params
* @return int
*/
function RegisterPageHit($params)
{
if ($this->Application->ConfigValue('UsePageHitCounter')) {
$db =& $this->Application->GetADODBConnection();
// get current counte
$sql = 'SELECT VariableValue
FROM '.TABLE_PREFIX.'ConfigurationValues
WHERE VariableName = "PageHitCounter"';
$page_counter = (int)$db->GetOne($sql);
$sql = 'UPDATE LOW_PRIORITY '.TABLE_PREFIX.'ConfigurationValues
SET VariableValue = '.($page_counter + 1).'
WHERE VariableName = "PageHitCounter"';
$db->Query($sql);
}
}
function Timestamp($params)
{
$format = isset($params['format']) ? $params['format'] : 'd.m.Y H:i:s';
return adodb_date($format);
}
}
Index: branches/5.0.x/core/kernel/utility/debugger/debugger.css
===================================================================
--- branches/5.0.x/core/kernel/utility/debugger/debugger.css (revision 12588)
+++ branches/5.0.x/core/kernel/utility/debugger/debugger.css (revision 12589)
@@ -1,119 +1,121 @@
.dbg_profiler {
margin-top: 5px;
padding: 0px;
height: 10px;
border: 1px solid #000000;
float: left;
display: inline;
}
.dbg_flat_table, .dbg_stats_table, table.dbg_explain_table {
border-collapse: collapse;
width: auto;
margin: 0px;
}
table.dbg_explain_table TD {
border: 1px solid #000000;
padding: 4px;
}
table.dbg_explain_table tr.explain_header TD {
font-weight: bold;
text-align: center;
}
.dbg_flat_table TD, .dbg_stats_table TD {
border: 1px solid #CCCCCC;
padding: 4px;
}
.dbg_stats_table TD {
background-color: #FFFFFF;
font-family: Arial, Verdana;
font-size: 9pt;
text-align: left;
}
.debug_layer_table {
border-collapse: collapse;
}
.debug_text, .debug_row_even TD, .debug_row_odd TD {
color: #000000;
font-family: Verdana;
font-size: 11px;
}
.debug_cell {
border: 1px solid #FF0000;
padding: 4px;
text-align: left;
}
.debug_row_even {
background-color: #CCCCFF;
}
.debug_row_odd {
background-color: #FFFFCC;
}
.debug_layer_container {
left: 2px;
top: 1px;
z-index: +1000;
position: absolute;
overflow: auto;
border: 2px solid;
padding: 3px;
border-top-color: threedlightshadow;
border-left-color: threedlightshadow;
border-right-color: threeddarkshadow;
border-bottom-color: threeddarkshadow;
background-color: buttonface;
}
.debug_layer {
padding: 0px;
}
.debug_error {
color: #FF0000;
}
.dbg-toolbar {
border: 1px solid #000000;
background-color: #D4D0C8;
border-collapse: separate;
+ border-spacing: 2px;
width: auto;
}
.dbg-toolbar td {
font-size: 13px;
font-family: Tahoma;
padding: 1px 5px 1px 5px;
+ vertical-align: middle;
margin: 3px;
}
.dbg-toolbar td.dbg-button, .dbg-toolbar td.dbg-button:hover {
cursor: default;
}
.dbg-toolbar td.dbg-button {
border: 1px solid #D4D0C8;
background-color: #D4D0C8;
}
.dbg-toolbar td.dbg-button:hover {
border: 1px solid #0A246A;
background-color: #B5BDD2;
}
.dbg-toolbar td.dbg-separator {
background-color: #000000;
width: 1px;
padding: 0px;
}
Index: branches/5.0.x/core/admin_templates/js/template_manager.js
===================================================================
--- branches/5.0.x/core/admin_templates/js/template_manager.js (revision 12588)
+++ branches/5.0.x/core/admin_templates/js/template_manager.js (revision 12589)
@@ -1,385 +1,388 @@
function TemplateManager ($edit_url, $browse_url, $save_layout_url, $edting_mode) {
this._editUrl = $edit_url;
this.browseUrl = $browse_url;
this._saveLayoutUrl = $save_layout_url;
this.editingMode = $edting_mode; // from {1 - browse, 2 - content, 3 - design}
this._blocks = {};
this._blockOrder = Array ();
this.inDrag = false; // don't process mouse over/out events while in drag mode
var $template_manager = this;
$(document).ready(
function() {
$template_manager.searchBlocks();
if (!$template_manager.editingMode) {
return ;
}
// show special toolbar when in any of 3 browse modes
var $head_frame = getFrame('head');
var $extra_toolbar = $head_frame.$('div.front-extra-toolbar').clone(); // clone to keep original untouched
$('a', $extra_toolbar).each(
function() {
// cut from end, because IE7 adds base_href to beginning of href
var $editing_mode = $(this).attr('href');
$editing_mode = $editing_mode.substr($editing_mode.length - 1, 1);
$(this).attr('href', $template_manager.browseUrl.replace('#EDITING_MODE#', $editing_mode));
if ($editing_mode == $template_manager.editingMode) {
$(this).parents('td:first').addClass('button-active').prevAll('td:first').addClass('button-active');
}
}
);
$head_frame.$('#extra_toolbar').html( $extra_toolbar.html() );
var $hover_effect = [];
if ($template_manager.editingMode > 1) {
// all modes except for "Browse Mode"
$hover_effect.push('div.cms-section-properties-btn:first');
}
if ($template_manager.editingMode == 2) {
// Content Mode
$hover_effect.push('div.cms-edit-btn');
// make all spans with phrases clickable
$template_manager.setupEditTranslationButtons(document);
}
if ($template_manager.editingMode == 3) {
// Design Mode
// $hover_effect.push('div.cms-save-layout-btn:first, div.cms-cancel-layout-btn:first');
$template_manager.renumberMovableElements();
$('div.movable-area').sortable(
{
placeholder: 'move-helper',
handle: '.movable-header',
items: 'div.movable-element',
connectWith: ['div.movable-area'],
tolerance: 'pointer',
start: function(e, ui) {
$template_manager.inDrag = true;
ui.placeholder.height( ui.item.height() );
},
stop: function(e, ui) {
$template_manager.inDrag = false;
// mouseout doesn't happen while in drag, so compensate it here
var $header = $('.movable-header', ui.item);
$('div.block-edit-block-btn-container', $header).mouseout();
},
change: function(e, ui) {
$('div.cms-layout-btn-container').show();
}
}
);
}
// make requested elements fully visible on mouseover
$($hover_effect.join(', '))
.mouseover(
function(e) {
$(this).css('opacity', 1);
}
)
.mouseout(
function(e) {
$(this).css('opacity', 0.5);
}
);
}
);
}
TemplateManager.prototype.setupEditTranslationButtons = function ($container) {
$("span[name='cms-translate-phrase']", $container).each(
function() {
var $me = $(this);
var $parent_link = $me.parents('a:first');
if ($parent_link.length == 0) {
// span in not inside "a" tag
$me.prepend('<div class="cms-edit-btn"><div class="cms-btn-text">Edit</div></div>');
$('div.cms-edit-btn:first', $me).click(TemplateManager.prototype.translatePhrase);
$me.dblclick(
function ($e) {
$('div.cms-edit-btn:first', this).click();
return false;
}
);
var $effect_element = $me;
}
else {
// span is inside "a" tag
var $clone = $me.clone();
$clone.empty().attr('title', '');
+ // in case if "a" tag is "display: block", then make "span" the same
+ $clone.css('display', $parent_link.css('display'));
+
$parent_link.html( $me.html() ).wrap($clone);
$parent_link.before('<div class="cms-edit-btn" title="' + $me.attr('title') + '"><div class="cms-btn-text">Edit</div></div>');
$parent_link.prev('div.cms-edit-btn:first').click(TemplateManager.prototype.translatePhrase);
var $effect_element = $parent_link.parents("span[name='cms-translate-phrase']:first");
}
$effect_element
.mouseover(
function($e) {
$('div.cms-edit-btn', this).css('display', 'inline');
}
)
.mouseout(
function($e) {
$('div.cms-edit-btn', this).hide();
}
);
}
);
}
TemplateManager.prototype.translatePhrase = function ($e) {
var $translate_url = $(this).parents("span[name='cms-translate-phrase']:first").attr('href');
if ($translate_url.match(/javascript:(.*)/)) {
eval(RegExp.$1);
}
else {
window.location.href = $translate_url;
}
return false;
}
TemplateManager.prototype.renumberMovableElements = function () {
var $area_index = 0;
// 1. dynamically assign IDs to all movable elements
$('div.movable-area').each(
function() {
var $element_index = 0;
$('div.movable-element', this).each(
function() {
$(this).attr('id', 'target_order_a' + $area_index + 'e' + $element_index);
$element_index++;
}
);
$area_index++;
}
);
}
TemplateManager.prototype.saveLayout = function () {
// prepare order string
var $sort_order = [];
$('div.movable-area').each(
function($area_index) {
var $order = $(this).sortable('serialize').replace(/target_order\[\]/g, 'target_order[' + $area_index + '][]');
if ($order) {
$sort_order.push($order);
}
}
);
$sort_order = $sort_order.join('&');
// save order string
var $me = this;
var $settings = {
url: this._saveLayoutUrl + '&' + $sort_order + '&width=200&height=70&modal=true',
caption: 'Layout Saving Result',
onDataReceived: function ($data) {
var $message = '';
if ($data == 'OK') {
$message = 'New Layout Saved';
$('div.cms-layout-btn-container').hide();
$me.renumberMovableElements();
}
else {
$message = 'Failed to Save New Layout';
}
$data = '<div style="text-align: center;">' + $message + '<br/><br/><input type="button" class="button" value="OK" onclick="TB.remove();"/></div>';
return $data;
}
};
TB.setWindowTitle( window.top.document.title.replace(main_title + ' :: ', '') );
TB.show($settings);
}
TemplateManager.prototype.cancelLayout = function () {
window.location.href = window.location.href;
}
TemplateManager.prototype.onBtnClick = function ($e, $element) {
var $id = $element.id.replace(/_btn$/, '');
var $block_info = this._blocks[$id];
var $url = this._editUrl.replace('#BLOCK#', $block_info.block_name + ':' + $block_info.function_name).replace('#EVENT#', 'OnLoadBlock');
direct_edit('theme-file', $url);
$e.stopPropagation();
}
TemplateManager.prototype.onMouseOver = function ($e, $element) {
if (this.inDrag) {
return ;
}
$element = $($element);
if ($element.hasClass('block-edit-design-btn-container')) {
$($element).addClass('block-edit-design-btn-container-over');
var $button_group = $('div.cms-edit-design-btn-container:first', $element);
if ($button_group.length) {
$button_group.show();
}
else {
$('div.cms-edit-design-btn:first', $element).show();
}
}
else {
$($element).addClass('block-edit-block-btn-container-over');
$('div.cms-edit-block-btn:first', $element).show();
}
$e.stopPropagation();
}
TemplateManager.prototype.onMouseOut = function ($e, $element) {
if (this.inDrag) {
return ;
}
$element = $($element);
if ($element.hasClass('block-edit-design-btn-container')) {
$($element).removeClass('block-edit-design-btn-container-over');
var $button_group = $('div.cms-edit-design-btn-container:first', $element);
if ($button_group.length) {
$button_group.hide();
}
else {
$('div.cms-edit-design-btn:first', $element).hide();
}
}
else {
$($element).removeClass('block-edit-block-btn-container-over');
$('div.cms-edit-block-btn:first', $element).hide();
}
$e.stopPropagation();
}
TemplateManager.prototype.searchBlocks = function () {
var $design_containers = $('div.block-edit-design-btn-container');
var $block_containers = $('div.block-edit-block-btn-container');
$design_containers.each(
function() {
var $block_container = $('div.block-edit-block-btn-container:first', this);
if ($block_container.length) {
$block_containers = $block_containers.not($block_container);
// place "Edit Block" button near "Edit Design" button
var $edit_design_btn = $('div.cms-edit-design-btn:first', this);
var $edit_block_btn = $('div.cms-edit-block-btn:first', $block_container);
$edit_design_btn
.wrap('<div class="cms-edit-design-btn-container"></div>')
.before( $edit_block_btn.clone() );
$edit_block_btn.remove();
// make "hint" from "Edit Block" button container main
$(this).attr('title', $block_container.attr('title'));
$block_container.attr('title', '');
TemplateManager.prototype.registerBlock.call(aTemplateManager, $block_container.get(0), ['hover']);
}
TemplateManager.prototype.registerBlock.call(aTemplateManager, this, ['dblclick']);
}
);
$block_containers.each(
function() {
TemplateManager.prototype.registerBlock.call(aTemplateManager, this);
}
);
// $('div').each (
// function () {
// /*var $id = $(this).attr('id');
//
// if (!$id || $id.match(/parser_block\[.*\].*_btn$/) || !$id.match(/parser_block\[.*\]/)) {
// // skip other divs
// return true;
// }*/
//
//
// TemplateManager.prototype.registerBlock.call(aTemplateManager, this);
// }
// );
}
TemplateManager.prototype.registerBlock = function ($element, $skip_events) {
var $params = $element.getAttribute('params').split(':');
this._blocks[$element.id] = {
block_name: $params[0],
function_name: $params[1]
};
var $btn = document.getElementById($element.id + '_btn');
$($btn).click(
function(ev) {
TemplateManager.prototype.onBtnClick.call(aTemplateManager, ev, this);
}
);
if ($skip_events === undefined) {
$skip_events = [];
}
if (!in_array('dblclick', $skip_events)) {
$($element)
.dblclick(
function(ev) {
TemplateManager.prototype.onBtnClick.call(aTemplateManager, ev, this);
}
)
}
if (!in_array('hover', $skip_events)) {
$($element)
.mouseover(
function(ev) {
TemplateManager.prototype.onMouseOver.call(aTemplateManager, ev, this);
}
)
.mouseout(
function(ev) {
TemplateManager.prototype.onMouseOut.call(aTemplateManager, ev, this);
}
);
}
this._blockOrder.push($element.id);
}
\ No newline at end of file

Event Timeline