Index: trunk/kernel/admin_templates/incs/tree.js =================================================================== diff -u -N --- trunk/kernel/admin_templates/incs/tree.js (revision 0) +++ trunk/kernel/admin_templates/incs/tree.js (revision 4357) @@ -0,0 +1,349 @@ +function TreeItem(title, url, icon) +{ + this.Title = title; + this.Url = url; + this.Rendered = false; + this.Displayed = false; + this.Level = 0; + this.Icon = icon; +} + +TreeItem.prototype.Render = function(before) +{ + if (!this.Rendered) { + 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; + } +} + +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 = 'icons/'+this.Icon; + } + img.style.verticalAlign = 'middle'; + td.appendChild(img); +} + +TreeItem.prototype.appendLink = function (td) +{ + link = document.createElement('a'); + link.nodeValue = this.Title; + link.href = this.Url; + link.target = 'main'; + link.appendChild( document.createTextNode(this.Title) ) + td.appendChild( link ); +// td.appendChild( document.createTextNode(this.Title) ); +} + +TreeItem.prototype.display = function() +{ + this.Tr.style.display = 'block'; + this.Displayed = true; +} + +TreeItem.prototype.hide = function() +{ + this.Tr.style.display = 'none'; + this.Displayed = false; +} + +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 "+variable[prop] + ""; + s += prop+" => "+variable[prop] + "\n"; } alert(s); } @@ -803,30 +818,31 @@ var $dst_html = $aSelect.options[$dst_num].innerHTML; var $src_value = $aSelect.options[$src_num].value; var $dst_value = $aSelect.options[$dst_num].value; - + var $src_option = document.createElement('OPTION'); var $dst_option = document.createElement('OPTION'); - + $aSelect.remove($src_num); $aSelect.options.add($dst_option, $src_num); $dst_option.innerText = $dst_html; $dst_option.value = $dst_value; $dst_option.innerHTML = $dst_html; - + $aSelect.remove($dst_num); $aSelect.options.add($src_option, $dst_num); $src_option.innerText = $src_html; $src_option.value = $src_value; $src_option.innerHTML = $src_html; } - - function getXMLHTTPObject() + + function getXMLHTTPObject(content_type) { + if (!isset(content_type)) content_type = 'text/plain'; var http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { - http_request.overrideMimeType('text/plain'); + http_request.overrideMimeType(content_type); // See note below about this line } } else if (window.ActiveXObject) { // IE @@ -840,8 +856,8 @@ } return http_request; } - - function str_repeat($symbol, $count) + + function str_repeat($symbol, $count) { var $i = 0; var $ret = ''; @@ -850,4 +866,18 @@ $i++; } return $ret; + } + + function getDocumentFromXML(xml) + { + if (window.ActiveXObject) { + var doc = new ActiveXObject("Microsoft.XMLDOM"); + doc.async=false; + doc.loadXML(xml); + } + else { + var parser = new DOMParser(); + var doc = parser.parseFromString(xml,"text/xml"); + } + return doc; } \ No newline at end of file Index: trunk/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r4329 -r4357 --- trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 4329) +++ trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 4357) @@ -187,13 +187,13 @@ { // list($prefix_special, $field_name) = explode(':', $params['src']); - + $object =& $this->Application->recallObject($prefix_special); $name = $this->SelectParam($params, 'param,name,var'); - + $this->Application->Parser->SetParam($name, $object->GetField($field_name) ); }*/ - + /** * Compares block parameter with value specified * @@ -498,7 +498,7 @@ $t = $this->SelectParam($params, 't,template,block,name'); $t = eregi_replace("\.tpl$", '', $t); - + $templates_cache =& $this->Application->recallObject('TemplatesCache'); $res = $BlockParser->Parse( $templates_cache->GetTemplateBody($t, getArrayValue($params, 'is_silent')), $t ); @@ -699,6 +699,11 @@ */ function RequireLogin($params) { + $t = $this->Application->GetVar('t'); + if ($next_t = getArrayValue($params, 'next_template')) { + $t = $next_t; + } + if($permission_groups = getArrayValue($params, 'permissions')) { $permission_groups = explode('|', $permission_groups); @@ -721,8 +726,7 @@ if( !$this->Application->LoggedIn() ) { - $t = $this->Application->GetVar('t'); - $this->Application->Redirect( $params['login_template'], Array('next_template'=>$t) ); + $this->Application->Redirect( $params['login_template'], Array('next_template'=>$t) ); } else { @@ -760,7 +764,9 @@ if( (!$this->Application->LoggedIn() || !$group_access) && $condition ) { - $t = $this->Application->GetVar('t'); + if ( $this->Application->LoggedIn() && !$group_access) { + $this->Application->Redirect( $params['no_group_perm_template'], Array('next_template'=>$t) ); + } $this->Application->Redirect( $params['login_template'], Array('next_template'=>$t) ); } } @@ -834,21 +840,21 @@ $module =& $this->Application->recallObject('mod.'.$module_name); $this->Application->SetVar('m_cat_id', $module->GetDBField('RootCat') ); } - + function ImportRedirect($params) { $import_id = $this->Application->GetVar('import_id'); if ($import_id) { // redirect forward to step3 (import parameters coosing) $this->Application->StoreVar('ImportScriptID', $import_id); - + $sql = 'SELECT * FROM '.TABLE_PREFIX.'ImportScripts WHERE is_id = '.$import_id; - + $db =& $this->Application->GetADODBConnection(); $is_params = $db->GetRow($sql); - + if ($is_params['is_type'] == 'db') { $this->Application->Redirect('', null, '', 'import/step3.php'); } @@ -879,7 +885,7 @@ { return replaceModuleSection($params['icon']); } - + function StoreSystemVars($params) { // save theese variables to session, because they are useful for most configuration templates @@ -892,6 +898,12 @@ $this->Application->LinkVar('main_prefix'); // window prefix, that opener selector $this->Application->LinkVar('dst_field'); // field to set value choosed in selector $this->Application->LinkVar('return_template'); // template to go, when something was coosen from popup (from finalizePopup) + } + + function XMLTemplate($params) + { + define('DBG_SKIP_REPORTING', 1); + header('Content-type: text/xml'); } }