Merge branch 'pm_wysiwyg'

This commit is contained in:
Gustavo Cruz
2012-12-07 15:39:37 -04:00
25 changed files with 648 additions and 437 deletions

View File

@@ -25,7 +25,7 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
* @package workflow.engine.classes
*/
**/
class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText
{
@@ -432,6 +432,7 @@ function getGridsVars ($sProcessUID)
{
$aFields = array ();
$aFieldsNames = array ();
require_once 'classes/model/Dynaform.php';
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( DynaformPeer::DYN_FILENAME );
@@ -445,8 +446,7 @@ function getGridsVars ($sProcessUID)
foreach ($G_FORM->fields as $k => $v) {
if ($v->type == 'grid') {
if (! in_array( $k, $aFieldsNames )) {
$aFields[] = array ('sName' => $k,'sXmlForm' => str_replace( $sProcessUID . '/', '', $v->xmlGrid )
);
$aFields[] = array ('sName' => $k,'sXmlForm' => str_replace( $sProcessUID . '/', '', $v->xmlGrid ));
$aFieldsNames[] = $k;
}
}
@@ -456,6 +456,44 @@ function getGridsVars ($sProcessUID)
}
return $aFields;
}
/**
* Function getVarsGrid returns all variables of Grid
*
* @access public
* @param string proUid process ID
* @param string dynUid dynaform ID
* @return array
*/
function getVarsGrid ($proUid, $dynUid)
{
G::LoadClass( 'dynaformhandler' );
G::LoadClass( 'AppSolr' );
$dynaformFields = array ();
if (is_file( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) {
$dyn = new dynaFormHandler( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' );
$dynaformFields[] = $dyn->getFields();
}
$dynaformFieldTypes = array ();
foreach ($dynaformFields as $aDynFormFields) {
foreach ($aDynFormFields as $field) {
if ($field->getAttribute( 'validate' ) == 'Int') {
$dynaformFieldTypes[$field->nodeName] = 'Int';
} elseif ($field->getAttribute( 'validate' ) == 'Real') {
$dynaformFieldTypes[$field->nodeName] = 'Real';
} else {
$dynaformFieldTypes[$field->nodeName] = $field->getAttribute( 'type' );
}
}
}
return $dynaformFieldTypes;
}
/**
* Class XmlForm_Field_CheckBoxTable

View File

@@ -8,6 +8,16 @@ var setVariablePickerJS = function(){
}
});
/**
* Function getVariableList returns a list with all process variables
*
* @access public
* @param string proUid process ID
* @param string queryText text searched
* @param string varType type of variables (System or Process)
* @return array
*/
var getVariableList = function (queryText, proUid, varType){
varType = varType.toLowerCase();
var responseData
@@ -25,6 +35,13 @@ var setVariablePickerJS = function(){
return responseData;
}
/**
* Function getPrefix returns selected prefix
*
* @access public
* @param string prefix
* @return string
*/
var getPrefix = function (prefix) {
if(document.getElementById('prefix').value=='ID_TO_STRING')
prefix='@@';
@@ -41,6 +58,14 @@ var setVariablePickerJS = function(){
return prefix;
}
/**
* Function getPrefixInfo returns a prefix description
*
* @access public
* @param string prefix
* @return string
*/
var getPrefixInfo = function (prefix){
var oRPC = new leimnud.module.rpc.xmlhttp({
url : "../processes/processes_Ajax",
@@ -82,6 +107,14 @@ var setVariablePickerJS = function(){
}
});
/**
* Function generateListValues fills the dropdown with all variables according to filters
*
* @access public
* @param string prefix
* @return array
*/
function generateListValues (prefix){
var list = getVariableList(document.getElementById('search').value, document.getElementById('process').value, document.getElementById('type_variables').value);
var combo = document.getElementById("_Var_Form_");
@@ -109,9 +142,13 @@ var setVariablePickerJS = function(){
}
}
}
// check wether the document has been already loaded or not,
// whatever the state is this condition ensures that the events are always loaded
if (document.readyState == 'complete'){
// if completed load the functions and events
setVariablePickerJS();
} else {
// if not set the function call in the body onload event
document.body.onload = setVariablePickerJS;
}

View File

@@ -161,8 +161,11 @@ var EventCompose = function(t){
oPanel.make();
oPanel.loader.show();
var oRPC = new leimnud.module.rpc.xmlhttp({
// url : '../events/eventsAjax',
// args: 'request=showDynavars',
// previous calls for the old component
// url : '../events/eventsAjax',
// args: 'request=showDynavars',
// the control for assign dynavars is the same as
// the other sections inside processmaker
url : '../controls/varsAjax',
args: 'sSymbol=@@&displayOption=event'
});

View File

@@ -51,8 +51,6 @@ $html .= '<label for="variables_label">Search</label>';
$html .= '</td>';
$html .= '</tr>';
//$html = '<form action="uploader.php?'.$_SERVER["QUERY_STRING"].'&q=upload" method="post" enctype="multipart/form-data" onsubmit="">';
$html .= '<tr>';
$html .= '<td width="25%">';
$html .= '<select name="type_variables" id="type_variables">';
@@ -63,7 +61,6 @@ $html .= '</select> &nbsp;&nbsp;&nbsp;&nbsp;';
$html .= '</td>';
$html .= '<td width="25%">';
//$html .= '<select name="prefix" id="prefix" onChange="Seleccionar(this);">';
$html .= '<select name="prefix" id="prefix">';
$html .= '<option value="ID_TO_STRING">@@</option>';
@@ -72,14 +69,7 @@ $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>';
/*
$html .= '<option value="@@">@@</option>';
$html .= '<option value="@#">@#</option>';
$html .= '<option value="@%">@%</option>';
$html .= '<option value="@?">@?</option>';
$html .= '<option value="@$">@$</option>';
$html .= '<option value="@=">@=</option>';
*/
$html .= '</select> &nbsp;&nbsp;&nbsp;&nbsp;';
$html .= '</td>';
@@ -90,14 +80,12 @@ $html .= '</tr>';
$html .= '<tr>';
$html .= '<tr><td><label for="prefix_label">Variables</label></td></tr>';
$html .= '<tr>';
//onChange="Seleccionar(this);
$html .= '<td colspan="3">';
G::LoadClass( 'xmlfield_InputPM' );
$aFields = getDynaformsVars( $_REQUEST['sProcess'], true, isset( $_POST['bIncMulSelFields'] ) ? $_POST['bIncMulSelFields'] : 0 );
//$html .= '<select name="_Var_Form_" id="_Var_Form_" size="' . count( $aFields ) . '" style="width:100%;' . (! isset( $_POST['sNoShowLeyend'] ) ? 'height:50%;' : '') . '" ondblclick="insertFormVar(\'' . $_POST['sFieldName'] . '\', this.value);">';
$displayOption = '';
if (isset($_REQUEST['displayOption'])){
$displayOption = 'displayOption="'.$_REQUEST['displayOption'].'"';
@@ -143,7 +131,7 @@ $html .= '</div>';
$html .= '</form>';
$display = 'raw';
$display = 'raw';
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
@@ -159,66 +147,3 @@ if (isset($_REQUEST['displayOption'])) {
echo $html;
G::RenderPage( 'publish', $display );
/*
$alll = '<script type="text/javascript" language="javascript">';
$alll .= 'function Seleccionar(combo){';
$alll .= 'alert(combo.value);';
$alll .= '}';
$alll .= '</script>';
echo $alll;
*/
//echo var_dump($aFields);
/*
$sHTML = '<select name="_Var_Form_" id="_Var_Form_" size="' . count( $aFields ) . '" style="width:100%;' . (! isset( $_POST['sNoShowLeyend'] ) ? 'height:50%;' : '') . '" ondblclick="insertFormVar(\'' . $_POST['sFieldName'] . '\', this.value);">';
foreach ($aFields as $aField) {
$html .= '<option value="' . $_POST['sSymbol'] . $aField['sName'] . '">' . $_POST['sSymbol'] . $aField['sName'] . ' (' . $aField['sType'] . ')</option>';
}
$aRows[0] = Array ('fieldname' => 'char','variable' => 'char','type' => 'type','label' => 'char'
);
foreach ($aFields as $aField) {
$aRows[] = Array ('fieldname' => $_POST['sFieldName'],'variable' => $_POST['sSymbol'] . $aField['sName'],'variable_label' => '<div class="pm__dynavars"> <a id="dynalink" href=# onclick="insertFormVar(\'' . $_POST['sFieldName'] . '\',\'' . $_POST['sSymbol'] . $aField['sName'] . '\');">' . $_POST['sSymbol'] . $aField['sName'] . '</a></div>','type' => $aField['sType'],'label' => $aField['sLabel']
);
}
$html .= '</select>';
$html .= '</td>';
$html .= '</tr>';
$html .= '</table>';
$html .= '</div>';
$html .= '<br>';
$html .= '<div id="desc_variables">';
$html .= '<table border="1" width="90%" align="center">';
$html .= '<tr width="40%">';
$html .= '<td>Result</td>';
$html .= '<td>@#SYS_LANG</td>';
$html .= '</tr>';
$html .= '<tr width="60%">';
$html .= '<td>Description</td>';
$html .= '<td>Description @#SYS_LANG</td>';
$html .= '</tr>';
$html .= '</table>';
$html .= '</div>';
$html .= '<br>';
$html .= '<div id="desc_variables">';
$html .= '<table width="90%" align="center">';
$html .= '<tr><td>';
$html .= '<label for="desc_prefix">' . G::LoadTranslation( 'ID_TO_FLOAT' ) . '</label>';
$html .= '</td></tr>';
$html .= '</div>';
$html .= '</form>';
echo $html;
G::RenderPage( 'publish', 'raw' );
/*$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'triggers/dynavars', $oCriteria );
G::RenderPage( 'publish', 'raw' );
*/

View File

@@ -1,71 +0,0 @@
<?php
/**
* groups.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.
*/
$access = $RBAC->userCanAccess( 'PM_USERS' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'users';
$G_ID_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'GROUPS';
$G_PUBLISH = new Publisher();
G::LoadClass( 'configuration' );
$c = new Configurations();
$configPage = $c->getConfiguration( 'groupList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$configEnv = $c->getConfiguration( 'ENVIRONMENT_SETTINGS', '' );
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
//$oHeadPublisher->addExtJsScript( 'groups/groupsList', false ); //adding a javascript file .js
//$oHeadPublisher->clearScripts();
$oHeadPublisher->addScriptFile( '/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js' );
//$oHeadPublisher->addScriptFile( '/js/jquery/jquery-1.8.2.min.js' );
//$oHeadPublisher->addScriptFile( '/js/jquery/jquery-1.7.1.min.js' );
//$oHeadPublisher->addScriptFile( '/js/tinymce/pmScripts/editorEmailTemplate.js' );
$G_PUBLISH->addContent( 'view', 'outputdocs/testOut' ); //adding a html file .html.
G::RenderPage( 'publish', 'blank' );

View File

@@ -522,6 +522,9 @@ try {
case 'events':
$oProcessMap->eventsList( $oData->pro_uid, $oData->type );
break;
/**
* returns an array with all Dynaforms Fields
*/
case 'getVariableList':
G::LoadClass('xmlfield_InputPM');
$proUid= isset( $_REQUEST['process'] )?$_REQUEST['process']:'';
@@ -548,10 +551,48 @@ try {
}
echo Bootstrap::json_encode( $aVariables );
break;
/**
* returns the prefix mean
*
*/
case 'getVariablePrefix':
$_REQUEST['prefix'] = $_REQUEST['prefix']!=null?$_REQUEST['prefix']:'ID_TO_STRING';
echo G::LoadTranslation($_REQUEST['prefix']);
break;
/**
* return an array with all Variables of Grid type
*/
case 'getGridList':
G::LoadClass('xmlfield_InputPM');
$proUid= isset( $_REQUEST['PRO_UID'] )?$_REQUEST['PRO_UID']:'';
$aFields = getGridsVars( $proUid );
$aVariables = array();
foreach ($aFields as $key => $value){
$aVariables[] = $aFields[$key];
}
echo Bootstrap::json_encode( $aVariables );
break;
/**
* return an array with all Grid Variables according to Grid
*/
case 'getVariableGrid':
G::LoadClass('xmlfield_InputPM');
$proUid= isset( $_REQUEST['PRO_UID'] )?$_REQUEST['PRO_UID']:'';
$dynUid= isset( $_REQUEST['DYN_UID'] )?$_REQUEST['DYN_UID']:'';
$aFields = getVarsGrid($proUid, $dynUid);
$aVariables = array();
foreach ($aFields as $key => $value) {
$aVariables[] = $key;
}
echo Bootstrap::json_encode( $aVariables );
break;
/*
case 'saveFile':
global $G_PUBLISH;

View File

@@ -1,94 +0,0 @@
<?php
echo '
<script>
document.body.onload = function(){
// delete Array.prototype.isArray;
// delete Array.prototype.isObject;
// delete Array.prototype.onlyInt;
// delete Object.prototype.propertyIsEnumerable;
// delete Array.prototype.toStr;
// delete Object.prototype.toStr;
// delete Object.prototype.concat;
// delete Object.prototype.get_by_key;
// delete Object.prototype.expand;
// delete Object.prototype.setParent;
// delete Object.prototype.isset_key;
// delete Function.prototype.extend;
tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce";
tinyMCE.init({
theme : "advanced",
plugins : "fullpage",
mode : "specific_textareas",
editor_selector : "tmceEditor",
width : "640",
height : "200",
theme_advanced_buttons3_add : "fullpage"
});
// alert($("#fcontent").val());
/*
tinyMCE.init({
theme : "advanced",
mode : "specific_textareas",
editor_selector : "tmceEditor",
plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks",
// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Example content CSS (should be your site CSS)
content_css : "css/content.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",
// Style formats
style_formats : [
{title : \'Bold text\', inline : \'b\'},
{title : \'Red text\', inline : \'span\', styles : {color : \'#ff0000\'}},
{title : \'Red header\', block : \'h1\', styles : {color : \'#ff0000\'}},
{title : \'Example 1\', inline : \'span\', classes : \'example1\'},
{title : \'Example 2\', inline : \'span\', classes : \'example2\'},
{title : \'Table styles\'},
{title : \'Table row 1\', selector : \'tr\', classes : \'tablerow1\'}
],
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
*/
//alert(\'loaded\');
}
</script>
';
?>
<textarea name="form[fcontent]" id="form[fcontent]" class="tmceEditor"><p>news<table><tr><td>cell 1</td></tr><tr><td>cell 2</td></tr></table></p></textarea>
<!--<textarea name="new" id="new" class="tmceEditor">another one</textarea>-->
<?php

View File

@@ -85,8 +85,7 @@ function editFile(pro_uid, fileName){
position : {x:50,y:50,center:true},
title : '',
control : {close:true,resize:false},
fx : {modal:true},
fx : {shadow:true,modal:true}
fx : {shadow:true,modal:true}
};
oPanel.make();