From 47d20cbaa58376ef6ba8e719c97ef967907b4706 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Wed, 2 Apr 2014 13:16:26 -0400 Subject: [PATCH 1/3] Add mafe-translation --- workflow/engine/bin/tasks/cliMafe.php | 69 +++++++++++++++++++ workflow/engine/bin/tasks/cliWorkspaces.php | 3 + workflow/engine/classes/model/Translation.php | 14 ++++ workflow/engine/templates/designer/index.html | 4 +- 4 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 workflow/engine/bin/tasks/cliMafe.php diff --git a/workflow/engine/bin/tasks/cliMafe.php b/workflow/engine/bin/tasks/cliMafe.php new file mode 100644 index 000000000..0887a9f15 --- /dev/null +++ b/workflow/engine/bin/tasks/cliMafe.php @@ -0,0 +1,69 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + * @package workflow-engine-bin-tasks + */ +G::LoadClass("system"); +G::LoadClass("wsTools"); + + +CLI::taskName('mafe-translation'); +CLI::taskDescription(<<setRootDir($rootDir); + $loadConstants = false; + + $workspaces = get_workspaces_from_args($args); + print_r($workspaces); + $lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en'; + + //$app->loadEnvironment("marcoantonio3", $loadConstants); + + $translation = new Translation(); + CLI::logging("Updating labels Mafe ...\n"); + foreach ($workspaces as $workspace) { + try { + echo "Updating labels for workspace " . pakeColor::colorize($workspace->name, "INFO") . "\n"; + $app->loadEnvironment($workspace->name, $loadConstants); + $translation->generateTransaltionMafe($lang); + } catch (Exception $e) { + echo "Errors upgrading labels for workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n"; + } + } + + CLI::logging("Create successful\n"); + +} diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php index 00ad1f68d..cf8a9f172 100755 --- a/workflow/engine/bin/tasks/cliWorkspaces.php +++ b/workflow/engine/bin/tasks/cliWorkspaces.php @@ -258,6 +258,9 @@ function run_database_check($args, $opts) { } function database_upgrade($command, $args) { + print_r($command); + print_r($args); + die; $workspaces = get_workspaces_from_args($args); $checkOnly = (strcmp($command, "check") == 0); foreach ($workspaces as $workspace) { diff --git a/workflow/engine/classes/model/Translation.php b/workflow/engine/classes/model/Translation.php index b6508cfb8..5a0a77650 100755 --- a/workflow/engine/classes/model/Translation.php +++ b/workflow/engine/classes/model/Translation.php @@ -573,5 +573,19 @@ class Translation extends BaseTranslation } return false; } + + public function generateTransaltionMafe ($lang='en') + { + if (!file_exists(PATH_TRUNK .'vendor/colosa/MichelangeloFE/' . 'labels.php')) { + throw new Exception( PATH_TRUNK .'vendor/colosa/MichelangeloFE/' . 'labels.php'); + throw new Exception( 'labels.php not exist in MAFE '); + } + + include PATH_TRUNK .'vendor/colosa/MichelangeloFE/' . 'labels.php'; + + foreach ($labels as $key => $row) { + $this->addTranslation ('LABEL', 'ID_MAFE_'.MD5($row), $lang, $row); + } + } } diff --git a/workflow/engine/templates/designer/index.html b/workflow/engine/templates/designer/index.html index 10755be86..5e8cd6b4c 100644 --- a/workflow/engine/templates/designer/index.html +++ b/workflow/engine/templates/designer/index.html @@ -112,10 +112,10 @@ -
  • + From eefe69385224379d78703ec1a4c7a87824cfacac Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Wed, 2 Apr 2014 13:18:33 -0400 Subject: [PATCH 2/3] Add mafe-translation --- workflow/engine/bin/tasks/cliMafe.php | 6 +----- workflow/engine/classes/model/Translation.php | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/workflow/engine/bin/tasks/cliMafe.php b/workflow/engine/bin/tasks/cliMafe.php index 0887a9f15..b5ed6232f 100644 --- a/workflow/engine/bin/tasks/cliMafe.php +++ b/workflow/engine/bin/tasks/cliMafe.php @@ -33,8 +33,7 @@ CLI::taskDescription(<<loadEnvironment("marcoantonio3", $loadConstants); - $translation = new Translation(); CLI::logging("Updating labels Mafe ...\n"); foreach ($workspaces as $workspace) { diff --git a/workflow/engine/classes/model/Translation.php b/workflow/engine/classes/model/Translation.php index 5a0a77650..1f7347475 100755 --- a/workflow/engine/classes/model/Translation.php +++ b/workflow/engine/classes/model/Translation.php @@ -577,7 +577,6 @@ class Translation extends BaseTranslation public function generateTransaltionMafe ($lang='en') { if (!file_exists(PATH_TRUNK .'vendor/colosa/MichelangeloFE/' . 'labels.php')) { - throw new Exception( PATH_TRUNK .'vendor/colosa/MichelangeloFE/' . 'labels.php'); throw new Exception( 'labels.php not exist in MAFE '); } From 07ee040c00dfd0c13e0e98095daaa49f5411d665 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Wed, 2 Apr 2014 13:26:15 -0400 Subject: [PATCH 3/3] Add mafe-translation --- workflow/engine/bin/tasks/cliMafe.php | 2 +- workflow/engine/bin/tasks/cliWorkspaces.php | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/workflow/engine/bin/tasks/cliMafe.php b/workflow/engine/bin/tasks/cliMafe.php index b5ed6232f..d0655eede 100644 --- a/workflow/engine/bin/tasks/cliMafe.php +++ b/workflow/engine/bin/tasks/cliMafe.php @@ -35,7 +35,7 @@ EOT ); CLI::taskArg('workspace', true, true); -CLI::taskOpt("lang", "You must specify language on which rebuild of the case cache list builder will be done; if you don't specify this, it will use 'en' by default", "l:","lang="); +CLI::taskOpt("lang", "languaje", "l:","lang="); CLI::taskRun('run_create_translation'); function run_create_translation($args, $opts) diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php index cf8a9f172..00ad1f68d 100755 --- a/workflow/engine/bin/tasks/cliWorkspaces.php +++ b/workflow/engine/bin/tasks/cliWorkspaces.php @@ -258,9 +258,6 @@ function run_database_check($args, $opts) { } function database_upgrade($command, $args) { - print_r($command); - print_r($args); - die; $workspaces = get_workspaces_from_args($args); $checkOnly = (strcmp($command, "check") == 0); foreach ($workspaces as $workspace) {