This commit is contained in:
Paula Quispe
2017-08-05 12:35:14 -04:00
parent e0c81c4662
commit 5d202bb681
2 changed files with 74 additions and 60 deletions

View File

@@ -80,36 +80,42 @@ class Installer extends Controller
G::RenderPage( 'publish', 'extJs' );
}
/**
* This function can be create a new workspace
* The user need permission PM_SETUP_ADVANCE for this action
* @return void
*/
public function newSite ()
{
$textStep1 = G::LoadTranslation('ID_PROCESSMAKER_REQUIREMENTS_DESCRIPTION_STEP4_1');
$textStep2 = G::LoadTranslation('ID_PROCESSMAKER_REQUIREMENTS_DESCRIPTION_STEP5');
if (!$this->pmIsInstalled()) {
$textStep1 = G::LoadTranslation('ID_PROCESSMAKER_REQUIREMENTS_DESCRIPTION_STEP4_1');
$textStep2 = G::LoadTranslation('ID_PROCESSMAKER_REQUIREMENTS_DESCRIPTION_STEP5');
$this->includeExtJS( 'installer/CardLayout', false );
$this->includeExtJS( 'installer/Wizard', false );
$this->includeExtJS( 'installer/Header', false );
$this->includeExtJS( 'installer/Card', false );
$this->includeExtJS( 'installer/newSite', false );
$this->includeExtJS('installer/CardLayout', false);
$this->includeExtJS('installer/Wizard', false);
$this->includeExtJS('installer/Header', false);
$this->includeExtJS('installer/Card', false);
$this->includeExtJS('installer/newSite', false);
$this->setJSVar('textStep1', $textStep1);
$this->setJSVar('textStep2', $textStep2);
$this->setJSVar('DB_ADAPTER', DB_ADAPTER);
$aux = explode(':', DB_HOST);
$this->setJSVar('DB_HOST', $aux[0]);
$this->setJSVar('DB_PORT', isset( $aux[1] ) ? $aux[1] : (DB_ADAPTER == 'mssql' ? '1433' : '3306'));
$this->setJSVar('DB_NAME', 'workflow');
$this->setJSVar('DB_USER', '');
$this->setJSVar('DB_PASS', '');
$this->setJSVar('pathConfig', PATH_CORE . 'config' . PATH_SEP);
$this->setJSVar('pathLanguages', PATH_LANGUAGECONT);
$this->setJSVar('pathPlugins', PATH_PLUGINS);
$this->setJSVar('pathXmlforms', PATH_XMLFORM);
$this->setJSVar('pathShared', PATH_DATA);
$this->setView('installer/newSite');
$this->setJSVar( 'textStep1', $textStep1 );
$this->setJSVar( 'textStep2', $textStep2 );
$this->setJSVar( 'DB_ADAPTER', DB_ADAPTER );
$aux = explode( ':', DB_HOST );
$this->setJSVar( 'DB_HOST', $aux[0] );
$this->setJSVar( 'DB_PORT', isset( $aux[1] ) ? $aux[1] : (DB_ADAPTER == 'mssql' ? '1433' : '3306') );
$this->setJSVar( 'DB_NAME', 'workflow' );
$this->setJSVar( 'DB_USER', '' );
$this->setJSVar( 'DB_PASS', '' );
$this->setJSVar( 'pathConfig', PATH_CORE . 'config' . PATH_SEP );
$this->setJSVar( 'pathLanguages', PATH_LANGUAGECONT );
$this->setJSVar( 'pathPlugins', PATH_PLUGINS );
$this->setJSVar( 'pathXmlforms', PATH_XMLFORM );
$this->setJSVar( 'pathShared', PATH_DATA );
$this->setView( 'installer/newSite' );
G::RenderPage( 'publish', 'extJs' );
G::RenderPage('publish', 'extJs');
} else {
$this->displayError();
}
}
public function getSystemInfo ()
@@ -414,22 +420,49 @@ class Installer extends Controller
/**
* function to create a workspace
* in fact this function is calling appropiate functions for mysql and mssql
* need permission PM_SETUP_ADVANCE for this action
* @return void
*/
public function createWorkspace ()
{
$pathSharedPartner = trim( $_REQUEST['pathShared'] );
if (file_exists(trim($pathSharedPartner,PATH_SEP). PATH_SEP .'partner.info')) {
$this->systemName = $this->getSystemName($pathSharedPartner);
$_REQUEST["PARTNER_FLAG"] = true;
}
$this->setResponseType( 'json' );
if ($_REQUEST['db_engine'] == 'mysql') {
$info = $this->createMySQLWorkspace();
} else {
$info = $this->createMSSQLWorkspace();
}
if (!$this->pmIsInstalled()) {
$pathSharedPartner = trim($_REQUEST['pathShared']);
if (file_exists(trim($pathSharedPartner, PATH_SEP) . PATH_SEP . 'partner.info')) {
$this->systemName = $this->getSystemName($pathSharedPartner);
$_REQUEST["PARTNER_FLAG"] = true;
}
$this->setResponseType('json');
if ($_REQUEST['db_engine'] == 'mysql') {
$info = $this->createMySQLWorkspace();
} else {
$info = $this->createMSSQLWorkspace();
}
return $info;
return $info;
} else {
$this->displayError();
}
}
/**
* We check if processMaker is not installed
*
* @return boolean
*/
private function pmIsInstalled(){
return file_exists(FILE_PATHS_INSTALLED);
}
/**
* Display an error when processMaker is already installed
*
* @return void
*/
private function displayError(){
$this->setJSVar('messageError', G::LoadTranslation('ID_PROCESSMAKER_ALREADY_INSTALLED'));
$this->includeExtJS('installer/stopInstall');
$this->setView('installer/mainStopInstall');
G::RenderPage('publish', 'extJs');
}
public function forceTogenerateTranslationsFiles ($url)

View File

@@ -1,26 +1,7 @@
<?php
/**
* installServer.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.
*/
global $RBAC;
$RBAC->allows(basename(__FILE__), basename(__FILE__));
if (isset( $_POST['form']['NW_TITLE'] )) {
$action = (isset( $_POST['form']['ACTION'] )) ? trim( $_POST['form']['ACTION'] ) : 'test';