CODE STYLE, workflow/engine/methods/tools/
FILES: ajaxListener.php dvServices.php index.php main.php methodsPermissions.php methodsPermissions_Ajax.php translations.php translationsAdd.php translationsAjax.php translationsDelete.php translationsEdit.php translationsSave.php updateTranslation.php
This commit is contained in:
@@ -20,10 +20,10 @@
|
|||||||
*
|
*
|
||||||
* 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.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @author Erik Amaru Ortiz <erik@colosa.com>
|
* @author Erik Amaru Ortiz <erik@colosa.com>
|
||||||
* @date Jan 10th, 2010
|
* @date Jan 10th, 2010
|
||||||
*/
|
*/
|
||||||
@@ -37,6 +37,7 @@ $ajax->$action($_REQUEST);
|
|||||||
|
|
||||||
class Ajax
|
class Ajax
|
||||||
{
|
{
|
||||||
|
|
||||||
function getList ($params)
|
function getList ($params)
|
||||||
{
|
{
|
||||||
$search = isset( $params['search'] ) ? $params['search'] : null;
|
$search = isset( $params['search'] ) ? $params['search'] : null;
|
||||||
@@ -45,6 +46,7 @@ class Ajax
|
|||||||
$result = Translation::getAll( 'en', $params['start'], $params['limit'], $search, $params['dateFrom'], $params['dateTo'] );
|
$result = Translation::getAll( 'en', $params['start'], $params['limit'], $search, $params['dateFrom'], $params['dateTo'] );
|
||||||
//$result = Translation::getAll('en', $params['start'], $params['limit'], $search);
|
//$result = Translation::getAll('en', $params['start'], $params['limit'], $search);
|
||||||
|
|
||||||
|
|
||||||
/*foreach($result->data as $i=>$row){
|
/*foreach($result->data as $i=>$row){
|
||||||
$result->data[$i]['TRN_VALUE'] = substr($row['TRN_VALUE'], 0, 15) . '...';
|
$result->data[$i]['TRN_VALUE'] = substr($row['TRN_VALUE'], 0, 15) . '...';
|
||||||
}*/
|
}*/
|
||||||
@@ -103,7 +105,7 @@ class Ajax
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
require_once ("classes/model/Translation.php");
|
require_once ("classes/model/Translation.php");
|
||||||
$t = new Translation;
|
$t = new Translation();
|
||||||
$result = Translation::generateFileTranslation( 'en' );
|
$result = Translation::generateFileTranslation( 'en' );
|
||||||
$result['success'] = true;
|
$result['success'] = true;
|
||||||
|
|
||||||
@@ -115,4 +117,3 @@ class Ajax
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
*
|
*
|
||||||
* 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.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Created on 11-02-2008
|
* Created on 11-02-2008
|
||||||
@@ -28,31 +27,33 @@
|
|||||||
* @author David Callizaya <davidsantos@colosa.com>
|
* @author David Callizaya <davidsantos@colosa.com>
|
||||||
*/
|
*/
|
||||||
G::LoadSystem( "webResource" );
|
G::LoadSystem( "webResource" );
|
||||||
|
|
||||||
class dvServices extends WebResource
|
class dvServices extends WebResource
|
||||||
{
|
{
|
||||||
|
|
||||||
function get_session_vars ()
|
function get_session_vars ()
|
||||||
{
|
{
|
||||||
$cur = array_keys( $_SESSION );
|
$cur = array_keys( $_SESSION );
|
||||||
$res = '';
|
$res = '';
|
||||||
foreach($cur as $key)
|
foreach ($cur as $key) {
|
||||||
{
|
|
||||||
$res .= '* ' . $key . '<br/>';
|
$res .= '* ' . $key . '<br/>';
|
||||||
}
|
}
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_session_xmlforms ()
|
function get_session_xmlforms ()
|
||||||
{
|
{
|
||||||
$cur = array_keys( $_SESSION );
|
$cur = array_keys( $_SESSION );
|
||||||
$res = '';
|
$res = '';
|
||||||
$colors=array('white','#EEFFFF');
|
$colors = array ('white','#EEFFFF'
|
||||||
$colori=0;$count=0;
|
);
|
||||||
|
$colori = 0;
|
||||||
|
$count = 0;
|
||||||
//Get xmlforms in session
|
//Get xmlforms in session
|
||||||
foreach($cur as $key)
|
foreach ($cur as $key) {
|
||||||
{
|
|
||||||
$res .= '<div style="background-color:' . $colors[$colori] . ';">';
|
$res .= '<div style="background-color:' . $colors[$colori] . ';">';
|
||||||
$xml = G::getUIDName( $key, '' );
|
$xml = G::getUIDName( $key, '' );
|
||||||
if (strpos($xml,'.xml')!==false)
|
if (strpos( $xml, '.xml' ) !== false) {
|
||||||
{
|
|
||||||
$res .= '<i>FORM:</i> ' . $xml;
|
$res .= '<i>FORM:</i> ' . $xml;
|
||||||
$colori = $colori ^ 1;
|
$colori = $colori ^ 1;
|
||||||
$count ++;
|
$count ++;
|
||||||
@@ -60,11 +61,9 @@ class dvServices extends WebResource
|
|||||||
$res .= '</div>';
|
$res .= '</div>';
|
||||||
}
|
}
|
||||||
//Get pagedTable in session
|
//Get pagedTable in session
|
||||||
foreach($cur as $key)
|
foreach ($cur as $key) {
|
||||||
{
|
|
||||||
$res .= '<div style="background-color:' . $colors[$colori] . ';">';
|
$res .= '<div style="background-color:' . $colors[$colori] . ';">';
|
||||||
if (substr($key,0,11)==="pagedTable[")
|
if (substr( $key, 0, 11 ) === "pagedTable[") {
|
||||||
{
|
|
||||||
$xml = G::getUIDName( substr( $key, 11, - 1 ), '' );
|
$xml = G::getUIDName( substr( $key, 11, - 1 ), '' );
|
||||||
$res .= '<i>TABLE:</i> ' . $xml;
|
$res .= '<i>TABLE:</i> ' . $xml;
|
||||||
$colori = $colori ^ 1;
|
$colori = $colori ^ 1;
|
||||||
@@ -72,7 +71,8 @@ class dvServices extends WebResource
|
|||||||
}
|
}
|
||||||
$res .= '</div>';
|
$res .= '</div>';
|
||||||
}
|
}
|
||||||
return array("count"=>$count,"html"=>$res);
|
return array ("count" => $count,"html" => $res
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$o = new dvServices( $_SERVER['REQUEST_URI'], $_POST );
|
$o = new dvServices( $_SERVER['REQUEST_URI'], $_POST );
|
||||||
@@ -80,4 +80,3 @@ $o=new dvServices($_SERVER['REQUEST_URI'],$_POST);
|
|||||||
//tienda viva.
|
//tienda viva.
|
||||||
//122
|
//122
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -20,10 +20,8 @@
|
|||||||
*
|
*
|
||||||
* 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.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
unset( $_SESSION['TOOLS_VIEWTYPE'] );
|
unset( $_SESSION['TOOLS_VIEWTYPE'] );
|
||||||
$newFile = str_replace( 'index.php', 'translations.php', __FILE__ );
|
$newFile = str_replace( 'index.php', 'translations.php', __FILE__ );
|
||||||
return $newFile;
|
return $newFile;
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
$oHeadPublisher = & headPublisher::getSingleton();
|
$oHeadPublisher = & headPublisher::getSingleton();
|
||||||
$oHeadPublisher->addExtJsScript( 'tools/main', true );
|
$oHeadPublisher->addExtJsScript( 'tools/main', true );
|
||||||
|
|
||||||
//$oHeadPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d')));
|
//$oHeadPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d')));
|
||||||
G::RenderPage( 'publish', 'extJs' );
|
G::RenderPage( 'publish', 'extJs' );
|
||||||
|
|
||||||
|
|||||||
@@ -20,12 +20,10 @@
|
|||||||
*
|
*
|
||||||
* 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.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$G_PUBLISH = new Publisher;
|
$G_PUBLISH = new Publisher();
|
||||||
$G_PUBLISH->AddContent( 'view', 'tools/methodsPermissions' );
|
$G_PUBLISH->AddContent( 'view', 'tools/methodsPermissions' );
|
||||||
|
|
||||||
G::RenderPage( 'publish' );
|
G::RenderPage( 'publish' );
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -20,13 +20,14 @@
|
|||||||
*
|
*
|
||||||
* 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.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
G::LoadClass( "webResource" );
|
G::LoadClass( "webResource" );
|
||||||
define( 'GET_PERMISSION_REG_EXP', '/(G::\\s*genericForceLogin\\s*\\(\\s*[\'"])(\\w+)([\'"]\\s*,\\s*[\'"].+[\'"],.+\\)\\s*)|(\\$RBAC->userCanAccess\\s*\\(\\s*[\'"])(\\w+)([\'"]\\s*\\))/i' );
|
define( 'GET_PERMISSION_REG_EXP', '/(G::\\s*genericForceLogin\\s*\\(\\s*[\'"])(\\w+)([\'"]\\s*,\\s*[\'"].+[\'"],.+\\)\\s*)|(\\$RBAC->userCanAccess\\s*\\(\\s*[\'"])(\\w+)([\'"]\\s*\\))/i' );
|
||||||
define( 'GET_PERMISSION_REG_EXP2', '/\\s*if\\s*\\(\\s*\\(\\s*\\$RBAC_Response\\s*=\\s*\\$RBAC->userCanAccess\\s*\\(\\s*[\'"]\\w+[\'"]\\s*\\)\\s*\\)\\s*!=1\\s*\\)\\s*return(?:.*)?;\\s*/i' );
|
define( 'GET_PERMISSION_REG_EXP2', '/\\s*if\\s*\\(\\s*\\(\\s*\\$RBAC_Response\\s*=\\s*\\$RBAC->userCanAccess\\s*\\(\\s*[\'"]\\w+[\'"]\\s*\\)\\s*\\)\\s*!=1\\s*\\)\\s*return(?:.*)?;\\s*/i' );
|
||||||
|
|
||||||
class phpFile extends webResource
|
class phpFile extends webResource
|
||||||
{
|
{
|
||||||
|
|
||||||
function _get_permissions ($filename)
|
function _get_permissions ($filename)
|
||||||
{
|
{
|
||||||
$aSource = file( $filename );
|
$aSource = file( $filename );
|
||||||
@@ -36,59 +37,46 @@
|
|||||||
$permissions = array ();
|
$permissions = array ();
|
||||||
$lines = array ();
|
$lines = array ();
|
||||||
$len = preg_match_all( $regExp, $source, $matches, PREG_OFFSET_CAPTURE );
|
$len = preg_match_all( $regExp, $source, $matches, PREG_OFFSET_CAPTURE );
|
||||||
for($r=0; $r < $len; $r++)
|
for ($r = 0; $r < $len; $r ++) {
|
||||||
{
|
|
||||||
$match = $matches[0][$r][0];
|
$match = $matches[0][$r][0];
|
||||||
$permission = ($matches[2][$r][0] != '') ? $matches[2][$r][0] : $matches[5][$r][0];
|
$permission = ($matches[2][$r][0] != '') ? $matches[2][$r][0] : $matches[5][$r][0];
|
||||||
$toPrint=($matches[2][$r][0]!='') ?
|
$toPrint = ($matches[2][$r][0] != '') ? (htmlentities( $matches[1][$r][0], ENT_QUOTES, 'utf-8' ) . '<b>' . htmlentities( $matches[2][$r][0], ENT_QUOTES, 'utf-8' ) . '</b>' . htmlentities( $matches[3][$r][0], ENT_QUOTES, 'utf-8' )) : (htmlentities( $matches[4][$r][0], ENT_QUOTES, 'utf-8' ) . '<b>' . htmlentities( $matches[5][$r][0], ENT_QUOTES, 'utf-8' ) . '</b>' . htmlentities( $matches[6][$r][0], ENT_QUOTES, 'utf-8' ));
|
||||||
(
|
|
||||||
htmlentities($matches[1][$r][0],ENT_QUOTES,'utf-8').
|
|
||||||
'<b>'.htmlentities($matches[2][$r][0],ENT_QUOTES,'utf-8').'</b>'.
|
|
||||||
htmlentities($matches[3][$r][0],ENT_QUOTES,'utf-8')
|
|
||||||
)
|
|
||||||
:
|
|
||||||
(
|
|
||||||
htmlentities($matches[4][$r][0],ENT_QUOTES,'utf-8').
|
|
||||||
'<b>'.htmlentities($matches[5][$r][0],ENT_QUOTES,'utf-8').'</b>'.
|
|
||||||
htmlentities($matches[6][$r][0],ENT_QUOTES,'utf-8')
|
|
||||||
);
|
|
||||||
$row = $this->_getLine( $aSource, $matches[0][$r][1] );
|
$row = $this->_getLine( $aSource, $matches[0][$r][1] );
|
||||||
if (array_search($permission,$permissions)===FALSE)
|
if (array_search( $permission, $permissions ) === false) {
|
||||||
{
|
|
||||||
$permissions[] = $permission;
|
$permissions[] = $permission;
|
||||||
$lines[] = $row;
|
$lines[] = $row;
|
||||||
}
|
}
|
||||||
//TODO: Need to htmlencode the rest of the line that is not in match. Ex. < ? php
|
//TODO: Need to htmlencode the rest of the line that is not in match. Ex. < ? php
|
||||||
if ($row>0) $aOutSource[$row-1]=str_replace($match,$toPrint,isset($aOutSource[$row-1])?$aOutSource[$row-1]:$aSource[$row-1]);
|
if ($row > 0)
|
||||||
|
$aOutSource[$row - 1] = str_replace( $match, $toPrint, isset( $aOutSource[$row - 1] ) ? $aOutSource[$row - 1] : $aSource[$row - 1] );
|
||||||
$aOutSource[$row] = str_replace( $match, $toPrint, isset( $aOutSource[$row] ) ? $aOutSource[$row] : $aSource[$row] );
|
$aOutSource[$row] = str_replace( $match, $toPrint, isset( $aOutSource[$row] ) ? $aOutSource[$row] : $aSource[$row] );
|
||||||
if ($row<(sizeof($aSource)-1)) $aOutSource[$row+1]=str_replace($match,$toPrint,isset($aOutSource[$row+1])?$aOutSource[$row+1]:$aSource[$row+1]);
|
if ($row < (sizeof( $aSource ) - 1))
|
||||||
|
$aOutSource[$row + 1] = str_replace( $match, $toPrint, isset( $aOutSource[$row + 1] ) ? $aOutSource[$row + 1] : $aSource[$row + 1] );
|
||||||
}
|
}
|
||||||
ksort( $aOutSource );
|
ksort( $aOutSource );
|
||||||
$row0=0;$html='';
|
$row0 = 0;
|
||||||
foreach($aOutSource as $row => $line)
|
$html = '';
|
||||||
{
|
foreach ($aOutSource as $row => $line) {
|
||||||
if (($row-1) > $row0) $html.=$this->_printLine($row,'...');
|
if (($row - 1) > $row0)
|
||||||
|
$html .= $this->_printLine( $row, '...' );
|
||||||
$html .= $this->_printLine( $row + 1, $line, true, $aSource[$row], $filename . '?' . $row );
|
$html .= $this->_printLine( $row + 1, $line, true, $aSource[$row], $filename . '?' . $row );
|
||||||
$row0 = $row;
|
$row0 = $row;
|
||||||
}
|
}
|
||||||
return array (
|
return array (($html === '') ? 'Dont have RBAC validation!' : ('<table>' . $html . '</table>'),$permissions,$lines
|
||||||
($html==='')?'Dont have RBAC validation!':('<table>'.$html.'</table>'),
|
|
||||||
$permissions,
|
|
||||||
$lines
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_permissions ($filename)
|
function get_permissions ($filename)
|
||||||
{
|
{
|
||||||
$res = $this->_get_permissions( $filename );
|
$res = $this->_get_permissions( $filename );
|
||||||
return $res[0];
|
return $res[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
function modify_line ($filename, $row, $value)
|
function modify_line ($filename, $row, $value)
|
||||||
{
|
{
|
||||||
$aSource = file( $filename );
|
$aSource = file( $filename );
|
||||||
$line = $aSource[$row];
|
$line = $aSource[$row];
|
||||||
$nl=(strlen($line)>=2)&&(substr($line,-2,2)=="\r\n")?
|
$nl = (strlen( $line ) >= 2) && (substr( $line, - 2, 2 ) == "\r\n") ? "\r\n" : ((strlen( $line ) >= 1) && (substr( $line, - 1, 1 ) == "\n") ? "\n" : "");
|
||||||
"\r\n":
|
|
||||||
((strlen($line)>=1)&&(substr($line,-1,1)=="\n")?"\n":"");
|
|
||||||
$aSource[$row] = $value . $nl;
|
$aSource[$row] = $value . $nl;
|
||||||
/*Save change*/
|
/*Save change*/
|
||||||
$fp = fopen( $filename, 'w' );
|
$fp = fopen( $filename, 'w' );
|
||||||
@@ -98,49 +86,34 @@
|
|||||||
$regExp = GET_PERMISSION_REG_EXP;
|
$regExp = GET_PERMISSION_REG_EXP;
|
||||||
$line = $aSource[$row];
|
$line = $aSource[$row];
|
||||||
$len = preg_match_all( $regExp, $line, $matches, PREG_OFFSET_CAPTURE );
|
$len = preg_match_all( $regExp, $line, $matches, PREG_OFFSET_CAPTURE );
|
||||||
for($r=0; $r < $len; $r++)
|
for ($r = 0; $r < $len; $r ++) {
|
||||||
{
|
|
||||||
$match = $matches[0][$r][0];
|
$match = $matches[0][$r][0];
|
||||||
$toPrint=($matches[2][$r][0]!='') ?
|
$toPrint = ($matches[2][$r][0] != '') ? (htmlentities( $matches[1][$r][0], ENT_QUOTES, 'utf-8' ) . '<b>' . htmlentities( $matches[2][$r][0], ENT_QUOTES, 'utf-8' ) . '</b>' . htmlentities( $matches[3][$r][0], ENT_QUOTES, 'utf-8' )) : (htmlentities( $matches[4][$r][0], ENT_QUOTES, 'utf-8' ) . '<b>' . htmlentities( $matches[5][$r][0], ENT_QUOTES, 'utf-8' ) . '</b>' . htmlentities( $matches[6][$r][0], ENT_QUOTES, 'utf-8' ));
|
||||||
(
|
|
||||||
htmlentities($matches[1][$r][0],ENT_QUOTES,'utf-8').
|
|
||||||
'<b>'.htmlentities($matches[2][$r][0],ENT_QUOTES,'utf-8').'</b>'.
|
|
||||||
htmlentities($matches[3][$r][0],ENT_QUOTES,'utf-8')
|
|
||||||
)
|
|
||||||
:
|
|
||||||
(
|
|
||||||
htmlentities($matches[4][$r][0],ENT_QUOTES,'utf-8').
|
|
||||||
'<b>'.htmlentities($matches[5][$r][0],ENT_QUOTES,'utf-8').'</b>'.
|
|
||||||
htmlentities($matches[6][$r][0],ENT_QUOTES,'utf-8')
|
|
||||||
);
|
|
||||||
$line = str_replace( $match, $toPrint, $line );
|
$line = str_replace( $match, $toPrint, $line );
|
||||||
}
|
}
|
||||||
return array($line,$aSource[$row]);
|
return array ($line,$aSource[$row]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_header ($filename, $value)
|
function set_header ($filename, $value)
|
||||||
{
|
{
|
||||||
$aFields=array("_FILENAME_"=>basename( $filename ) );
|
$aFields = array ("_FILENAME_" => basename( $filename )
|
||||||
|
);
|
||||||
$value = G::replaceDataField( $value, $aFields );
|
$value = G::replaceDataField( $value, $aFields );
|
||||||
$aOrigin = file( $filename );
|
$aOrigin = file( $filename );
|
||||||
//It suposse that allway start with <?. or <?php
|
//It suposse that allway start with <?. or <?php
|
||||||
$line = $aOrigin[0];
|
$line = $aOrigin[0];
|
||||||
$nl=(strlen($line)>=2)&&(substr($line,-2,2)=="\r\n")?
|
$nl = (strlen( $line ) >= 2) && (substr( $line, - 2, 2 ) == "\r\n") ? "\r\n" : ((strlen( $line ) >= 1) && (substr( $line, - 1, 1 ) == "\n") ? "\n" : "");
|
||||||
"\r\n":
|
|
||||||
((strlen($line)>=1)&&(substr($line,-1,1)=="\n")?"\n":"");
|
|
||||||
|
|
||||||
$codigo = implode( '', $aOrigin );
|
$codigo = implode( '', $aOrigin );
|
||||||
$pattern = '/\/\*[\w\W]+\* ' . 'ProcessMaker Open Source' . '[\w\W]+?\*\//i';
|
$pattern = '/\/\*[\w\W]+\* ' . 'ProcessMaker Open Source' . '[\w\W]+?\*\//i';
|
||||||
if (preg_match($pattern,$codigo))
|
if (preg_match( $pattern, $codigo )) {
|
||||||
{
|
|
||||||
$codigo = preg_replace( $pattern, $value, $codigo );
|
$codigo = preg_replace( $pattern, $value, $codigo );
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$aSource = array ();
|
$aSource = array ();
|
||||||
$aSource[0] = $aOrigin[0];
|
$aSource[0] = $aOrigin[0];
|
||||||
$aSource[1] = $value . $nl;
|
$aSource[1] = $value . $nl;
|
||||||
for($r=1;$r<sizeof($aOrigin);$r++)
|
for ($r = 1; $r < sizeof( $aOrigin ); $r ++) {
|
||||||
{
|
|
||||||
$aSource[] = $aOrigin[$r];
|
$aSource[] = $aOrigin[$r];
|
||||||
}
|
}
|
||||||
$codigo = implode( '', $aSource );
|
$codigo = implode( '', $aSource );
|
||||||
@@ -151,18 +124,16 @@
|
|||||||
fclose( $fp );
|
fclose( $fp );
|
||||||
return $this->get_permissions( $filename );
|
return $this->get_permissions( $filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_permission ($filename, $value)
|
function add_permission ($filename, $value)
|
||||||
{
|
{
|
||||||
$aOrigin = file( $filename );
|
$aOrigin = file( $filename );
|
||||||
//It suposse that allway start with <?. or <?php
|
//It suposse that allway start with <?. or <?php
|
||||||
$aSource[0] = $aOrigin[0];
|
$aSource[0] = $aOrigin[0];
|
||||||
$line = $aOrigin[0];
|
$line = $aOrigin[0];
|
||||||
$nl=(strlen($line)>=2)&&(substr($line,-2,2)=="\r\n")?
|
$nl = (strlen( $line ) >= 2) && (substr( $line, - 2, 2 ) == "\r\n") ? "\r\n" : ((strlen( $line ) >= 1) && (substr( $line, - 1, 1 ) == "\n") ? "\n" : "");
|
||||||
"\r\n":
|
|
||||||
((strlen($line)>=1)&&(substr($line,-1,1)=="\n")?"\n":"");
|
|
||||||
$aSource[1] = $value . $nl;
|
$aSource[1] = $value . $nl;
|
||||||
for($r=1;$r<sizeof($aOrigin);$r++)
|
for ($r = 1; $r < sizeof( $aOrigin ); $r ++) {
|
||||||
{
|
|
||||||
$aSource[] = $aOrigin[$r];
|
$aSource[] = $aOrigin[$r];
|
||||||
}
|
}
|
||||||
/*Save change*/
|
/*Save change*/
|
||||||
@@ -171,84 +142,68 @@
|
|||||||
fclose( $fp );
|
fclose( $fp );
|
||||||
return $this->get_permissions( $filename );
|
return $this->get_permissions( $filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
function _getLine (&$aSource, $pos)
|
function _getLine (&$aSource, $pos)
|
||||||
{
|
{
|
||||||
$i = 1;
|
$i = 1;
|
||||||
while ($pos>sizeof($aSource[$i]))
|
while ($pos > sizeof( $aSource[$i] )) {
|
||||||
{
|
|
||||||
$pos -= strlen( $aSource[$i] );
|
$pos -= strlen( $aSource[$i] );
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
return $i - 1;
|
return $i - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _printLine ($row, $txt, $editable = false, $editValue = '', $name = '')
|
function _printLine ($row, $txt, $editable = false, $editValue = '', $name = '')
|
||||||
{
|
{
|
||||||
if ($editable)
|
if ($editable) {
|
||||||
{
|
return '<tr><td><input value="X" type="button" style="width:100%;" ' . ' name="' . htmlentities( $name, ENT_QUOTES, 'utf-8' ) . '"' . ' onclick="removeLine(this);"/></td>' . '<td class="treeContent" align="right">' . $row . '</td>
|
||||||
return '<tr><td><input value="X" type="button" style="width:100%;" '.
|
<td class="treeNode"><span onclick="switchViewEdit(this,this.nextSibling);">' . $txt . '</span>' . '<input class="treeNode"' . ' name="' . htmlentities( $name, ENT_QUOTES, 'utf-8' ) . '"' . ' style="border:none;width:100%;display:none;"' . ' onblur="switchEditView(this.previousSibling,this);"' . ' value="' . htmlentities( $editValue, ENT_QUOTES, 'utf-8' ) . '"/></td></tr>';
|
||||||
' name="'.htmlentities($name,ENT_QUOTES,'utf-8').'"'.
|
} else {
|
||||||
' onclick="removeLine(this);"/></td>'.
|
return '<tr><td></td>' . '<td class="treeContent" align="right">' . $row . '</td>' . '<td class="treeNode">' . $txt . '</td></tr>';
|
||||||
'<td class="treeContent" align="right">'.$row.'</td>
|
|
||||||
<td class="treeNode"><span onclick="switchViewEdit(this,this.nextSibling);">'.
|
|
||||||
$txt.'</span>'.
|
|
||||||
'<input class="treeNode"'.
|
|
||||||
' name="'.htmlentities($name,ENT_QUOTES,'utf-8').'"'.
|
|
||||||
' style="border:none;width:100%;display:none;"'.
|
|
||||||
' onblur="switchEditView(this.previousSibling,this);"'.
|
|
||||||
' value="'.htmlentities($editValue,ENT_QUOTES,'utf-8').'"/></td></tr>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return '<tr><td></td>'.
|
|
||||||
'<td class="treeContent" align="right">'.$row.'</td>'.
|
|
||||||
'<td class="treeNode">'.$txt.'</td></tr>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_permission ($filename, $permission)
|
function set_permission ($filename, $permission)
|
||||||
{
|
{
|
||||||
list ($html, $permissions) = $this->_get_permissions( $filename );
|
list ($html, $permissions) = $this->_get_permissions( $filename );
|
||||||
if (array_search($permission,$permissions)===FALSE)
|
if (array_search( $permission, $permissions ) === false) {
|
||||||
{
|
$this->add_permission( $filename, 'if (($RBAC_Response=$RBAC->userCanAccess("' . $permission . '"))!=1) return $RBAC_Response;' );
|
||||||
$this->add_permission
|
|
||||||
(
|
|
||||||
$filename,
|
|
||||||
'if (($RBAC_Response=$RBAC->userCanAccess("'.$permission.'"))!=1) return $RBAC_Response;'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return $this->get_permissions( $filename );
|
return $this->get_permissions( $filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_path_permission ($path, $permission)
|
function set_path_permission ($path, $permission)
|
||||||
{
|
{
|
||||||
$files = glob( $path . '*.php' );
|
$files = glob( $path . '*.php' );
|
||||||
foreach($files as $file)
|
foreach ($files as $file) {
|
||||||
{
|
|
||||||
$this->set_permission( $file, $permission );
|
$this->set_permission( $file, $permission );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_path_header ($path, $header)
|
function set_path_header ($path, $header)
|
||||||
{
|
{
|
||||||
$files = glob( $path . '*.php' );
|
$files = glob( $path . '*.php' );
|
||||||
$filesMod = array ();
|
$filesMod = array ();
|
||||||
foreach($files as $file)
|
foreach ($files as $file) {
|
||||||
{
|
|
||||||
$filesMod[] = $file;
|
$filesMod[] = $file;
|
||||||
$this->set_header( $file, $header );
|
$this->set_header( $file, $header );
|
||||||
}
|
}
|
||||||
$dirs = glob( $path . '*', GLOB_MARK );
|
$dirs = glob( $path . '*', GLOB_MARK );
|
||||||
foreach($dirs as $dir)
|
foreach ($dirs as $dir) {
|
||||||
{
|
if (substr( $dir, - 1, 1 ) == '/')
|
||||||
if (substr( $dir , -1 , 1 )=='/') $this->set_path_header($dir,$header);
|
$this->set_path_header( $dir, $header );
|
||||||
}
|
}
|
||||||
return $filesMod;
|
return $filesMod;
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_path_permission ($path, $permission)
|
function remove_path_permission ($path, $permission)
|
||||||
{
|
{
|
||||||
$files = glob( $path . '*.php' );
|
$files = glob( $path . '*.php' );
|
||||||
foreach($files as $file)
|
foreach ($files as $file) {
|
||||||
{
|
|
||||||
$this->remove_permission( $file, $permission );
|
$this->remove_permission( $file, $permission );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_line ($filename, $line)
|
function remove_line ($filename, $line)
|
||||||
{
|
{
|
||||||
$aSource = file( $filename );
|
$aSource = file( $filename );
|
||||||
@@ -259,20 +214,17 @@
|
|||||||
fclose( $fp );
|
fclose( $fp );
|
||||||
return $this->get_permissions( $filename );
|
return $this->get_permissions( $filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_permission ($filename, $permission)
|
function remove_permission ($filename, $permission)
|
||||||
{
|
{
|
||||||
$aSource = file( $filename );
|
$aSource = file( $filename );
|
||||||
list ($html, $permissions, $lines) = $this->_get_permissions( $filename );
|
list ($html, $permissions, $lines) = $this->_get_permissions( $filename );
|
||||||
if (($row=array_search($permission,$permissions))!==FALSE)
|
if (($row = array_search( $permission, $permissions )) !== false) {
|
||||||
{
|
|
||||||
$line = $lines[$row];
|
$line = $lines[$row];
|
||||||
if (preg_match(GET_PERMISSION_REG_EXP2,$aSource[$line]))
|
if (preg_match( GET_PERMISSION_REG_EXP2, $aSource[$line] )) {
|
||||||
{
|
|
||||||
unset( $aSource[$line] );
|
unset( $aSource[$line] );
|
||||||
$msg = "Removed.";
|
$msg = "Removed.";
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$msg = "Can not be removed!";
|
$msg = "Can not be removed!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -284,4 +236,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$phpFile = new phpFile( 'methodsPermissions_Ajax', $_POST );
|
$phpFile = new phpFile( 'methodsPermissions_Ajax', $_POST );
|
||||||
?>
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
*
|
*
|
||||||
* 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.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$G_MAIN_MENU = 'tools';
|
$G_MAIN_MENU = 'tools';
|
||||||
@@ -35,7 +34,7 @@
|
|||||||
|
|
||||||
$table = "TRANSLATION";
|
$table = "TRANSLATION";
|
||||||
|
|
||||||
$G_PUBLISH = new Publisher;
|
$G_PUBLISH = new Publisher();
|
||||||
$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'tools/translationsList', '', array (), '' );
|
$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'tools/translationsList', '', array (), '' );
|
||||||
if (isset( $_SESSION['TOOLS_VIEWTYPE'] )) {
|
if (isset( $_SESSION['TOOLS_VIEWTYPE'] )) {
|
||||||
G::RenderPage( 'publishBlank', 'green-submenu' );
|
G::RenderPage( 'publishBlank', 'green-submenu' );
|
||||||
|
|||||||
@@ -20,14 +20,13 @@
|
|||||||
*
|
*
|
||||||
* 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.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
$G_MAIN_MENU = 'tools';
|
$G_MAIN_MENU = 'tools';
|
||||||
$G_SUB_MENU = 'toolsTranslations';
|
$G_SUB_MENU = 'toolsTranslations';
|
||||||
$G_ID_MENU_SELECTED = 'TRANSLATION';
|
$G_ID_MENU_SELECTED = 'TRANSLATION';
|
||||||
$G_ID_SUB_MENU_SELECTED = 'TRANSLATION_ADD';
|
$G_ID_SUB_MENU_SELECTED = 'TRANSLATION_ADD';
|
||||||
|
|
||||||
$G_PUBLISH = new Publisher;
|
$G_PUBLISH = new Publisher();
|
||||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tools/translationAdd', '', null, 'translationsSave' );
|
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tools/translationAdd', '', null, 'translationsSave' );
|
||||||
|
|
||||||
if (isset( $_SESSION['TOOLS_VIEWTYPE'] ) && $_SESSION['TOOLS_VIEWTYPE'] == 'blank') {
|
if (isset( $_SESSION['TOOLS_VIEWTYPE'] ) && $_SESSION['TOOLS_VIEWTYPE'] == 'blank') {
|
||||||
@@ -35,4 +34,4 @@
|
|||||||
} else {
|
} else {
|
||||||
G::RenderPage( 'publish' );
|
G::RenderPage( 'publish' );
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
*
|
*
|
||||||
* 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.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
ini_set( 'display_errors', 'off' );
|
ini_set( 'display_errors', 'off' );
|
||||||
G::LoadInclude( 'ajax' );
|
G::LoadInclude( 'ajax' );
|
||||||
@@ -31,35 +30,38 @@
|
|||||||
$langLabel = get_ajax_value( 'langLabel' );
|
$langLabel = get_ajax_value( 'langLabel' );
|
||||||
$text = get_ajax_value( 'text' );
|
$text = get_ajax_value( 'text' );
|
||||||
$table = "TRANSLATION";
|
$table = "TRANSLATION";
|
||||||
$dbc = new DBConnection;
|
$dbc = new DBConnection();
|
||||||
$ses = new DBSession( $dbc );
|
$ses = new DBSession( $dbc );
|
||||||
switch($function)
|
switch ($function) {
|
||||||
{
|
|
||||||
case "editLabel":
|
case "editLabel":
|
||||||
case "changeLabel":
|
case "changeLabel":
|
||||||
$query = $ses->execute( "select * from $table where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'", false );
|
$query = $ses->execute( "select * from $table where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'", false );
|
||||||
if ($query->count()===0) {echo("Not found $cat:$node:$lang in table '$table'");return;}
|
if ($query->count() === 0) {
|
||||||
if ($query->count()>1) {echo("The $cat:$node:$lang in table '$table' is not unique");return;}
|
echo ("Not found $cat:$node:$lang in table '$table'");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($query->count() > 1) {
|
||||||
|
echo ("The $cat:$node:$lang in table '$table' is not unique");
|
||||||
|
return;
|
||||||
|
}
|
||||||
$res = $query->read();
|
$res = $query->read();
|
||||||
switch($function)
|
switch ($function) {
|
||||||
{
|
|
||||||
case "editLabel":
|
case "editLabel":
|
||||||
$myID = "input_" . $cat . "_" . $node . "_" . $lang;
|
$myID = "input_" . $cat . "_" . $node . "_" . $lang;
|
||||||
$myID = 'aux';
|
$myID = 'aux';
|
||||||
echo("<input id='$myID' type='text' value='".htmlspecialchars($res['TRN_VALUE'])."' ".
|
echo ("<input id='$myID' type='text' value='" . htmlspecialchars( $res['TRN_VALUE'] ) . "' " . ajax_event( "onblur", "translationsAjax.php", 'lang_' . $cat . '_' . $node . '_' . $lang, "'function=changeLabel&cat=" . urlencode( $cat ) . "&node=" . urlencode( $node ) . "&lang=" . urlencode( $lang ) . "&langLabel='+encodeURI(getElementById('$myID').value)", '' ) . "/>");
|
||||||
ajax_event("onblur","translationsAjax.php",
|
|
||||||
'lang_'.$cat.'_'.$node.'_'.$lang,
|
|
||||||
"'function=changeLabel&cat=".urlencode($cat).
|
|
||||||
"&node=".urlencode($node).
|
|
||||||
"&lang=".urlencode($lang).
|
|
||||||
"&langLabel='+encodeURI(getElementById('$myID').value)",'')
|
|
||||||
."/>");
|
|
||||||
break;
|
break;
|
||||||
case "changeLabel":
|
case "changeLabel":
|
||||||
$update = $ses->execute( "update $table set TRN_VALUE='$langLabel' where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'", false );
|
$update = $ses->execute( "update $table set TRN_VALUE='$langLabel' where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'", false );
|
||||||
$query = $ses->execute( "select * from $table where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'", false );
|
$query = $ses->execute( "select * from $table where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'", false );
|
||||||
if ($query->count()===0) {echo("Not found $cat:$node:$lang in table '$table'");return;}
|
if ($query->count() === 0) {
|
||||||
if ($query->count()>1) {echo("The $cat:$node:$lang in table '$table' is not unique");return;}
|
echo ("Not found $cat:$node:$lang in table '$table'");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($query->count() > 1) {
|
||||||
|
echo ("The $cat:$node:$lang in table '$table' is not unique");
|
||||||
|
return;
|
||||||
|
}
|
||||||
$res = $query->read();
|
$res = $query->read();
|
||||||
echo (htmlspecialchars( $res['TRN_VALUE'] ));
|
echo (htmlspecialchars( $res['TRN_VALUE'] ));
|
||||||
break;
|
break;
|
||||||
@@ -67,8 +69,8 @@ switch($function)
|
|||||||
}
|
}
|
||||||
G::LoadClass( "translation" );
|
G::LoadClass( "translation" );
|
||||||
|
|
||||||
$dbc = new DBConnection;
|
$dbc = new DBConnection();
|
||||||
$obj = new Translation;
|
$obj = new Translation();
|
||||||
$obj->SetTo( $dbc );
|
$obj->SetTo( $dbc );
|
||||||
$translation2 = $obj->generateFileTranslation();
|
$translation2 = $obj->generateFileTranslation();
|
||||||
break;
|
break;
|
||||||
@@ -77,11 +79,9 @@ switch($function)
|
|||||||
$template = new TemplatePower( PATH_CORE . 'templates/tools/translationsTP.html' );
|
$template = new TemplatePower( PATH_CORE . 'templates/tools/translationsTP.html' );
|
||||||
$template->prepare();
|
$template->prepare();
|
||||||
$template->newBlock( "languageList" );
|
$template->newBlock( "languageList" );
|
||||||
$template->assign("ajaxDelLang",ajax_event("onclick","translationsAjax","showSpace",
|
$template->assign( "ajaxDelLang", ajax_event( "onclick", "translationsAjax", "showSpace", "'function=delLanguage&lang='+encodeURI(getElementById('language').value)", 'hideLangBar' ) );
|
||||||
"'function=delLanguage&lang='+encodeURI(getElementById('language').value)",'hideLangBar'));
|
|
||||||
|
|
||||||
for($r=1;$r<=$query->count();$r++)
|
for ($r = 1; $r <= $query->count(); $r ++) {
|
||||||
{
|
|
||||||
$res = $query->read();
|
$res = $query->read();
|
||||||
$template->newBlock( "languageItem" );
|
$template->newBlock( "languageItem" );
|
||||||
$template->assign( "langIdRadio", $res['TRN_LANG'] );
|
$template->assign( "langIdRadio", $res['TRN_LANG'] );
|
||||||
@@ -94,8 +94,7 @@ switch($function)
|
|||||||
case "addLanguage":
|
case "addLanguage":
|
||||||
case "delLanguage":
|
case "delLanguage":
|
||||||
case "delField":
|
case "delField":
|
||||||
switch($function)
|
switch ($function) {
|
||||||
{
|
|
||||||
case "show":
|
case "show":
|
||||||
$query = $ses->execute( "select * from $table ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ", false );
|
$query = $ses->execute( "select * from $table ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ", false );
|
||||||
break;
|
break;
|
||||||
@@ -103,10 +102,10 @@ switch($function)
|
|||||||
$query = $ses->execute( "select * from $table where (TRN_CATEGORY like '%$text%') or (TRN_ID like '%$text%') or (TRN_LANG like '%$text%') or (TRN_VALUE like '%$text%') ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ", false );
|
$query = $ses->execute( "select * from $table where (TRN_CATEGORY like '%$text%') or (TRN_ID like '%$text%') or (TRN_LANG like '%$text%') or (TRN_VALUE like '%$text%') ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ", false );
|
||||||
break;
|
break;
|
||||||
case "addField":
|
case "addField":
|
||||||
if (!defined('LANGUAGES')) define('LANGUAGES',SYS_LANG);
|
if (! defined( 'LANGUAGES' ))
|
||||||
|
define( 'LANGUAGES', SYS_LANG );
|
||||||
$languages = explode( ",", LANGUAGES );
|
$languages = explode( ",", LANGUAGES );
|
||||||
foreach($languages as $lang)
|
foreach ($languages as $lang) {
|
||||||
{
|
|
||||||
//$langLabel=$cat;
|
//$langLabel=$cat;
|
||||||
/* $update=$ses->execute("insert into $table(TRN_CATEGORY , TRN_ID , TRN_LANG , TRN_VALUE )
|
/* $update=$ses->execute("insert into $table(TRN_CATEGORY , TRN_ID , TRN_LANG , TRN_VALUE )
|
||||||
values ('$cat','$node','$lang','$langLabel')",false);*/
|
values ('$cat','$node','$lang','$langLabel')",false);*/
|
||||||
@@ -121,13 +120,11 @@ switch($function)
|
|||||||
$query1 = $ses->execute( "select * from $table where TRN_LANG='$lang'", false );
|
$query1 = $ses->execute( "select * from $table where TRN_LANG='$lang'", false );
|
||||||
$query2 = $ses->execute( "select distinct TRN_CATEGORY, TRN_ID from $table", false );
|
$query2 = $ses->execute( "select distinct TRN_CATEGORY, TRN_ID from $table", false );
|
||||||
$existe = array ();
|
$existe = array ();
|
||||||
for($r=1;$r<=$query1->count();$r++)
|
for ($r = 1; $r <= $query1->count(); $r ++) {
|
||||||
{
|
|
||||||
$res = $query1->read();
|
$res = $query1->read();
|
||||||
$existe[$res['TRN_CATEGORY'] . "_" . $res['TRN_ID']] = $res;
|
$existe[$res['TRN_CATEGORY'] . "_" . $res['TRN_ID']] = $res;
|
||||||
}
|
}
|
||||||
for($r=1;$r<=$query2->count();$r++)
|
for ($r = 1; $r <= $query2->count(); $r ++) {
|
||||||
{
|
|
||||||
$res = $query2->read();
|
$res = $query2->read();
|
||||||
$cat = $res['TRN_CATEGORY'];
|
$cat = $res['TRN_CATEGORY'];
|
||||||
$node = $res['TRN_ID'];
|
$node = $res['TRN_ID'];
|
||||||
@@ -140,7 +137,8 @@ switch($function)
|
|||||||
unset( $update );
|
unset( $update );
|
||||||
}
|
}
|
||||||
unset( $existe );
|
unset( $existe );
|
||||||
unset($query1);unset($query2);
|
unset( $query1 );
|
||||||
|
unset( $query2 );
|
||||||
$query = $ses->execute( "select * from $table ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ", false );
|
$query = $ses->execute( "select * from $table ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ", false );
|
||||||
break;
|
break;
|
||||||
case "delLanguage":
|
case "delLanguage":
|
||||||
@@ -157,29 +155,21 @@ switch($function)
|
|||||||
$template->prepare();
|
$template->prepare();
|
||||||
$template->newBlock( "CONTENT" );
|
$template->newBlock( "CONTENT" );
|
||||||
$template->newBlock( "table" );
|
$template->newBlock( "table" );
|
||||||
$aCat="";$aNode="";
|
$aCat = "";
|
||||||
for($i=1;$i<=$query->count();$i++)
|
$aNode = "";
|
||||||
{
|
for ($i = 1; $i <= $query->count(); $i ++) {
|
||||||
$template->newBlock( "row" );
|
$template->newBlock( "row" );
|
||||||
$res = $query->read();
|
$res = $query->read();
|
||||||
$cat = $res['TRN_CATEGORY'];
|
$cat = $res['TRN_CATEGORY'];
|
||||||
$node = $res['TRN_ID'];
|
$node = $res['TRN_ID'];
|
||||||
$lang = $res['TRN_LANG'];
|
$lang = $res['TRN_LANG'];
|
||||||
$langLabel = $res['TRN_VALUE'];
|
$langLabel = $res['TRN_VALUE'];
|
||||||
if ($cat!=$aCat)
|
if ($cat != $aCat) {
|
||||||
{
|
|
||||||
$template->newBlock( "TDcat" );
|
$template->newBlock( "TDcat" );
|
||||||
$template->assign( "catId", $res['TRN_CATEGORY'] );
|
$template->assign( "catId", $res['TRN_CATEGORY'] );
|
||||||
$template->assign("ajaxDelField",
|
$template->assign( "ajaxDelField", ajax_event( 'onclick', 'translationsAjax', 'showSpace', "'function=delField" . "&cat=" . urlencode( $cat ) . "&node=" . urlencode( $node ) . "&lang=" . urlencode( $lang ) . "'", '' ) );
|
||||||
ajax_event('onclick','translationsAjax','showSpace',
|
|
||||||
"'function=delField".
|
|
||||||
"&cat=".urlencode($cat).
|
|
||||||
"&node=".urlencode($node).
|
|
||||||
"&lang=".urlencode($lang)."'",''));
|
|
||||||
}
|
}
|
||||||
if (($cat!=$aCat) ||
|
if (($cat != $aCat) || ($node != $aNode)) {
|
||||||
($node!=$aNode))
|
|
||||||
{
|
|
||||||
$template->newBlock( "TDnode" );
|
$template->newBlock( "TDnode" );
|
||||||
$template->assign( "nodeId", $res['TRN_ID'] );
|
$template->assign( "nodeId", $res['TRN_ID'] );
|
||||||
}
|
}
|
||||||
@@ -190,28 +180,26 @@ switch($function)
|
|||||||
$template->assign( "nodeId", $res['TRN_ID'] );
|
$template->assign( "nodeId", $res['TRN_ID'] );
|
||||||
$template->assign( "langId", $lang );
|
$template->assign( "langId", $lang );
|
||||||
$template->assign( "langLabel", $langLabel );
|
$template->assign( "langLabel", $langLabel );
|
||||||
$template->assign("ajaxLabel","onclick=\"if (!document.getElementById('aux'))".
|
$template->assign( "ajaxLabel", "onclick=\"if (!document.getElementById('aux'))" . ajax_init( 'translationsAjax.php', 'lang_' . $cat . '_' . $node . '_' . $lang, "'function=editLabel" . "&cat=" . urlencode( $cat ) . "&node=" . urlencode( $node ) . "&lang=" . urlencode( $lang ) . "'", 'focusInputLabel' ) . '"' );
|
||||||
ajax_init('translationsAjax.php',
|
|
||||||
'lang_'.$cat.'_'.$node.'_'.$lang,
|
|
||||||
"'function=editLabel".
|
|
||||||
"&cat=".urlencode($cat).
|
|
||||||
"&node=".urlencode($node).
|
|
||||||
"&lang=".urlencode($lang)."'",'focusInputLabel')
|
|
||||||
.'"');
|
|
||||||
}
|
}
|
||||||
$template->printToScreen();
|
$template->printToScreen();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
function ajax_event ($event = "onclick", $page, $div, $param, $freturn = "")
|
function ajax_event ($event = "onclick", $page, $div, $param, $freturn = "")
|
||||||
{
|
{
|
||||||
if ($freturn==='') $freturn="''";
|
if ($freturn === '')
|
||||||
|
$freturn = "''";
|
||||||
return "$event=\"ajax_init('$page','$div',$param,$freturn)\"";
|
return "$event=\"ajax_init('$page','$div',$param,$freturn)\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
function ajax_init ($page, $div, $param, $freturn = "")
|
function ajax_init ($page, $div, $param, $freturn = "")
|
||||||
{
|
{
|
||||||
if ($freturn=='') $freturn="''";
|
if ($freturn == '')
|
||||||
|
$freturn = "''";
|
||||||
return "ajax_init('$page','$div',$param,$freturn);";
|
return "ajax_init('$page','$div',$param,$freturn);";
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
@@ -20,16 +20,15 @@
|
|||||||
*
|
*
|
||||||
* 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.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//to do: improve the way to pass two or more parameters in the paged-table ( link )
|
//to do: improve the way to pass two or more parameters in the paged-table ( link )
|
||||||
|
|
||||||
|
|
||||||
$aux = explode( '|', $_GET['id'] );
|
$aux = explode( '|', $_GET['id'] );
|
||||||
$category = str_replace( '"', '', $aux[0] );
|
$category = str_replace( '"', '', $aux[0] );
|
||||||
$id = str_replace( '"', '', $aux[1] );
|
$id = str_replace( '"', '', $aux[1] );
|
||||||
|
|
||||||
|
|
||||||
require_once ("classes/model/Translation.php");
|
require_once ("classes/model/Translation.php");
|
||||||
//if exists the row in the database propel will update it, otherwise will insert.
|
//if exists the row in the database propel will update it, otherwise will insert.
|
||||||
$tr = TranslationPeer::retrieveByPK( $category, $id, 'en' );
|
$tr = TranslationPeer::retrieveByPK( $category, $id, 'en' );
|
||||||
@@ -39,5 +38,6 @@
|
|||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
|
|
||||||
|
|
||||||
G::Header( 'location: translations' );
|
G::Header( 'location: translations' );
|
||||||
?>
|
|
||||||
|
|||||||
@@ -20,16 +20,15 @@
|
|||||||
*
|
*
|
||||||
* 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.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//to do: improve the way to pass two or more parameters in the paged-table ( link )
|
//to do: improve the way to pass two or more parameters in the paged-table ( link )
|
||||||
|
|
||||||
|
|
||||||
$aux = explode( '|', $_GET['id'] );
|
$aux = explode( '|', $_GET['id'] );
|
||||||
$category = str_replace( '"', '', $aux[0] );
|
$category = str_replace( '"', '', $aux[0] );
|
||||||
$id = str_replace( '"', '', $aux[1] );
|
$id = str_replace( '"', '', $aux[1] );
|
||||||
|
|
||||||
|
|
||||||
require_once ("classes/model/Translation.php");
|
require_once ("classes/model/Translation.php");
|
||||||
//if exists the row in the database propel will update it, otherwise will insert.
|
//if exists the row in the database propel will update it, otherwise will insert.
|
||||||
$tr = TranslationPeer::retrieveByPK( $category, $id, 'en' );
|
$tr = TranslationPeer::retrieveByPK( $category, $id, 'en' );
|
||||||
@@ -38,8 +37,7 @@
|
|||||||
$fields['trn_category'] = $tr->getTrnCategory();
|
$fields['trn_category'] = $tr->getTrnCategory();
|
||||||
$fields['trn_id'] = $tr->getTrnId();
|
$fields['trn_id'] = $tr->getTrnId();
|
||||||
$fields['trn_value'] = $tr->getTrnValue();
|
$fields['trn_value'] = $tr->getTrnValue();
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
$fields = array ();
|
$fields = array ();
|
||||||
|
|
||||||
$G_MAIN_MENU = 'tools';
|
$G_MAIN_MENU = 'tools';
|
||||||
@@ -47,14 +45,14 @@
|
|||||||
$G_ID_MENU_SELECTED = 'TOOLS';
|
$G_ID_MENU_SELECTED = 'TOOLS';
|
||||||
$G_ID_SUB_MENU_SELECTED = 'ADD_TRANSLATION';
|
$G_ID_SUB_MENU_SELECTED = 'ADD_TRANSLATION';
|
||||||
|
|
||||||
$G_PUBLISH = new Publisher;
|
$G_PUBLISH = new Publisher();
|
||||||
$dbc = new DBConnection;
|
$dbc = new DBConnection();
|
||||||
$ses = new DBSession( $dbc );
|
$ses = new DBSession( $dbc );
|
||||||
$G_PUBLISH = new Publisher;
|
$G_PUBLISH = new Publisher();
|
||||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tools/translationAdd', '', $fields, 'translationsSave' );
|
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tools/translationAdd', '', $fields, 'translationsSave' );
|
||||||
if (isset( $_SESSION['TOOLS_VIEWTYPE'] ) && $_SESSION['TOOLS_VIEWTYPE'] == 'blank') {
|
if (isset( $_SESSION['TOOLS_VIEWTYPE'] ) && $_SESSION['TOOLS_VIEWTYPE'] == 'blank') {
|
||||||
G::RenderPage( 'publishBlank', 'green-submenu' );
|
G::RenderPage( 'publishBlank', 'green-submenu' );
|
||||||
} else {
|
} else {
|
||||||
G::RenderPage( 'publish' );
|
G::RenderPage( 'publish' );
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
*
|
*
|
||||||
* 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.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form = $_POST['form'];
|
$form = $_POST['form'];
|
||||||
@@ -33,4 +32,4 @@
|
|||||||
G::SendMessageText( $res['message'], 'error' );
|
G::SendMessageText( $res['message'], 'error' );
|
||||||
}
|
}
|
||||||
G::Header( 'location: translations' );
|
G::Header( 'location: translations' );
|
||||||
?>
|
|
||||||
|
|||||||
@@ -20,12 +20,11 @@
|
|||||||
*
|
*
|
||||||
* 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.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once ("classes/model/Translation.php");
|
require_once ("classes/model/Translation.php");
|
||||||
|
|
||||||
$t = new Translation;
|
$t = new Translation();
|
||||||
$fields = Translation::generateFileTranslation( 'en' );
|
$fields = Translation::generateFileTranslation( 'en' );
|
||||||
|
|
||||||
$G_MAIN_MENU = 'tools';
|
$G_MAIN_MENU = 'tools';
|
||||||
@@ -33,11 +32,11 @@
|
|||||||
$G_ID_MENU_SELECTED = 'TRANSLATION';
|
$G_ID_MENU_SELECTED = 'TRANSLATION';
|
||||||
$G_ID_SUB_MENU_SELECTED = 'TRANSLATION_REBUILD';
|
$G_ID_SUB_MENU_SELECTED = 'TRANSLATION_REBUILD';
|
||||||
|
|
||||||
$G_PUBLISH = new Publisher;
|
$G_PUBLISH = new Publisher();
|
||||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tools/updateTranslation', '', $fields );
|
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tools/updateTranslation', '', $fields );
|
||||||
if (isset( $_SESSION['TOOLS_VIEWTYPE'] ) && $_SESSION['TOOLS_VIEWTYPE'] == 'blank') {
|
if (isset( $_SESSION['TOOLS_VIEWTYPE'] ) && $_SESSION['TOOLS_VIEWTYPE'] == 'blank') {
|
||||||
G::RenderPage( 'publishBlank', 'green-submenu' );
|
G::RenderPage( 'publishBlank', 'green-submenu' );
|
||||||
} else {
|
} else {
|
||||||
G::RenderPage( 'publish' );
|
G::RenderPage( 'publish' );
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user