Merge pull request #223 from marcoAntonioNina/BUG-0000

BUG 0000 Short tags
This commit is contained in:
julceslauhub
2012-07-11 16:01:23 -07:00
2 changed files with 299 additions and 265 deletions

View File

@@ -1,261 +1,290 @@
<?php <?php
/** /**
* groups_Tree.php * groups_Tree.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
/** /**
* New Debugger interface * New Debugger interface
* *
* @author Erik A. O. <erik@colosa.com> * @author Erik A. O. <erik@colosa.com>
* @Date Wed Mar 17th. 2010 * @Date Wed Mar 17th. 2010
*/ */
G::LoadClass('case'); G::LoadClass('case');
//variables //variables
$oApp= new Cases(); $oApp= new Cases();
$aFields = $oApp->loadCase($_SESSION['APPLICATION']); $aFields = $oApp->loadCase($_SESSION['APPLICATION']);
$aStoredVarNames = array_keys($aFields['APP_DATA']); $aStoredVarNames = array_keys($aFields['APP_DATA']);
$aVariables = Array(); $aVariables = Array();
for($i=0; $i<count($_SESSION['TRIGGER_DEBUG']['DATA']); $i++) {
$aVariables[$_SESSION['TRIGGER_DEBUG']['DATA'][$i]['key']] = $_SESSION['TRIGGER_DEBUG']['DATA'][$i]['value']; for ($i=0; $i<count($_SESSION['TRIGGER_DEBUG']['DATA']); $i++) {
} $aVariables[$_SESSION['TRIGGER_DEBUG']['DATA'][$i]['key']] = $_SESSION['TRIGGER_DEBUG']['DATA'][$i]['value'];
}
$aVariables = array_merge($aFields['APP_DATA'], $aVariables);
ksort($aVariables); $aVariables = array_merge($aFields['APP_DATA'], $aVariables);
ksort($aVariables);
//triggers
//triggers
if( isset($_SESSION['TRIGGER_DEBUG']['info']) ) { if (isset($_SESSION['TRIGGER_DEBUG']['info'])) {
$aTriggers = $_SESSION['TRIGGER_DEBUG']['info']; $aTriggers = $_SESSION['TRIGGER_DEBUG']['info'];
} else { } else {
$aTriggers[0] = $_SESSION['TRIGGER_DEBUG']; $aTriggers[0] = $_SESSION['TRIGGER_DEBUG'];
} }
foreach($aTriggers as $aTrigger) { foreach ($aTriggers as $aTrigger) {
$triggers_name = Array(); $triggers_name = Array();
$triggers_code = Array(); $triggers_code = Array();
$t_time = $aTrigger['TIME']; $t_time = $aTrigger['TIME'];
if($aTrigger['NUM_TRIGGERS'] != 0) { if ($aTrigger['NUM_TRIGGERS'] != 0) {
$triggers_onfly = $aTrigger['NUM_TRIGGERS']." trigger(s) was executed <font color='#641213'><b>".strtolower($aTrigger['TIME'])."</b></font><br/>"; $triggers_onfly = $aTrigger['NUM_TRIGGERS']." trigger(s) was executed <font color='#641213'><b>".
strtolower($aTrigger['TIME'])."</b></font><br/>";
$cnt = 0;
if(isset($aTrigger['TRIGGERS_NAMES'])) { $cnt = 0;
foreach($aTrigger['TRIGGERS_NAMES'] as $name) { if (isset($aTrigger['TRIGGERS_NAMES'])) {
$t_code = $aTrigger['TRIGGERS_VALUES'][$cnt]['TRI_WEBBOT']; foreach ($aTrigger['TRIGGERS_NAMES'] as $name) {
//$t_code = str_replace('"', '\'',$t_code); $t_code = $aTrigger['TRIGGERS_VALUES'][$cnt]['TRI_WEBBOT'];
//$t_code = addslashes($t_code); //$t_code = str_replace('"', '\'',$t_code);
$t_code = Only1br($t_code); //$t_code = addslashes($t_code);
$t_code = Only1br($t_code);
$triggers_name[] = $name;
$triggers_code[] = $t_code; $triggers_name[] = $name;
$cnt++; $triggers_code[] = $t_code;
} $cnt++;
} }
} else { }
$triggers_onfly = " No triggers found <font color='#641213'><b>".strtolower($t_time)."</b></font>"; } else {
} $triggers_onfly = " No triggers found <font color='#641213'><b>".strtolower($t_time)."</b></font>";
} }
}
//errors
$DEBUG_POST = array_unique($_SESSION['TRIGGER_DEBUG']['ERRORS']); //errors
$DEBUG_POST = array_unique($_SESSION['TRIGGER_DEBUG']['ERRORS']);
/////
/////
function Only1br($string) {
return preg_replace("/(\r\n)+|(\n|\r)+/", "<br />", $string); function Only1br($string)
} {
return preg_replace("/(\r\n)+|(\n|\r)+/", "<br />", $string);
?> }
<style>
?>
table.pmdebugger{
border: 1px solid #777; <style>
padding: 0; table.pmdebugger{
border-spacing: 0; border: 1px solid #777;
color: #000; padding: 0;
} border-spacing: 0;
color: #000;
table.pmdebugger td{ }
border: 1px solid #777;
border-width: 0 0 1px 1px; table.pmdebugger td{
padding-left: 0px; border: 1px solid #777;
padding-right: 0px; border-width: 0 0 1px 1px;
color: #000; padding-left: 0px;
font: 8pt Tahoma,sans-serif,MiscFixed; padding-right: 0px;
} color: #000;
font: 8pt Tahoma,sans-serif,MiscFixed;
td.pmdebuggerHeader{ }
font-weight: bold;
color: #000; td.pmdebuggerHeader{
padding-left: 3px; font-weight: bold;
padding-right: 3px; color: #000;
background-color: #C3C3C3; padding-left: 3px;
font: 8pt Tahoma,sans-serif,MiscFixed; padding-right: 3px;
} background-color: #C3C3C3;
font: 8pt Tahoma,sans-serif,MiscFixed;
#debugger_vars{ }
padding: 3px;
overflow: auto; #debugger_vars{
} padding: 3px;
#debugger_triggers{ overflow: auto;
padding: 3px; }
overflow: auto;
} #debugger_triggers{
#debugger_errors{ padding: 3px;
padding: 3px; overflow: auto;
overflow: auto; }
}
#debugger_errors{
.data_view{ padding: 3px;
padding: 3px; overflow: auto;
display:none; }
background: #F6F3F3;
font-family: monospace; .data_view{
} padding: 3px;
</style> display:none;
<script> background: #F6F3F3;
function toggle(id){ font-family: monospace;
var o = document.getElementById(id); }
if( o.style.display != 'block'){ </style>
o.style.display = 'block';
newimg = new Image(); <script>
newimg.src = '/images/pin-dn-on.gif'; function toggle(id){
document.getElementById('img_'+id).src = newimg.src; var o = document.getElementById(id);
} else { if(o.style.display != 'block'){
o.style.display = 'none'; o.style.display = 'block';
newimg = new Image(); newimg = new Image();
newimg.src = '/images/pin-up-on.gif'; newimg.src = '/images/pin-dn-on.gif';
document.getElementById('img_'+id).src = newimg.src; document.getElementById('img_'+id).src = newimg.src;
} } else {
} o.style.display = 'none';
</script> newimg = new Image();
newimg.src = '/images/pin-up-on.gif';
<div class="ui-widget-header ui-corner-all" width="100%" align="center">Processmaker - Debugger</div> document.getElementById('img_'+id).src = newimg.src;
}
<div class="ui-widget-header ui-corner-all" width="50%" align="center">Triggers</div> }
<div id="debugger_triggers" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all"> </script>
<table width='100%' cellspacing='0' cellpadding='0' border='1' style='border:0px;'>
<tr> <div class="ui-widget-header ui-corner-all" width="100%" align="center">Processmaker - Debugger</div>
<td width='410px' class='treeNode' style='border:0px;background-color:transparent;'>
<font color='#0B58B6'><?php= $triggers_onfly?></font><br/> <div class="ui-widget-header ui-corner-all" width="50%" align="center">Triggers</div>
<?php if( sizeof($triggers_name) > 0 ) {?> <div id="debugger_triggers" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
<table class="pmdebugger" width="100%"> <table width='100%' cellspacing='0' cellpadding='0' border='1' style='border:0px;'>
<tr> <tr>
<td width="5" class="pmdebuggerHeader">#</td><td class="pmdebuggerHeader">Name</td><td class="pmdebuggerHeader">&nbsp;</td> <td width='410px' class='treeNode' style='border:0px;background-color:transparent;'>
</tr> <font color='#0B58B6'><?php echo $triggers_onfly; ?></font><br/>
<?php foreach($triggers_name as $k=>$trigger) {?> <?php if (sizeof($triggers_name) > 0) {?>
<tr> <table class="pmdebugger" width="100%">
<td>&nbsp;<?php =($k+1)?>&nbsp;</td> <tr>
<td> <td width="5" class="pmdebuggerHeader">#</td>
&nbsp;<?php= $trigger?> <td class="pmdebuggerHeader">Name</td>
<div id='trigger_<?php= $k?>' class='ui-accordion-header ui-helper-reset ui-state-active ui-corner-all data_view'><?php=$triggers_code[$k]?></div> <td class="pmdebuggerHeader">&nbsp;</td>
</td> </tr>
<td valign="top" width="5"> <?php
<a href='#' onclick="toggle('trigger_<?php=$k?>'); return false;"> foreach ($triggers_name as $k => $trigger) {?>
<img id='img_trigger_<?php=$k?>' src='/images/pin-up-on.gif' border='0'> <tr>
</a> <td>&nbsp;<?php echo ($k+1); ?>&nbsp;</td>
</td> <td>
</tr> &nbsp;<?php echo $trigger; ?>
<?php } ?> <div id='trigger_<?php echo $k; ?>'
</table> class='ui-accordion-header ui-helper-reset ui-state-active ui-corner-all data_view'>
<?php } ?> <?php echo $triggers_code[$k]; ?>
</td> </div>
</tr> </td>
</table> <td valign="top" width="5">
</div> <a href='#' onclick="toggle('trigger_<?php echo $k; ?>'); return false;">
<!----> <img id='img_trigger_<?php echo $k; ?>' src='/images/pin-up-on.gif' border='0'>
</a>
<div class="ui-widget-header ui-corner-all" width="50%" align="center">Variables</div> </td>
<div id="debugger_vars" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all"> </tr>
<table class="pmdebugger" width="100%"> <?php
<tr> } ?>
<td class="pmdebuggerHeader">Name</td><td class="pmdebuggerHeader">Value</td> </table>
</tr> <?php
<?php foreach($aVariables as $sName=>$aVariable) {?> } ?>
<tr> </td>
<?php if( is_array($aVariable) ) {?> </tr>
<td valign="top"><font color="blue">&nbsp;<?=$sName?></font></td> </table>
<?php } else {?> </div>
<td>&nbsp;<?php =$sName?></td> <!---->
<?php }?>
<td><?php echo expandVarView($aVariable, $sName)?></td> <div class="ui-widget-header ui-corner-all" width="50%" align="center">Variables</div>
</tr> <div id="debugger_vars" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
<?php }?> <table class="pmdebugger" width="100%">
</table> <tr>
</div> <td class="pmdebuggerHeader">Name</td><td class="pmdebuggerHeader">Value</td>
</tr>
<!----> <?php
<?php if( count($DEBUG_POST) > 0 ) {?> foreach ($aVariables as $sName => $aVariable) {?>
<div class="ui-widget-header ui-corner-all" width="50%" align="center">Errors</div> <tr>
<div id="debugger_errors" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all" align="left"> <?php
if (is_array($aVariable)) {?>
<?php for($i=0; $i<count($DEBUG_POST); $i++) { <td valign="top"><font color="blue">&nbsp;<?php
if(isset($DEBUG_POST[$i]['ERROR']) and $DEBUG_POST[$i]['ERROR'] != '') {?> echo $sName; ?></font></td>
<span class='treeNode'> <?php
<font color='red'>Error </font> } else {?>
<font color='#0B58B6'><?php=str_replace('<br />', '',$DEBUG_POST[$i]['ERROR'])?></font> <td>&nbsp;<?php echo $sName; ?></td>
</span><br/> <?php
<?php} }?>
} <td><?php echo expandVarView($aVariable, $sName)?></td>
for($i=0; $i<count($DEBUG_POST); $i++) { ?> </tr>
<?php if(isset($DEBUG_POST[$i]['FATAL']) and $DEBUG_POST[$i]['FATAL'] != '') { ?> <?php
<span class='treeNode'> }?>
<font color='red'>Fatal error </font> </table>
<font color='#0B58B6'> <?php=str_replace('<br />', '',$DEBUG_POST[$i]['FATAL'])?></font> </div>
</span><br/>
<?php } <!---->
}
} else { ?> <?php
<div class="ui-widget-header ui-corner-all" width="50%" align="center">No errors reported</div> if (count($DEBUG_POST) > 0) {?>
<?php}?> <div class="ui-widget-header ui-corner-all" width="50%" align="center">Errors</div>
</div> <div id="debugger_errors" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all" align="left">
<!----> <?php
for ($i=0; $i<count($DEBUG_POST); $i++) {
<?php if(isset($_POST['NextStep'])) {?> if (isset($DEBUG_POST[$i]['ERROR']) and $DEBUG_POST[$i]['ERROR'] != '') {?>
<input type="button" value="Continue" class="module_app_button___gray" onclick="javascript:location.href='<?php= $_POST['NextStep']?>'"> <span class='treeNode'>
<?php}?> <font color='red'>Error </font>
<font color='#0B58B6'><?php echo str_replace('<br />', '',$DEBUG_POST[$i]['ERROR']);?></font>
</span><br/>
<?php <?php
}
function expandVarView($a, $name) { }
if( is_array($a) ) { for ($i=0; $i<count($DEBUG_POST); $i++) { ?>
echo "<a href='#' onclick=\"toggle('data_view_{$name}'); return false;\"><img id='img_data_view_{$name}' src='/images/pin-up-on.gif' border='0'></a><div id='data_view_{$name}' class='data_view'><table class='pmdebugger' width='100%'>"; <?php
foreach($a as $k=>$v) { if (isset($DEBUG_POST[$i]['FATAL']) and $DEBUG_POST[$i]['FATAL'] != '') {?>
echo "<tr><td valign='top'>&nbsp;$k</td><td>"; <span class='treeNode'>
expandVarView($v, "{$name}_{$k}"); <font color='red'>Fatal error </font>
echo "</td></tr>"; <font color='#0B58B6'> <?php echo str_replace('<br />', '',$DEBUG_POST[$i]['FATAL']); ?></font>
} </span><br/>
echo "</table><div>"; <?php
} else { }
echo ($a=='')? '&nbsp;': "&nbsp;$a"; }
} } else { ?>
<div class="ui-widget-header ui-corner-all" width="50%" align="center">No errors reported</div>
} <?php
}?>
?> </div>
<!---->
<?php if (isset($_POST['NextStep'])) {?>
<input type="button" value="Continue" class="module_app_button___gray" onclick="javascript:location.href='
<?php echo $_POST['NextStep']; ?>'">
<?php
}?>
<?php
function expandVarView($a, $name)
{
if (is_array($a)) {
echo "<a href='#' onclick=\"toggle('data_view_{$name}'); return false;\">
<img id='img_data_view_{$name}' src='/images/pin-up-on.gif' border='0'></a>
<div id='data_view_{$name}' class='data_view'><table class='pmdebugger' width='100%'>";
foreach ($a as $k => $v) {
echo "<tr><td valign='top'>&nbsp;$k</td><td>";
expandVarView($v, "{$name}_{$k}");
echo "</td></tr>";
}
echo "</table><div>";
} else {
echo ($a=='')? '&nbsp;': "&nbsp;$a";
}
}

View File

@@ -1,4 +1,9 @@
<?php if(isset($_POST['NextStep'])){?> <?php if (isset($_POST['NextStep'])) {?>
<div class="ui-widget-header ui-corner-all" width="100%" align="center">Processmaker - Debugger (Break Point)&nbsp;&nbsp;&nbsp;&nbsp; <input type="button" value="Continue" class="module_app_button___gray" onclick="javascript:location.href='<?=$_POST['NextStep']?>'"> <div class="ui-widget-header ui-corner-all" width="100%" align="center">
</div> Processmaker - Debugger (Break Point)&nbsp;&nbsp;&nbsp;&nbsp;
<?php }?> <input type="button" value="Continue" class="module_app_button___gray"
onclick="javascript:location.href='<?php echo $_POST['NextStep']; ?>'">
</div>
<?php
}