BUG 0000 Adjustment for the standardization of code. CODE_STYLE

This commit is contained in:
Hector Cortez
2013-03-05 09:12:44 -04:00
parent 782300f92c
commit 3fe55aa94f
4 changed files with 400 additions and 384 deletions

View File

@@ -25,6 +25,7 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
* Class headPublisher
*
@@ -34,51 +35,50 @@
*/
class headPublisher
{
public static $instance = null;
var $scriptFiles = array ();
var $leimnudLoad = array ();
public $scriptFiles = array();
public $leimnudLoad = array();
/* extJsSkin init coreLoad flag */
var $extJsInit = 'false';
public $extJsInit = 'false';
/* extJsSkin store the current skin for the ExtJs */
var $extJsSkin = '';
public $extJsSkin = '';
/* extJsScript Array, to store the file to be include */
var $extJsScript = array ();
public $extJsScript = array();
/* extJsLibrary Array, to store extended ExtJs lybraries */
var $extJsLibrary = array ();
public $extJsLibrary = array();
/* extJsContent Array, to store the file to be include in the skin content */
var $extJsContent = array ();
public $extJsContent = array();
/* extVariable array, to store the variables generated in PHP, and used in JavaScript */
var $extVariable = array ();
public $extVariable = array();
/* variable array, to store the variables generated in PHP, and used in JavaScript */
var $vars = array ();
public $vars = array();
/* tplVariable array, to store the variables for template power */
var $tplVariable = array ();
var $translationsFile;
var $leimnudInitString = ' var leimnud = new maborak();
public $tplVariable = array();
public $translationsFile;
public $leimnudInitString = ' var leimnud = new maborak();
leimnud.make({
zip:true,
inGulliver:true,
modules :"dom,abbr,rpc,drag,drop,app,panel,fx,grid,xmlform,validator,dashboard",
files :""
});';
var $headerScript = '
public $headerScript = '
try{
leimnud.exec(leimnud.fix.memoryLeak);
if(leimnud.browser.isIphone){
leimnud.iphone.make();
}
}catch(e){}';
var $disableHeaderScripts = false;
var $title = '';
public $disableHeaderScripts = false;
public $title = '';
/**
* Function headPublisher
@@ -87,14 +87,13 @@ class headPublisher
* @access public
* @return string
*/
public function __construct()
{
$this->addScriptFile("/js/maborak/core/maborak.js");
$this->translationsFile = "/js/ext/translation." . SYS_LANG . ".js";
}
function &getSingleton ()
public function &getSingleton()
{
if (self::$instance == null) {
self::$instance = new headPublisher();
@@ -111,7 +110,7 @@ class headPublisher
* @param eter string LoadType
* @return string
*/
function setTitle ($title)
public function setTitle($title)
{
$this->title = $title;
}
@@ -125,7 +124,7 @@ class headPublisher
* @param eter string LoadType
* @return string
*/
function addScriptFile ($url, $LoadType = 1)
public function addScriptFile($url, $LoadType = 1)
{
if ($LoadType == 1) {
$this->scriptFiles[$url] = $url;
@@ -144,8 +143,7 @@ class headPublisher
* @param eter string module
* @return string
*/
function addInstanceModule ($instance, $module)
public function addInstanceModule($instance, $module)
{
$this->headerScript .= "leimnud.Package.Load('" . $module . "',{Instance:" . $instance . ",Type:'module'});\n";
}
@@ -159,7 +157,7 @@ class headPublisher
* @param eter string module
* @return string
*/
function addClassModule ($class, $module)
public function addClassModule($class, $module)
{
$this->headerScript .= "leimnud.Package.Load('" . $module . "',{Class:" . $class . ",Type:'module'});\n";
}
@@ -172,7 +170,7 @@ class headPublisher
* @param eter string script
* @return string
*/
function addScriptCode ($script)
public function addScriptCode($script)
{
$this->headerScript .= $script;
}
@@ -184,7 +182,7 @@ class headPublisher
* @access public
* @return string
*/
function printHeader ()
public function printHeader()
{
$jslabel = 'labels/en.js';
if (defined('SYS_LANG')) {
@@ -201,8 +199,7 @@ class headPublisher
}
// available js-calendar languages array
$availableJsCalendarLang = array ('ca','cn','cz','de','en','es','fr','it','jp','nl','pl','pt','ro','ru','sv'
);
$availableJsCalendarLang = array('ca', 'cn', 'cz', 'de', 'en', 'es', 'fr', 'it', 'jp', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv');
// get the system language without locale
$sysLang = explode('-', SYS_LANG);
@@ -245,7 +242,7 @@ class headPublisher
* @access public
* @return string
*/
function printRawHeader ()
public function printRawHeader()
{
$jslabel = '/jscore/labels/en.js';
if (defined('SYS_LANG')) {
@@ -279,7 +276,7 @@ class headPublisher
* @access public
* @return string
*/
function clearScripts ()
public function clearScripts()
{
$this->scriptFiles = array();
$this->leimnudLoad = array();
@@ -298,7 +295,7 @@ class headPublisher
* @access public
* @return string
*/
function includeExtJs ()
public function includeExtJs()
{
$this->clearScripts();
$head = '';
@@ -330,7 +327,7 @@ class headPublisher
return $head;
}
function getExtJsStylesheets ($skinName)
public function getExtJsStylesheets($skinName)
{
$script = " <link rel='stylesheet' type='text/css' href='/css/$skinName.css' />\n";
//$script .= " <script type='text/javascript' src='/js/ext/translation." . SYS_LANG . ".js'></script>\n";
@@ -360,7 +357,7 @@ class headPublisher
return $script;
}
function getExtJsScripts ()
public function getExtJsScripts()
{
$script = '';
if (isset($this->extJsScript) && is_array($this->extJsScript)) {
@@ -371,7 +368,7 @@ class headPublisher
return $script;
}
function getExtJsVariablesScript ()
public function getExtJsVariablesScript()
{
$script = '';
if (count($this->extVariable) > 0) {
@@ -396,7 +393,7 @@ class headPublisher
return $script;
}
function getExtJsLibraries ()
public function getExtJsLibraries()
{
$script = '';
if (isset($this->extJsLibrary) && is_array($this->extJsLibrary)) {
@@ -418,7 +415,7 @@ class headPublisher
* @param (String) http js path library
* @return none
*/
function usingExtJs ($library)
public function usingExtJs($library)
{
if (!is_string($library)) {
throw new Exception('headPublisher::usingExt->ERROR - the parameter should be a js path string');
@@ -433,7 +430,7 @@ class headPublisher
* @access public
* @return string
*/
function setExtSkin ($skin)
public function setExtSkin($skin)
{
$this->extJsSkin = $skin;
}
@@ -455,7 +452,7 @@ class headPublisher
* @access public
* @return string
*/
function addExtJsScript ($filename, $debug = false, $isExternal = false)
public function addExtJsScript($filename, $debug = false, $isExternal = false)
{
$sPath = PATH_TPL;
//if the template file doesn't exists, then try with the plugins folders
@@ -565,12 +562,12 @@ class headPublisher
* @access public
* @return string
*/
function AddContent ($templateHtml)
public function AddContent($templateHtml)
{
$this->extJsContent[] = $templateHtml;
}
function getContent ()
public function getContent()
{
return $this->extJsContent;
}
@@ -584,18 +581,18 @@ class headPublisher
* @access public
* @return string
*/
function Assign ($variable, $value)
public function Assign($variable, $value)
{
$this->extVariable[] = array('name' => $variable, 'value' => $value, 'type' => 'string'
);
}
function AssignVar ($name, $value)
public function AssignVar($name, $value)
{
$this->vars[$name] = $value;
}
function getVars ()
public function getVars()
{
return $this->vars;
}
@@ -609,10 +606,9 @@ class headPublisher
* @access public
* @return string
*/
function AssignNumber ($variable, $value)
public function AssignNumber($variable, $value)
{
$this->extVariable[] = array ('name' => $variable,'value' => $value,'type' => 'number'
);
$this->extVariable[] = array('name' => $variable, 'value' => $value, 'type' => 'number');
}
/**
@@ -624,7 +620,7 @@ class headPublisher
* @access public
* @return string
*/
function renderExtJs ()
public function renderExtJs()
{
$body = '';
if (isset($this->extJsContent) && is_array($this->extJsContent)) {
@@ -655,7 +651,7 @@ class headPublisher
return $body;
}
function stripCodeQuotes ($sJson)
public function stripCodeQuotes($sJson)
{
$fields = array("editor", "renderer"
);
@@ -687,7 +683,7 @@ class headPublisher
* @access public
* @return string
*/
function disableHeaderScripts ()
public function disableHeaderScripts()
{
$this->disableHeaderScripts = true;
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* class.helper.php
* @package gulliver.system
@@ -30,15 +31,17 @@
* @package gulliver.system
* @access public
*/
class Helper
{
class Helper{
public $content;
public $gzipEnabled;
public $minified;
public $gzipModuleEnabled;
public $contentType;
function __construct(){
public function __construct()
{
$this->content = '';
$this->gzipEnabled = true;
$this->minified = true;
@@ -46,20 +49,25 @@ class Helper{
$this->contentType = 'text/html';
}
function addFile($file){
if( is_file($file) )
public function addFile($file)
{
if (is_file($file)) {
$this->content .= file_get_contents($file);
}
}
function addContent($content){
public function addContent($content)
{
$this->content = $content;
}
function setContentType($ctype){
public function setContentType($ctype)
{
$this->contentType = $ctype;
}
function init(){
public function init()
{
header("Content-type: {$this->contentType}");
header('Pragma: cache');
header('Cache-Control: public');
@@ -67,33 +75,41 @@ class Helper{
if ($this->gzipEnabled && extension_loaded('zlib')) {
$this->gzipModuleEnabled = true;
ob_start('ob_gzhandler');
} else
} else {
ob_start();
}
}
function minify() {
public function minify()
{
if ($this->contentType != 'text/css') {
G::LoadThirdParty('jsmin', 'jsmin');
$this->content = JSMin::minify($this->content);
}
}
function flush(){
if( $this->minified )
public function flush()
{
if ($this->minified) {
$this->minify();
}
print($this->content);
ob_end_flush();
}
function serve($type=null){
if( isset($type) )
public function serve($type = null)
{
if (isset($type)) {
$this->setContentType($ctype);
}
$this->init();
$this->flush();
}
}
/*
function minify($buffer) {
return G::removeComments($buffer);
}
*/

View File

@@ -23,7 +23,6 @@
* @icon /images/triggers/alfrescoIcon.png
* @className class.pmTrAlfresco.pmFunctions.php
*/
/**
* @method
*
@@ -41,8 +40,10 @@
*
*/
G::LoadSystem('restClient');
// Validation left
function cancelCheckout($alfrescoServerUrl, $docUid, $user="", $pwd="") {
function cancelCheckout($alfrescoServerUrl, $docUid, $user = "", $pwd = "")
{
//require_once(PATH_CORE. 'classes' . PATH_SEP.'triggers' . PATH_SEP . 'class.pmTrAlfresco.php');
$alfresco_url = "$alfrescoServerUrl/s/cmis/pwc/s/workspace:SpacesStore/i/$docUid";
$domapi_exec = RestClient::delete($alfresco_url, $user, $pwd, "application/atom+xml;type=entry");
@@ -69,21 +70,22 @@ return $domapi_res;
*
*/
// Validation done
function checkIn($alfrescoServerUrl, $docUid, $comments, $user="", $pwd="") {
function checkIn($alfrescoServerUrl, $docUid, $comments, $user = "", $pwd = "")
{
$alfresco_url = "$alfrescoServerUrl/s/cmis/pwc/i/$docUid?checkin=true&checkinComment=$comments";
$xmlData = array();
$xmlData = '<?xml version="1.0" encoding="utf-8"?><entry xmlns="http://www.w3.org/2005/Atom"/>';
$alfresco_exec = RestClient::put($alfresco_url, $xmlData, $user, $pwd, "application/atom+xml");
$alfrescoMessage = $alfresco_exec->getResponseMessage();
if($alfrescoMessage === 'OK' )
if ($alfrescoMessage === 'OK') {
return "The Document has been Checkedin";
elseif ($alfrescoMessage === 'Internal Server Error')
} elseif ($alfrescoMessage === 'Internal Server Error') {
return "Please enter a Valid Document Id";
else
} else {
return $alfrescoMessage;
}
}
/**
* @method
@@ -102,20 +104,22 @@ return $alfrescoMessage;
*
*/
// Validation done
function checkOut($alfrescoServerUrl, $docUid, $user="", $pwd="") {
function checkOut($alfrescoServerUrl, $docUid, $user = "", $pwd = "")
{
$alfresco_url = "$alfrescoServerUrl/s/cmis/checkedout";
$xmlData = array();
$xmlData = '<?xml version="1.0" encoding="utf-8"?>' . '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/">' . '<cmisra:object>' . '<cmis:properties>' . '<cmis:propertyId propertyDefinitionId="cmis:objectId">' . '<cmis:value>workspace://SpacesStore/' . $docUid . '</cmis:value>' . '</cmis:propertyId>' . '</cmis:properties>' . '</cmisra:object>' . '</entry>';
$alfresco_exec = RestClient::post($alfresco_url, $xmlData, $user, $pwd, "application/atom+xml;type=entry");
$alfrescoMessage = $alfresco_exec->getResponseMessage();
if($alfrescoMessage === 'Created' )
if ($alfrescoMessage === 'Created') {
return "The Document has been Checkedout";
elseif ($alfrescoMessage === 'Conflict')
} elseif ($alfrescoMessage === 'Conflict') {
return "The Document you are trying to checkout has already been Checkedout";
else
} else {
return $alfrescoMessage;
}
}
/**
* @method
@@ -134,7 +138,8 @@ return $alfrescoMessage;
* @return string | $result | Response
*
*/
function createFolder($alfrescoServerUrl, $parentFolder, $folderName, $user, $pwd) {
function createFolder($alfrescoServerUrl, $parentFolder, $folderName, $user, $pwd)
{
$name = explode("/", $folderName);
$init = substr($parentFolder, 0, 1);
$parentFolder = ($init == "/") ? substr($parentFolder, 1) . "/" : $parentFolder . "/";
@@ -172,7 +177,8 @@ function createFolder($alfrescoServerUrl, $parentFolder, $folderName, $user, $pw
* @return string | $result | Response
*
*/
function deleteObject($alfrescoServerUrl, $objetcId, $user, $pwd) {
function deleteObject($alfrescoServerUrl, $objetcId, $user, $pwd)
{
$alfresco_url = "$alfrescoServerUrl/s/cmis/s/workspace:SpacesStore/i/$objetcId";
$alfresco_exec = RestClient::delete($alfresco_url, $user, $pwd, "application/atom+xml");
@@ -198,7 +204,8 @@ function deleteObject($alfrescoServerUrl, $objetcId, $user, $pwd) {
* @return string | $result | Response
*
*/
function downloadDoc($alfrescoServerUrl, $pathFile , $pathFolder, $user, $pwd) {
function downloadDoc($alfrescoServerUrl, $pathFile, $pathFolder, $user, $pwd)
{
if (!(G::verifyPath($pathFolder))) {
G::SendTemporalMessage('ID_FILE_PLUGIN_NOT_EXISTS', 'error', 'labels', null, null, array('pluginFile' => $pathFolder));
G::header('Location: ' . $_SERVER['HTTP_REFERER']);
@@ -250,7 +257,8 @@ function downloadDoc($alfrescoServerUrl, $pathFile , $pathFolder, $user, $pwd) {
* @return string | $result | Response
*
*/
function getCheckedoutFiles($alfrescoServerUrl, $user, $pwd) {
function getCheckedoutFiles($alfrescoServerUrl, $user, $pwd)
{
$getChildrenUrl = "$alfrescoServerUrl/s/cmis/checkedout";
$domapi_exec = RestClient::get($getChildrenUrl, $user, $pwd, 'application/atom+xml');
@@ -278,7 +286,8 @@ function getCheckedoutFiles($alfrescoServerUrl, $user, $pwd) {
* @return string | $result | Response
*
*/
function getFolderChildren($alfrescoServerUrl, $folderId, $user, $pwd) {
function getFolderChildren($alfrescoServerUrl, $folderId, $user, $pwd)
{
$getChildrenUrl = "$alfrescoServerUrl/service/api/node/workspace/SpacesStore/$folderId/children";
$alfresco_exec = RestClient::get($getChildrenUrl, $user, $pwd);
$sXmlArray = $alfresco_exec->getResponse();
@@ -309,9 +318,9 @@ function getFolderChildren($alfrescoServerUrl, $folderId, $user, $pwd) {
* @return string | $result | Response
*
*/
function uploadDoc($alfrescoServerUrl, $fileSource, $title, $description, $docType, $user, $pwd, $path = '') {
if (!(file_exists($fileSource)))
function uploadDoc($alfrescoServerUrl, $fileSource, $title, $description, $docType, $user, $pwd, $path = '')
{
if (!(file_exists($fileSource))) {
G::SendTemporalMessage('ID_FILE_PLUGIN_NOT_EXISTS', 'error', 'labels', null, null, array('pluginFile' => $fileSource));
G::header('Location: ' . $_SERVER['HTTP_REFERER']);
die;
@@ -338,3 +347,4 @@ function uploadDoc($alfrescoServerUrl, $fileSource, $title, $description, $docTy
return $aXmlArray;
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* cases_SaveDocument.php
*
@@ -82,10 +83,8 @@
break;
case "NV": //New Version
$aFields = array('APP_DOC_UID' => $appDocUid,
'APP_UID' => $appId,
'DEL_INDEX' => 1,
'USR_UID' => $_SESSION['USER_LOGGED'],
'DOC_UID' => $docUid,
@@ -112,12 +111,10 @@
'FOLDER_UID' => $folderId,
'APP_DOC_TAGS' => $fileTags);
$oAppDocument->create($aFields);
break;
}
$sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo($oAppDocument->getAppDocFilename());
@@ -150,12 +147,8 @@
}
}
G::header('location: appFolderList');
die;
} catch (Exception $e) {
/* Render Error page */
$aMessage['MESSAGE'] = $e->getMessage();
@@ -163,3 +156,4 @@
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
G::RenderPage('publish');
}