Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F773481
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Feb 2, 1:04 PM
Size
65 KB
Mime Type
text/x-diff
Expires
Tue, Feb 4, 1:04 PM (2 h, 6 m)
Engine
blob
Format
Raw Data
Handle
556701
Attached To
rINP In-Portal
in-portal
View Options
Index: trunk/kernel/include/debugger.php
===================================================================
--- trunk/kernel/include/debugger.php (revision 1316)
+++ trunk/kernel/include/debugger.php (revision 1317)
@@ -1,839 +1,841 @@
<?php
if(!class_exists('Debugger'))
{
function dbg_ConstOn($const_name)
{
return defined($const_name)&&constant($const_name);
}
function dbg_safeDefine($const_name,$const_value)
{
if(!defined($const_name)) define($const_name,$const_value);
}
unset($_REQUEST['debug_host']); // this var messed up whole detection stuff :(
// Detect fact, that this session beeing debugged by Zend Studio
foreach($_REQUEST as $rq_name=>$rq_value)
{
if( substr($rq_name,0,6)=='debug_' )
{
define('DBG_ZEND_PRESENT',1);
break;
}
}
dbg_safeDefine('DBG_ZEND_PRESENT',0);
// set default values for debugger constants
$dbg_constMap=Array('DBG_OPTIONS'=>0,
'DBG_USE_HIGHLIGHT'=>1,
'DBG_USE_SHUTDOWN_FUNC'=>DBG_ZEND_PRESENT?0:1,
'DBG_HANDLE_ERRORS'=>DBG_ZEND_PRESENT?0:1,
'DBG_SHOW_MEMORY_USAGE'=>1,
'DBG_IGNORE_STRICT_ERRORS'=>1,
'DOC_ROOT'=>$_SERVER['DOCUMENT_ROOT'],
'DBG_LOCAL_BASE_PATH'=>'w:');
foreach($dbg_constMap as $dbg_constName=>$dbg_constValue)
{
dbg_safeDefine($dbg_constName,$dbg_constValue);
}
// only for IE, in case if no windows php script editor defined
/*if(!defined('WINDOWS_EDITOR'))
{
$dbg_editor = 0;
$dbg_editors[0] = Array('editor' => 'c:\Program Files\UltraEdit\uedit32.exe', 'params' => '%F/%L');
$dbg_editors[1] = Array('editor' => 'c:\Program Files\Zend\ZendStudio-4.0Beta\bin\ZDE.exe', 'params' => '%F');
define('WINDOWS_EDITOR',$dbg_editors[$dbg_editor]['editor'].' '.$dbg_editors[$dbg_editor]['params']);
unset($dbg_editors,$dbg_editor);
}*/
class Debugger
{
/**
* Debugger data for building report
*
* @var Array
*/
var $Data = Array();
var $ProfilerData = Array();
var $RecursionStack = Array(); // prevent recursion when processing debug_backtrace() function results
var $TraceNextError=false;
var $Options = 0;
var $OptionsMap = Array('shutdown_func' => 1, 'error_handler' => 2,
'output_buffer' => 4, 'highlight_output' => 8);
var $longErrors=Array();
/**
* Amount of memory used by debugger itself
*
* @var Array
* @access private
*/
var $memoryUsage=Array();
function Debugger()
{
ini_set('display_errors',dbg_ConstOn('DBG_ZEND_PRESENT')?0:1);
$this->memoryUsage['error_handling']=0; // memory amount used by error handler
$this->appendRequest();
}
function initOptions()
{
}
function mapLongError($msg)
{
$key=$this->generateID();
$this->longErrors[$key]=$msg;
return $key;
}
function setOption($name,$value)
{
if( !isset($this->OptionsMap[$name]) ) die('undefined debugger option: ['.$name.']<br>');
if($value)
{
$this->Options|=$this->OptionsMap[$name];
}
else
{
$this->Options=$this->Options&~$this->OptionsMap[$name];
}
}
function getOption($name)
{
if( !isset($this->OptionsMap[$name]) ) die('undefined debugger option: ['.$name.']<br>');
return ($this->Options & $this->OptionsMap[$name]) == $this->OptionsMap[$name];
}
/**
* Set's flag, that next error that occurs will
* be prepended by backtrace results
*
*/
function traceNext()
{
$this->TraceNextError=true;
}
function dumpVars()
{
$dumpVars = func_get_args();
foreach($dumpVars as $varValue)
{
$this->Data[] = Array('value' => $varValue, 'debug_type' => 'var_dump');
}
}
function prepareHTML($dataIndex)
{
$Data =& $this->Data[$dataIndex];
if($Data['debug_type'] == 'html') return $Data['html'];
switch($Data['debug_type'])
{
case 'error':
$fileLink = $this->getFileLink($Data['file'],$Data['line']);
$ret = '<b class="debug_error">'.$this->getErrorNameByCode($Data['no']).'</b>: '.$Data['str'];
$ret .= ' in <b>'.$fileLink.'</b> on line <b>'.$Data['line'].'</b>';
return $ret;
break;
case 'var_dump':
return $this->highlightString( print_r($Data['value'], true) );
break;
case 'trace':
ini_set('memory_limit','500M');
$trace =& $Data['trace'];
//return 'sorry';
//return $this->highlightString(print_r($trace,true));
$i = 0; $traceCount = count($trace);
$ret = '';
while($i < $traceCount)
{
$traceRec =& $trace[$i];
$argsID = 'trace_args_'.$dataIndex.'_'.$i;
if(isset($traceRec['file']))
{
$func_name=isset($traceRec['class'])?$traceRec['class'].$traceRec['type'].$traceRec['function']:$traceRec['function'];
$ret .= '<a href="javascript:toggleTraceArgs(\''.$argsID.'\');" title="Show/Hide Function Arguments"><b>Function</b></a>: '.$this->getFileLink($traceRec['file'],$traceRec['line'],$func_name);
$ret .= ' in <b>'.basename($traceRec['file']).'</b> on line <b>'.$traceRec['line'].'</b><br>';
}
else
{
$ret .= 'no file information available';
}
// ensure parameter value is not longer then 200 symbols
$this->processTraceArguments($traceRec['args']);
$args = $this->highlightString(print_r($traceRec['args'], true));
$ret .= '<div id="'.$argsID.'" style="display: none;">'.$args.'</div>';
$i++;
}
return $ret;
break;
case 'profiler':
$profileKey = $Data['profile_key'];
$Data =& $this->ProfilerData[$profileKey];
$runtime = ($Data['ends'] - $Data['begins']); // in seconds
return '<b>Name</b>: '.$Data['description'].'<br><b>Runtime</b>: '.$runtime.'s';
break;
default:
return 'incorrect debug data';
break;
}
}
function processTraceArguments(&$traceArgs)
{
if(!$traceArgs) return '';
foreach ($traceArgs as $argID => $argValue)
{
if( is_array($argValue) || is_object($argValue) )
{
if(is_object($argValue) && !in_array(get_class($argValue),$this->RecursionStack) )
{
// object & not in stack - ok
array_push($this->RecursionStack, get_class($argValue));
settype($argValue,'array');
$this->processTraceArguments($argValue);
array_pop($this->RecursionStack);
}
elseif(is_object($argValue) && in_array(get_class($argValue),$this->RecursionStack) )
{
// object & in stack - recursion
$traceArgs[$argID] = '**** RECURSION ***';
}
else
{
// normal array here
$this->processTraceArguments($argValue);
}
}
else
{
$traceArgs[$argID] = $this->cutStringForHTML($traceArgs[$argID]);
}
}
}
function cutStringForHTML($string)
{
if( strlen($string) > 200 ) $string = substr($string,0,50).' ...';
return $string;
}
/**
* Format SQL Query using predefined formatting
* and highlighting techniques
*
* @param string $sql
* @return string
*/
function formatSQL($sql)
{
$sql = preg_replace('/(\n|\t| )+/is',' ',$sql);
$sql = preg_replace('/(CREATE TABLE|DROP TABLE|SELECT|UPDATE|SET|REPLACE|INSERT|DELETE|VALUES|FROM|LEFT JOIN|INNER JOIN|LIMIT|WHERE|HAVING|GROUP BY|ORDER BY) /is', "\n\t$1 ",$sql);
return $this->highlightString($sql);
}
function highlightString($string)
{
if( dbg_ConstOn('DBG_USE_HIGHLIGHT') )
{
+ $string = str_replace('\\','_no_match_string_',$string);
$string = highlight_string('<?php '.$string.'?>', true);
+ $string = str_replace('_no_match_string_','\\',$string);
return preg_replace('/<\?(.*)php (.*)\?>/s','$2',$string);
}
else
{
return $string;
}
}
function getFileLink($file, $lineno = 1, $title = '')
{
if(!$title) $title = $file;
$is_mozilla=strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'firefox')!==false?true:false;
if($is_mozilla)
{
return '<a href="file://'.$this->getLocalFile($file).'">'.$title.'</a>';
}
else
{
return '<a href="javascript:editFile(\''.$this->getLocalFile($file).'\','.$lineno.');" title="'.$file.'">'.$title.'</a>';
}
}
function getLocalFile($remoteFile)
{
return str_replace(DOC_ROOT, DBG_LOCAL_BASE_PATH, $remoteFile);
}
function appendTrace()
{
$trace = debug_backtrace();
array_shift($trace);
$this->Data[] = Array('trace' => $trace, 'debug_type' => 'trace');
}
function appendHTML($html)
{
$this->Data[] = Array('html' => $html,'debug_type' => 'html');
}
/**
* Change debugger info that was already generated before.
* Returns true if html was set.
*
* @param int $index
* @param string $html
* @param string $type = {'append','prepend','replace'}
* @return bool
*/
function setHTMLByIndex($index,$html,$type='append')
{
if( !isset($this->Data[$index]) || $this->Data[$index]['debug_type'] != 'html' )
{
return false;
}
switch ($type)
{
case 'append':
$this->Data[$index]['html'] .= '<br>'.$html;
break;
case 'prepend':
$this->Data[$index]['html'] = $this->Data[$index]['html'].'<br>'.$html;
break;
case 'replace':
$this->Data[$index]['html'] = $html;
break;
}
return true;
}
/**
* Move $debugLineCount lines of input from debug output
* end to beginning.
*
* @param int $debugLineCount
*/
function moveToBegin($debugLineCount)
{
$lines = array_splice($this->Data,count($this->Data)-$debugLineCount,$debugLineCount);
$this->Data = array_merge($lines,$this->Data);
}
function moveAfterRow($new_row, $debugLineCount)
{
$lines = array_splice($this->Data,count($this->Data)-$debugLineCount,$debugLineCount);
$rows_before = array_splice($this->Data,0,$new_row,$lines);
$this->Data = array_merge($rows_before,$this->Data);
}
function appendRequest()
{
$script = $_SERVER['PATH_TRANSLATED'];
$this->appendHTML('ScriptName: <b>'.$this->getFileLink($script,1,basename($script)).'</b> (<b>'.dirname($script).'</b>)');
ob_start();
?>
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="dbg_flat_table">
<thead style="font-weight: bold;">
<td width="20">Src</td><td>Name</td><td>Value</td>
</thead>
<?php
foreach($_REQUEST as $key => $value)
{
if( !is_array($value) && trim($value) == '' )
{
$value = '<b class="debug_error">no value</b>';
}
else
{
$value = htmlspecialchars(print_r($value, true));
}
$src = isset($_GET[$key]) ? 'GE' : (isset($_POST[$key]) ? 'PO' : (isset($_COOKIE[$key]) ? 'CO' : '?') );
echo '<tr><td>'.$src.'</td><td>'.$key.'</td><td>'.$value.'</td></tr>';
}
?>
</table>
<?php
$this->appendHTML( ob_get_contents() );
ob_end_clean();
}
function appendSession()
{
if( isset($_SESSION)&&$_SESSION )
{
$this->appendHTML('PHP Session: [<b>'.ini_get('session.name').'</b>]');
$this->dumpVars($_SESSION);
$this->moveToBegin(2);
}
}
function profileStart($key, $description)
{
$timeStamp = $this->getMoment();
$this->ProfilerData[$key] = Array('begins' => $timeStamp, 'ends' => 5000, 'debuggerRowID' => count($this->Data), 'description' => $description);
$this->Data[] = array('profile_key' => $key, 'debug_type' => 'profiler');
}
function profileFinish($key)
{
$this->ProfilerData[$key]['ends'] = $this->getMoment();
}
function getMoment()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
function generateID()
{
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 getErrorNameByCode($errorCode)
{
switch($errorCode)
{
case E_USER_ERROR:
return 'Fatal Error';
break;
case E_WARNING:
case E_USER_WARNING:
return 'Warning';
break;
case E_NOTICE:
case E_USER_NOTICE:
return 'Notice';
break;
case E_STRICT:
return 'PHP5 Strict';
break;
default:
return '';
break;
}
}
/**
* Generates report
*
*/
function printReport($returnResult = false)
{
if( dbg_ConstOn('DBG_ZEND_PRESENT') ) return;
dbg_safeDefine('DBG_RAISE_ON_WARNINGS',0);
$this->memoryUsage['debugger_start']=memory_get_usage();
// show php session if any
$this->appendSession();
// ensure, that 1st line of debug output always is this one:
$this->appendHTML('<a href="javascript:toggleDebugLayer(27);">Hide Debugger</a>');
$this->moveToBegin(1);
$i = 0; $lineCount = count($this->Data);
ob_start();
?>
<style type="text/css">
.dbg_flat_table {
border-collapse: collapse;
}
.dbg_flat_table TD {
border: 1px solid buttonface;
}
.debug_layer_table {
border-collapse: collapse;
width: 480px;
}
.debug_text, .debug_row_even TD, .debug_row_odd TD {
color: #000000;
font-family: Verdana;
font-size: 11px;
word-wrap: break-word;
}
.debug_cell {
border: 1px solid #FF0000;
padding: 2px;
word-wrap: break-word;
}
.debug_row_even {
background-color: #CCCCFF;
}
.debug_row_odd {
background-color: #FFFFCC;
}
.debug_layer_container {
left: 2px;
top: 1px;
width: 500px;
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;
width: 480px;
}
.debug_error {
color: #FF0000;
}
</style>
<div id="debug_layer" class="debug_layer_container" style="display: none;">
<div class="debug_layer">
<table width="100%" cellpadding="0" cellspacing="1" border="0" class="debug_layer_table">
<?php
while ($i < $lineCount)
{
echo '<tr class="debug_row_'.(($i % 2) ? 'odd' : 'even').'"><td class="debug_cell">'.$this->prepareHTML($i).'</td></tr>';
$i++;
}
?>
</table>
</div>
</div>
<script language="javascript">
function getEventKeyCode($e)
{
var $KeyCode = 0;
if($e.keyCode) $KeyCode = $e.keyCode;
else if($e.which) $KeyCode = $e.which;
return $KeyCode;
}
function keyProcessor($e)
{
if(!$e) $e = window.event;
var $KeyCode = getEventKeyCode($e);
if($KeyCode==123||$KeyCode==27) // F12 or ESC
{
toggleDebugLayer($KeyCode);
$e.cancelBubble = true;
if($e.stopPropagation) $e.stopPropagation();
}
}
function toggleDebugLayer($KeyCode)
{
var $isVisible=false;
var $DebugLayer = document.getElementById('debug_layer');
if( typeof($DebugLayer) != 'undefined' )
{
$isVisible = ($DebugLayer.style.display == 'none')?false:true;
if(!$isVisible&&$KeyCode==27) return false;
resizeDebugLayer(null);
$DebugLayer.style.display = $isVisible?'none':'block';
}
}
function prepareSizes($Prefix)
{
var $ret = '';
$ret = eval('document.body.'+$Prefix+'Top')+'; ';
$ret += eval('document.body.'+$Prefix+'Left')+'; ';
$ret += eval('document.body.'+$Prefix+'Height')+'; ';
$ret += eval('document.body.'+$Prefix+'Width')+'; ';
return $ret;
}
function resizeDebugLayer($e)
{
if(!$e) $e = window.event;
var $DebugLayer = document.getElementById('debug_layer');
var $TopMargin = 1;
if( typeof($DebugLayer) != 'undefined' )
{
$DebugLayer.style.top = parseInt(document.body.offsetTop + document.body.scrollTop) + $TopMargin;
$DebugLayer.style.height = document.body.clientHeight - $TopMargin - 5;
}
//window.parent.status = 'OFFSET: '+prepareSizes('offset')+' | SCROLL: '+prepareSizes('scroll')+' | CLIENT: '+prepareSizes('client');
//window.parent.status += 'DL Info: '+$DebugLayer.style.top+'; S.AH: '+screen.availHeight;
return true;
}
function SetClipboard(copyText)
{
if(window.clipboardData)
{
// IE send-to-clipboard method.
window.clipboardData.setData('Text', copyText);
}
else if (window.netscape)
{
// You have to sign the code to enable this or allow the action in about:config by changing user_pref("signed.applets.codebase_principal_support", true);
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
// Store support string in an object.
var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
if (!str) return false;
str.data=copyText;
// Make transferable.
var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
if (!trans) return false;
// Specify what datatypes we want to obtain, which is text in this case.
trans.addDataFlavor("text/unicode");
trans.setTransferData("text/unicode",str,copyText.length*2);
var clipid=Components.interfaces.nsIClipboard;
var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(clipid);
if (!clip) return false;
clip.setData(trans,null,clipid.kGlobalClipboard);
}
}
function showProps($Obj, $Name)
{
var $ret = '';
for($Prop in $Obj)
{
$ret += $Name+'.'+$Prop+' = '+$Obj[$Prop]+"\n";
}
return $ret;
}
function editFile($fileName,$lineNo)
{
if(!document.all)
{
alert('Only works in IE');
return;
}
var $editorPath = '<?php echo defined('WINDOWS_EDITOR') ? addslashes(WINDOWS_EDITOR) : '' ?>';
if($editorPath)
{
var $obj = new ActiveXObject("LaunchinIE.Launch");
$editorPath = $editorPath.replace('%F',$fileName);
$editorPath = $editorPath.replace('%L',$lineNo);
$obj.LaunchApplication($editorPath);
}
else
{
alert('Editor path not defined!');
}
}
function toggleTraceArgs($ArgsLayerID)
{
var $ArgsLayer = document.getElementById($ArgsLayerID);
$ArgsLayer.style.display = ($ArgsLayer.style.display == 'none') ? 'block' : 'none';
}
document.onkeydown = keyProcessor;
window.onresize = resizeDebugLayer;
window.onscroll = resizeDebugLayer;
window.focus();
if( typeof($isFatalError) != 'undefined' && $isFatalError == 1 || <?php echo DBG_RAISE_ON_WARNINGS; ?> )
{
toggleDebugLayer();
}
if( typeof($isFatalError) != 'undefined' && $isFatalError == 1)
{
document.getElementById('debug_layer').scrollTop = 10000000;
}
</script>
<?php
$this->memoryUsage['debugger_finish']=memory_get_usage();
$this->memoryUsage['print_report']=$this->memoryUsage['debugger_finish']-$this->memoryUsage['debugger_start'];
$this->memoryUsage['total']=$this->memoryUsage['print_report']+$this->memoryUsage['error_handling'];
$this->memoryUsage['application']=memory_get_usage()-$this->memoryUsage['total'];
if($returnResult)
{
$ret = ob_get_contents();
ob_clean();
if( dbg_ConstOn('DBG_SHOW_MEMORY_USAGE') ) $ret.=$this->getMemoryUsageReport();
return $ret;
}
else
{
ob_end_flush();
if( dbg_ConstOn('DBG_SHOW_MEMORY_USAGE') ) echo $this->getMemoryUsageReport();
}
}
/**
* Format's memory usage report by debugger
*
* @return string
* @access private
*/
function getMemoryUsageReport()
{
$info=Array('<a href="javascript:self.location.reload()">printReport</a>'=>'print_report',
'saveError'=>'error_handling',
'Total'=>'total',
'Application'=>'application');
$ret=Array();
foreach($info as $title => $value_key)
{
$ret[]='<tr><td>'.$title.':</td><td><b>'.$this->formatSize($this->memoryUsage[$value_key]).'</b></td></tr>';
}
return '<table class="dbg_flat_table">'.implode('',$ret).'</table>';
}
/**
* User-defined error handler
*
* @param int $errno
* @param string $errstr
* @param string $errfile
* @param int $errline
* @param array $errcontext
*/
function saveError($errno, $errstr, $errfile = '', $errline = '', $errcontext = '')
{
$memory_used=Array();
$memory_used['begin']=memory_get_usage();
$errorType = $this->getErrorNameByCode($errno);
if(!$errorType)
{
trigger_error('Unknown error type ['.$errno.']', E_USER_ERROR);
return false;
}
if( dbg_ConstOn('DBG_IGNORE_STRICT_ERRORS') && defined('E_STRICT') && ($errno == E_STRICT) ) return;
$long_id_pos=strrpos($errstr,'#');
if($long_id_pos!==false)
{
// replace short message with long one (due triger_error limitations on message size)
$long_id=substr($errstr,$long_id_pos+1,strlen($errstr));
$errstr=$this->longErrors[$long_id];
unset($this->longErrors[$long_id]);
}
if( strpos($errfile,'eval()\'d code') !== false )
{
$errstr = '[<b>EVAL</b>, line <b>'.$errline.'</b>]: '.$errstr;
$tmpStr = $errfile;
$pos = strpos($tmpStr,'(');
$errfile = substr($tmpStr,0,$pos);
$pos++;
$errline = substr($tmpStr,$pos,strpos($tmpStr,')',$pos)-$pos);
}
if($this->TraceNextError)
{
$this->appendTrace();
$this->TraceNextError=false;
}
$this->Data[] = Array('no' => $errno, 'str' => $errstr, 'file' => $errfile, 'line' => $errline, 'context' => $errcontext, 'debug_type' => 'error');
$memory_used['end']=memory_get_usage();
$this->memoryUsage['error_handling']+=$memory_used['end']-$memory_used['begin'];
if( substr($errorType,0,5) == 'Fatal')
{
echo '<script language="javascript">var $isFatalError = 1;</script>';
exit;
}
}
function saveToFile($msg)
{
$fp = fopen($_SERVER['DOCUMENT_ROOT'].'/vb_debug.txt', 'a');
fwrite($fp,$msg."\n");
fclose($fp);
}
/**
* Formats file/memory size in nice way
*
* @param int $bytes
* @return string
* @access public
*/
function formatSize($bytes)
{
if ($bytes >= 1099511627776) {
$return = round($bytes / 1024 / 1024 / 1024 / 1024, 2);
$suffix = "TB";
} elseif ($bytes >= 1073741824) {
$return = round($bytes / 1024 / 1024 / 1024, 2);
$suffix = "GB";
} elseif ($bytes >= 1048576) {
$return = round($bytes / 1024 / 1024, 2);
$suffix = "MB";
} elseif ($bytes >= 1024) {
$return = round($bytes / 1024, 2);
$suffix = "KB";
} else {
$return = $bytes;
$suffix = "Byte";
}
$return .= ' '.$suffix;
return $return;
}
}
if( !function_exists('memory_get_usage') )
{
function memory_get_usage(){ return -1; }
}
$debugger = new Debugger();
if(dbg_ConstOn('DBG_HANDLE_ERRORS')) set_error_handler( array(&$debugger,'saveError') );
if(dbg_ConstOn('DBG_USE_SHUTDOWN_FUNC')) register_shutdown_function( array(&$debugger,'printReport') );
}
?>
\ No newline at end of file
Property changes on: trunk/kernel/include/debugger.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.27
\ No newline at end of property
+1.28
\ No newline at end of property
Index: trunk/kernel/admin/include/toolbar/editcategory_relationselect.php
===================================================================
--- trunk/kernel/admin/include/toolbar/editcategory_relationselect.php (revision 1316)
+++ trunk/kernel/admin/include/toolbar/editcategory_relationselect.php (revision 1317)
@@ -1,656 +1,657 @@
<?php
global $objConfig,$objSections,$section, $rootURL,$adminURL,$imagesURL,$envar,
$m_var_list_update,$objCatList, $homeURL, $upURL, $objSession,$CatScopeClause,$DefaultTab;
global $CategoryFilter,$TotalItemCount;
global $Bit_All,$Bit_Pending,$Bit_Disabled,$Bit_New,$Bit_Pop,$Bit_Hot,$Bit_Ed;
global $hideSelectAll;
/* bit place holders for category view menu */
$Bit_Active=64;
$Bit_Pending=32;
$Bit_Disabled=16;
$Bit_New=8;
$Bit_Pop=4;
$Bit_Hot=2;
$Bit_Ed=1;
if(strlen($_GET["SetTab"]))
{
if($_GET["SetTab"] != "categories")
{
$m_tab_CatTab_Hide = 1;
$DefaultTab = $_GET["SetTab"];
}
else
{
$DefaultTab="categories";
$m_tab_CatTab_Hide = 0;
}
}
else
$m_tab_CatTab_Hide = (int)$objConfig->Get("CatTab_Hide");
$CategoryView = $objConfig->Get("Category_View");
if(!is_numeric($CategoryView))
{
$CategoryView = 127;
}
$Category_Sortfield = $objConfig->Get("Category_Sortfield");
if(!strlen($Category_Sortfield))
$Category_Sortfield = "Name";
$Category_Sortorder = $objConfig->Get("Category_Sortorder");
if(!strlen($Category_Sortorder))
$Category_Sortorder = "desc";
$Perpage_Category = (int)$objConfig->Get("Perpage_Category");
if(!$Perpage_Category)
$Perpage_Category="'all'";
if($CategoryView == 127)
{
$Category_ShowAll = 1;
}
else
{
$Category_ShowAll=0;
$Status = array();
$Mod = array();
if($CategoryView & $Bit_Pending)
$Status[] = STATUS_PENDING;
if($CategoryView & $Bit_Active)
$Status[] = STATUS_ACTIVE;
if($CategoryView & $Bit_Disabled)
$Status[] = STATUS_DISABLED;
if(count($Status))
{
$CategoryFilter .= " AND (Status IN (".implode(",",$Status).") ";
}
else
$CategoryFilter .= " AND ((Status=-1) ";
if($CategoryView & $Bit_Ed)
{
$CategoryFilter .= " OR (EditorsPick=1) ";
}
if($CategoryView & $Bit_New)
{
$cutoff = adodb_date("U") - ($objConfig->Get("Category_DaysNew") * 86400);
$CategoryFilter .= " OR (CreatedOn > ".$cutoff.") ";
}
$CategoryFilter .= ")";
}
$list = $objSession->GetVariable("SearchWord");
if(strlen($list))
{
$CatScope = $objSession->GetVariable("SearchScope");
switch($CatScope)
{
case 0 :
$CatScopeClause = "";
break;
case 1:
$cat = $objCatList->CurrentCategoryID();
if($cat>0)
{
$allcats = $objCatList->AllSubCats($cat);
if(count($allcats)>0)
{
$catlist = implode(",",$allcats);
$CatScopeClause = " CategoryId IN ($catlist) ";
}
}
break;
case 2:
$CatScopeClause = "CategoryId=".$objCatList->CurrentCategoryID();
break;
}
}
else
$CatScopeClause="";
$mnuClearSearch = language("la_SearchMenu_Clear");
$mnuNewSearch = language("la_SearchMenu_New");
$mnuSearchCategory = language("la_SearchMenu_Categories");
$lang_New = language("la_Text_New");
$lang_Hot = language("la_Text_Hot");
$lang_EdPick = language("la_prompt_EditorsPick");
$lang_Pop = language("la_Text_Pop");
$lang_Rating = language("la_prompt_Rating");
$lang_Hits = language("la_prompt_Hits");
$lang_Votes = language("la_prompt_Votes");
$lang_Name = language("la_prompt_Name");
$lang_Categories = language("la_ItemTab_Categories");
$lang_Description = language("la_prompt_Description");
$lang_MetaKeywords = language("la_prompt_MetaKeywords");
$lang_SubSearch = language("la_prompt_SubSearch");
$lang_Within = language("la_Text_Within");
$lang_Current = language("la_Text_Current");
$lang_Active = language("la_Text_Active");
$lang_SubCats = language("la_Text_SubCats");
$lang_SubItems = language("la_Text_Subitems");
$selector = isset($_GET['Selector']) ? '&Selector='.$_GET['Selector'] : '';
print <<<END
<script language="JavaScript">
var Category_Sortfield = '$Category_Sortfield';
var Category_Sortorder = '$Category_Sortorder';
var Category_Perpage = $Perpage_Category;
var Category_ShowAll = $Category_ShowAll;
var CategoryView = $CategoryView;
var default_tab = "$DefaultTab";
//JS Language variables
var lang_New = "$lang_New";
var lang_Hot = "$lang_Hot";
var lang_EdPick = "$lang_EdPick";
var lang_Pop = "$lang_Pop";
var lang_Rating = "$lang_Rating";
var lang_Hits = "$lang_Hits";
var lang_Votes = "$lang_Votes";
var lang_Name = "$lang_Name";
var lang_Categories = "$lang_Categories";
var lang_Description = "$lang_Description";
var lang_MetaKeywords = "$lang_MetaKeywords";
var lang_SubSearch = "$lang_SubSearch";
var lang_Within="$lang_Within";
var lang_Current = "$lang_Current";
var lang_Active = "$lang_Active";
var lang_SubCats = "$lang_SubCats";
var lang_SubItems = "$lang_SubItems";
var m_tab_CatTab_hide = $m_tab_CatTab_Hide;
var hostname = '$rootURL';
var env = '$envar';
var actionlist = new Array();
var homeURL = "$homeURL$selector";
var upURL = "$upURL$selector";
var Categories_Paste = false;
function InitPage()
{
addCommonActions();
initToolbar('mainToolBar', actionHandler);
initCheckBoxes();
toggleMenu();
}
function AddButtonAction(actionname,actionval)
{
var item = new Array(actionname,actionval);
actionlist[actionlist.length] = item;
}
function actionHandler(button)
{
//alert('a button has been pressed!');
for(i=0; i<actionlist.length;i++)
{
a = actionlist[i];
if(button.action==a[0])
{
//alert('Button action '+a[0]+' is '+a[1]);
eval(a[1]);
break;
}
}
}
function addCommonActions()
{
AddButtonAction('upcat',"get_to_server(upURL,'');");// UP
AddButtonAction('homecat',"get_to_server(homeURL,'');"); //home
AddButtonAction('select',"check_submit();"); //edit
AddButtonAction('stop',"window.close();"); //delete
AddButtonAction('view',"toggleMenu(); window.FW_showMenu(window.cat_menu,getRealLeft(button) - ((document.all) ? 6 : -2),getRealTop(button)+32);");
- AddButtonAction('search_a',"setSearchMenu(); window.FW_showMenu(window.SearchMenu,getRealLeft(button)-134 - ((document.all) ? 8 : -1),getRealTop(button)+22);");
+ //AddButtonAction('search_a',"setSearchMenu(); window.FW_showMenu(window.SearchMenu,getRealLeft(button)-134 - ((document.all) ? 8 : -1),getRealTop(button)+22);");
AddButtonAction('search_b',"search_submit();");
+ AddButtonAction('search_c',"ClearSearch();");
}
function AdminCatNav(url)
{
f = document.getElementById("admin_search");
if(f)
{
f.action = url;
new_search_submit();
}
}
function search_submit()
{
f = document.getElementById("admin_search");
if(f)
{
//alert('Setting SearchWord to ' + f.value);
f.Action.value = "m_SearchWord";
f.submit();
}
}
function new_search_submit()
{
var newSearchInput = document.getElementById("NewSearch");
if (newSearchInput) newSearchInput.value = 1;
search_submit();
}
function ClearSearch()
{
//alert('Clearing Search');
f = document.getElementById("admin_search");
if(f)
{
f.Action.value = "m_ClearSearch";
f.submit();
}
}
function SetSearchType(value)
{
f = document.getElementById("admin_search");
if(f)
{
f.SearchType.value = value;
}
}
function SetSearchScope(value)
{
f = document.getElementById("admin_search");
if(f)
{
f.SearchScope.value = value;
}
}
function ToggleNewSearch()
{
f = document.getElementById("admin_search");
if(f)
{
value = f.NewSearch.value;
if(value==1)
{
f.NewSearch.value=0;
}
else
f.NewSearch.value=1;
}
}
function isNewSearch()
{
f = document.getElementById("admin_search");
if(f)
{
return f.NewSearch.value;
}
else return 0;
}
function get_to_server(path,attr)
{
if(attr.length>0)
path = path + '?'+attr;
//alert(path);
window.location.href=path;
return true;
}
function check_submit()
{
var formname = '';
if ((activeTab) && (!isAnyChecked('categories')))
{
form_name = activeTab.id;
}
else
{
form_name = 'categories';
}
var f = document.getElementsByName(form_name+'_form')[0];
var bf = window.opener.document.getElementById('popup');
if(bf)
{
if(LastCheckedItem)
{
try{
item_id = LastCheckedItem.value;
item_type = LastCheckedItem.ItemType;
}
catch(err)
{
}
bf.TargetId.value = item_id;
bf.TargetType.value = item_type;
bf.submit();
window.close();
}
else {
theMainScript.Alert(lang_Selection_Empty);
}
}
} // check submit
function flip_current(field_suffix)
{
if(activeTab)
{
field = activeTab.getAttribute("tabTitle")+field_suffix;
return flip(eval(field));
}
}
function config_current(field_suffix,value)
{
if(activeTab)
{
field = activeTab.getAttribute("tabTitle")+field_suffix;
config_val(field,value);
}
}
function getSType(type,value)
{
f = document.getElementById("admin_search");
if(f)
{
if (f.SearchType.value == type) return 2; else return 0;
} else return 0;
}
function getSScope(scope)
{
f = document.getElementById("admin_search");
if(f)
{
if (f.SearchScope.value == scope) return 2; else return 0;
} else return 0;
}
- function setSearchMenu()
- {
-
- window.SearchMenu = new Menu("search");
- SearchMenu.addMenuItem(lang_All,"SetSearchType('all');",getSType('all'));
- SearchMenu.addMenuSeparator()
-
- SearchMenu.addMenuItem(lang_Categories, "SetSearchType('categories');",getSType('categories'));
- param = "";
-
- for (var i = 0; i < tabIDs.length; i++)
- {
- d = document.getElementById(tabIDs[i]);
- if(d)
- {
- tabname = d.getAttribute("tabTitle");
- param = "SetSearchType('"+tabname+"');";
-
- SearchMenu.addMenuItem(tabname,param,getSType(tabname));
- }
- }
-
- SearchMenu.addMenuSeparator();
- SearchMenu.addMenuItem(lang_All+' '+lang_Categories,"SetSearchScope('0');",getSScope(0));
- SearchMenu.addMenuItem(lang_SubSearch,"ToggleNewSearch();",isNewSearch());
- SearchMenu.addMenuItem(lang_Current+' '+lang_Categories,"SetSearchScope('2');",getSScope(2));
- SearchMenu.addMenuItem(lang_Within+' '+lang_Categories,"SetSearchScope('1');",getSScope(1));
-
- SearchMenu.addMenuSeparator();
-
- window.SearchMenu.addMenuItem('$mnuClearSearch',"ClearSearch();","");
- window.triedToWriteMenus = false;
- window.SearchMenu.writeMenus();
- }
+// function setSearchMenu()
+// {
+//
+// window.SearchMenu = new Menu("search");
+// SearchMenu.addMenuItem(lang_All,"SetSearchType('all');",getSType('all'));
+// SearchMenu.addMenuSeparator()
+//
+// SearchMenu.addMenuItem(lang_Categories, "SetSearchType('categories');",getSType('categories'));
+// param = "";
+//
+// for (var i = 0; i < tabIDs.length; i++)
+// {
+// d = document.getElementById(tabIDs[i]);
+// if(d)
+// {
+// tabname = d.getAttribute("tabTitle");
+// param = "SetSearchType('"+tabname+"');";
+//
+// SearchMenu.addMenuItem(tabname,param,getSType(tabname));
+// }
+// }
+//
+// SearchMenu.addMenuSeparator();
+// SearchMenu.addMenuItem(lang_All+' '+lang_Categories,"SetSearchScope('0');",getSScope(0));
+// SearchMenu.addMenuItem(lang_SubSearch,"ToggleNewSearch();",isNewSearch());
+// SearchMenu.addMenuItem(lang_Current+' '+lang_Categories,"SetSearchScope('2');",getSScope(2));
+// SearchMenu.addMenuItem(lang_Within+' '+lang_Categories,"SetSearchScope('1');",getSScope(1));
+//
+// SearchMenu.addMenuSeparator();
+//
+// window.SearchMenu.addMenuItem('$mnuClearSearch',"ClearSearch();","");
+// window.triedToWriteMenus = false;
+// window.SearchMenu.writeMenus();
+// }
function Category_SortMenu(caption)
{
menu_sorting = new Menu(caption);
menu_sorting.addMenuItem(lang_Asc,"config_val('Category_Sortorder','asc');",RadioIsSelected(Category_Sortorder,'asc'));
menu_sorting.addMenuItem(lang_Desc,"config_val('Category_Sortorder','desc');",RadioIsSelected(Category_Sortorder,'desc'));
menu_sorting.addMenuSeparator();
menu_sorting.addMenuItem(lang_Default,"config_val('Category_Sortfield','Name');","");
menu_sorting.addMenuItem(lang_Name,"config_val('Category_Sortfield','Name');",RadioIsSelected(Category_Sortfield,'Name'));
menu_sorting.addMenuItem(lang_Description,"config_val('Category_Sortfield','Description');",RadioIsSelected(Category_Sortfield,'Description'));
menu_sorting.addMenuItem(lang_CreatedOn,"config_val('Category_Sortfield','CreatedOn');",RadioIsSelected(Category_Sortfield,'CreatedOn'));
menu_sorting.addMenuItem(lang_SubCats,"config_val('Category_Sortfield','CachedDescendantCatsQty');",RadioIsSelected(Category_Sortfield,'CachedDescendantCatsQty'));
menu_sorting.addMenuItem(lang_SubItems,"config_val('Category_Sortfield','SubItems');",RadioIsSelected(Category_Sortfield,'SubItems'));
return menu_sorting;
}
function Category_FilterMenu(caption)
{
menu_filter = new Menu(caption);
menu_filter.addMenuItem(lang_All,"config_val('Category_View', 127);",CategoryView==127);
menu_filter.addMenuSeparator();
menu_filter.addMenuItem(lang_Active,"FlipBit('Category_View',CategoryView,6);",BitStatus(CategoryView,6));
menu_filter.addMenuItem(lang_Pending,"FlipBit('Category_View',CategoryView,5);", BitStatus(CategoryView,5));
menu_filter.addMenuItem(lang_Disabled,"FlipBit('Category_View',CategoryView,4);",BitStatus(CategoryView,4));
menu_filter.addMenuSeparator();
menu_filter.addMenuItem(lang_New,"FlipBit('Category_View',CategoryView,3);",BitStatus(CategoryView,3));
menu_filter.addMenuItem(lang_EdPick,"FlipBit('Category_View',CategoryView,0);",BitStatus(CategoryView,0));
return menu_filter;
}
function toggleMenu()
{
//var tab_title = GetTabTitle(activeTab.id);
//alert(tab_title);
if ((document.getElementById('categories').active) && (activeTab))
{
filterfunc = activeTab.getAttribute("tabTitle")+'_FilterMenu();';
window.cat_menu_filter_sub = Category_FilterMenu(lang_Categories);
window.sub_menu_filter_sub = eval(filterfunc);
window.cat_menu_filter = new Menu(lang_View);
cat_menu_filter.addMenuItem(cat_menu_filter_sub);
cat_menu_filter.addMenuItem(sub_menu_filter_sub);
}
else
{
if (document.getElementById('categories').active)
{
window.cat_menu_filter = Category_FilterMenu(lang_View);
}
if (activeTab)
{
filterfunc = activeTab.getAttribute("tabTitle")+'_FilterMenu();';
window.cat_menu_filter = eval(filterfunc);
}
} // Filter
//Sorting
if ((document.getElementById('categories').active) && (activeTab))
{
//Sort->Categories
sortfunc = activeTab.getAttribute("tabTitle")+'_SortMenu();';
window.cat_menu_sorting_sub = Category_SortMenu(lang_Categories);
window.sub_menu_sorting_sub = eval(sortfunc);
window.cat_menu_sorting = new Menu(lang_Sort);
cat_menu_sorting.addMenuItem(cat_menu_sorting_sub);
cat_menu_sorting.addMenuItem(sub_menu_sorting_sub);
}
else
{
if (document.getElementById('categories').active)
{
window.cat_menu_sorting = Category_SortMenu(lang_Sort);
} // categories
if (activeTab)
{
window.cat_menu_sorting = Category_SortMenu(lang_Sort);
}
} // && Sorting
if ((document.getElementById('categories').active) && (activeTab))
{
window.cat_menu_select_sub = new Menu(lang_Categories);
cat_menu_select_sub.addMenuItem(lang_All,"javascript:selectAll('categories');","");
cat_menu_select_sub.addMenuItem(lang_Unselect,"javascript:unselectAll('categories');","");
cat_menu_select_sub.addMenuItem(lang_Invert,"javascript:invert('categories');","");
selectfunc = activeTab.getAttribute("tabTitle")+"_SelectMenu();";
window.sub_menu_select_sub = eval(selectfunc);
// sub_menu_select_sub.addMenuItem(lang_All,"javascript:selectAll('"+activeTab.id+"');","");
// sub_menu_select_sub.addMenuItem(lang_Unselect,"javascript:unselectAll('"+activeTab.id+"');","");
// sub_menu_select_sub.addMenuItem(lang_Invert,"javascript:invert('"+activeTab.id+"');","");
END;
if (!$hideSelectAll) {
echo "
window.cat_menu_select = new Menu(lang_Select);
cat_menu_select.addMenuItem(cat_menu_select_sub);
cat_menu_select.addMenuItem(sub_menu_select_sub);";
}
print <<<END
}
else
{
END;
if (!$hideSelectAll) {
echo '
if (document.getElementById(\'categories\').active)
{
window.cat_menu_select = new Menu(lang_Select);
cat_menu_select.addMenuItem(lang_All,"javascript:selectAll(\'categories\');","");
cat_menu_select.addMenuItem(lang_Unselect,"javascript:unselectAll(\'categories\');","");
cat_menu_select.addMenuItem(lang_Invert,"javascript:invert(\'categories\');","");
} ';
echo ' if (activeTab)
{
window.cat_menu_select = new Menu(lang_Select);
cat_menu_select.addMenuItem(lang_All,"javascript:selectAllC(\'"+activeTab.id+"\');","");
cat_menu_select.addMenuItem(lang_Unselect,"javascript:unselectAll(\'"+activeTab.id+"\');","");
cat_menu_select.addMenuItem(lang_Invert,"javascript:invert(\'"+activeTab.id+"\');","");
} ';
}
print <<<END
}
if(activeTab)
{
pagefunc = activeTab.getAttribute("tabTitle")+"_PerPageMenu();";
window.PerPageMenu = eval(pagefunc);
}
window.cat_menu = new Menu("root");
if ((document.getElementById('categories').active) || (activeTab)) window.cat_menu.addMenuItem(cat_menu_filter);
if ((document.getElementById('categories').active) || (activeTab)) window.cat_menu.addMenuItem(cat_menu_sorting);
if(activeTab) window.cat_menu.addMenuItem(PerPageMenu);
END;
if (!$hideSelectAll) {
echo '
if ((document.getElementById(\'categories\').active) || (activeTab)) window.cat_menu.addMenuItem(cat_menu_select);
';
}
print <<<END
window.triedToWriteMenus = false;
window.cat_menu.writeMenus();
}
function toggleCategoriesA(tabHeader)
{
var categories = document.getElementById('categories');
if (!categories) return;
toggleCategories();
tabHeader.setAttribute("background", '$imagesURL'+'/itemtabs/' + ((categories.active) ? "tab_active" : "tab_inactive") + ".gif")
var images = tabHeader.getElementsByTagName("IMG");
if (images.length < 1) return;
images[0].src = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "divider_up" : "divider_dn") + ".gif";
}
function toggleTabA(tabId, atm)
{
var hl = document.getElementById("hidden_line");
var activeTabId;
if (activeTab) activeTabId = activeTab.id;
if (activeTabId == tabId)
{
var devider = document.getElementById("tabsDevider");
devider.style.display = "";
unselectAll(tabId);
var tab = document.getElementById(tabId);
tab.active = false;
activeTab = null;
collapseTab = tab;
toolbar.setTab(null);
showTab();
}
else
{
if (activeTab) toggleTab(tabId, true)
else toggleTab(tabId, atm)
if (hl) hl.style.display = "none";
}
tab_hdr = document.getElementById('tab_headers');
if (!tab_hdr) return;
for (var i = 0; i < tabIDs.length; i++)
{
var tabHeader;
TDs = tab_hdr.getElementsByTagName("TD");
for (var j = 0; j < TDs.length; j++)
if (TDs[j].getAttribute("tabHeaderOf") == tabIDs[i])
{
tabHeader = TDs[j];
break;
}
if (!tabHeader) continue;
var tab = document.getElementById(tabIDs[i]);
if (!tab) continue;
tabHeader.setAttribute("background", "$imagesURL/itemtabs/" + ((tab.active) ? "tab_active" : "tab_inactive") + ".gif")
var images = tabHeader.getElementsByTagName("IMG");
if (images.length < 1) continue;
images[0].src = "$imagesURL/itemtabs/" + ((tab.active) ? "divider_up" : "divider_empty") + ".gif";
}
}
</script>
END;
?>
Property changes on: trunk/kernel/admin/include/toolbar/editcategory_relationselect.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/admin/relation_select.php
===================================================================
--- trunk/admin/relation_select.php (revision 1316)
+++ trunk/admin/relation_select.php (revision 1317)
@@ -1,402 +1,453 @@
<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
//$b_topmargin = "0";
$hideSelectAll = true;
$b_header_addon = "<DIV style='position:relative; z-Index: 1; background-color: #ffffff; padding-top:1px;'><div style='z-Index:1; position:relative'>";
//$pathtoroot="";
if(!strlen($pathtoroot))
{
$path=dirname(realpath(__FILE__));
if(strlen($path))
{
/* determine the OS type for path parsing */
$pos = strpos($path,":");
if ($pos === false)
{
$gOS_TYPE="unix";
$pathchar = "/";
}
else
{
$gOS_TYPE="win";
$pathchar="\\";
}
$p = $path.$pathchar;
/*Start looking for the root flag file */
while(!strlen($pathtoroot) && strlen($p))
{
$sub = substr($p,strlen($pathchar)*-1);
if($sub==$pathchar)
{
$filename = $p."root.flg";
}
else
$filename = $p.$pathchar."root.flg";
if(file_exists($filename))
{
$pathtoroot = $p;
}
else
{
$parent = realpath($p.$pathchar."..".$pathchar);
if($parent!=$p)
{
$p = $parent;
}
else
$p = "";
}
}
if(!strlen($pathtoroot))
$pathtoroot = ".".$pathchar;
}
else
{
$pathtoroot = ".".$pathchar;
}
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
//echo $pathtoroot;
require_once($pathtoroot."kernel/startup.php");
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
$browseURL = $adminURL."/browse";
$cssURL = $adminURL."/include";
$m_var_list_update["cat"] = 0;
$homeURL = $_SERVER["PHP_SELF"]."?env=".BuildEnv();
unset($m_var_list_update["cat"]);
$envar = "env=" . BuildEnv();
if($objCatList->CurrentCategoryID()>0)
{
$c = $objCatList->CurrentCat();
$upURL = $c->Admin_Parent_Link();
}
else
$upURL = $_SERVER["PHP_SELF"]."?".$envar;
//admin only util
$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
//require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/browse/toolbar.php");
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value."admin/include/parser.php";
if(file_exists($path))
{
//echo "<!-- $path -->";
@include_once($path);
}
}
//Set Section
$section = 'in-portal:editcategory_relationselect';
$Selector = GetVar('Selector');
if(!$Selector) $Selector = 'checkbox';
//Set Environment Variable
//echo $objCatList->ItemsOnClipboard()." Categories on the clipboard<br>\n";
//echo $objTopicList->ItemsOnClipboard()." Topics on the clipboard<br>\n";
//echo $objLinkList->ItemsOnClipboard()." Links on the clipboard<br>\n";
//echo $objArticleList->ItemsOnClipboard()." Articles on the clipboard<br>\n";
$SearchType = $objSession->GetVariable("SearchType");
if(!strlen($SearchType))
$SearchType = "Categories";
$SearchLabel = "la_SearchLabel";
/* page header */
$charset = GetRegionalOption('Charset');
print <<<END
<html>
<head>
<title>In-portal</title>
<meta http-equiv="content-type" content="text/html;charset=$charset">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
</script>
END;
require_once($pathtoroot.$admin."/include/mainscript.php");
load_module_styles();
print <<<END
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/checkboxes_new.js"></script>
<script language="JavaScript1.2">
var enableContextMenus= true;
var doubleClickAction = 'select';
function toggleTabB(tabId, atm)
{
var hl = document.getElementById("hidden_line");
var activeTabId;
if (activeTab) activeTabId = activeTab.id;
if (activeTabId == tabId)
{
var devider = document.getElementById("tabsDevider");
devider.style.display = "";
unselectAll(tabId);
var tab = document.getElementById(tabId);
tab.active = false;
activeTab = null;
collapseTab = tab;
toolbar.setTab(null);
showTab();
}
else
{
if (activeTab)
toggleTab(tabId, true)
else
toggleTab(tabId, atm)
if (hl) hl.style.display = "none";
}
tab_hdr = document.getElementById('tab_headers');
if (!tab_hdr) return;
// process all module tabs
var active_str = '';
for(var i = 0; i < tabIDs.length; i++)
{
var tabHeader;
TDs = tab_hdr.getElementsByTagName("TD");
for (var j = 0; j < TDs.length; j++)
if (TDs[j].getAttribute("tabHeaderOf") == tabIDs[i])
{
tabHeader = TDs[j];
break;
}
if (!tabHeader) continue;
var tab = document.getElementById(tabIDs[i]);
if (!tab) continue;
active_str = (tab.active) ? "tab_active" : "tab_inactive";
if (TDs[j].getAttribute("tabHeaderOf") == tabId) {
// module tab is selected
SetBackground('l_' + tabId, "$imagesURL/itemtabs/" + active_str + "_l.gif");
SetBackground('m_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('m1_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('r_' + tabId, "$imagesURL/itemtabs/" + active_str + "_r.gif");
}
else
{
// module tab is not selected
SetBackground('l_' +tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_l.gif");
SetBackground('m_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('m1_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('r_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_r.gif");
}
var images = tabHeader.getElementsByTagName("IMG");
if (images.length < 1) continue;
images[0].src = "$imagesURL/itemtabs/" + ((tab.active) ? "divider_up" : "divider_empty") + ".gif";
}
}
function toggleCategoriesB(tabHeader, instant)
{
var categories = document.getElementById('categories');
if (!categories) return;
toggleCategories(instant);
var active_str = '$imagesURL'+'/itemtabs/' + (categories.active ? 'tab_active' : 'tab_inactive');
SetBackground('l_cat', active_str + '_l.gif');
SetBackground('m_cat', active_str + '.gif');
SetBackground('m1_cat', active_str + '.gif');
SetBackground('r_cat', active_str + '_r.gif');
var images = tabHeader.getElementsByTagName("IMG");
if (images.length < 1) return;
images[0].src = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "divider_up" : "divider_dn") + ".gif";
}
</script>
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
END;
int_SectionHeader();
?>
</DIV>
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<div name="toolBar" id="mainToolBar">
<tb:button action="select" alt="<?php echo admin_language("la_ToolTip_Select"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="stop" alt="<?php echo admin_language("la_ToolTip_Stop"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="upcat" alt="<?php echo admin_language("la_ToolTip_Up"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="homecat" alt="<?php echo admin_language("la_ToolTip_Home"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="view" alt="<?php echo admin_language("la_ToolTip_View"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
</div>
</td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" width="100%" bgcolor="#e0e0da" border="0" class="tableborder_full_a">
<tbody>
<tr>
<td><img height="15" src="<?php echo $imagesURL; ?>/arrow.gif" width="15" align="middle" border="0">
<span class="navbar"><?php print m_navbar( Array('admin' => 1) ); ?></span>
</td>
<td align="right">
<FORM METHOD="POST" ACTION="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>" NAME="admin_search" ID="admin_search">
<INPUT ID="SearchScope" NAME="SearchScope" type="hidden" VALUE="<?php echo $objSession->GetVariable("SearchScope"); ?>">
<INPUT ID="SearchType" NAME="SearchType" TYPE="hidden" VALUE="<?php echo $objSession->GetVariable("SearchType"); ?>">
<INPUT ID="NewSearch" NAME="NewSearch" TYPE="hidden" VALUE="0"><INPUT TYPE="HIDDEN" NAME="Action" value="m_Exec_Search">
<input type="hidden" name="Selector" value="<?php echo $Selector; ?>">
<table cellspacing="0" cellpadding="0"><tr>
<td><?php echo admin_language($SearchLabel); ?> </td>
- <td><input ID="SearchWord" type="text" name="SearchWord" size="10" style="border-width: 1; border-style: solid; border-color: #999999"></td>
- <td><img action="search_b" src="<?php echo $imagesURL."/toolbar/";?>/icon16_search.gif" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" src="<?php echo $imagesURL."/toolbar/";?>/arrow16.gif" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search.gif'" style="cursor:hand" width="22" width="22"><img action="search_a" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" src="<?php echo $imagesURL."/toolbar/";?>/arrow16.gif" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16.gif'" style="cursor:hand">
- <img action="search_c" src="<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif'" style="cursor:hand" width="22" width="22">
+ <td><input id="SearchWord" type="text" name="SearchWord" size="10" style="border-width: 1; border-style: solid; border-color: #999999" value="<?php echo $objSession->GetVariable('SearchWord'); ?>"></td>
+ <td>
+ <img
+ action="search_b"
+ src="<?php echo $imagesURL."/toolbar/";?>/icon16_search.gif"
+ alt="<?php echo admin_language("la_ToolTip_Search"); ?>"
+ align="absMiddle"
+ onclick="this.action = this.getAttribute('action'); actionHandler(this);"
+ src="<?php echo $imagesURL."/toolbar/";?>/arrow16.gif"
+ onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_f2.gif'"
+ onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search.gif'"
+ style="cursor:hand"
+ width="22"
+ width="22">
+ <!-- <img
+ action="search_a"
+ alt="<?php echo admin_language("la_ToolTip_Search"); ?>"
+ align="absMiddle"
+ onclick="this.action = this.getAttribute('action'); actionHandler(this);"
+ src="<?php echo $imagesURL."/toolbar/";?>/arrow16.gif"
+ onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16_f2.gif'"
+ onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16.gif'"
+ style="cursor:hand">-->
+
+ <img
+ action="search_c"
+ src="<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif"
+ alt="<?php echo admin_language("la_ToolTip_Search"); ?>"
+ align="absMiddle"
+ onclick="this.action = this.getAttribute('action'); actionHandler(this);"
+ onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif'" style="cursor:hand" width="22" width="22">
</td>
</tr></table>
</FORM>
<!--tb:button action="search_b" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="right" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="search_a" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="right" ImagePath="<?php echo $imagesURL."/toolbar/";?>"-->
</td>
</tr>
</tbody>
</table>
<br>
<!-- CATEGORY DIVIDER -->
<?php
$objCatList->Clear();
$OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE);
if($SearchType=="categories" || $SearchType="all")
{
- $list = $objSession->GetVariable("SearchWord");
+ $list = $objSession->GetVariable('SearchWord');
$SearchQuery = $objCatList->AdminSearchWhereClause($list);
if(strlen($SearchQuery))
{
$SearchQuery = " (".$SearchQuery.") ";
$objCatList->LoadCategories($SearchQuery.$CategoryFilter,$OrderBy);
}
else
$objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter,$OrderBy);
}
else
$objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter,$OrderBy);
?>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td width="138" height="20" nowrap="nowrap" class="active_tab" onclick="toggleCategoriesB(this)" id="cats_tab">
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td id="l_cat" background="<?php echo $imagesURL; ?>/itemtabs/tab_active_l.gif" class="left_tab">
<img src="<?php echo $imagesURL; ?>/itemtabs/divider_up.gif" width="20" height="20" border="0" align="absmiddle">
</td>
<td id="m_cat" nowrap background="<?php echo $imagesURL; ?>/itemtabs/tab_active.gif" class="tab_class">
<?php echo admin_language("la_ItemTab_Categories"); ?>:
</td>
<td id="m1_cat" align="right" valign="top" background="<?php echo $imagesURL; ?>/itemtabs/tab_active.gif" class="tab_class">
<span class="cats_stats">(<?php echo $objCatList->QueryItemCount; ?>)</span>
</td>
<td id="r_cat" background="<?php echo $imagesURL; ?>/itemtabs/tab_active_r.gif" class="right_tab">
<img src="<?php echo $imagesURL; ?>/spacer.gif" width="21" height="20">
</td>
</tr>
</table>
</td>
<td> </td>
</tr>
</tbody>
</table>
<div class="divider" style="" id="categoriesDevider"><img width=1 height=1 src="images/spacer.gif"></div>
</DIV>
<DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index:0" id="firstContainer">
<DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index: 2" id="secondContainer">
<!-- CATEGORY OUTPUT START -->
<div id="categories" tabtitle="Categories">
<form id="categories_form" name="categories_form" action="" method="post">
<input type="hidden" name="Action">
<?php print adListSubCats($objCatList->CurrentCategoryID(),"cat_select_element.tpl"); ?>
</form>
</div>
<!-- CATEGORY OUTPUT END -->
<br>
<?php
print $ItemTabs->TabRow();
?>
<div class="divider" id="tabsDevider"><img width=1 height=1 src="images/spacer.gif"></div>
</DIV>
<?php
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value."admin/relation_select.php";
if(file_exists($path))
{
echo "\n<!-- $path -->\n";
include_once($path);
}
}
?>
<form method="post" action="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>" name="viewmenu">
<input type="hidden" name="fieldname" value="">
<input type="hidden" name="varvalue" value="">
<input type="hidden" name="varvalue2" value="">
<input type="hidden" name="Action" value="">
</form>
</DIV>
<!-- END CODE-->
<script language="JavaScript">
<?php
if( GetVar('Selector') == 'radio' )
echo " var single_select = true;";
?>
InitPage();
+ cats_on = theMainScript.GetCookie('cats_tab_on');
+ if (cats_on == 0) {
+ toggleCategoriesB(document.getElementById('cats_tab'), true);
+ }
+
+ tabs_on = theMainScript.GetCookie('tabs_on');
+ if (tabs_on == '1' || tabs_on == null) {
+ if(default_tab.length == 0 || default_tab == 'categories' )
+ {
+ cookie_start = theMainScript.GetCookie('active_tab');
+ if (cookie_start != null) start_tab = cookie_start;
+ if(start_tab!=null) {
+ //alert('ok');
+ toggleTabB(start_tab, true);
+ }
+ }
+ else
+ {
+ //alert('ok');
+ toggleTabB(default_tab,true);
+ }
+ }
+
//toggleTabB(start_tab, true);
</script>
<?php int_footer(); ?>
Property changes on: trunk/admin/relation_select.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Event Timeline
Log In to Comment