Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F925669
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
Tue, May 20, 4:17 PM
Size
130 KB
Mime Type
text/x-diff
Expires
Thu, May 22, 4:17 PM (23 h, 37 m)
Engine
blob
Format
Raw Data
Handle
635006
Attached To
rINP In-Portal
in-portal
View Options
Index: trunk/kernel/include/debugger.php
===================================================================
--- trunk/kernel/include/debugger.php (revision 1332)
+++ trunk/kernel/include/debugger.php (revision 1333)
@@ -1,841 +1,860 @@
<?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);
+ if ( dbg_ConstOn('DBG_INCLUDED_FILES') ) {
+ $files = get_included_files();
+ $this->appendHTML('<b>Included files:</b>');
+ foreach ($files as $file)
+ {
+ $this->appendHTML($this->getFileLink($this->getLocalFile($file)).' ('.round(filesize($file)/1024, 2).'Kb)');
+ }
+ }
+
+
$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]);
}
+
+ /*in /www/kostja/in-commerce4/kernel/kernel4/parser/construct_tags.php(177) : runtime-created function on line
+
+ [PRE-PARSED block, $line 13]: Undefined variable: IdField*/
+
+ if( strpos($errfile,'runtime-created') !== false ) {
+ $errfile = ' PRE-PARSED block <b>'.$this->CurrentPreParsedBlock.'</b> ';
+ }
+
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.28
\ No newline at end of property
+1.29
\ No newline at end of property
Index: trunk/kernel/admin/include/toolbar/browse.php
===================================================================
--- trunk/kernel/admin/include/toolbar/browse.php (revision 1332)
+++ trunk/kernel/admin/include/toolbar/browse.php (revision 1333)
@@ -1,777 +1,718 @@
<?php
global $objConfig,$objSections,$section, $rootURL,$adminURL, $admin, $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( isset($_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="";
$Cat_Paste = "false";
if($objCatList->ItemsOnClipboard()>0)
$Cat_Paste = "true";
$CurrentCat = $objCatList->CurrentCategoryID();
if($CurrentCat>0)
{
$c = $objCatList->GetItem($CurrentCat);
$CurrentRes = (int)$c->Get("ResourceId");
}
else
$CurrentRes =0;
$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");
+// View, Sort, Select, Per Page
+$lang_View = language('la_Text_View');
+$lang_Sort = language('la_Text_Sort');
+$lang_PerPage = language('la_prompt_PerPage');
+$lang_Select = language('la_Text_Select');
+
print <<<END
<script language="JavaScript">
+// global usage phrases
+var lang_View = '$lang_View';
+var lang_Sort = '$lang_Sort';
+var lang_PerPage = '$lang_PerPage';
+var lang_Select = '$lang_Select';
+
+// local usage phrases
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";
var Categories_Paste = $Cat_Paste;
var CurrentCat = $CurrentCat;
var CurrentRes = $CurrentRes;
PasteButton = PasteButton || Categories_Paste;
//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";
var upURL = "$upURL";
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('new_cat',"get_to_server('$adminURL/category/addcategory.php',env+'&new=1');"); //new cat
AddButtonAction('editcat',"edit_current(); "); //edit current
AddButtonAction('edit',"check_submit('','edit');"); //edit
AddButtonAction('delete',"check_submit('$admin/browse','delete');"); //delete
AddButtonAction('approve',"check_submit('$admin/browse','approve');"); //approve
AddButtonAction('decline',"check_submit('$admin/browse','decline');"); //decline
AddButtonAction('cut',"check_submit('$admin/browse','cut');"); //cut
AddButtonAction('copy',"check_submit('$admin/browse','copy');"); //copy
AddButtonAction('paste',"get_to_server('$adminURL/browse.php',env+'&Action=m_paste');"); //paste
AddButtonAction('move_up',"check_submit('$admin/browse','move_up');"); //up
AddButtonAction('move_down',"check_submit('$admin/browse','move_down');"); //down
AddButtonAction('print',"window.print();"); //print ?
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_b',"search_submit();");
AddButtonAction('search_c',"new_search_submit();");
}
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;
window.location.href=path;
return true;
}
function check_submit(page,actionValue)
{
if (actionValue.match(/delete$/)) {
if (!theMainScript.Confirm(lang_DeleteConfirm)) return;
}
var formname = '';
var action_prefix ='';
if ((activeTab) && (!isAnyChecked('categories')))
{
form_name = activeTab.id;
action_prefix = activeTab.getAttribute("ActionPrefix");
if(page.length==0)
page = activeTab.getAttribute("EditURL");
}
else
{
form_name = 'categories';
action_prefix = 'm_cat_';
if(page.length==0)
page="$admin" + '/category/addcategory';
}
var f = document.getElementsByName(form_name+'_form')[0];
if(f)
{
f.Action.value = action_prefix + actionValue;
f.action = '$rootURL' + page + '.php?'+ env;
//alert(f.name+ ' is submitting to '+ f.action + ' action=' + f.Action.value);
f.submit();
}
} // check submit
function edit_current()
{
if(CurrentCat==0)
{
get_to_server('$adminURL/category/addcategory_permissions.php',env+'&item=0');
}
else
get_to_server('$adminURL/category/addcategory.php',env+'&item=$CurrentRes');
}
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 Category_SortMenu(caption)
+ \$fw_menus['c_view_menu'] = function()
{
- 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'));
+ // filtering menu
+ \$Menus['c_filtring_menu'] = new Menu(lang_View);
+ \$Menus['c_filtring_menu'].addMenuItem(lang_All,"config_val('Category_View', 127);",CategoryView==127);
+ \$Menus['c_filtring_menu'].addMenuSeparator();
+ \$Menus['c_filtring_menu'].addMenuItem(lang_Active,"FlipBit('Category_View',CategoryView,6);",BitStatus(CategoryView,6));
+ \$Menus['c_filtring_menu'].addMenuItem(lang_Pending,"FlipBit('Category_View',CategoryView,5);", BitStatus(CategoryView,5));
+ \$Menus['c_filtring_menu'].addMenuItem(lang_Disabled,"FlipBit('Category_View',CategoryView,4);",BitStatus(CategoryView,4));
+ \$Menus['c_filtring_menu'].addMenuSeparator();
+ \$Menus['c_filtring_menu'].addMenuItem(lang_New,"FlipBit('Category_View',CategoryView,3);",BitStatus(CategoryView,3));
+ \$Menus['c_filtring_menu'].addMenuItem(lang_EdPick,"FlipBit('Category_View',CategoryView,0);",BitStatus(CategoryView,0));
+
+ // sorting menu
+ \$Menus['c_sorting_menu'] = new Menu(lang_Sort);
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Asc,"config_val('Category_Sortorder','asc');",RadioIsSelected(Category_Sortorder,'asc'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Desc,"config_val('Category_Sortorder','desc');",RadioIsSelected(Category_Sortorder,'desc'));
+ \$Menus['c_sorting_menu'].addMenuSeparator();
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Default,"config_val('Category_Sortfield','Name');","");
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Name,"config_val('Category_Sortfield','Name');",RadioIsSelected(Category_Sortfield,'Name'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Description,"config_val('Category_Sortfield','Description');",RadioIsSelected(Category_Sortfield,'Description'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_CreatedOn,"config_val('Category_Sortfield','CreatedOn');",RadioIsSelected(Category_Sortfield,'CreatedOn'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_SubCats,"config_val('Category_Sortfield','CachedDescendantCatsQty');",RadioIsSelected(Category_Sortfield,'CachedDescendantCatsQty'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_SubItems,"config_val('Category_Sortfield','SubItems');",RadioIsSelected(Category_Sortfield,'SubItems'));
+
+ // perpage menu
- 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));
+ // select menu
+ \$Menus['c_select_menu'] = new Menu(lang_Select);
+ \$Menus['c_select_menu'].addMenuItem(lang_All,"javascript:selectAllC('categories');","");
+ \$Menus['c_select_menu'].addMenuItem(lang_Unselect,"javascript:unselectAll('categories');","");
+ \$Menus['c_select_menu'].addMenuItem(lang_Invert,"javascript:invert('categories');","");
- return menu_filter;
+ // view menu
+ \$Menus['c_view_menu'] = new Menu(lang_Categories);
+ \$Menus['c_view_menu'].addMenuItem( \$Menus['c_filtring_menu'] );
+ \$Menus['c_view_menu'].addMenuItem( \$Menus['c_sorting_menu'] );
+ \$Menus['c_view_menu'].addMenuItem( \$Menus['c_select_menu'] );
}
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
- {
+ var \$ViewMenus = new Array();
+
+ // prepare categories menu
if (document.getElementById('categories').active)
{
- window.cat_menu_filter = Category_FilterMenu(lang_View);
- }
+ \$fw_menus['c_view_menu']();
+ \$ViewMenus.push('c');
+ }
+
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);
+ var prefix_special = activeTab.getAttribute('PrefixSpecial');
+ \$fw_menus[prefix_special+'_view_menu']();
+ \$ViewMenus.push(prefix_special);
}
- 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:selectAllC('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:selectAllC('"+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
+
+ if(\$ViewMenus.length == 1)
+ {
+ prefix_special = \$ViewMenus[\$ViewMenus.length-1];
+ window.cat_menu = \$Menus[prefix_special+'_view_menu'];
}
else
{
- if (document.getElementById('categories').active)
- {
- window.cat_menu_select = new Menu(lang_Select);
- cat_menu_select.addMenuItem(lang_All,"javascript:selectAllC('categories');","");
- cat_menu_select.addMenuItem(lang_Unselect,"javascript:unselectAll('categories');","");
- cat_menu_select.addMenuItem(lang_Invert,"javascript:invert('categories');","");
- }
-END;
-if (!$hideSelectAll) {
-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
- } // && Select
- 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);
-
- if ((document.getElementById('categories').active) || (activeTab)) window.cat_menu.addMenuItem(cat_menu_select);
+ window.cat_menu = new Menu('ViewMenu_mixed');
+
+ // merge menus into new one
+ for(var i in \$ViewMenus)
+ {
+ prefix_special = \$ViewMenus[i];
+ window.cat_menu.addMenuItem( \$Menus[prefix_special+'_view_menu'] );
+ }
+ }
+
window.triedToWriteMenus = false;
window.cat_menu.writeMenus();
}
function toggleCategoriesA(tabHeader, instant)
{
var categories = document.getElementById('categories');
if (!categories) return;
toggleCategories(instant);
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 toggleCategoriesB(tabHeader, instant)
{
var categories = document.getElementById('categories');
if (!categories) return;
toggleCategories(instant);
document.getElementById('l_cat').background = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "tab_active_l" : "tab_inactive_l") + ".gif"
document.getElementById('m_cat').background = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "tab_active" : "tab_inactive") + ".gif"
document.getElementById('m1_cat').background = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "tab_active" : "tab_inactive") + ".gif"
document.getElementById('r_cat').background = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "tab_active_r" : "tab_inactive_r") + ".gif"
//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";
}
}
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 SetBackground(element_id, img_url)
{
// set background image of element specified by id
var el = document.getElementById(element_id);
el.style.backgroundImage = 'url('+img_url+')';
}
</script>
END;
?>
Property changes on: trunk/kernel/admin/include/toolbar/browse.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3
\ No newline at end of property
+1.4
\ No newline at end of property
Index: trunk/kernel/admin/include/toolbar/reviews.php
===================================================================
--- trunk/kernel/admin/include/toolbar/reviews.php (revision 1332)
+++ trunk/kernel/admin/include/toolbar/reviews.php (revision 1333)
@@ -1,447 +1,378 @@
<?php
global $objConfig,$objSections,$section, $rootURL,$adminURL, $admin, $imagesURL,$envar,
$m_var_list_update,$objCatList, $homeURL, $upURL, $objSession,$DefaultTab;
global $CategoryFilter,$TotalItemCount;
global $Bit_All,$Bit_Pending,$Bit_Disabled,$Bit_New,$Bit_Pop,$Bit_Hot,$Bit_Ed;
//global $hideSelectAll;
$m_tab_Categories_hide = isset($DefaultTab) && ($DefaultTab == 'category') ? 0 : 1;
/* 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( isset($_GET['SetTab']) ) $DefaultTab = $_GET["SetTab"];
// category list filtering stuff: begin
$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;
// FILTERING CODE V. 1.2
$where_clauses = Array(); $q = '';
//Group #1: Category Statuses (active,pending,disabled)
$Status = array(-1);
if($CategoryView & $Bit_Pending) $Status[] = STATUS_PENDING;
if($CategoryView & $Bit_Active) $Status[] = STATUS_ACTIVE;
if($CategoryView & $Bit_Disabled) $Status[] = STATUS_DISABLED;
if( count($Status) ) $where_clauses[] = 'Status IN ('.implode(',', $Status).')';
//Group #2: Category Statistics (new,pick)
$Status = array();
if(!($CategoryView & $Bit_New))
{
$cutoff = adodb_date("U") - ($objConfig->Get("Category_DaysNew") * 86400);
if($cutoff > 0) $q = 'CreatedOn > '.$cutoff;
$q .= (!empty($q) ? ' OR ' : '').'NewItem = 1';
$Status[] = "NOT ($q)";
}
if(!($CategoryView & $Bit_Ed)) $Status[] = 'NOT (EditorsPick = 1)';
if( count($Status) )
$where_clauses[] = '('.implode(') AND (', $Status).')';
$CategoryFilter = count($where_clauses) ? '('.implode(') AND (', $where_clauses).')' : '';
}
// category list filtering stuff: end
$OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE);
$objCatList->Clear();
$IsSearch = FALSE;
$list = $objSession->GetVariable("m_adv_view_search");
$SearchQuery = $objCatList->AdminSearchWhereClause($list);
if(strlen($SearchQuery))
{
$SearchQuery = " (".$SearchQuery.")".($CategoryFilter ? 'AND ('.$CategoryFilter.')' : '');
$objCatList->LoadCategories($SearchQuery,$OrderBy, false, 'set_last');
$IsSearch = TRUE;
}
else
$objCatList->LoadCategories($CategoryFilter,$OrderBy, false, 'set_last');
$TotalItemCount += $objCatList->QueryItemCount;
$CatTotal = TableCount($objCatList->SourceTable,null,false);
$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");
+//$lang_SubCats = language("la_Text_SubCats");
+//$lang_SubItems = language("la_Text_Subitems");
+
+// View, Sort, Select, Per Page
+$lang_View = language('la_Text_View');
+$lang_Sort = language('la_Text_Sort');
+$lang_PerPage = language('la_prompt_PerPage');
+$lang_Select = language('la_Text_Select');
print <<<END
<script language="JavaScript">
+// global usage phrases
+var lang_View = '$lang_View';
+var lang_Sort = '$lang_Sort';
+var lang_PerPage = '$lang_PerPage';
+var lang_Select = '$lang_Select';
+
+// local usage phrases
var default_tab = "$DefaultTab";
var Category_Sortfield = '$Category_Sortfield';
var Category_Sortorder = '$Category_Sortorder';
var Category_Perpage = $Perpage_Category;
var Category_ShowAll = $Category_ShowAll;
var CategoryView = $CategoryView;
//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 lang_SubCats = "$lang_SubCats";
+//var lang_SubItems = "$lang_SubItems";
var hostname = '$rootURL';
var env = '$envar';
var actionlist = new Array();
// Common function for all "Advanced View" page
function InitPage()
{
addCommonActions();
initToolbar('mainToolBar', actionHandler);
initCheckBoxes(null, false);
- toggleMenu();
+// toggleMenu();
}
function AddButtonAction(actionname,actionval)
{
var item = new Array(actionname,actionval);
actionlist[actionlist.length] = item;
}
function actionHandler(button)
{
for(i=0; i<actionlist.length;i++)
{
a = actionlist[i];
if(button.action == a[0])
{
eval(a[1]);
break;
}
}
}
function addCommonActions()
{
AddButtonAction('edit',"check_submit('','edit');"); //edit
AddButtonAction('delete',"check_submit('$admin/reviews','delete');"); //delete
AddButtonAction('approve',"check_submit('$admin/reviews','approve');"); //approve
AddButtonAction('decline',"check_submit('$admin/reviews','decline');"); //decline
AddButtonAction('print',"window.print();"); //print ?
AddButtonAction('view',"toggleMenu(); window.FW_showMenu(window.cat_menu,getRealLeft(button) - ((document.all) ? 6 : -2),getRealTop(button)+32);");
}
function check_submit(page,actionValue)
{
if (actionValue.match(/delete$/))
if (!theMainScript.Confirm(lang_DeleteConfirm)) return;
var formname = '';
var action_prefix ='';
if (activeTab)
{
form_name = activeTab.id;
action_prefix = activeTab.getAttribute("ActionPrefix");
if(page.length == 0) page = activeTab.getAttribute("EditURL");
}
var f = document.getElementsByName(form_name+'_form')[0];
if(f)
{
f.Action.value = action_prefix + actionValue;
f.action = '$rootURL' + page + '.php?'+ env;
f.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 toggleMenu()
{
- if (activeTab)
- {
- // module filtring menu
- filterfunc = activeTab.getAttribute("tabTitle")+'_FilterMenu(cat_menu_filter);';
- window.cat_menu_filter = new Menu(lang_View);
- cat_menu_filter = eval(filterfunc);
-
- // module select menu
- selectfunc = activeTab.getAttribute("tabTitle")+"_SelectMenu(cat_menu_select);";
- window.cat_menu_select = new Menu(lang_Select);
- cat_menu_select = eval(selectfunc);
-
- // module per-page menu (in case if module selected)
- pagefunc = activeTab.getAttribute("tabTitle")+"_PerPageMenu();";
- window.PerPageMenu = eval(pagefunc);
- }
- window.cat_menu = new Menu("root");
- if (activeTab)
- {
- // add root ViewMenu elements
- window.cat_menu.addMenuItem(cat_menu_filter); // "View" menu
- window.cat_menu.addMenuItem(PerPageMenu); // Module "Per-Page" menu
- window.cat_menu.addMenuItem(cat_menu_select); // "Select" menu
- }
+ var prefix_special = activeTab.getAttribute('PrefixSpecial');
+ \$fw_menus[prefix_special+'_view_menu']();
+ window.cat_menu = \$Menus[prefix_special+'_view_menu'];
window.triedToWriteMenus = false;
window.cat_menu.writeMenus();
}
function toggleTabB(tabId, atm)
{
var hl = document.getElementById("hidden_line");
var activeTabId;
if (activeTab) activeTabId = activeTab.id;
if (activeTabId != tabId)
{
if (activeTab)
{
//alert('switching to tab');
toggleTab(tabId, true)
}
else
{
//alert('opening tab');
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");
// find tab
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
TabActive = tabId;
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 SetBackground(element_id, img_url)
{
// set background image of element specified by id
var el = document.getElementById(element_id);
el.style.backgroundImage = 'url('+img_url+')';
}
function initContextMenu()
{
window.contextMenu = new Menu("Context");
contextMenu.addMenuItem("Edit","check_submit('','edit');","");
contextMenu.addMenuItem("Delete","check_submit('admin/reviews','delete');","");
contextMenu.addMenuSeparator();
contextMenu.addMenuItem("Approve","check_submit('admin/reviews','approve');","");
contextMenu.addMenuItem("Decline","check_submit('admin/reviews','decline');","");
window.triedToWriteMenus = false;
window.contextMenu.writeMenus();
return true;
}
-
-
- // only "Category" tab functions
- function Categories_SortMenu(menu_sorting)
- {
- if(menu_sorting == null && typeof(menu_sorting) == 'undefined') menu_sorting = new Menu(lang_Categories);
-
- 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 Categories_FilterMenu(menu_filter)
- {
- if(menu_filter == null && typeof(menu_filter) == 'undefined') menu_filter = new Menu(lang_Categories);
- 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 Categories_SelectMenu(menu_select)
- {
- if(menu_select == null && typeof(menu_select) == 'undefined') menu_select = new Menu(lang_Categories);
- menu_select.addMenuItem(lang_All,"javascript:selectAllC('"+activeTab.id+"');","");
- menu_select.addMenuItem(lang_Unselect,"javascript:unselectAll('"+activeTab.id+"');","");
- menu_select.addMenuItem(lang_Invert,"javascript:invert('"+activeTab.id+"');","");
-
- return menu_select;
- }
-
- function Categories_PerPageMenu()
- {
- caption = lang_Categories +" "+lang_PerPage;
-
- menu_results = new Menu(caption);
- menu_results.addMenuItem("10","config_val('Perpage_Category', '10');",RadioIsSelected(Category_Perpage,10));
- menu_results.addMenuItem("20","config_val('Perpage_Category', '20');",RadioIsSelected(Category_Perpage,20));
- menu_results.addMenuItem("50","config_val('Perpage_Category', '50');",RadioIsSelected(Category_Perpage,50));
- menu_results.addMenuItem("100","config_val('Perpage_Category', '100');",RadioIsSelected(Category_Perpage,100));
- menu_results.addMenuItem("500","config_val('Perpage_Category', '500');",RadioIsSelected(Category_Perpage,500));
- return menu_results;
- }
// Event Handling Stuff Cross-Browser
getEvent = window.Event
? function(e){return e}
: function() {return event}
getEventSrcElement = window.Event
? function(e){var targ=e.target;return targ.nodeType==1?targ:targ.parentNode}
: function() {return event.srcElement}
function getKeyCode(e){return e.charCode||e.keyCode}
function getKey(eMoz)
{
var e = getEvent(eMoz)
var keyCode = getKeyCode(e)
if(keyCode == 13)
{
var el = document.getElementById(TabActive+'_imgSearch');
if(typeof(el) != 'undefined') el.onclick();
}
}
</script>
END;
?>
\ No newline at end of file
Property changes on: trunk/kernel/admin/include/toolbar/reviews.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/kernel/admin/include/toolbar/advanced_view.php
===================================================================
--- trunk/kernel/admin/include/toolbar/advanced_view.php (revision 1332)
+++ trunk/kernel/admin/include/toolbar/advanced_view.php (revision 1333)
@@ -1,456 +1,428 @@
<?php
global $objConfig,$objSections,$section, $rootURL,$adminURL, $admin, $imagesURL,$envar,
$m_var_list_update,$objCatList, $homeURL, $upURL, $objSession,$DefaultTab;
global $CategoryFilter,$TotalItemCount;
global $Bit_All,$Bit_Pending,$Bit_Disabled,$Bit_New,$Bit_Pop,$Bit_Hot,$Bit_Ed;
//global $hideSelectAll;
$m_tab_Categories_hide = isset($DefaultTab) && ($DefaultTab == 'category') ? 0 : 1;
/* 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( isset($_GET['SetTab']) ) $DefaultTab = $_GET["SetTab"];
// category list filtering stuff: begin
$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;
// FILTERING CODE V. 1.2
$where_clauses = Array(); $q = '';
//Group #1: Category Statuses (active,pending,disabled)
$Status = array(-1);
if($CategoryView & $Bit_Pending) $Status[] = STATUS_PENDING;
if($CategoryView & $Bit_Active) $Status[] = STATUS_ACTIVE;
if($CategoryView & $Bit_Disabled) $Status[] = STATUS_DISABLED;
if( count($Status) ) $where_clauses[] = 'Status IN ('.implode(',', $Status).')';
//Group #2: Category Statistics (new,pick)
$Status = array();
if(!($CategoryView & $Bit_New))
{
$cutoff = adodb_date("U") - ($objConfig->Get("Category_DaysNew") * 86400);
if($cutoff > 0) $q = 'CreatedOn > '.$cutoff;
$q .= (!empty($q) ? ' OR ' : '').'NewItem = 1';
$Status[] = "NOT ($q)";
}
if(!($CategoryView & $Bit_Ed)) $Status[] = 'NOT (EditorsPick = 1)';
if( count($Status) )
$where_clauses[] = '('.implode(') AND (', $Status).')';
$CategoryFilter = count($where_clauses) ? '('.implode(') AND (', $where_clauses).')' : '';
}
// category list filtering stuff: end
$OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE);
$objCatList->Clear();
$IsSearch = FALSE;
$list = $objSession->GetVariable("m_adv_view_search");
$SearchQuery = $objCatList->AdminSearchWhereClause($list);
if(strlen($SearchQuery))
{
$SearchQuery = " (".$SearchQuery.")".($CategoryFilter ? 'AND ('.$CategoryFilter.')' : '');
$objCatList->LoadCategories($SearchQuery,$OrderBy, false, 'set_last');
$IsSearch = TRUE;
}
else
$objCatList->LoadCategories($CategoryFilter,$OrderBy, false, 'set_last');
$TotalItemCount += $objCatList->QueryItemCount;
$CatTotal = TableCount($objCatList->SourceTable,null,false);
$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");
+// View, Sort, Select, Per Page
+$lang_View = language('la_Text_View');
+$lang_Sort = language('la_Text_Sort');
+$lang_PerPage = language('la_prompt_PerPage');
+$lang_Select = language('la_Text_Select');
+
$ItemTabs->AddTab(language("la_ItemTab_Categories"),"category",$objCatList->QueryItemCount, $m_tab_Categories_hide, $CatTotal);
print <<<END
<script language="JavaScript">
+// global usage phrases
+var lang_View = '$lang_View';
+var lang_Sort = '$lang_Sort';
+var lang_PerPage = '$lang_PerPage';
+var lang_Select = '$lang_Select';
+
+// local usage phrases
var default_tab = "$DefaultTab";
var Category_Sortfield = '$Category_Sortfield';
var Category_Sortorder = '$Category_Sortorder';
var Category_Perpage = $Perpage_Category;
var Category_ShowAll = $Category_ShowAll;
var CategoryView = $CategoryView;
//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 hostname = '$rootURL';
var env = '$envar';
var actionlist = new Array();
// Common function for all "Advanced View" page
function InitPage()
{
addCommonActions();
initToolbar('mainToolBar', actionHandler);
initCheckBoxes(null, false);
- toggleMenu();
+ //toggleMenu();
}
function AddButtonAction(actionname,actionval)
{
var item = new Array(actionname,actionval);
actionlist[actionlist.length] = item;
}
function actionHandler(button)
{
for(i=0; i<actionlist.length;i++)
{
a = actionlist[i];
if(button.action == a[0])
{
eval(a[1]);
break;
}
}
}
function addCommonActions()
{
AddButtonAction('edit',"check_submit('','edit');"); //edit
AddButtonAction('delete',"check_submit('$admin/advanced_view','delete');"); //delete
AddButtonAction('approve',"check_submit('$admin/advanced_view','approve');"); //approve
AddButtonAction('decline',"check_submit('$admin/advanced_view','decline');"); //decline
AddButtonAction('print',"window.print();"); //print ?
AddButtonAction('view',"toggleMenu(); window.FW_showMenu(window.cat_menu,getRealLeft(button) - ((document.all) ? 6 : -2),getRealTop(button)+32);");
}
function check_submit(page,actionValue)
{
if (actionValue.match(/delete$/))
if (!theMainScript.Confirm(lang_DeleteConfirm)) return;
var formname = '';
var action_prefix ='';
if (activeTab)
{
form_name = activeTab.id;
action_prefix = activeTab.getAttribute("ActionPrefix");
if(page.length == 0) page = activeTab.getAttribute("EditURL");
}
var f = document.getElementsByName(form_name+'_form')[0];
if(f)
{
f.Action.value = action_prefix + actionValue;
f.action = '$rootURL' + page + '.php?'+ env;
f.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);
}
}
+ \$fw_menus['c_view_menu'] = function()
+ {
+ // filtring menu
+ \$Menus['c_filtring_menu'] = new Menu(lang_View);
+ \$Menus['c_filtring_menu'].addMenuItem(lang_All,"config_val('Category_View', 127);",CategoryView==127);
+ \$Menus['c_filtring_menu'].addMenuSeparator();
+ \$Menus['c_filtring_menu'].addMenuItem(lang_Active,"FlipBit('Category_View',CategoryView,6);",BitStatus(CategoryView,6));
+ \$Menus['c_filtring_menu'].addMenuItem(lang_Pending,"FlipBit('Category_View',CategoryView,5);", BitStatus(CategoryView,5));
+ \$Menus['c_filtring_menu'].addMenuItem(lang_Disabled,"FlipBit('Category_View',CategoryView,4);",BitStatus(CategoryView,4));
+ \$Menus['c_filtring_menu'].addMenuSeparator();
+ \$Menus['c_filtring_menu'].addMenuItem(lang_New,"FlipBit('Category_View',CategoryView,3);",BitStatus(CategoryView,3));
+ \$Menus['c_filtring_menu'].addMenuItem(lang_EdPick,"FlipBit('Category_View',CategoryView,0);",BitStatus(CategoryView,0));
+
+ // sorting menu
+ \$Menus['c_sorting_menu'] = new Menu(lang_Sort);
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Asc,"config_val('Category_Sortorder','asc');",RadioIsSelected(Category_Sortorder,'asc'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Desc,"config_val('Category_Sortorder','desc');",RadioIsSelected(Category_Sortorder,'desc'));
+ \$Menus['c_sorting_menu'].addMenuSeparator();
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Default,"config_val('Category_Sortfield','Name');","");
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Name,"config_val('Category_Sortfield','Name');",RadioIsSelected(Category_Sortfield,'Name'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Description,"config_val('Category_Sortfield','Description');",RadioIsSelected(Category_Sortfield,'Description'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_CreatedOn,"config_val('Category_Sortfield','CreatedOn');",RadioIsSelected(Category_Sortfield,'CreatedOn'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_SubCats,"config_val('Category_Sortfield','CachedDescendantCatsQty');",RadioIsSelected(Category_Sortfield,'CachedDescendantCatsQty'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_SubItems,"config_val('Category_Sortfield','SubItems');",RadioIsSelected(Category_Sortfield,'SubItems'));
+
+ // perpage menu
+ \$Menus['c_perpage_menu'] = new Menu(lang_PerPage);
+ \$Menus['c_perpage_menu'].addMenuItem("10","config_val('Perpage_Category', '10');",RadioIsSelected(Category_Perpage,10));
+ \$Menus['c_perpage_menu'].addMenuItem("20","config_val('Perpage_Category', '20');",RadioIsSelected(Category_Perpage,20));
+ \$Menus['c_perpage_menu'].addMenuItem("50","config_val('Perpage_Category', '50');",RadioIsSelected(Category_Perpage,50));
+ \$Menus['c_perpage_menu'].addMenuItem("100","config_val('Perpage_Category', '100');",RadioIsSelected(Category_Perpage,100));
+ \$Menus['c_perpage_menu'].addMenuItem("500","config_val('Perpage_Category', '500');",RadioIsSelected(Category_Perpage,500));
+
+ // select menu
+ \$Menus['c_select_menu'] = new Menu(lang_Select);
+ \$Menus['c_select_menu'].addMenuItem(lang_All,"javascript:selectAllC('"+activeTab.id+"');","");
+ \$Menus['c_select_menu'].addMenuItem(lang_Unselect,"javascript:unselectAll('"+activeTab.id+"');","");
+ \$Menus['c_select_menu'].addMenuItem(lang_Invert,"javascript:invert('"+activeTab.id+"');","");
+
+ // view menu
+ \$Menus['c_view_menu'] = new Menu(lang_Categories);
+ \$Menus['c_view_menu'].addMenuItem( \$Menus['c_filtring_menu'] );
+ \$Menus['c_view_menu'].addMenuItem( \$Menus['c_sorting_menu'] );
+ \$Menus['c_view_menu'].addMenuItem( \$Menus['c_perpage_menu'] );
+ \$Menus['c_view_menu'].addMenuItem( \$Menus['c_select_menu'] );
+ }
+
function toggleMenu()
{
- if (activeTab)
- {
- // module filtring menu
- filterfunc = activeTab.getAttribute("tabTitle")+'_FilterMenu(cat_menu_filter);';
- window.cat_menu_filter = new Menu(lang_View);
- cat_menu_filter = eval(filterfunc);
-
- // module sorting menu
- sortfunc = activeTab.getAttribute("tabTitle")+'_SortMenu(cat_menu_sorting);';
- window.cat_menu_sorting = new Menu(lang_Sort);
- cat_menu_sorting = eval(sortfunc);
-
- // module select menu
- selectfunc = activeTab.getAttribute("tabTitle")+"_SelectMenu(cat_menu_select);";
- window.cat_menu_select = new Menu(lang_Select);
- cat_menu_select = eval(selectfunc);
-
- // module per-page menu (in case if module selected)
- pagefunc = activeTab.getAttribute("tabTitle")+"_PerPageMenu();";
- window.PerPageMenu = eval(pagefunc);
- }
- window.cat_menu = new Menu("root");
- if (activeTab)
- {
- // add root ViewMenu elements
- window.cat_menu.addMenuItem(cat_menu_filter); // "View" menu
- window.cat_menu.addMenuItem(cat_menu_sorting); // "Sort" menu
- window.cat_menu.addMenuItem(PerPageMenu); // Module "Per-Page" menu
- window.cat_menu.addMenuItem(cat_menu_select); // "Select" menu
- }
+ var prefix_special = activeTab.getAttribute('PrefixSpecial');
+ \$fw_menus[prefix_special+'_view_menu']();
+ window.cat_menu = \$Menus[prefix_special+'_view_menu'];
window.triedToWriteMenus = false;
window.cat_menu.writeMenus();
}
function toggleTabB(tabId, atm)
{
var hl = document.getElementById("hidden_line");
var activeTabId;
if (activeTab) activeTabId = activeTab.id;
if (activeTabId != tabId)
{
if (activeTab)
{
//alert('switching to tab');
toggleTab(tabId, true)
}
else
{
//alert('opening tab');
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");
// find tab
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
TabActive = tabId;
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 SetBackground(element_id, img_url)
{
// set background image of element specified by id
var el = document.getElementById(element_id);
el.style.backgroundImage = 'url('+img_url+')';
}
function initContextMenu()
{
window.contextMenu = new Menu("Context");
contextMenu.addMenuItem("Edit","check_submit('','edit');","");
contextMenu.addMenuItem("Delete","check_submit('admin/advanced_view','delete');","");
contextMenu.addMenuSeparator();
contextMenu.addMenuItem("Approve","check_submit('admin/advanced_view','approve');","");
contextMenu.addMenuItem("Decline","check_submit('admin/advanced_view','decline');","");
window.triedToWriteMenus = false;
window.contextMenu.writeMenus();
return true;
}
-
-
- // only "Category" tab functions
- function Categories_SortMenu(menu_sorting)
- {
- if(menu_sorting == null && typeof(menu_sorting) == 'undefined') menu_sorting = new Menu(lang_Categories);
-
- 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 Categories_FilterMenu(menu_filter)
- {
- if(menu_filter == null && typeof(menu_filter) == 'undefined') menu_filter = new Menu(lang_Categories);
- 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 Categories_SelectMenu(menu_select)
- {
- if(menu_select == null && typeof(menu_select) == 'undefined') menu_select = new Menu(lang_Categories);
- menu_select.addMenuItem(lang_All,"javascript:selectAllC('"+activeTab.id+"');","");
- menu_select.addMenuItem(lang_Unselect,"javascript:unselectAll('"+activeTab.id+"');","");
- menu_select.addMenuItem(lang_Invert,"javascript:invert('"+activeTab.id+"');","");
-
- return menu_select;
- }
-
- function Categories_PerPageMenu()
- {
- caption = lang_Categories +" "+lang_PerPage;
-
- menu_results = new Menu(caption);
- menu_results.addMenuItem("10","config_val('Perpage_Category', '10');",RadioIsSelected(Category_Perpage,10));
- menu_results.addMenuItem("20","config_val('Perpage_Category', '20');",RadioIsSelected(Category_Perpage,20));
- menu_results.addMenuItem("50","config_val('Perpage_Category', '50');",RadioIsSelected(Category_Perpage,50));
- menu_results.addMenuItem("100","config_val('Perpage_Category', '100');",RadioIsSelected(Category_Perpage,100));
- menu_results.addMenuItem("500","config_val('Perpage_Category', '500');",RadioIsSelected(Category_Perpage,500));
- return menu_results;
- }
// Event Handling Stuff Cross-Browser
getEvent = window.Event
? function(e){return e}
: function() {return event}
getEventSrcElement = window.Event
? function(e){var targ=e.target;return targ.nodeType==1?targ:targ.parentNode}
: function() {return event.srcElement}
function getKeyCode(e){return e.charCode||e.keyCode}
function getKey(eMoz)
{
var e = getEvent(eMoz)
var keyCode = getKeyCode(e)
if(keyCode == 13)
{
var el = document.getElementById(TabActive+'_imgSearch');
if(typeof(el) != 'undefined') el.onclick();
}
}
</script>
END;
?>
\ No newline at end of file
Property changes on: trunk/kernel/admin/include/toolbar/advanced_view.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property
Index: trunk/kernel/admin/advanced_view.php
===================================================================
--- trunk/kernel/admin/advanced_view.php (revision 1332)
+++ trunk/kernel/admin/advanced_view.php (revision 1333)
@@ -1,57 +1,57 @@
<?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. ##
##############################################################
global $rootURL, $imagesURL, $adminURL,$admin,$pathtoroot;
$localURL = $rootURL."kernel/";
$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtolocal."admin/include/navmenu.php");
//Set Section
$section = 'in-portal:advanced_view';
//Set Environment Variable
$envar = "env=" . BuildEnv($mod_prefixes);
?>
<!-- CATS -->
-<div id="category" class="ini_tab" isTab="true" tabTitle="Categories" ActionPrefix="m_cat_" EditURL="admin/category/addcategory">
+<div id="category" class="ini_tab" isTab="true" tabTitle="Categories" PrefixSpecial="c" ActionPrefix="m_cat_" EditURL="admin/category/addcategory">
<table cellSpacing=0 cellPadding=2 width="100%" class="tabTable">
<tr>
<td align="left" width="70%">
<img height=15 src="<?php echo $imagesURL; ?>/arrow.gif" width=15 align=absMiddle border=0>
<b class=text><?php echo prompt_language("la_Page"); ?></b> <?php print $objCatList->GetAdminPageLinkList($_SERVER["PHP_SELF"]); ?>
</td>
<td align="right" width="30%">
<?php ShowSearchForm('m', $envar, 'category'); ?>
</td>
</tr>
</table><br>
<form name=category_form action="" method=post>
<input type="hidden" name="Action">
<table cellSpacing=0 cellPadding=2 width="100%" border=0>
<tbody>
<?php print adListSubCats(0, 'cat_tab_element.tpl','m_adv_view_search'); ?>
</tbody>
</table>
</form>
</div>
<!-- END CATS -->
\ No newline at end of file
Property changes on: trunk/kernel/admin/advanced_view.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3
\ No newline at end of property
+1.4
\ No newline at end of property
Index: trunk/admin/browse.php
===================================================================
--- trunk/admin/browse.php (revision 1332)
+++ trunk/admin/browse.php (revision 1333)
@@ -1,478 +1,478 @@
<?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. ##
##############################################################
//$pathtoroot="";
define('REQUIRE_LAYER_HEADER', 1);
$b_topmargin = "0";
//$b_header_addon = "<DIV style='position:relative; z-Index: 1; background-color: #ffffff; padding-top:1px;'><div style='position:absolute; width:100%;top:0px;' align='right'><img src='images/logo_bg.gif'></div><img src='images/spacer.gif' width=1 height=15><br><div style='z-Index:1; position:relative'>";
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");
if (!admin_login())
{
if(!headers_sent())
setcookie("sid"," ",time()-3600);
$objSession->Logout();
header("Location: ".$adminURL."/index.php?logout=1");
die();
//require_once($pathtoroot."admin/login.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";
$indexURL = $rootURL."index.php";
$m_var_list_update["cat"] = 0;
$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');";
unset($m_var_list_update["cat"]);
$envar = "env=" . BuildEnv();
if($objCatList->CurrentCategoryID()>0)
{
$c = $objCatList->CurrentCat();
$upURL = "javascript:AdminCatNav('".$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);
}
}
if(!defined('IS_INSTALL'))define('IS_INSTALL',0);
if(!IS_INSTALL)
{
if (!admin_login())
{
if(!headers_sent())
setcookie("sid"," ",time()-3600);
$objSession->Logout();
header("Location: ".$adminURL."/index.php?logout=1");
die();
//require_once($pathtoroot."admin/login.php");
}
}
//Set Section
$section = 'in-portal:browse';
//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";
// save last category visited
$objSession->SetVariable('prev_category', $objSession->GetVariable('last_category') );
$objSession->SetVariable('last_category', $objCatList->CurrentCategoryID() );
/* // for testing
$last_cat = $objSession->GetVariable('last_category');
$prev_cat = $objSession->GetVariable('prev_category');
echo "Last CAT: [$last_cat]<br>";
echo "Prev CAT: [$prev_cat]<br>";
*/
$SearchType = $objSession->GetVariable("SearchType");
if(!strlen($SearchType))
$SearchType = "all";
$SearchLabel = "la_SearchLabel";
if( GetVar('SearchWord') !== false ) $objSession->SetVariable('admin_seach_words', GetVar('SearchWord') );
$SearchWord = $objSession->GetVariable('admin_seach_words');
// where should all edit popups submit changes
$objSession->SetVariable("ReturnScript", basename($_SERVER['PHP_SELF']) );
$charset = GetRegionalOption('Charset');
/* page header */
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");
print <<<END
<script type="text/javascript">
if (window.opener != null) {
theMainScript.CloseAndRefreshParent();
}
</script>
END;
print <<<END
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/checkboxes_new.js"></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;
load_module_styles();
if( !isset($list) ) $list = '';
if(($SearchType=="categories" || $SearchType="all") && strlen($list))
{
int_SectionHeader(NULL,NULL,NULL,admin_language("la_Title_SearchResults"));
}
else
int_SectionHeader();
$filter = false; // always initialize variables before use
if($objSession->GetVariable("SearchWord") != '') {
$filter = true;
}
else {
$bit_combo = $objModules->ExecuteFunction('GetModuleInfo', 'all_bitmask');
$bit_combo = $objModules->MergeReturn($bit_combo);
foreach($bit_combo['VarName'] as $mod_name => $VarName)
{
//echo "VarName: [$VarName] = [".$objConfig->Get($VarName)."], ALL = [".$bit_combo['Bits'][$mod_name]."]<br>";
if( $objConfig->Get($VarName) )
if( $objConfig->Get($VarName) != $bit_combo['Bits'][$mod_name] )
{
$filter = true;
break;
}
}
}
?>
</div>
<!-- alex mark -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<div name="toolBar" id="mainToolBar">
<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="new_cat" alt="<?php echo admin_language("la_ToolTip_New_Category"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="editcat" alt="<?php echo admin_language("la_ToolTip_Edit_Current_Category"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<?php
foreach($NewButtons as $btn)
{
- print "<tb:button action=\"".$btn["Action"]."\" alt=\"".$btn["Alt"]."\" ImagePath=\"".$btn["ImagePath"]."\" ";
+ print "<tb:button action=\"".$btn["Action"]."\" title=\"".$btn["Alt"]."\" ImagePath=\"".$btn["ImagePath"]."\" ";
if(strlen($btn["Tab"])>0)
print "tab=\"".$btn["Tab"]."\"";
print ">\n";
}
?>
<tb:button action="edit" alt="<?php echo admin_language("la_ToolTip_Edit"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="delete" alt="<?php echo admin_language("la_ToolTip_Delete"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="approve" alt="<?php echo admin_language("la_ToolTip_Approve"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="decline" alt="<?php echo admin_language("la_ToolTip_Decline"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="cut" alt="<?php echo admin_language("la_ToolTip_Cut"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="copy" alt="<?php echo admin_language("la_ToolTip_Copy"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="paste" alt="<?php echo admin_language("la_ToolTip_Paste"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="move_up" alt="<?php echo admin_language("la_ToolTip_Move_Up"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="move_down" alt="<?php echo admin_language("la_ToolTip_Move_Down"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="print" alt="<?php echo admin_language("la_ToolTip_Print"); ?>" 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 $attribs["admin"]=1; print m_navbar($attribs); ?></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">
<table cellspacing="0" cellpadding="0"><tr>
<td><?php echo admin_language($SearchLabel); ?> </td>
<td><input ID="SearchWord" type="text" value="<?php echo inp_htmlize($SearchWord,1); ?>" name="SearchWord" size="10" style="border-width: 1; border-style: solid; border-color: 999999"></td>
<td><img id="imgSearch" 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="document.all.SearchWord.value = ''; 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>
<?php if ($filter) { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Filter")); ?>
</td>
</tr>
</table>
<?php } ?>
<br>
<!-- CATEGORY DIVIDER -->
<?php
$OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE);
$objCatList->Clear();
$IsSearch = FALSE;
if($SearchType == 'categories' || $SearchType == 'all')
{
$list = $objSession->GetVariable("SearchWord");
$SearchQuery = $objCatList->AdminSearchWhereClause($list);
if(strlen($SearchQuery))
{
$SearchQuery = " (".$SearchQuery.") ";
if( strlen($CatScopeClause) ) {
$SearchQuery .= " AND ParentId = ".$objCatList->CurrentCategoryID();//" AND ".$CatScopeClause;
}
$objCatList->LoadCategories($SearchQuery.$CategoryFilter,$OrderBy);
$IsSearch = TRUE;
}
else
$objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter,$OrderBy);
}
else
$objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter, $OrderBy);
$TotalItemCount += $objCatList->QueryItemCount;
?>
<?php
$e = $Errors->GetAdminUserErrors();
if(count($e)>0)
{
echo "<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" border=\"0\">";
for($ex = 0; $ex<count($e);$ex++)
{
echo "<tr><td width=\100%\" class=\"error\">".prompt_language($e[$ex])."</td></tr>";
}
echo "</TABLE><br>";
}
?>
<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="<?php echo $imagesURL; ?>/spacer.gif"></div>
</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
if($IsSearch)
{
$template = "cat_search_element.tpl";
}
else {
$template = "cat_element.tpl";
}
print adListSubCats($objCatList->CurrentCategoryID(),$template);
?>
</form>
</div>
<BR>
<!-- CATEGORY OUTPUT END -->
<?php
print $ItemTabs->TabRow();
if(count($ItemTabs->Tabs))
{
?>
<div class="divider" id="tabsDevider"><img width=1 height=1 src="images/spacer.gif"></div>
<?php
}
?>
</DIV>
<?php
unset($m);
$m = GetModuleArray("admin");
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value."admin/browse.php";
if(file_exists($path))
{
//echo "\n<!-- $path -->\n";
include_once($path);
}
}
?>
<form method="post" action="browse.php?env=<?php echo BuildEnv(); ?>" 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">
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);
}
}
d = document.getElementById('SearchWord');
if(d)
{
d.onkeyup = function(event) {
if(window.event.keyCode==13)
{
var el = document.getElementById('imgSearch');
el.onclick();
}
}
}
</script>
<?php
$objSession->SetVariable("HasChanges", 0);
int_footer();
?>
\ No newline at end of file
Property changes on: trunk/admin/browse.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.14
\ No newline at end of property
+1.15
\ No newline at end of property
Index: trunk/admin/include/mainscript.php
===================================================================
--- trunk/admin/include/mainscript.php (revision 1332)
+++ trunk/admin/include/mainscript.php (revision 1333)
@@ -1,565 +1,567 @@
<?php
global $imagesURL,$objConfig,$adminURL,$rootURL, $en;
$group_select = $adminURL."/users/group_select.php";
$item_select = $adminURL."/relation_select.php";
$user_select = $adminURL."/users/user_select.php";
$cat_select = $adminURL."/cat_select.php";
$missing_edit = $adminURL."/config/missing_label_search.php";
$lang_Filter = language("la_Text_Filter");
$lang_View = language("la_Text_View");
$lang_Sort = language("la_Text_Sort");
$lang_Select = language("la_Text_Select");
$lang_Unselect = language("la_Text_Unselect");
$lang_Invert = language("la_Text_Invert");
$lang_PerPage = language("la_prompt_PerPage");
$lang_All = language("la_Text_All");
$lang_Asc = language("la_common_ascending");
$lang_Desc = language("la_common_descending");
$lang_Disabled = language("la_Text_Disabled");
$lang_Enabled = language("la_Text_Enabled");
$lang_Pending = language("la_Text_Pending");
$lang_Default = language("la_Text_Default");
$lang_CreatedOn = language("la_prompt_CreatedOn");
$lang_None = language("la_Text_None");
$lang_PerPage = language("la_prompt_PerPage");
$lang_Views = language("la_Text_Views");
$lang_URL = language("la_ColHeader_Url");
$lang_Status = language("la_prompt_Status");
$lang_Name = language("la_prompt_Name");
$lang_MoveDn = language("la_prompt_MoveDown");
$lang_MoveUp = language("la_prompt_MoveUp");
$lang_Delete = language("la_prompt_Delete");
$lang_Edit = language("la_prompt_Edit");
$errormsg = language("la_validation_AlertMsg");
$env2 = BuildEnv();
if(is_numeric($en))
{
$env2 = BuildEnv() . "&en=$en";
}
$editor_url = $adminURL."/editor/editor.php?env=$env2";
$email_url = $adminURL."/email/sendmail.php?env=$env2";
$phrase_edit = $adminURL."/config/edit_label.php?env=".$env2;
$submit_done = isset($_REQUEST['submit_done']) ? 1 : 0; // returns form submit status
$Cal = GetDateFormat();
if(strpos($Cal,"y"))
{
$Cal = str_replace("y","yy",$Cal);
}
else
$Cal = str_replace("Y","y",$Cal);
$Cal = str_replace("m","mm",$Cal);
$Cal = str_replace("n","m",$Cal);
$Cal = str_replace("d","dd",$Cal);
$format = GetStdFormat(GetDateFormat());
$yearpos = (int)DateFieldOrder($format,"year");
$monthpos = (int)DateFieldOrder($format,"month");
$daypos = (int)DateFieldOrder($format,"day");
$ampm = "false";
if($objConfig->Get("ampm_time")=="1")
{
$ampm = "true";
}
require_once($pathtoroot.$admin."/lv/js/js_lang.php");
print <<<END
<script type="text/javascript" src="$adminURL/lv/js/in-portal.js"></script>
<script language="Javascript">
var CurrentTab= new String();
+var \$Menus = new Array();
+if(!\$fw_menus) var \$fw_menus = new Array();
var lang_Filter = "$lang_Filter";
var lang_Sort = "$lang_Sort";
var lang_Select = "$lang_Select";
var lang_Unselect = "$lang_Unselect";
var lang_Invert = "$lang_Invert";
var lang_PerPage = "$lang_PerPage";
var lang_All = "$lang_All";
var lang_Asc = "$lang_Asc";
var lang_Desc = "$lang_Desc";
var lang_Disabled = "$lang_Disabled";
var lang_Pending = "$lang_Pending";
var lang_Default = "$lang_Default";
var lang_CreatedOn = "$lang_CreatedOn";
var lang_View = "$lang_View";
var lang_Views = "$lang_Views";
var lang_None = "$lang_None";
var lang_PerPage = "$lang_PerPage";
var lang_Enabled = "$lang_Enabled";
var lang_URL = "$lang_URL";
var lang_Status = "$lang_Status";
var lang_Name = "$lang_Name";
var lang_Edit = "$lang_Edit";
var lang_Delete = "$lang_Delete";
var lang_MoveUp = "$lang_MoveUp";
var lang_MoveDn = "$lang_MoveDn";
var ampm = $ampm;
var listview_clear=1;
var CalDateFormat = "$Cal";
var yearpos = $yearpos;
var monthpos = $monthpos;
var daypos = $daypos;
var ErrorMsg = '$errormsg';
//en = $en
var rootURL = '$rootURL';
function clear_list_checkboxes()
{
var inputs = document.getElementsByTagName("INPUT");
for (var i = 0; i < inputs.length; i++)
if (inputs[i].type == "checkbox" && inputs[i].getAttribute("isSelector"))
{
inputs[i].checked=false;
}
}
function getRealLeft(el) {
xPos = el.offsetLeft;
tempEl = el.offsetParent;
while (tempEl != null) {
xPos += tempEl.offsetLeft;
tempEl = tempEl.offsetParent;
}
return xPos;
}
function getRealTop(el) {
yPos = el.offsetTop;
tempEl = el.offsetParent;
while (tempEl != null) {
yPos += tempEl.offsetTop;
tempEl = tempEl.offsetParent;
}
return yPos;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function SetButtonStateByImage(btn_id, img_src)
{
// set state depending on image name
var btn = document.getElementById(btn_id);
if(btn)
{
if( !HasParam(img_src) ) img_src = btn.getAttribute('src');
var img_name = img_src.split('/');
img_name = img_name.length ? img_name[img_name.length - 1] : img_name;
img_name = img_name.split('.');
img_name = img_name[0].split('_');
img_name = img_name.length ? img_name[img_name.length - 1] : img_name;
if(img_name)
{
switch(img_name)
{
case 'f2': btn.setAttribute('ButtonState','over'); break;
case 'f3': btn.setAttribute('ButtonState','disabled'); break;
default: btn.setAttribute('ButtonState','enabled'); break;
}
}
}
}
function swap(imgid, src, module_name){
// swaps toobar icons from kernel
// admin or from module specified
var ob = document.getElementById(imgid);
if(ob)
{
SetButtonStateByImage(imgid, src);
var s = src;
s = s.slice(0,4);
if(s=='http')
{
ob.src = src;
}
else
{
if(module_name == null)
ob.src = '$adminURL' + '/images/' + src;
else
{
ob.src = '$rootURL' + module_name + '/$admin/images/' + src;
}
}
}
}
function flip(val)
{
if (val == 0)
return 1;
else
return 0;
}
function config_val(field, val2,url){
//alert('Setting ' + field + ' to ' + val2);
if(url)
document.viewmenu.action=url;
document.viewmenu.Action.value = "m_SetVariable";
document.viewmenu.fieldname.value = field;
document.viewmenu.varvalue.value = val2;
document.viewmenu.submit();
}
function session_val(field, val2){
//alert('Setting ' + field + ' to ' + val2);
document.viewmenu.Action.value = "m_SetSessionVariable";
document.viewmenu.fieldname.value = field;
document.viewmenu.varvalue.value = val2;
document.viewmenu.submit();
}
function Submit_ListSearch(action)
{
f = document.getElementById('ListSearchForm');
s = document.getElementById('ListSearchWord');
if(f)
{
f.Action.value = action;
f.list_search.value = s.value;
f.submit();
}
}
function ValidTime(time_str)
{
var valid = true;
if( trim(time_str) == '' ) return true; // is valid in case if not entered
time_str = time_str.toUpperCase();
parts = time_str.split(/\s*[: ]\s*/);
hour = parseInt(parts[0]);
minute = parseInt(parts[1]);
sec = parseInt(parts[2]);
if(ampm == true)
{
amstr = parts[3];
var am_valid = (amstr == 'AM' || amstr == 'PM');
if(am_valid && hour > 12) valid = false;
if(amstr == 'PM' && hour <= 12) hour = hour + 12;
if(hour == 24) hour = 0;
if(!am_valid) valid = false;
}
valid = valid && (hour > -1 && hour < 24);
valid = valid && (minute > -1 && minute < 60);
valid = valid && (sec > -1 && sec < 60);
return valid;
}
function ValidCustomName(name_str)
{
if (trim(name_str) == '') return false;
var re = new RegExp('^[a-zA-Z0-9_]{1,}$');
if (name_str.match(re)) {
return true;
}
else {
return false;
}
}
function ValidThemeName(name_str)
{
if (trim(name_str) == '') return false;
var re = new RegExp('^[a-zA-Z0-9 ]{1,}$');
if (name_str.match(re)) {
return true;
}
else {
return false;
}
}
function DaysInMonth(month,year)
{
timeA = new Date(year, month,1);
timeDifference = timeA - 86400000;
timeB = new Date(timeDifference);
return timeB.getDate();
}
function ValidDate(date_str)
{
var valid = true;
if( trim(date_str) == '' ) return true; // is valid in case if not entered
parts = date_str.split(/\s*\D\s*/);
year = parts[yearpos-1];
month = parts[monthpos-1];
day = parts[daypos-1];
valid = (year>0);
valid = valid && ((month>0) && (month<13));
valid = valid && (day<DaysInMonth(month,year)+1);
return valid;
}
function trim(str)
{
return str.replace(/(^\s*)|(\s*$)/g,'');
}
function ValidateNumber(aValue, aNumberType)
{
var valid = true;
if( trim(aValue) == '' ) return true;
return (parseInt(aValue) == aValue);
}
function OpenEditor(extra_env,TargetForm,TargetField)
{
var url = '$editor_url';
url = url+'&TargetForm='+TargetForm+'&TargetField='+TargetField+'&destform=popup';
if(extra_env.length>0)
url = url+extra_env;
window.open(url,"html_edit","width=800,height=575,status=yes,resizable=yes,menubar=no,scrollbars=yes,toolbar=no");
}
function BitStatus(Value,bit)
{
var val = Math.pow(2,bit);
if((Value & val))
{
return 1;
}
else
return 0;
}
function FlipBit(ValueName,Value,bit)
{
var val = Math.pow(2,bit);
//alert("Setting bit "+bit);
if(BitStatus(Value,bit))
{
Value = Value - val;
}
else
Value = Value + val;
session_val(ValueName,Value);
}
function PerPageSelected(Value,PageCount)
{
if(Value==PageCount)
{
return 2;
}
else
return 0;
}
function RadioIsSelected(Value1,Value2)
{
if(Value1 == Value2)
{
return 2;
}
else
return 0;
}
function OpenItemSelector(envstr)
{
//alert(envstr);
window.open('$item_select?'+envstr,"groupselect","width=750,height=400,status=yes,resizable=yes,menubar=no,scrollbars=yes,toolbar=no");
}
function OpenUserSelector(CheckIdField,Checks,envstr)
{
if(Checks) var retval = Checks.getItemList();
f = document.getElementById('userpopup');
if(f)
{
if(CheckIdField)
f.elements[CheckIdField].value = retval;
}
SessionPrepare('$user_select', envstr, 'userselect');
}
function SessionPrepare(url, get_str, window_name)
{
var params = ExtractParams(get_str);
if(params['destform'])
{
if(params['destform'] == 'popup')
{
CreatePopup(window_name, url + '?' + get_str);
return true;
}
else
var frm = CreateFakeForm();
}
else
var frm = CreateFakeForm();
if(!frm) return false;
frm.destform.value = params['destform'];
params['destform'] = 'popup';
get_str = MergeParams(params);
CreatePopup(window_name);
frm.target = window_name;
frm.method = 'POST';
frm.action = url + '?' + get_str;
frm.submit();
}
function addField(form, type, name, value)
{
// create field in form
var field = document.createElement("INPUT");
field.type = type;
field.name = name;
field.id = name;
field.value = value;
form.insertBefore(field, form.nextSibling);
}
function CreateFakeForm()
{
if($submit_done == 0)
{
var theBody = document.getElementsByTagName("BODY");
if(theBody.length == 1)
{
var frm = document.createElement("FORM");
frm.name = "fake_form";
frm.id = "fake_form";
frm.method = "post";
theBody[0].insertBefore(frm, theBody[0].nextSibling);
addField(frm, 'hidden', 'submit_done', 1);
addField(frm, 'hidden', 'destform', '');
return document.getElementById('fake_form');
}
}
return false;
}
function CreatePopup(window_name, url, width, height)
{
// creates a popup window & returns it
if(url == null && typeof(url) == 'undefined' ) url = '';
if(width == null && typeof(width) == 'undefined' ) width = 750;
if(height == null && typeof(height) == 'undefined' ) height = 400;
return window.open(url,window_name,'width='+width+',height='+height+',status=yes,resizable=yes,menubar=no,scrollbars=yes,toolbar=no');
}
function ShowHelp(section)
{
var frm = document.getElementById('help_form');
frm.section.value = section;
frm.method = 'POST';
CreatePopup('HelpPopup','$rootURL$admin/help/blank.html'); // , null, 600
frm.target = 'HelpPopup';
frm.submit();
}
function ExtractParams(get_str)
{
// extract params into associative array
var params = get_str.split('&');
var result = Array();
var temp_var;
var i = 0;
var params_count = params.length;
while(i < params_count)
{
temp_var = params[i].split('=');
result[temp_var[0]] = temp_var[1];
i++;
}
return result;
}
function MergeParams(params)
{
// join splitted params into GET string
var key;
var result = '';
for(key in params)
result += key + '=' + params[key] + '&';
if(result.length) result = result.substring(0, result.length - 1);
return result;
}
function show_props(obj, objName)
{
var result = "";
for (var i in obj) {
result += objName + "." + i + " = " + obj[i] + "\\n";
}
return result;
}
function OpenGroupSelector(envstr)
{
//alert(envstr);
SessionPrepare('$group_select', envstr, 'groupselect');
//window.open('$group_select?'+envstr,"groupselect","width=750,height=400,status=yes,resizable=yes,menubar=no,scrollbars=yes,toolbar=no");
}
function OpenCatSelector(envstr)
{
//alert(envstr);
window.open('$cat_select?'+envstr,"catselect","width=750,height=400,status=yes,resizable=yes,menubar=no,scrollbars=yes,toolbar=no");
}
function openEmailPopup(envar,form,Checks)
{
var email_url='$email_url';
var url = email_url+envar;
if(Checks.itemChecked())
{
f = document.getElementById(form);
if(f)
{
window.open('',"sendmail","width=750,height=400,status=yes,resizable=yes,menubar=no,scrollbars=yes,toolbar=no");
f.idlist.value = Checks.getItemList();
f.submit();
}
}
}
function OpenPhraseEditor(extra_env)
{
//SessionPrepare('$phrase_edit', extra_env, 'phrase_edit');
var url = '$phrase_edit'+extra_env+'&destform=popup';
window.open(url,"phrase_edit","width=750,height=400,status=yes,resizable=yes,menubar=no,scrollbars=yes,toolbar=no");
}
var env = '$env2';
var SubmitFunc = false;
</script>
END;
?>
Property changes on: trunk/admin/include/mainscript.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.10
\ No newline at end of property
+1.11
\ No newline at end of property
Event Timeline
Log In to Comment