2012-10-22 13:17:19 -04:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* varsAjax.php
|
|
|
|
|
*
|
|
|
|
|
* ProcessMaker Open Source Edition
|
|
|
|
|
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* 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/>.
|
|
|
|
|
*
|
|
|
|
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
|
|
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
2013-05-06 19:36:45 +00:00
|
|
|
*
|
2012-10-22 13:17:19 -04:00
|
|
|
*/
|
2015-03-18 17:12:38 -04:00
|
|
|
|
|
|
|
|
G::LoadSystem('inputfilter');
|
|
|
|
|
$filter = new InputFilter();
|
|
|
|
|
$_POST = $filter->xssFilterHard($_POST);
|
|
|
|
|
$_REQUEST = $filter->xssFilterHard($_REQUEST);
|
|
|
|
|
|
2012-11-28 21:20:41 +00:00
|
|
|
$_SERVER["QUERY_STRING"] = isset($_SERVER["QUERY_STRING"])?$_SERVER["QUERY_STRING"]:'';
|
2012-11-30 18:21:27 +00:00
|
|
|
$_REQUEST["sProcess"] = isset($_REQUEST["sProcess"])?$_REQUEST["sProcess"]:'';
|
|
|
|
|
$_REQUEST["sFieldName"] = isset($_REQUEST["sFieldName"])?$_REQUEST["sFieldName"]:'';
|
|
|
|
|
$_REQUEST['sSymbol']= isset($_REQUEST["sSymbol"])?$_REQUEST["sSymbol"]:'';
|
2012-11-23 15:23:44 -04:00
|
|
|
|
2015-03-18 17:12:38 -04:00
|
|
|
$_SERVER["QUERY_STRING"] = $filter->xssFilterHard($_SERVER["QUERY_STRING"]);
|
|
|
|
|
|
2012-11-28 21:20:41 +00:00
|
|
|
$html = '<form action="uploader.php?'.$_SERVER["QUERY_STRING"].'&q=upload" onLoad="onLoad()" method="post" enctype="multipart/form-data" onsubmit="">';
|
2012-11-23 19:01:17 +00:00
|
|
|
$html .= '<div id="d_variables">';
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '<table width="90%" align="center">';
|
2012-11-26 16:08:09 +00:00
|
|
|
|
2012-11-27 08:55:29 -04:00
|
|
|
$html .= '<tr style="display:none; visibility:hidden;">';
|
2012-11-26 12:29:29 -04:00
|
|
|
$html .= '<td colspan="3">';
|
2012-11-29 14:50:22 +00:00
|
|
|
$html .= '<input type="hidden" id="process" value="'.$_REQUEST['sProcess'].'">';
|
|
|
|
|
$html .= '<input type="hidden" id="selectedField" name="selectedField" value="'.$_REQUEST['sFieldName'].'"/> ';
|
2012-11-26 16:08:09 +00:00
|
|
|
$html .= '</td>';
|
|
|
|
|
$html .= '</tr>';
|
|
|
|
|
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '<tr>';
|
|
|
|
|
$html .= '<td width="50%">';
|
2015-03-18 17:12:38 -04:00
|
|
|
$html .= '<label for="type_label">'.$filter->xssFilterHard(G::LoadTranslation('ID_TINY_TYPE_VARIABLE')).'</label>';
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '</td>';
|
|
|
|
|
|
|
|
|
|
$html .= '<td width="25%">';
|
2015-03-18 17:12:38 -04:00
|
|
|
$html .= '<label for="prefix_label">'.$filter->xssFilterHard(G::LoadTranslation('ID_PREFIX')).'</label>';
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '</td>';
|
|
|
|
|
|
|
|
|
|
$html .= '<td width="25%">';
|
2015-03-18 17:12:38 -04:00
|
|
|
$html .= '<label for="variables_label">'.$filter->xssFilterHard(G::LoadTranslation( 'ID_SEARCH')).'</label>';
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '</td>';
|
|
|
|
|
$html .= '</tr>';
|
|
|
|
|
|
|
|
|
|
$html .= '<tr>';
|
2012-11-23 19:01:17 +00:00
|
|
|
$html .= '<td width="25%">';
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '<select name="type_variables" id="type_variables">';
|
2015-03-18 17:12:38 -04:00
|
|
|
$html .= '<option value="all">'.$filter->xssFilterHard(G::LoadTranslation( 'ID_TINY_ALL_VARIABLES' )).'</option>';
|
|
|
|
|
$html .= '<option value="system">'.$filter->xssFilterHard(G::LoadTranslation( 'ID_TINY_SYSTEM_VARIABLES' )).'</option>';
|
|
|
|
|
$html .= '<option value="process">'.$filter->xssFilterHard(G::LoadTranslation( 'ID_TINY_PROCESS_VARIABLES' )).'</option>';
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '</select> ';
|
2012-11-23 14:05:44 +00:00
|
|
|
$html .= '</td>';
|
|
|
|
|
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '<td width="25%">';
|
|
|
|
|
$html .= '<select name="prefix" id="prefix">';
|
2012-11-27 17:24:38 +00:00
|
|
|
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '<option value="ID_TO_STRING">@@</option>';
|
2012-11-27 17:24:38 +00:00
|
|
|
$html .= '<option value="ID_TO_FLOAT">@#</option>';
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '<option value="ID_TO_INTEGER">@%</option>';
|
|
|
|
|
$html .= '<option value="ID_TO_URL">@?</option>';
|
|
|
|
|
$html .= '<option value="ID_SQL_ESCAPE">@$</option>';
|
|
|
|
|
$html .= '<option value="ID_REPLACE_WITHOUT_CHANGES">@=</option>';
|
2012-12-07 19:28:59 +00:00
|
|
|
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '</select> ';
|
|
|
|
|
$html .= '</td>';
|
|
|
|
|
|
2012-11-26 16:08:09 +00:00
|
|
|
$html .= '<td width="25%" valign="top">';
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '<input type="text" id="search" size="15">';
|
2012-11-23 14:05:44 +00:00
|
|
|
$html .= '</td>';
|
|
|
|
|
$html .= '</tr>';
|
|
|
|
|
$html .= '<tr>';
|
2015-03-18 17:12:38 -04:00
|
|
|
$html .= '<tr><td><label for="prefix_label">'.$filter->xssFilterHard(G::LoadTranslation( 'ID_VARIABLES' )).'</label></td></tr>';
|
2012-11-23 14:05:44 +00:00
|
|
|
$html .= '<tr>';
|
2012-12-07 19:28:59 +00:00
|
|
|
|
2012-11-23 14:05:44 +00:00
|
|
|
$html .= '<td colspan="3">';
|
|
|
|
|
|
2012-11-23 15:23:44 -04:00
|
|
|
G::LoadClass( 'xmlfield_InputPM' );
|
2012-11-29 14:50:22 +00:00
|
|
|
$aFields = getDynaformsVars( $_REQUEST['sProcess'], true, isset( $_POST['bIncMulSelFields'] ) ? $_POST['bIncMulSelFields'] : 0 );
|
2012-11-23 14:05:44 +00:00
|
|
|
|
2012-11-28 17:43:19 -04:00
|
|
|
$displayOption = '';
|
|
|
|
|
if (isset($_REQUEST['displayOption'])){
|
|
|
|
|
$displayOption = 'displayOption="'.$_REQUEST['displayOption'].'"';
|
|
|
|
|
} else {
|
|
|
|
|
$displayOption = 'displayOption="normal"' ;
|
|
|
|
|
}
|
|
|
|
|
$html .= '<select name="_Var_Form_" id="_Var_Form_" size="8" style="width:100%;' . (! isset( $_POST['sNoShowLeyend'] ) ? 'height:170;' : '') . '" '.$displayOption.'>';
|
2012-11-23 14:05:44 +00:00
|
|
|
|
2012-11-29 14:50:22 +00:00
|
|
|
foreach ($aFields as $aField) {
|
2012-11-27 15:42:28 -04:00
|
|
|
$html .= '<option value="' . $_REQUEST['sSymbol'] . $aField['sName'] . '">' . $_REQUEST['sSymbol'] . $aField['sName'] . ' (' . $aField['sType'] . ')</option>';
|
2012-11-23 15:23:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$aRows[0] = Array ('fieldname' => 'char','variable' => 'char','type' => 'type','label' => 'char');
|
|
|
|
|
foreach ($aFields as $aField) {
|
2012-11-29 14:50:22 +00:00
|
|
|
$aRows[] = Array ('fieldname' => $_REQUEST['sFieldName'], 'variable' => $_REQUEST['sSymbol'] . $aField['sName'],'variable_label' => '<div class="pm__dynavars"> <a id="dynalink" href=# onclick="insertFormVar(\'' . $_REQUEST['sFieldName'] . '\',\'' . $_REQUEST['sSymbol'] . $aField['sName'] . '\');">' . $_REQUEST['sSymbol'] . $aField['sName'] . '</a></div>','type' => $aField['sType'],'label' => $aField['sLabel']
|
2012-11-23 15:23:44 -04:00
|
|
|
);
|
|
|
|
|
}
|
2012-11-23 14:05:44 +00:00
|
|
|
$html .= '</select>';
|
|
|
|
|
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '</td>';
|
|
|
|
|
$html .= '</tr>';
|
|
|
|
|
$html .= '</table>';
|
|
|
|
|
$html .= '</div>';
|
|
|
|
|
|
|
|
|
|
$html .= '<br>';
|
|
|
|
|
$html .= '<table border="1" width="90%" align="center">';
|
|
|
|
|
$html .= '<tr width="40%">';
|
2015-03-18 17:12:38 -04:00
|
|
|
$html .= '<td>'.$filter->xssFilterHard(G::LoadTranslation('ID_RESULT')).'</td>';
|
2012-11-27 08:55:29 -04:00
|
|
|
$html .= '<td><span id="selectedVariableLabel">@@SYS_LANG</span></td>';
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '</tr>';
|
|
|
|
|
$html .= '<tr width="60%">';
|
2015-03-18 17:12:38 -04:00
|
|
|
$html .= '<td>'.$filter->xssFilterHard(G::LoadTranslation('ID_DESCRIPTION')).'</td>';
|
|
|
|
|
$html .= '<td><span id="desc_variables">'.$filter->xssFilterHard(G::LoadTranslation('ID_SYSTEM')).'</span></td>';
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '</tr>';
|
|
|
|
|
$html .= '</table>';
|
|
|
|
|
$html .= '</div>';
|
|
|
|
|
$html .= '<br>';
|
|
|
|
|
$html .= '<table width="90%" align="center">';
|
|
|
|
|
$html .= '<tr><td>';
|
2015-03-18 17:12:38 -04:00
|
|
|
$html .= '<label for="desc_prefix">*<span id="desc_prefix">'.$filter->xssFilterHard(G::LoadTranslation( 'ID_TO_STRING' )).'</span></label>';
|
2012-11-23 15:23:44 -04:00
|
|
|
$html .= '</td></tr>';
|
|
|
|
|
$html .= '</div>';
|
|
|
|
|
|
2012-11-23 14:05:44 +00:00
|
|
|
$html .= '</form>';
|
|
|
|
|
|
2012-12-07 19:28:59 +00:00
|
|
|
$display = 'raw';
|
2012-11-23 19:01:17 +00:00
|
|
|
|
2012-11-23 15:23:44 -04:00
|
|
|
$G_PUBLISH = new Publisher();
|
2012-11-23 19:01:17 +00:00
|
|
|
$oHeadPublisher = & headPublisher::getSingleton();
|
2012-11-23 15:23:44 -04:00
|
|
|
$oHeadPublisher->addScriptFile('/jscore/controls/variablePicker.js');
|
2012-11-27 21:10:12 +00:00
|
|
|
if (isset($_REQUEST['displayOption'])) {
|
|
|
|
|
if($_REQUEST['displayOption']=='tinyMCE'){
|
|
|
|
|
$display = 'blank';
|
|
|
|
|
$oHeadPublisher->addScriptFile('/js/tinymce/jscripts/tiny_mce/tiny_mce_popup.js');
|
|
|
|
|
$oHeadPublisher->addScriptFile('/js/tinymce/jscripts/tiny_mce/plugins/pmVariablePicker/editor_plugin_src.js');
|
|
|
|
|
}
|
2012-11-27 15:42:28 -04:00
|
|
|
}
|
|
|
|
|
|
2012-11-23 14:05:44 +00:00
|
|
|
echo $html;
|
2012-11-23 19:01:17 +00:00
|
|
|
|
2015-03-18 17:12:38 -04:00
|
|
|
G::RenderPage( 'publish', $display );
|