Add php files
This commit is contained in:
227
modules/ModuleBuilder/views/view.dashlet.php
Executable file
227
modules/ModuleBuilder/views/view.dashlet.php
Executable file
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' ) ;
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once ('modules/ModuleBuilder/views/view.listview.php') ;
|
||||
require_once 'modules/ModuleBuilder/parsers/constants.php' ;
|
||||
|
||||
class ViewDashlet extends ViewListView
|
||||
{
|
||||
function ViewDashlet()
|
||||
{
|
||||
$this->init () ;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* Pseudo-constructor to enable subclasses to call a parent's constructor without knowing the parent in PHP4
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
$this->editModule = $_REQUEST [ 'view_module' ] ;
|
||||
$this->editLayout = $_REQUEST [ 'view' ] ;
|
||||
$this->editPackage = (isset ( $_REQUEST [ 'view_package' ] ) && ! empty ( $_REQUEST [ 'view_package' ] )) ? $_REQUEST [ 'view_package' ] : null ;
|
||||
|
||||
$this->fromModuleBuilder = isset ( $_REQUEST [ 'MB' ] ) || (isset($_REQUEST['view_package']) && $_REQUEST['view_package'] && $_REQUEST['view_package'] != 'studio') ;
|
||||
|
||||
if (!$this->fromModuleBuilder)
|
||||
{
|
||||
global $app_list_strings ;
|
||||
$moduleNames = array_change_key_case ( $app_list_strings [ 'moduleList' ] ) ;
|
||||
$this->translatedEditModule = $moduleNames [ strtolower ( $this->editModule ) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
// DO NOT REMOVE - overrides parent ViewEdit preDisplay() which attempts to load a bean for a non-existent module
|
||||
function preDisplay()
|
||||
{
|
||||
}
|
||||
|
||||
function display(
|
||||
$preview = false
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
require_once 'modules/ModuleBuilder/parsers/ParserFactory.php' ;
|
||||
$parser = ParserFactory::getParser ( $this->editLayout, $this->editModule, $this->editPackage) ;
|
||||
|
||||
$smarty = $this->constructSmarty ( $parser ) ;
|
||||
if ($preview)
|
||||
{
|
||||
echo $smarty->fetch ( "modules/ModuleBuilder/tpls/Preview/listView.tpl" ) ;
|
||||
} else
|
||||
{
|
||||
$ajax = $this->constructAjax () ;
|
||||
$ajax->addSection ( 'center', translate('LBL_DASHLET'), $smarty->fetch ( "modules/ModuleBuilder/tpls/listView.tpl" ) ) ;
|
||||
echo $ajax->getJavascript () ;
|
||||
}
|
||||
}
|
||||
|
||||
function constructAjax()
|
||||
{
|
||||
require_once ('modules/ModuleBuilder/MB/AjaxCompose.php') ;
|
||||
$ajax = new AjaxCompose ( ) ;
|
||||
|
||||
if ($this->fromModuleBuilder)
|
||||
{
|
||||
$ajax->addCrumb ( translate ( 'LBL_MODULEBUILDER', 'ModuleBuilder' ), 'ModuleBuilder.main("mb")' ) ;
|
||||
$ajax->addCrumb ( $_REQUEST [ 'view_package' ], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $this->editPackage . '")' ) ;
|
||||
$ajax->addCrumb ( $this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $this->editPackage . '&view_module=' . $this->editModule . '")' ) ;
|
||||
$ajax->addCrumb ( translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&layouts=1&MB=1&view_package='.$this->editPackage.'&view_module=' . $this->editModule . '")');
|
||||
$ajax->addCrumb ( translate('LBL_DASHLET', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=dashlet&MB=1&view_package='.$this->editPackage.'&view_module=' . $this->editModule . '")' );
|
||||
|
||||
$ViewLabel = ($this->editLayout == MB_DASHLET) ? 'LBL_DASHLETLISTVIEW' : 'LBL_DASHLETSEARCHVIEW';
|
||||
$ajax->addCrumb ( translate ($ViewLabel, 'ModuleBuilder' ), '' ) ;
|
||||
}else{
|
||||
$ajax->addCrumb ( $this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_module=' . $this->editModule . '")' ) ;
|
||||
$ajax->addCrumb ( translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&layouts=1&view_module=' . $this->editModule . '")');
|
||||
$ajax->addCrumb ( translate('LBL_DASHLET', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=dashlet&view_module=' . $this->editModule . '")' );
|
||||
$ViewLabel = ($this->editLayout == MB_DASHLET) ? 'LBL_DASHLETLISTVIEW' : 'LBL_DASHLETSEARCHVIEW';
|
||||
$ajax->addCrumb ( translate ($ViewLabel, 'ModuleBuilder' ), '' ) ;
|
||||
}
|
||||
return $ajax ;
|
||||
}
|
||||
|
||||
function constructSmarty($parser)
|
||||
{
|
||||
$smarty = new Sugar_Smarty ( ) ;
|
||||
$smarty->assign ( 'translate', true ) ;
|
||||
$smarty->assign ( 'language', $parser->getLanguage () ) ;
|
||||
|
||||
$smarty->assign ( 'view', $this->editLayout ) ;
|
||||
$smarty->assign ( 'action', 'dashletSave' ) ;
|
||||
$smarty->assign( 'module', 'ModuleBuilder');
|
||||
$smarty->assign ( 'view_module', $this->editModule ) ;
|
||||
$helpName = (isset( $_REQUEST['view']) && $_REQUEST['view']=='dashletsearch') ? 'searchViewEditor' : 'listViewEditor';
|
||||
$smarty->assign ( 'helpName', $helpName ) ;
|
||||
$smarty->assign ( 'helpDefault', 'modify' ) ;
|
||||
if ($this->fromModuleBuilder) {
|
||||
$mb = new ModuleBuilder ( ) ;
|
||||
$module = & $mb->getPackageModule ( $this->editPackage, $this->editModule ) ;
|
||||
$smarty->assign('current_mod_strings', $module->getModStrings());
|
||||
}
|
||||
$smarty->assign ( 'title', $this->_constructTitle () ) ;
|
||||
$groups = array ( ) ;
|
||||
foreach ( $parser->columns as $column => $function )
|
||||
{
|
||||
// update this so that each field has a properties set
|
||||
// properties are name, value, title (optional)
|
||||
$groups [ $GLOBALS [ 'mod_strings' ] [ $column ] ] = $parser->$function () ; // call the parser functions to populate the list view columns, by default 'default', 'available' and 'hidden'
|
||||
}
|
||||
foreach ( $groups as $groupKey => $group )
|
||||
{
|
||||
foreach ( $group as $fieldKey => $field )
|
||||
{
|
||||
if (isset ( $field [ 'width' ] ))
|
||||
{
|
||||
if (substr ( $field [ 'width' ], - 1, 1 ) == '%')
|
||||
{
|
||||
|
||||
$groups [ $groupKey ] [ $fieldKey ] [ 'width' ] = substr ( $field [ 'width' ], 0, strlen ( $field [ 'width' ] ) - 1 ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign ( 'groups', $groups ) ;
|
||||
|
||||
global $image_path ;
|
||||
$imageSave = SugarThemeRegistry::current()->getImage('studio_save') ;
|
||||
// $imageHelp = SugarThemeRegistry::current()->getImage('help') ;
|
||||
|
||||
$histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")" ;
|
||||
if (isset($this->searchlayout))
|
||||
$histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$this->searchlayout}\")" ;
|
||||
|
||||
$buttons = array ( ) ;
|
||||
if (! $this->fromModuleBuilder)
|
||||
{
|
||||
$buttons [] = array ( 'name' => 'savebtn' , 'image' => $imageSave , 'text' => $GLOBALS [ 'mod_strings' ] [ 'LBL_BTN_SAVEPUBLISH' ] , 'actionScript' => "onclick='studiotabs.generateGroupForm(\"edittabs\");ModuleBuilder.state.isDirty=false;ModuleBuilder.submitForm(\"edittabs\" )'" ) ;
|
||||
} else
|
||||
{
|
||||
$buttons [] = array ( 'name' => 'mbsavebtn' , 'image' => $imageSave , 'text' => $GLOBALS [ 'mod_strings' ] [ 'LBL_BTN_SAVE' ] , 'actionScript' => "onclick='studiotabs.generateGroupForm(\"edittabs\");ModuleBuilder.state.isDirty=false;ModuleBuilder.submitForm(\"edittabs\" )'" ) ;
|
||||
}
|
||||
$buttons [] = array ( 'name' => 'historyBtn' , 'text' => translate ( 'LBL_HISTORY' ) , 'actionScript' => "onclick='$histaction'" ) ;
|
||||
$smarty->assign ( 'buttons', $this->_buildImageButtons ( $buttons ) ) ;
|
||||
$editImage = SugarThemeRegistry::current()->getImage('edit_inline') ;
|
||||
$smarty->assign ( 'editImage', $editImage ) ;
|
||||
$deleteImage = SugarThemeRegistry::current()->getImage('delete_inline') ;
|
||||
$smarty->assign ( 'deleteImage', $deleteImage ) ;
|
||||
$smarty->assign ( 'MOD', $GLOBALS [ 'mod_strings' ] ) ;
|
||||
|
||||
if ($this->fromModuleBuilder)
|
||||
{
|
||||
$smarty->assign ( 'MB', true ) ;
|
||||
$smarty->assign ( 'view_package', $this->editPackage ) ;
|
||||
$smarty->assign ( 'description', $GLOBALS [ 'mod_strings' ] [ 'LBL_LISTVIEW_DESCRIPTION' ] ) ;
|
||||
|
||||
} else
|
||||
{
|
||||
$smarty->assign ( 'description', $GLOBALS [ 'mod_strings' ] [ 'LBL_LISTVIEW_DESCRIPTION' ] ) ;
|
||||
}
|
||||
|
||||
return $smarty ;
|
||||
}
|
||||
|
||||
function _constructTitle()
|
||||
{
|
||||
global $app_list_strings ;
|
||||
|
||||
if ($this->fromModuleBuilder)
|
||||
$title = $this->editModule ;
|
||||
else
|
||||
$title = $app_list_strings [ 'moduleList' ] [ $this->editModule ] ;
|
||||
|
||||
return $GLOBALS [ 'mod_strings' ] [ 'LBL_LISTVIEW_EDIT' ] . ': ' . $title ;
|
||||
}
|
||||
}
|
||||
60
modules/ModuleBuilder/views/view.deletemodule.php
Executable file
60
modules/ModuleBuilder/views/view.deletemodule.php
Executable file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
require_once('modules/ModuleBuilder/MB/ModuleBuilder.php');
|
||||
|
||||
class Viewdeletemodule extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
$ajax = new AjaxCompose();
|
||||
$ajax->addSection('center', 'Module Deleted', $_REQUEST['module'] . ' was deleted from ' . $_REQUEST['package']);
|
||||
echo $ajax->getJavascript();
|
||||
}
|
||||
}
|
||||
63
modules/ModuleBuilder/views/view.deletepackage.php
Executable file
63
modules/ModuleBuilder/views/view.deletepackage.php
Executable file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
require_once('modules/ModuleBuilder/MB/ModuleBuilder.php');
|
||||
|
||||
class Viewdeletepackage extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
$ajax = new AjaxCompose();
|
||||
$ajax->addSection('center', $mod_strings['LBL_PACKAGE_DELETED'],
|
||||
str_replace('[[package]]',$_REQUEST['package'],$mod_strings['LBL_PACKAGE_WAS_DELETED']));
|
||||
echo $ajax->getJavascript();
|
||||
}
|
||||
}
|
||||
65
modules/ModuleBuilder/views/view.displaydeploy.php
Executable file
65
modules/ModuleBuilder/views/view.displaydeploy.php
Executable file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
|
||||
class ViewDisplaydeploy extends SugarView
|
||||
{
|
||||
function ViewDisplaydeploy()
|
||||
{
|
||||
$smarty = new Sugar_Smarty();
|
||||
$smarty->assign('package', $_REQUEST['name']);
|
||||
$smarty->assign('message', $GLOBALS['mod_strings']['LBL_DEPLOY_IN_PROGRESS']);
|
||||
$ajax = new AjaxCompose();
|
||||
$ajax->addCrumb($GLOBALS['mod_strings']['LBL_MODULEBUILDER'], 'ModuleBuilder.main("mb")');
|
||||
$ajax->addCrumb($_REQUEST['name'],'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package='.$_REQUEST['name'].'")');
|
||||
$ajax->addCrumb(translate('LBL_SECTION_DEPLOY', 'ModuleBuilder'), '');
|
||||
$ajax->addSection('center', translate('LBL_SECTION_DEPLOY', 'ModuleBuilder'), $smarty->fetch('modules/ModuleBuilder/tpls/MBPackage/deploy.tpl'));
|
||||
echo $ajax->getJavascript();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
}
|
||||
68
modules/ModuleBuilder/views/view.displaydeployresult.php
Executable file
68
modules/ModuleBuilder/views/view.displaydeployresult.php
Executable file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
|
||||
class ViewDisplaydeployresult extends SugarView
|
||||
{
|
||||
function ViewDisplaydeployresult(){
|
||||
$this->show_header = false;
|
||||
$this->show_title = false;
|
||||
$this->show_subpanels = false;
|
||||
$this->show_search = false;
|
||||
$this->show_footer = true;
|
||||
$this->show_javascript = true;
|
||||
$this->view_print = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
$message = $this->view_object_map['message'];
|
||||
echo $message."<script type='text/javascript' src='include/javascript/sugar_grp1_yui.js?s=".$GLOBALS['sugar_version']."&c=".$GLOBALS['sugar_config']['js_custom_version']."'></script><script type='text/javascript' language='Javascript'>YAHOO.util.Connect.asyncRequest('GET', 'index.php?module=Administration&action=RebuildRelationship&silent=true');</script>";
|
||||
}
|
||||
}
|
||||
159
modules/ModuleBuilder/views/view.dropdown.php
Executable file
159
modules/ModuleBuilder/views/view.dropdown.php
Executable file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
|
||||
class ViewDropdown extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
$ajax = new AjaxCompose();
|
||||
$smarty = $this->generateSmarty();
|
||||
|
||||
if (isset($_REQUEST['refreshTree']))
|
||||
{
|
||||
require_once ('modules/ModuleBuilder/Module/DropDownTree.php');
|
||||
$mbt = new DropDownTree();
|
||||
$ajax->addSection('west', $mbt->getName(), $mbt->fetchNodes());
|
||||
$smarty->assign('refreshTree',true);
|
||||
}
|
||||
|
||||
$smarty->assign('deleteImage', SugarThemeRegistry::current()->getImage( 'delete_inline', ''));
|
||||
$smarty->assign('editImage', SugarThemeRegistry::current()->getImage( 'edit_inline', ''));
|
||||
$smarty->assign('action', 'savedropdown');
|
||||
$body = $smarty->fetch('modules/ModuleBuilder/tpls/MBModule/dropdown.tpl');
|
||||
$ajax->addSection('east2', $GLOBALS['mod_strings']['LBL_SECTION_DROPDOWNED'], $body );
|
||||
echo $ajax->getJavascript();
|
||||
}
|
||||
|
||||
function generateSmarty()
|
||||
{
|
||||
//get the selected language
|
||||
$selected_lang = (!empty($_REQUEST['dropdown_lang'])?$_REQUEST['dropdown_lang']:$_SESSION['authenticated_user_language']);
|
||||
$vardef = array();
|
||||
$package_name = 'studio';
|
||||
$package_strings = array();
|
||||
$new =false;
|
||||
$my_list_strings = return_app_list_strings_language( $selected_lang ) ;
|
||||
// $my_list_strings = $GLOBALS['app_list_strings'];
|
||||
|
||||
//if we are using ModuleBuilder then process the following
|
||||
if(!empty($_REQUEST['view_package']) && $_REQUEST['view_package'] != 'studio'){
|
||||
require_once('modules/ModuleBuilder/MB/ModuleBuilder.php');
|
||||
$mb = new ModuleBuilder();
|
||||
$this->module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
|
||||
$package =& $mb->packages[$_REQUEST['view_package']];
|
||||
$package_name = $package->name;
|
||||
$this->module->getVardefs();
|
||||
if(empty($_REQUEST['dropdown_name']) && !empty($_REQUEST['field'])){
|
||||
$new = true;
|
||||
$_REQUEST['dropdown_name'] = $_REQUEST['field']. '_list';
|
||||
}
|
||||
|
||||
$vardef = (!empty($this->module->mbvardefs->fields[$_REQUEST['dropdown_name']]))? $this->module->mbvardefs->fields[$_REQUEST['dropdown_name']]: array();
|
||||
$this->module->mblanguage->generateAppStrings(false) ;
|
||||
$my_list_strings = array_merge( $my_list_strings, $this->module->mblanguage->appListStrings[$selected_lang.'.lang.php'] );
|
||||
}
|
||||
|
||||
foreach($my_list_strings as $key=>$value){
|
||||
if(!is_array($value)){
|
||||
unset($my_list_strings[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$dropdowns = array_keys($my_list_strings);
|
||||
asort($dropdowns);
|
||||
$keys = array_keys($dropdowns);
|
||||
$first_string = $my_list_strings[$dropdowns[$keys[0]]];
|
||||
if(!empty($cf))$smarty->assign('cf', $cf);
|
||||
|
||||
$name = '';
|
||||
$selected_dropdown = array();
|
||||
|
||||
$smarty = new Sugar_Smarty();
|
||||
$json = getJSONobj();
|
||||
|
||||
if(!empty($_REQUEST['dropdown_name']) && !$new){
|
||||
$name = $_REQUEST['dropdown_name'];
|
||||
|
||||
// handle the case where we've saved a dropdown in one language, and now attempt to edit it for another language. The $name exists, but $my_list_strings[$name] doesn't
|
||||
// for now, we just treat it as if it was new. A better approach might be to use the first language version as a template for future languages
|
||||
if (!isset($my_list_strings[$name]))
|
||||
$my_list_strings[$name] = array () ;
|
||||
|
||||
$selected_dropdown = (!empty($vardef['options']) && !empty($my_list_strings[$vardef['options']])) ? $my_list_strings[$vardef['options']] : $my_list_strings[$name];
|
||||
$smarty->assign('ul_list', 'list = '.$json->encode(array_keys($selected_dropdown)));
|
||||
$smarty->assign('dropdown_name', (!empty($vardef['options']) ? $vardef['options'] : $_REQUEST['dropdown_name']));
|
||||
$smarty->assign('name', $_REQUEST['dropdown_name']);
|
||||
$smarty->assign('options', $selected_dropdown);
|
||||
}else{
|
||||
$smarty->assign('ul_list', 'list = {}');
|
||||
//we should try to find a name for this dropdown based on the field name.
|
||||
$pre_pop_name = '';
|
||||
if(!empty($_REQUEST['field']))
|
||||
$pre_pop_name = $_REQUEST['field'];
|
||||
//ensure this dropdown name does not already exist
|
||||
$use_name = $pre_pop_name.'_list';
|
||||
for($i = 0; $i < 100; $i++){
|
||||
if(empty($my_list_strings[$use_name]))
|
||||
break;
|
||||
else
|
||||
$use_name = $pre_pop_name.'_'.$i;
|
||||
}
|
||||
$smarty->assign('prepopulated_name', $use_name);
|
||||
}
|
||||
|
||||
$smarty->assign('module', $this->module);
|
||||
$smarty->assign('APP', $GLOBALS['app_strings']);
|
||||
$smarty->assign('MOD', $GLOBALS['mod_strings']);
|
||||
$smarty->assign('selected_lang', $selected_lang);
|
||||
$smarty->assign('available_languages',get_languages());
|
||||
$smarty->assign('package_name', $package_name);
|
||||
return $smarty;
|
||||
}
|
||||
}
|
||||
82
modules/ModuleBuilder/views/view.dropdowns.php
Executable file
82
modules/ModuleBuilder/views/view.dropdowns.php
Executable file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
|
||||
class ViewDropdowns extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
$ajax = new AjaxCompose();
|
||||
$smarty = new Sugar_Smarty();
|
||||
|
||||
if (isset($_REQUEST['refreshTree']))
|
||||
{
|
||||
require_once ('modules/ModuleBuilder/Module/DropDownTree.php');
|
||||
$mbt = new DropDownTree();
|
||||
$ajax->addSection('west', $mbt->getName(), $mbt->fetchNodes());
|
||||
$smarty->assign('refreshTree',true);
|
||||
}
|
||||
|
||||
global $mod_strings;
|
||||
$ajax->addCrumb($mod_strings['LBL_DROPDOWNEDITOR'], 'ModuleBuilder.main("dropdowns")');
|
||||
|
||||
require_once('modules/ModuleBuilder/Module/DropDownBrowser.php');
|
||||
$dd = new DropDownBrowser();
|
||||
|
||||
$smarty->assign('LBL_BTN_ADDDROPDOWN',translate('LBL_BTN_ADDDROPDOWN'));
|
||||
$smarty->assign('dropdowns', $dd->getNodes());
|
||||
$smarty->assign('deleteImage', SugarThemeRegistry::current()->getImage( 'delete_inline', ''));
|
||||
$smarty->assign('editImage', SugarThemeRegistry::current()->getImage( 'edit_inline', ''));
|
||||
$smarty->assign('action', 'savedropdown');
|
||||
|
||||
|
||||
$ajax->addSection('center', $GLOBALS['mod_strings']['LBL_DROPDOWNEDITOR'], $smarty->fetch('modules/ModuleBuilder/tpls/MBModule/dropdowns.tpl') );
|
||||
echo $ajax->getJavascript();
|
||||
}
|
||||
}
|
||||
75
modules/ModuleBuilder/views/view.exportcustomizations.php
Executable file
75
modules/ModuleBuilder/views/view.exportcustomizations.php
Executable file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
class ViewExportcustomizations extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
global $current_user, $mod_strings;
|
||||
$smarty = new Sugar_Smarty();
|
||||
$mb = new MBPackage("packageCustom");
|
||||
$mod=$mb->getCustomModules();
|
||||
foreach($mod as $key => $value){
|
||||
$modules[]=$key;
|
||||
$custom[]=$value;
|
||||
}
|
||||
$nb_mod = count($modules);
|
||||
$smarty->assign('mod_strings', $mod_strings);
|
||||
$smarty->assign('modules', $mod);
|
||||
$smarty->assign('custom', $custom);
|
||||
$smarty->assign('nb_mod', $nb_mod);
|
||||
$smarty->assign('defaultHelp', 'exportHelp');
|
||||
$smarty->assign('moduleList',$GLOBALS['app_list_strings']['moduleList']);
|
||||
$smarty->assign('moduleList',$GLOBALS['app_list_strings']['moduleList']);
|
||||
$ajax = new AjaxCompose();
|
||||
$ajax->addCrumb($mod_strings['LBL_STUDIO'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")');
|
||||
$ajax->addSection('center', $mod_strings['LBL_EC_TITLE'],$smarty->fetch('modules/ModuleBuilder/tpls/exportcustomizations.tpl'));
|
||||
echo $ajax->getJavascript();
|
||||
}
|
||||
}
|
||||
182
modules/ModuleBuilder/views/view.history.php
Executable file
182
modules/ModuleBuilder/views/view.history.php
Executable file
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once ('modules/ModuleBuilder/MB/AjaxCompose.php') ;
|
||||
require_once ('modules/ModuleBuilder/parsers/views/History.php') ;
|
||||
require_once ('modules/ModuleBuilder/parsers/ParserFactory.php') ;
|
||||
|
||||
class ViewHistory extends SugarView
|
||||
{
|
||||
var $pageSize = 10 ;
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display ()
|
||||
{
|
||||
$this->layout = strtolower ( $_REQUEST [ 'view' ] ) ;
|
||||
|
||||
$subpanelName = null ;
|
||||
if ((strtolower ( $this->layout ) == 'listview') && (!empty ( $_REQUEST [ 'subpanel' ] )))
|
||||
{
|
||||
$subpanelName = $_REQUEST [ 'subpanel' ] ;
|
||||
|
||||
}
|
||||
|
||||
$packageName = (isset ( $_REQUEST [ 'view_package' ] ) && (strtolower ( $_REQUEST [ 'view_package' ] ) != 'studio')) ? $_REQUEST [ 'view_package' ] : null ;
|
||||
$this->module = $_REQUEST [ 'view_module' ] ;
|
||||
|
||||
$this->parser = ParserFactory::getParser ( $this->layout, $this->module, $packageName, $subpanelName ) ;
|
||||
$this->history = $this->parser->getHistory () ;
|
||||
$action = ! empty ( $_REQUEST [ 'histAction' ] ) ? $_REQUEST [ 'histAction' ] : 'browse' ;
|
||||
$GLOBALS['log']->debug( get_class($this)."->display(): performing History action {$action}" ) ;
|
||||
$this->$action () ;
|
||||
}
|
||||
|
||||
function browse ()
|
||||
{
|
||||
$smarty = new Sugar_Smarty ( ) ;
|
||||
global $mod_strings ;
|
||||
$smarty->assign ( 'mod_strings', $mod_strings ) ;
|
||||
$smarty->assign ( 'view_module', $this->module ) ;
|
||||
$smarty->assign ( 'view', $this->layout ) ;
|
||||
|
||||
if (! empty ( $_REQUEST [ 'subpanel' ] ))
|
||||
{
|
||||
$smarty->assign ( 'subpanel', $_REQUEST [ 'subpanel' ] ) ;
|
||||
}
|
||||
$stamps = array ( ) ;
|
||||
global $timedate ;
|
||||
$userFormat = $timedate->get_date_time_format () ;
|
||||
$page = ! empty ( $_REQUEST [ 'page' ] ) ? $_REQUEST [ 'page' ] : 0 ;
|
||||
$count = $this->history->getCount();
|
||||
$ts = $this->history->getNth ( $page * $this->pageSize ) ;
|
||||
$snapshots = array ( ) ;
|
||||
for ( $i = 0 ; $i <= $this->pageSize && $ts > 0 ; $i ++ )
|
||||
{
|
||||
$dbDate = gmdate ( $timedate->get_db_date_time_format (), $ts ) ;
|
||||
$displayTS = $timedate->to_display_date_time ( $dbDate ) ;
|
||||
if ($page * $this->pageSize + $i + 1 == $count)
|
||||
$displayTS = translate("LBL_MB_DEFAULT_LAYOUT");
|
||||
$snapshots [ $ts ] = $displayTS ;
|
||||
$ts = $this->history->getNext () ;
|
||||
}
|
||||
if (count ( $snapshots ) > $this->pageSize)
|
||||
{
|
||||
$smarty->assign ( 'nextPage', true ) ;
|
||||
}
|
||||
$snapshots = array_slice ( $snapshots, 0, $this->pageSize, true ) ;
|
||||
$smarty->assign ( 'currentPage', $page ) ;
|
||||
$smarty->assign ( 'snapshots', $snapshots ) ;
|
||||
|
||||
$html = $smarty->fetch ( 'modules/ModuleBuilder/tpls/history.tpl' ) ;
|
||||
echo $html ;
|
||||
}
|
||||
|
||||
function preview ()
|
||||
{
|
||||
global $mod_strings ;
|
||||
if (! isset ( $_REQUEST [ 'sid' ] ))
|
||||
{
|
||||
die ( 'SID Required' ) ;
|
||||
}
|
||||
$sid = $_REQUEST [ 'sid' ] ;
|
||||
$subpanel = '';
|
||||
if (! empty ( $_REQUEST [ 'subpanel' ] ))
|
||||
{
|
||||
$subpanel = ',"' . $_REQUEST [ 'subpanel' ] . '"' ;
|
||||
}
|
||||
echo "<input type='button' name='close$sid' value='". translate ( 'LBL_BTN_CLOSE' )."' " .
|
||||
"class='button' onclick='ModuleBuilder.tabPanel.removeTab(ModuleBuilder.tabPanel.get(\"activeTab\"));' style='margin:5px;'>" .
|
||||
"<input type='button' name='restore$sid' value='" . translate ( 'LBL_MB_RESTORE' ) . "' " .
|
||||
"class='button' onclick='ModuleBuilder.history.revert(\"$this->module\",\"{$this->layout}\",\"$sid\"$subpanel);' style='margin:5px;'>" ;
|
||||
$this->history->restoreByTimestamp ( $sid ) ;
|
||||
$view ;
|
||||
if ($this->layout == 'listview')
|
||||
{
|
||||
require_once ("modules/ModuleBuilder/views/view.listview.php") ;
|
||||
$view = new ViewListView ( ) ;
|
||||
} else if ($this->layout == 'basic_search' || $this->layout == 'advanced_search')
|
||||
{
|
||||
require_once ("modules/ModuleBuilder/views/view.searchview.php") ;
|
||||
$view = new ViewSearchView ( ) ;
|
||||
} else if ($this->layout == 'dashlet' || $this->layout == 'dashletsearch')
|
||||
{
|
||||
require_once ("modules/ModuleBuilder/views/view.dashlet.php") ;
|
||||
$view = new ViewDashlet ( ) ;
|
||||
} else if ($this->layout == 'popuplist' || $this->layout == 'popupsearch')
|
||||
{
|
||||
require_once ("modules/ModuleBuilder/views/view.popupview.php") ;
|
||||
$view = new ViewPopupview ( ) ;
|
||||
} else
|
||||
{
|
||||
require_once ("modules/ModuleBuilder/views/view.layoutview.php") ;
|
||||
$view = new ViewLayoutView ( ) ;
|
||||
}
|
||||
|
||||
$view->display ( true ) ;
|
||||
$this->history->undoRestore () ;
|
||||
}
|
||||
|
||||
function restore ()
|
||||
{
|
||||
if (! isset ( $_REQUEST [ 'sid' ] ))
|
||||
{
|
||||
die ( 'SID Required' ) ;
|
||||
}
|
||||
$sid = $_REQUEST [ 'sid' ] ;
|
||||
$this->history->restoreByTimestamp ( $sid ) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores a layout to its current customized state.
|
||||
* Called when leaving a restored layout without saving.
|
||||
*/
|
||||
function unrestore()
|
||||
{
|
||||
$this->history->undoRestore () ;
|
||||
}
|
||||
}
|
||||
86
modules/ModuleBuilder/views/view.home.php
Executable file
86
modules/ModuleBuilder/views/view.home.php
Executable file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
class ViewHome extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
global $current_user;
|
||||
global $mod_strings;
|
||||
$smarty = new Sugar_Smarty();
|
||||
$smarty->assign('title' , $mod_strings['LBL_DEVELOPER_TOOLS']);
|
||||
$smarty->assign('question', $mod_strings['LBL_QUESTION_EDITOR']);
|
||||
$smarty->assign('defaultHelp', 'mainHelp');
|
||||
$this->generateHomeButtons();
|
||||
$smarty->assign('buttons', $this->buttons);
|
||||
$assistant=array('group'=>'main', 'key'=>'welcome');
|
||||
$smarty->assign('assistant',$assistant);
|
||||
//initialize Assistant's display property.
|
||||
$userPref = $current_user->getPreference('mb_assist', 'Assistant');
|
||||
if(!$userPref) $userPref="na";
|
||||
$smarty->assign('userPref',$userPref);
|
||||
$ajax = new AjaxCompose();
|
||||
$ajax->addSection('center', $mod_strings['LBL_HOME'],$smarty->fetch('modules/ModuleBuilder/tpls/wizard.tpl'));
|
||||
echo $ajax->getJavascript();
|
||||
}
|
||||
|
||||
|
||||
function generateHomeButtons()
|
||||
{
|
||||
global $current_user;
|
||||
if(displayStudioForCurrentUser() == true) {
|
||||
//$this->buttons['Application'] = array ('action' => '', 'imageTitle' => 'Application', 'size' => '128', 'help'=>'appBtn');
|
||||
$this->buttons[$GLOBALS['mod_strings']['LBL_STUDIO']] = array ('action' => 'javascript:ModuleBuilder.main("studio")', 'imageTitle' => 'Studio', 'size' => '128', 'help'=>'studioBtn');
|
||||
}
|
||||
if(is_admin($current_user)) {
|
||||
$this->buttons[$GLOBALS['mod_strings']['LBL_MODULEBUILDER']] = array ('action' => 'javascript:ModuleBuilder.main("mb")', 'imageTitle' => 'ModuleBuilder', 'size' => '128', 'help'=>'mbBtn');
|
||||
}
|
||||
$this->buttons[$GLOBALS['mod_strings']['LBL_DROPDOWNEDITOR']] = array ('action' => 'javascript:ModuleBuilder.main("dropdowns")', 'imageTitle' => $GLOBALS['mod_strings']['LBL_HOME_EDIT_DROPDOWNS'], 'imageName' => 'DropDownEditor', 'size' => '128', 'help'=>'dropDownEditorBtn');
|
||||
}
|
||||
}
|
||||
180
modules/ModuleBuilder/views/view.labels.php
Executable file
180
modules/ModuleBuilder/views/view.labels.php
Executable file
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*
|
||||
* Created on Jul 24, 2007
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
||||
*/
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
require_once('modules/ModuleBuilder/views/view.modulefields.php');
|
||||
class ViewLabels extends ViewModulefields
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
//STUDIO LABELS ONLY//
|
||||
//TODO Bundle Studio and ModuleBuilder label handling to increase maintainability.
|
||||
function display()
|
||||
{
|
||||
$editModule = $_REQUEST['view_module'];
|
||||
if (!isset($_REQUEST['MB']))
|
||||
{
|
||||
global $app_list_strings;
|
||||
$moduleNames = array_change_key_case($app_list_strings['moduleList']);
|
||||
$translatedEditModule = $moduleNames[strtolower($editModule)];
|
||||
}
|
||||
$selected_lang = (!empty($_REQUEST['selected_lang'])? $_REQUEST['selected_lang']:$_SESSION['authenticated_user_language']);
|
||||
if(empty($selected_lang)){
|
||||
$selected_lang = $GLOBALS['sugar_config']['default_language'];
|
||||
}
|
||||
|
||||
$smarty = new Sugar_Smarty();
|
||||
global $mod_strings;
|
||||
$smarty->assign('mod_strings', $mod_strings);
|
||||
$smarty->assign('available_languages',get_languages());
|
||||
|
||||
|
||||
global $beanList;
|
||||
$objectName = $beanList[$editModule];
|
||||
if($objectName == 'aCase') {
|
||||
$objectName = 'Case';
|
||||
}
|
||||
|
||||
VardefManager::loadVardef($editModule, $objectName);
|
||||
global $dictionary;
|
||||
$vnames = array();
|
||||
//jchi 24557 . We should list all the lables in viewdefs(list,detail,edit,quickcreate) that the user can edit them.
|
||||
require_once 'modules/ModuleBuilder/parsers/views/ListLayoutMetaDataParser.php' ;
|
||||
$parser = new ListLayoutMetaDataParser ( MB_LISTVIEW, $editModule ) ;
|
||||
foreach ( $parser->getLayout() as $key => $def )
|
||||
{
|
||||
if(isset($def['label']) ) {
|
||||
$vnames[$def['label']] = $def['label'];
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'modules/ModuleBuilder/parsers/views/GridLayoutMetaDataParser.php' ;
|
||||
$variableMap = array ( MB_EDITVIEW => 'EditView' , MB_DETAILVIEW => 'DetailView' , MB_QUICKCREATE => 'QuickCreate' ) ;
|
||||
if($editModule == 'KBDocuments'){
|
||||
$variableMap = array();
|
||||
}
|
||||
foreach($variableMap as $key => $value){
|
||||
$gridLayoutMetaDataParserTemp = new GridLayoutMetaDataParser ( $value, $editModule) ;
|
||||
foreach ( $gridLayoutMetaDataParserTemp->getLayout() as $panel)
|
||||
{
|
||||
foreach ( $panel as $row )
|
||||
{
|
||||
foreach ( $row as $fieldArray )
|
||||
{ // fieldArray is an array('name'=>name,'label'=>label)
|
||||
if (isset ( $fieldArray [ 'label' ] ))
|
||||
{
|
||||
$vnames[$fieldArray [ 'label' ] ] = $fieldArray [ 'label' ] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//end
|
||||
|
||||
//Get Subpanel Labels:
|
||||
require_once ('include/SubPanel/SubPanel.php') ;
|
||||
$subList = SubPanel::getModuleSubpanels ( $editModule );
|
||||
foreach($subList as $subpanel => $titleLabel) {
|
||||
$vnames[$titleLabel] = $titleLabel;
|
||||
}
|
||||
|
||||
foreach($dictionary[$objectName]['fields'] as $name=>$def) {
|
||||
if(isset($def['vname'])) {
|
||||
$vnames[$def['vname']] = $def['vname'];
|
||||
}
|
||||
}
|
||||
$formatted_mod_strings = array();
|
||||
|
||||
//we shouldn't set the $refresh=true here, or will lost template language mod_strings.
|
||||
//return_module_language($selected_lang, $editModule,false) : the mod_strings will be included from cache files here.
|
||||
foreach(return_module_language($selected_lang, $editModule,false) as $name=>$label) {
|
||||
//#25294
|
||||
if(isset($vnames[$name]) || preg_match( '/lbl_city|lbl_country|lbl_billing_address|lbl_alt_address|lbl_shipping_address|lbl_postal_code|lbl_state$/si' , $name)) {
|
||||
$formatted_mod_strings[$name] = htmlentities($label, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
}
|
||||
//Grab everything from the custom files
|
||||
$mod_bak = $mod_strings;
|
||||
$files = array(
|
||||
"custom/modules/$editModule/language/$selected_lang.lang.php",
|
||||
"custom/modules/$editModule/Ext/Language/$selected_lang.lang.ext.php"
|
||||
);
|
||||
foreach($files as $langfile){
|
||||
$mod_strings = array();
|
||||
if (is_file($langfile))
|
||||
{
|
||||
include($langfile);
|
||||
foreach($mod_strings as $key => $label)
|
||||
{
|
||||
$formatted_mod_strings[$key] = htmlentities($label, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
}
|
||||
}
|
||||
$mod_strings = $mod_bak;
|
||||
ksort($formatted_mod_strings);
|
||||
$smarty->assign('MOD', $formatted_mod_strings);
|
||||
$smarty->assign('view_module', $editModule);
|
||||
$smarty->assign('APP', $GLOBALS['app_strings']);
|
||||
$smarty->assign('selected_lang', $selected_lang);
|
||||
$smarty->assign('defaultHelp', 'labelsBtn');
|
||||
$smarty->assign('assistant', array('key'=>'labels', 'group'=>'module'));
|
||||
|
||||
$ajax = new AjaxCompose();
|
||||
$ajax->addCrumb($mod_strings['LBL_STUDIO'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")');
|
||||
$ajax->addCrumb($translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module='.$editModule.'")');
|
||||
$ajax->addCrumb($mod_strings['LBL_LABELS'], '');
|
||||
|
||||
$html = $smarty->fetch('modules/ModuleBuilder/tpls/labels.tpl');
|
||||
$ajax->addSection('center', $GLOBALS['mod_strings']['LBL_SECTION_EDLABELS'], $html);
|
||||
echo $ajax->getJavascript();
|
||||
}
|
||||
}
|
||||
222
modules/ModuleBuilder/views/view.layoutview.php
Executable file
222
modules/ModuleBuilder/views/view.layoutview.php
Executable file
@@ -0,0 +1,222 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' ) ;
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: This file is used to override the default Meta-data EditView behavior
|
||||
* to provide customization specific to the Calls module.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
require_once ('include/MVC/View/views/view.edit.php') ;
|
||||
require_once ('modules/ModuleBuilder/parsers/ParserFactory.php') ;
|
||||
require_once ('modules/ModuleBuilder/MB/AjaxCompose.php') ;
|
||||
require_once 'modules/ModuleBuilder/parsers/constants.php' ;
|
||||
|
||||
//require_once('include/Utils.php');
|
||||
|
||||
|
||||
class ViewLayoutView extends ViewEdit
|
||||
{
|
||||
function ViewLayoutView ()
|
||||
{
|
||||
$GLOBALS [ 'log' ]->debug ( 'in ViewLayoutView' ) ;
|
||||
$this->editModule = $_REQUEST [ 'view_module' ] ;
|
||||
$this->editLayout = $_REQUEST [ 'view' ] ;
|
||||
$this->package = null;
|
||||
$this->fromModuleBuilder = isset ( $_REQUEST [ 'MB' ] ) || !empty($_REQUEST [ 'view_package' ]);
|
||||
if ($this->fromModuleBuilder)
|
||||
{
|
||||
$this->package = $_REQUEST [ 'view_package' ] ;
|
||||
} else
|
||||
{
|
||||
global $app_list_strings ;
|
||||
$moduleNames = array_change_key_case ( $app_list_strings [ 'moduleList' ] ) ;
|
||||
$this->translatedEditModule = $moduleNames [ strtolower ( $this->editModule ) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
// DO NOT REMOVE - overrides parent ViewEdit preDisplay() which attempts to load a bean for a non-existent module
|
||||
function preDisplay ()
|
||||
{
|
||||
}
|
||||
|
||||
function display ($preview = false)
|
||||
{
|
||||
|
||||
global $mod_strings ;
|
||||
$parser = ParserFactory::getParser($this->editLayout,$this->editModule,$this->package);
|
||||
$history = $parser->getHistory () ;
|
||||
$smarty = new Sugar_Smarty ( ) ;
|
||||
//Add in the module we are viewing to our current mod strings
|
||||
if (! $this->fromModuleBuilder) {
|
||||
global $current_language;
|
||||
$editModStrings = return_module_language($current_language, $this->editModule);
|
||||
$mod_strings = sugarArrayMerge($editModStrings, $mod_strings);
|
||||
}
|
||||
$smarty->assign('mod', $mod_strings);
|
||||
$smarty->assign('MOD', $mod_strings);
|
||||
// assign buttons
|
||||
$images = array ( 'icon_save' => 'studio_save' , 'icon_publish' => 'studio_publish' , 'icon_address' => 'icon_Address' , 'icon_emailaddress' => 'icon_EmailAddress' , 'icon_phone' => 'icon_Phone' ) ;
|
||||
foreach ( $images as $image => $file )
|
||||
{
|
||||
$smarty->assign ( $image, SugarThemeRegistry::current()->getImage($file) ) ;
|
||||
}
|
||||
|
||||
$requiredFields = implode($parser->getRequiredFields () , ',');
|
||||
$slashedRequiredFields = addslashes($requiredFields);
|
||||
$buttons = array ( ) ;
|
||||
|
||||
if ($preview)
|
||||
{
|
||||
$smarty->assign ( 'layouttitle', translate ( 'LBL_LAYOUT_PREVIEW', 'ModuleBuilder' ) ) ;
|
||||
} else
|
||||
{
|
||||
$smarty->assign ( 'layouttitle', translate ( 'LBL_CURRENT_LAYOUT', 'ModuleBuilder' ) ) ;
|
||||
if (! $this->fromModuleBuilder)
|
||||
{
|
||||
$buttons [] = array ( 'id' => 'saveBtn' , 'text' => translate ( 'LBL_BTN_SAVE' ) , 'actionScript' => "onclick='if(Studio2.checkGridLayout()) Studio2.handleSave();'" ) ;
|
||||
$buttons [] = array ( 'id' => 'publishBtn' , 'text' => translate ( 'LBL_BTN_SAVEPUBLISH' ) , 'actionScript' => "onclick='if(Studio2.checkGridLayout()) Studio2.handlePublish();'" ) ;
|
||||
$buttons [] = array ( 'id' => 'spacer' , 'width' => '50px' ) ;
|
||||
$buttons [] = array ( 'id' => 'historyBtn' , 'text' => translate ( 'LBL_HISTORY' ) , 'actionScript' => "onclick='ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")'") ;
|
||||
$buttons [] = array ( 'id' => 'historyDefault' , 'text' => translate ( 'LBL_RESTORE_DEFAULT' ) , 'actionScript' => "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'" ) ;
|
||||
} else
|
||||
{
|
||||
$buttons [] = array ( 'id' => 'saveBtn' , 'text' => $GLOBALS [ 'mod_strings' ] [ 'LBL_BTN_SAVE' ] , 'actionScript' => "onclick='if(Studio2.checkGridLayout()) Studio2.handlePublish();'" ) ;
|
||||
$buttons [] = array ( 'id' => 'spacer' , 'width' => '50px' ) ;
|
||||
$buttons [] = array ( 'id' => 'historyBtn' , 'text' => translate ( 'LBL_HISTORY' ) , 'actionScript' => "onclick='ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")'" ) ;
|
||||
$buttons [] = array ( 'id' => 'historyDefault' , 'text' => translate ( 'LBL_RESTORE_DEFAULT' ) , 'actionScript' => "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'" ) ;
|
||||
}
|
||||
}
|
||||
|
||||
$html = "" ;
|
||||
foreach ( $buttons as $button )
|
||||
{
|
||||
if ($button['id'] == "spacer") {
|
||||
$html .= "<td style='width:{$button['width']}'> </td>";
|
||||
} else {
|
||||
$html .= "<td><input id='{$button['id']}' type='button' valign='center' class='button' style='cursor:pointer' "
|
||||
. "onmousedown='this.className=\"buttonOn\";return false;' onmouseup='this.className=\"button\"' "
|
||||
. "onmouseout='this.className=\"button\"' {$button['actionScript']} value = '{$button['text']}' ></td>" ;
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign ( 'buttons', $html ) ;
|
||||
|
||||
// assign fields and layout
|
||||
$smarty->assign ( 'available_fields', $parser->getAvailableFields () ) ;
|
||||
$smarty->assign ( 'required_fields', $requiredFields) ;
|
||||
$smarty->assign ( 'layout', $parser->getLayout () ) ;
|
||||
$smarty->assign ( 'view_module', $this->editModule ) ;
|
||||
$smarty->assign ( 'view', $this->editLayout ) ;
|
||||
$smarty->assign ( 'maxColumns', $parser->getMaxColumns() ) ;
|
||||
$smarty->assign ( 'nextPanelId', $parser->getFirstNewPanelId() ) ;
|
||||
$smarty->assign ( 'displayAsTabs', $parser->getUseTabs() ) ;
|
||||
$smarty->assign ( 'fieldwidth', 150 ) ;
|
||||
$smarty->assign ( 'translate', $this->fromModuleBuilder ? false : true ) ;
|
||||
|
||||
if ($this->fromModuleBuilder)
|
||||
{
|
||||
$smarty->assign ( 'fromModuleBuilder', $this->fromModuleBuilder ) ;
|
||||
$smarty->assign ( 'view_package', $this->package ) ;
|
||||
}
|
||||
|
||||
$labels = array (
|
||||
MB_EDITVIEW => 'LBL_EDITVIEW' ,
|
||||
MB_DETAILVIEW => 'LBL_DETAILVIEW' ,
|
||||
MB_QUICKCREATE => 'LBL_QUICKCREATE',
|
||||
) ;
|
||||
|
||||
$layoutLabel = 'LBL_LAYOUTS' ;
|
||||
$layoutView = 'layouts' ;
|
||||
|
||||
|
||||
$ajax = new AjaxCompose ( ) ;
|
||||
$viewType;
|
||||
|
||||
$translatedViewType = '' ;
|
||||
if ( isset ( $labels [ strtolower ( $this->editLayout ) ] ) )
|
||||
$translatedViewType = translate ( $labels [ strtolower( $this->editLayout ) ] , 'ModuleBuilder' ) ;
|
||||
|
||||
if ($this->fromModuleBuilder)
|
||||
{
|
||||
$ajax->addCrumb ( translate ( 'LBL_MODULEBUILDER', 'ModuleBuilder' ), 'ModuleBuilder.main("mb")' ) ;
|
||||
$ajax->addCrumb ( $this->package, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $this->package . '")' ) ;
|
||||
$ajax->addCrumb ( $this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $this->package . '&view_module=' . $this->editModule . '")' ) ;
|
||||
$ajax->addCrumb ( translate ( $layoutLabel, 'ModuleBuilder' ), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view='.$layoutView.'&view_module=' . $this->editModule . '&view_package=' . $this->package . '")' ) ;
|
||||
$ajax->addCrumb ( $translatedViewType, '' ) ;
|
||||
} else
|
||||
{
|
||||
$ajax->addCrumb ( translate ( 'LBL_STUDIO', 'ModuleBuilder' ), 'ModuleBuilder.main("studio")' ) ;
|
||||
$ajax->addCrumb ( $this->translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $this->editModule . '")' ) ;
|
||||
$ajax->addCrumb ( translate ( $layoutLabel, 'ModuleBuilder' ), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view='.$layoutView.'&view_module=' . $this->editModule . '")' ) ;
|
||||
$ajax->addCrumb ( $translatedViewType, '' ) ;
|
||||
}
|
||||
|
||||
// set up language files
|
||||
$smarty->assign ( 'language', $parser->getLanguage() ) ; // for sugar_translate in the smarty template
|
||||
$smarty->assign('from_mb',$this->fromModuleBuilder);
|
||||
if ($this->fromModuleBuilder) {
|
||||
$mb = new ModuleBuilder ( ) ;
|
||||
$module = & $mb->getPackageModule ( $this->package, $this->editModule ) ;
|
||||
$smarty->assign('current_mod_strings', $module->getModStrings());
|
||||
}
|
||||
|
||||
$ajax->addSection ( 'center', $translatedViewType, $smarty->fetch ( 'modules/ModuleBuilder/tpls/layoutView.tpl' ) ) ;
|
||||
if ($preview) {
|
||||
echo $smarty->fetch ( 'modules/ModuleBuilder/tpls/Preview/layoutView.tpl' );
|
||||
} else {
|
||||
echo $ajax->getJavascript () ;
|
||||
}
|
||||
}
|
||||
}
|
||||
340
modules/ModuleBuilder/views/view.listview.php
Executable file
340
modules/ModuleBuilder/views/view.listview.php
Executable file
@@ -0,0 +1,340 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' ) ;
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once ('include/MVC/View/views/view.edit.php') ;
|
||||
|
||||
require_once 'modules/ModuleBuilder/parsers/constants.php' ;
|
||||
require_once ('include/SubPanel/SubPanel.php') ;
|
||||
|
||||
class ViewListView extends ViewEdit
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* Pseudo-constructor to enable subclasses to call a parent's constructor without knowing the parent in PHP4
|
||||
*/
|
||||
function init ()
|
||||
{
|
||||
$this->editModule = $_REQUEST [ 'view_module' ] ;
|
||||
$this->editLayout = $_REQUEST [ 'view' ] ;
|
||||
$this->subpanel = (! empty ( $_REQUEST [ 'subpanel' ] )) ? $_REQUEST [ 'subpanel' ] : false ;
|
||||
$this->subpanelLabel = (! empty ( $_REQUEST [ 'subpanelLabel' ] )) ? $_REQUEST [ 'subpanelLabel' ] : false ;
|
||||
|
||||
$this->fromModuleBuilder = ! empty ( $_REQUEST [ 'view_package' ] ) ;
|
||||
if (! $this->fromModuleBuilder)
|
||||
{
|
||||
$moduleNames = array_change_key_case ( $GLOBALS['app_list_strings'] [ 'moduleList' ] ) ;
|
||||
$this->translatedEditModule = $moduleNames [ strtolower ( $this->editModule ) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
// DO NOT REMOVE - overrides parent ViewEdit preDisplay() which attempts to load a bean for a non-existent module
|
||||
function preDisplay ()
|
||||
{
|
||||
}
|
||||
|
||||
function display ($preview = false)
|
||||
{
|
||||
|
||||
$packageName = (! empty ( $_REQUEST [ 'view_package' ] )) ? $_REQUEST [ 'view_package' ] : null ;
|
||||
$subpanelName = (! empty ( $_REQUEST [ 'subpanel' ] )) ? $_REQUEST [ 'subpanel' ] : null ;
|
||||
require_once 'modules/ModuleBuilder/parsers/ParserFactory.php' ;
|
||||
$parser = ParserFactory::getParser ( $this->editLayout , $this->editModule , $packageName, $subpanelName ) ;
|
||||
$smarty = $this->constructSmarty ( $parser ) ;
|
||||
|
||||
if ($preview)
|
||||
{
|
||||
echo $smarty->fetch ( "modules/ModuleBuilder/tpls/Preview/listView.tpl" ) ;
|
||||
} else
|
||||
{
|
||||
$ajax = $this->constructAjax () ;
|
||||
$ajax->addSection ( 'center', $this->translatedViewType, $smarty->fetch ( "modules/ModuleBuilder/tpls/listView.tpl" ) ) ;
|
||||
|
||||
echo $ajax->getJavascript () ;
|
||||
}
|
||||
}
|
||||
|
||||
function constructAjax ()
|
||||
{
|
||||
require_once ('modules/ModuleBuilder/MB/AjaxCompose.php') ;
|
||||
$ajax = new AjaxCompose ( ) ;
|
||||
|
||||
$layoutLabel = 'LBL_LAYOUTS' ;
|
||||
$layoutView = 'layouts' ;
|
||||
|
||||
|
||||
$labels = array (
|
||||
MB_LISTVIEW => 'LBL_LISTVIEW' ,
|
||||
) ;
|
||||
$translatedViewType = '' ;
|
||||
if ( isset ( $labels [ strtolower ( $this->editLayout ) ] ) )
|
||||
$translatedViewType = translate ( $labels [ strtolower( $this->editLayout ) ] , 'ModuleBuilder' ) ;
|
||||
$this->translatedViewType = $translatedViewType;
|
||||
|
||||
if ($this->fromModuleBuilder)
|
||||
{
|
||||
$ajax->addCrumb ( translate ( 'LBL_MODULEBUILDER', 'ModuleBuilder' ), 'ModuleBuilder.main("mb")' ) ;
|
||||
$ajax->addCrumb ( $_REQUEST [ 'view_package' ], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $_REQUEST [ 'view_package' ] . '")' ) ;
|
||||
$ajax->addCrumb ( $this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $_REQUEST [ 'view_package' ] . '&view_module=' . $_REQUEST [ 'view_module' ] . '")' ) ;
|
||||
if ($this->subpanel != "")
|
||||
{
|
||||
$ajax->addCrumb ( translate ( 'LBL_AVAILABLE_SUBPANELS', 'ModuleBuilder' ), '' ) ;
|
||||
if ($this->subpanelLabel)
|
||||
{
|
||||
$ajax->addCrumb ( $this->subpanelLabel, '' ) ;
|
||||
$this->translatedViewType = $this->subpanelLabel . " " . translate("LBL_SUBPANEL", "ModuleBuilder");
|
||||
} else
|
||||
{
|
||||
$ajax->addCrumb ( $this->subpanel, '' ) ;
|
||||
$this->translatedViewType = translate("LBL_SUBPANEL", "ModuleBuilder");
|
||||
}
|
||||
} else
|
||||
{
|
||||
$ajax->addCrumb ( translate ( $layoutLabel, 'ModuleBuilder' ), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view_module=' . $_REQUEST [ 'view_module' ] . '&view_package=' . $_REQUEST [ 'view_package' ] . '")' ) ;
|
||||
$ajax->addCrumb ( $translatedViewType, '' ) ;
|
||||
}
|
||||
} else
|
||||
{
|
||||
$ajax->addCrumb ( translate ( 'LBL_STUDIO', 'ModuleBuilder' ), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")' ) ;
|
||||
$ajax->addCrumb ( $this->translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $this->editModule . '")' ) ;
|
||||
|
||||
if ($this->subpanel)
|
||||
{
|
||||
$ajax->addCrumb ( translate ( 'LBL_SUBPANELS', 'ModuleBuilder' ), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&subpanels=1&view_module=' . $this->editModule . '")' ) ;
|
||||
if ($this->subpanelLabel)
|
||||
{
|
||||
$ajax->addCrumb ( $this->subpanelLabel, '' ) ;
|
||||
$this->translatedViewType = $this->subpanelLabel . " " . translate("LBL_SUBPANEL", "ModuleBuilder");
|
||||
} else
|
||||
{
|
||||
$ajax->addCrumb ( $this->subpanel, '' ) ;
|
||||
$this->translatedViewType = translate("LBL_SUBPANEL", "ModuleBuilder");
|
||||
}
|
||||
} else
|
||||
{
|
||||
$ajax->addCrumb ( translate ( $layoutLabel, 'ModuleBuilder' ), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view='.$layoutView.'&view_module=' . $this->editModule . '")' ) ;
|
||||
$ajax->addCrumb ( $translatedViewType, '' ) ;
|
||||
}
|
||||
}
|
||||
return $ajax ;
|
||||
}
|
||||
|
||||
function constructSmarty ($parser)
|
||||
{
|
||||
$smarty = new Sugar_Smarty ( ) ;
|
||||
$smarty->assign ( 'translate', true ) ;
|
||||
$smarty->assign ( 'language', $parser->getLanguage () ) ;
|
||||
|
||||
$smarty->assign ( 'view', $this->editLayout ) ;
|
||||
$smarty->assign ( 'module', "ModuleBuilder" ) ;
|
||||
$smarty->assign ( 'action', 'listViewSave' ) ;
|
||||
$smarty->assign ( 'view_module', $this->editModule ) ;
|
||||
if (!empty ( $this->subpanel ) )
|
||||
{
|
||||
$smarty->assign ( 'subpanel', $this->subpanel ) ;
|
||||
if (!$this->fromModuleBuilder) {
|
||||
$subList = SubPanel::getModuleSubpanels ( $this->editModule);
|
||||
$subRef = $subList[strtolower($this->subpanel)];
|
||||
$subTitleKey = empty($subRef) ? $subRef : "LBL_" . strtoupper($this->subpanel) . "_SUBPANEL_TITLE";
|
||||
$subTitle = !empty($subRef) ? translate($subTitleKey, $this->editModule) : UCfirst($this->subpanel);
|
||||
$smarty->assign ( 'subpanel_label', $subTitleKey ) ;
|
||||
$smarty->assign ( 'subpanel_title', $subTitle ) ;
|
||||
}
|
||||
}
|
||||
$helpName = $this->subpanel ? 'subPanelEditor' : 'listViewEditor';
|
||||
$smarty->assign ( 'helpName', $helpName ) ;
|
||||
$smarty->assign ( 'helpDefault', 'modify' ) ;
|
||||
|
||||
$smarty->assign ( 'title', $this->_constructTitle () ) ;
|
||||
$groups = array ( ) ;
|
||||
foreach ( $parser->columns as $column => $function )
|
||||
{
|
||||
// update this so that each field has a properties set
|
||||
// properties are name, value, title (optional)
|
||||
$groups [ $GLOBALS [ 'mod_strings' ] [ $column ] ] = $parser->$function () ; // call the parser functions to populate the list view columns, by default 'default', 'available' and 'hidden'
|
||||
}
|
||||
foreach ( $groups as $groupKey => $group )
|
||||
{
|
||||
foreach ( $group as $fieldKey => $field )
|
||||
{
|
||||
if (isset ( $field [ 'width' ] ))
|
||||
{
|
||||
if (substr ( $field [ 'width' ], - 1, 1 ) == '%')
|
||||
{
|
||||
|
||||
$groups [ $groupKey ] [ $fieldKey ] [ 'width' ] = substr ( $field [ 'width' ], 0, strlen ( $field [ 'width' ] ) - 1 ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign ( 'groups', $groups ) ;
|
||||
$smarty->assign('from_mb', $this->fromModuleBuilder);
|
||||
|
||||
global $image_path ;
|
||||
$imageSave = SugarThemeRegistry::current()->getImage('studio_save') ;
|
||||
// $imageHelp = SugarThemeRegistry::current()->getImage('help') ;
|
||||
|
||||
$history = $parser->getHistory () ;
|
||||
|
||||
$histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")" ;
|
||||
if ($this->subpanel)
|
||||
$histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$this->subpanel}\")" ;
|
||||
|
||||
$restoreAction = "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'";
|
||||
if ($this->subpanel)
|
||||
$restoreAction = "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"{$this->subpanel}\")'";
|
||||
|
||||
$buttons = array ( ) ;
|
||||
$buttons [] = array ( 'id' =>'savebtn', 'name' => 'savebtn' , 'image' => $imageSave , 'text' => (! $this->fromModuleBuilder)?$GLOBALS [ 'mod_strings' ] [ 'LBL_BTN_SAVEPUBLISH' ]: $GLOBALS [ 'mod_strings' ] [ 'LBL_BTN_SAVE' ], 'actionScript' => "onclick='studiotabs.generateGroupForm(\"edittabs\");if (countListFields()==0) ModuleBuilder.layoutValidation.popup() ; else ModuleBuilder.handleSave(\"edittabs\" )'" ) ;
|
||||
$buttons [] = array ( 'id' => 'spacer' , 'width' => '50px' ) ;
|
||||
$buttons [] = array ( 'id' =>'historyBtn', 'name' => 'historyBtn' , 'text' => translate ( 'LBL_HISTORY' ) , 'actionScript' => "onclick='$histaction'" ) ;
|
||||
$buttons [] = array ( 'id' => 'historyDefault' , 'name' => 'historyDefault', 'text' => translate ( 'LBL_RESTORE_DEFAULT' ) , 'actionScript' => $restoreAction ) ;
|
||||
|
||||
$smarty->assign ( 'buttons', $this->_buildImageButtons ( $buttons ) ) ;
|
||||
|
||||
$editImage = SugarThemeRegistry::current()->getImage('edit_inline') ;
|
||||
$smarty->assign ( 'editImage', $editImage ) ;
|
||||
$deleteImage = SugarThemeRegistry::current()->getImage('delete_inline') ;
|
||||
$smarty->assign ( 'deleteImage', $deleteImage ) ;
|
||||
$smarty->assign ( 'MOD', $GLOBALS [ 'mod_strings' ] ) ;
|
||||
|
||||
if ($this->fromModuleBuilder)
|
||||
{
|
||||
$smarty->assign ( 'MB', true ) ;
|
||||
$smarty->assign ( 'view_package', $_REQUEST [ 'view_package' ] ) ;
|
||||
$mb = new ModuleBuilder ( ) ;
|
||||
$module = & $mb->getPackageModule ( $_REQUEST [ 'view_package' ], $this->editModule ) ;
|
||||
$smarty->assign('current_mod_strings', $module->getModStrings());
|
||||
if ($this->subpanel)
|
||||
{
|
||||
if (isset ( $_REQUEST [ 'local' ] ))
|
||||
{
|
||||
$smarty->assign ( 'local', '1' ) ;
|
||||
}
|
||||
$smarty->assign ( "subpanel", $this->subpanel ) ;
|
||||
} else
|
||||
{
|
||||
$smarty->assign ( 'description', $GLOBALS [ 'mod_strings' ] [ 'LBL_LISTVIEW_DESCRIPTION' ] ) ;
|
||||
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
if ($this->subpanel)
|
||||
{
|
||||
$smarty->assign ( "subpanel", "$this->subpanel" ) ;
|
||||
} else
|
||||
{
|
||||
$smarty->assign ( 'description', $GLOBALS [ 'mod_strings' ] [ 'LBL_LISTVIEW_DESCRIPTION' ] ) ;
|
||||
}
|
||||
}
|
||||
|
||||
return $smarty ;
|
||||
}
|
||||
|
||||
function _constructTitle ()
|
||||
|
||||
{
|
||||
|
||||
global $app_list_strings ;
|
||||
|
||||
if ($this->fromModuleBuilder)
|
||||
{
|
||||
$title = $this->editModule ;
|
||||
if ($this->subpanel != "")
|
||||
{
|
||||
$title .= ":$this->subpanel" ;
|
||||
}
|
||||
} else
|
||||
{
|
||||
$title = ($this->subpanel) ? ':' . $this->subpanel : $app_list_strings [ 'moduleList' ] [ $this->editModule ] ;
|
||||
}
|
||||
return $GLOBALS [ 'mod_strings' ] [ 'LBL_LISTVIEW_EDIT' ] . ': ' . $title ;
|
||||
|
||||
}
|
||||
|
||||
function _buildImageButtons ($buttons , $horizontal = true)
|
||||
{
|
||||
$text = '<table cellspacing=2><tr>' ;
|
||||
foreach ( $buttons as $button )
|
||||
{
|
||||
if (empty($button['id'])) {
|
||||
$button['id'] = $button['name'];
|
||||
}
|
||||
if (! $horizontal)
|
||||
{
|
||||
$text .= '</tr><tr>' ;
|
||||
}
|
||||
if ($button['id'] == "spacer") {
|
||||
$text .= "<td style='width:{$button['width']}'> </td>";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! empty ( $button [ 'plain' ] ))
|
||||
{
|
||||
$text .= <<<EOQ
|
||||
<td><input name={$button['name']} id={$button['id']} class="button" type="button" valign='center' {$button['actionScript']}
|
||||
EOQ;
|
||||
|
||||
} else
|
||||
{
|
||||
$text .= <<<EOQ
|
||||
<td><input name={$button['name']} id={$button['id']} class="button" type="button" valign='center' style='cursor:default' {$button['actionScript']}
|
||||
EOQ;
|
||||
}
|
||||
$text .= "value=\"{$button['text']}\"/></td>" ;
|
||||
}
|
||||
$text .= '</tr></table>' ;
|
||||
return $text ;
|
||||
}
|
||||
}
|
||||
119
modules/ModuleBuilder/views/view.main.php
Executable file
119
modules/ModuleBuilder/views/view.main.php
Executable file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
class ViewMain extends SugarView
|
||||
{
|
||||
function ViewMain(){
|
||||
$this->options['show_footer'] = true;
|
||||
parent::SugarView();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
global $app_strings, $current_user, $mod_strings, $theme;
|
||||
|
||||
$smarty = new Sugar_Smarty();
|
||||
$type = (!empty($_REQUEST['type']))?$_REQUEST['type']:'main';
|
||||
$mbt = false;
|
||||
$admin = false;
|
||||
$mb = strtolower($type);
|
||||
$smarty->assign('TYPE', $type);
|
||||
$smarty->assign('app_strings', $app_strings);
|
||||
$smarty->assign('mod', $mod_strings);
|
||||
//Replaced by javascript function "setMode"
|
||||
switch($type){
|
||||
case 'studio':
|
||||
//$smarty->assign('ONLOAD','ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")');
|
||||
require_once('modules/ModuleBuilder/Module/StudioTree.php');
|
||||
$mbt = new StudioTree();
|
||||
break;
|
||||
case 'mb':
|
||||
//$smarty->assign('ONLOAD','ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=")');
|
||||
require_once('modules/ModuleBuilder/MB/MBPackageTree.php');
|
||||
$mbt = new MBPackageTree();
|
||||
break;
|
||||
case 'dropdowns':
|
||||
// $admin = is_admin($current_user);
|
||||
require_once('modules/ModuleBuilder/Module/DropDownTree.php');
|
||||
$mbt = new DropDownTree();
|
||||
break;
|
||||
default:
|
||||
//$smarty->assign('ONLOAD','ModuleBuilder.getContent("module=ModuleBuilder&action=home")');
|
||||
require_once('modules/ModuleBuilder/Module/MainTree.php');
|
||||
$mbt = new MainTree();
|
||||
}
|
||||
$smarty->assign('TEST_STUDIO', displayStudioForCurrentUser());
|
||||
$smarty->assign('ADMIN', is_admin($current_user));
|
||||
$smarty->display('modules/ModuleBuilder/tpls/includes.tpl');
|
||||
if($mbt)
|
||||
{
|
||||
$smarty->assign('TREE',$mbt->fetch());
|
||||
$smarty->assign('TREElabel', $mbt->getName());
|
||||
}
|
||||
$userPref = $current_user->getPreference('mb_assist', 'Assistant');
|
||||
if(!$userPref) $userPref="na";
|
||||
$smarty->assign('userPref',$userPref);
|
||||
|
||||
///////////////////////////////////
|
||||
require_once('include/SugarTinyMCE.php');
|
||||
$tiny = new SugarTinyMCE();
|
||||
$tiny->defaultConfig['width']=300;
|
||||
$tiny->defaultConfig['height']=300;
|
||||
$tiny->buttonConfig = "code,separator,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,
|
||||
justifyfull,separator,forecolor,backcolor,
|
||||
";
|
||||
$tiny->buttonConfig2 = "pastetext,pasteword,fontselect,fontsizeselect,";
|
||||
$tiny->buttonConfig3 = "";
|
||||
$ed = $tiny->getInstance();
|
||||
$smarty->assign("tiny", $ed);
|
||||
|
||||
$smarty->display('modules/ModuleBuilder/tpls/index.tpl');
|
||||
|
||||
}
|
||||
}
|
||||
101
modules/ModuleBuilder/views/view.module.php
Executable file
101
modules/ModuleBuilder/views/view.module.php
Executable file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
|
||||
class ViewModule extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
global $mod_strings;
|
||||
$smarty = new Sugar_Smarty();
|
||||
|
||||
require_once('modules/ModuleBuilder/MB/ModuleBuilder.php');
|
||||
$mb = new ModuleBuilder();
|
||||
$mb->getPackage($_REQUEST['view_package']);
|
||||
$package = $mb->packages[$_REQUEST['view_package']];
|
||||
$module_name = (!empty($_REQUEST['view_module']))?$_REQUEST['view_module']:'';
|
||||
$package->getModule($module_name);
|
||||
$this->module = $package->modules[$module_name];
|
||||
$this->loadPackageHelp($module_name);
|
||||
|
||||
// set up the list of either available types for a new module, or implemented types for an existing one
|
||||
$types = (empty($module_name)) ? MBModule::getTypes() : $this->module->mbvardefs->templates ;
|
||||
|
||||
foreach( $types as $type=>$definition)
|
||||
{
|
||||
$translated_type[$type]=translate('LBL_TYPE_'.strtoupper($type),'ModuleBuilder');
|
||||
}
|
||||
natcasesort($translated_type);
|
||||
$smarty->assign('types',$translated_type);
|
||||
|
||||
$smarty->assign('package', $package);
|
||||
$smarty->assign('module', $this->module);
|
||||
$smarty->assign('mod_strings', $mod_strings);
|
||||
|
||||
$ajax = new AjaxCompose();
|
||||
$ajax->addCrumb($GLOBALS['mod_strings']['LBL_MODULEBUILDER'], 'ModuleBuilder.main("mb")');
|
||||
$ajax->addCrumb(' '. $package->name,'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package='.$package->name.'")');
|
||||
if(empty($module_name))$module_name = translate('LBL_NEW_MODULE', 'ModuleBuilder');
|
||||
$ajax->addCrumb($module_name, '');
|
||||
$html=$smarty->fetch('modules/ModuleBuilder/tpls/MBModule/module.tpl');
|
||||
if(!empty($_REQUEST['action']) && $_REQUEST['action']=='SaveModule')
|
||||
$html .="<script>ModuleBuilder.treeRefresh('ModuleBuilder')</script>";
|
||||
$ajax->addSection('center', translate('LBL_SECTION_MODULE', 'ModuleBuilder'), $html);
|
||||
|
||||
echo $ajax->getJavascript();
|
||||
}
|
||||
|
||||
function loadPackageHelp(
|
||||
$name
|
||||
)
|
||||
{
|
||||
$this->module->help['default'] = (empty($name))?'create':'modify';
|
||||
$this->module->help['group'] = 'module';
|
||||
}
|
||||
}
|
||||
306
modules/ModuleBuilder/views/view.modulefield.php
Executable file
306
modules/ModuleBuilder/views/view.modulefield.php
Executable file
@@ -0,0 +1,306 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
require_once('modules/DynamicFields/FieldViewer.php');
|
||||
|
||||
class ViewModulefield extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
$ac = $this->fetch();
|
||||
echo $ac->getJavascript();
|
||||
}
|
||||
|
||||
function fetch(
|
||||
$ac = false
|
||||
)
|
||||
{
|
||||
$fv = new FieldViewer();
|
||||
if(empty($_REQUEST['field'])&& !empty($_REQUEST['name']))$_REQUEST['field'] = $_REQUEST['name'];
|
||||
$field_name = '';
|
||||
if(!empty($this->view_object_map['field_name']))
|
||||
$field_name = $this->view_object_map['field_name'];
|
||||
elseif(!empty($_REQUEST['field']))
|
||||
$field_name = $_REQUEST['field'];
|
||||
else
|
||||
$field_name = '';
|
||||
|
||||
$action = 'saveField'; // tyoung bug 17606: default action is to save as a dynamic field; but for standard OOB
|
||||
// fields we override this so don't create a new dynamic field instead of updating the existing field
|
||||
|
||||
$isClone = false;
|
||||
if(!empty($this->view_object_map['is_clone']) && $this->view_object_map['is_clone'])
|
||||
$isClone = true;
|
||||
/*
|
||||
$field_types = array('varchar'=>'YourField', 'int'=>'Integer', 'float'=>'Decimal','bool'=>'Checkbox','enum'=>'DropDown',
|
||||
'date'=>'Date', 'phone' => 'Phone', 'currency' => 'Currency', 'html' => 'HTML', 'radioenum' => 'Radio',
|
||||
'relate' => 'Relate', 'address' => 'Address', 'text' => 'TextArea', 'url' => 'Link');
|
||||
*/
|
||||
$field_types = $GLOBALS['mod_strings']['fieldTypes'];
|
||||
$field_name_exceptions = array(
|
||||
//bug 22264: Field name must not be an SQL keyword.
|
||||
//Taken from SQL Server's list of reserved keywords; http://msdn.microsoft.com/en-us/library/aa238507(SQL.80).aspx
|
||||
'ADD','EXCEPT','PERCENT','ALL','EXEC','PLAN','ALTER','EXECUTE','PRECISION','AND','EXISTS','PRIMARY',
|
||||
'ANY','EXIT','PRINT','AS','FETCH','PROC','ASC','FILE','PROCEDURE','AUTHORIZATION','FILLFACTOR','PUBLIC',
|
||||
'BACKUP','FOR','RAISERROR','BEGIN','FOREIGN','READ','BETWEEN','FREETEXT','READTEXT','BREAK','FREETEXTTABLE',
|
||||
'RECONFIGURE','BROWSE','FROM','REFERENCES','BULK','FULL','REPLICATION','BY','FUNCTION','RESTORE',
|
||||
'CASCADE','GOTO','RESTRICT','CASE','GRANT','RETURN','CHECK','GROUP','REVOKE','CHECKPOINT','HAVING','RIGHT','CLOSE',
|
||||
'HOLDLOCK','ROLLBACK','CLUSTERED','IDENTITY','ROWCOUNT','COALESCE','IDENTITY_INSERT','ROWGUIDCOL','COLLATE','IDENTITYCOL',
|
||||
'RULE','COLUMN','IF','SAVE','COMMIT','IN','SCHEMA','COMPUTE','INDEX','SELECT','CONSTRAINT','INNER','SESSION_USER',
|
||||
'CONTAINS','INSERT','SET','CONTAINSTABLE','INTERSECT','SETUSER','CONTINUE','INTO','SHUTDOWN','CONVERT','IS','SOME',
|
||||
'CREATE','JOIN','STATISTICS','CROSS','KEY','SYSTEM_USER','CURRENT','KILL','TABLE','CURRENT_DATE','LEFT','TEXTSIZE',
|
||||
'CURRENT_TIME','LIKE','THEN','CURRENT_TIMESTAMP','LINENO','TO','CURRENT_USER','LOAD','TOP','CURSOR','NATIONAL','TRAN',
|
||||
'DATABASE','NOCHECK','TRANSACTION','DBCC','NONCLUSTERED','TRIGGER','DEALLOCATE','NOT','TRUNCATE','DECLARE','NULL','TSEQUAL',
|
||||
'DEFAULT','NULLIF','UNION','DELETE','OF','UNIQUE','DENY','OFF','UPDATE','DESC','OFFSETS','UPDATETEXT',
|
||||
'DISK','ON','USE','DISTINCT','OPEN','USER','DISTRIBUTED','OPENCONNECTOR','VALUES','DOUBLE','OPENQUERY','VARYING',
|
||||
'DROP','OPENROWSET','VIEW','DUMMY','OPENXML','WAITFOR','DUMP','OPTION','WHEN','ELSE','OR','WHERE',
|
||||
'END','ORDER','WHILE','ERRLVL','OUTER','WITH','ESCAPE','OVER','WRITETEXT',
|
||||
//Mysql Keywords from http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html (those not in MSSQL's list)
|
||||
'ANALYZE', 'ASENSITIVE', 'BEFORE', 'BIGINT', 'BINARY', 'BOTH', 'CALL', 'CHANGE', 'CHARACTER',
|
||||
'CONDITION', 'DATABASES', 'DAY_HOUR', 'DAY_MICROSECOND', 'DAY_MINUTE', 'DAY_SECOND', 'DEC', 'DECIMAL', 'DELAYED',
|
||||
'DESCRIBE', 'DETERMINISTIC', 'DISTINCTROW', 'DIV', 'DUAL', 'EACH', 'ELSEIF', 'ENCLOSED', 'ESCAPED', 'EXPLAIN',
|
||||
'FALSE', 'FLOAT', 'FLOAT4', 'FLOAT8', 'FORCE', 'FULLTEXT', 'HIGH_PRIORITY', 'HOUR_MICROSECOND', 'HOUR_MINUTE',
|
||||
'HOUR_SECOND', 'IGNORE', 'INFILE', 'INOUT', 'INSENSITIVE', 'INT', 'INT1', 'INT2', 'INT3', 'INT4', 'INT8',
|
||||
'INTEGER', 'ITERATE', 'KEYS', 'LEADING', 'LEAVE', 'LIMIT', 'LINES', 'LOCALTIME', 'LOCALTIMESTAMP', 'LOCK',
|
||||
'LONGBLOB', 'LONGTEXT', 'LOOP', 'LOW_PRIORITY', 'MATCH', 'MEDIUMBLOB', 'MEDIUMINT', 'MEDIUMTEXT', 'MIDDLEINT',
|
||||
'MINUTE_MICROSECOND', 'MINUTE_SECOND', 'MOD', 'MODIFIES', 'NATURAL', 'NO_WRITE_TO_BINLOG', 'NUMERIC', 'OPTIMIZE',
|
||||
'OPTIONALLY', 'OUT', 'OUTFILE', 'PURGE', 'READS', 'REAL', 'REGEXP', 'RELEASE', 'RENAME', 'REPEAT', 'REPLACE',
|
||||
'REQUIRE', 'RLIKE', 'SCHEMAS', 'SECOND_MICROSECOND', 'SENSITIVE', 'SEPARATOR', 'SHOW', 'SMALLINT', 'SONAME',
|
||||
'SPATIAL', 'SPECIFIC', 'SQL', 'SQLEXCEPTION', 'SQLSTATE', 'SQLWARNING', 'SQL_BIG_RESULT', 'SQL_CALC_FOUND_ROWS',
|
||||
'SQL_SMALL_RESULT', 'SSL', 'STARTING', 'STRAIGHT_JOIN', 'TERMINATED', 'TINYBLOB', 'TINYINT', 'TINYTEXT',
|
||||
'TRAILING', 'TRUE', 'UNDO', 'UNLOCK', 'UNSIGNED', 'USAGE', 'USING', 'UTC_DATE', 'UTC_TIME', 'UTC_TIMESTAMP',
|
||||
'VARBINARY', 'VARCHARACTER', 'WRITE', 'XOR', 'YEAR_MONTH', 'ZEROFILL', 'CONNECTION', 'LABEL', 'UPGRADE',
|
||||
//Oracle datatypes
|
||||
'DATE','VARCHAR','VARCHAR2','NVARCHAR2','CHAR','NCHAR','NUMBER','PLS_INTEGER','BINARY_INTEGER','LONG','TIMESTAMP',
|
||||
'INTERVAL','RAW','ROWID','UROWID','MLSLABEL','CLOB','NCLOB','BLOB','BFILE','XMLTYPE',
|
||||
//SugarCRM reserved
|
||||
'ID', 'ID_C',
|
||||
);
|
||||
|
||||
if(! isset($_REQUEST['view_package']) || $_REQUEST['view_package'] == 'studio' || empty ( $_REQUEST [ 'view_package' ] ) ) {
|
||||
$module = new stdClass;
|
||||
$moduleName = $_REQUEST['view_module'];
|
||||
|
||||
global $beanList;
|
||||
|
||||
$objectName = $beanList[$moduleName];
|
||||
$className = $objectName;
|
||||
if($objectName == 'aCase') // Bug 17614 - renamed aCase as Case in vardefs for backwards compatibililty with 451 modules
|
||||
$objectName = 'Case';
|
||||
|
||||
$module = new $className();
|
||||
|
||||
VardefManager::loadVardef($moduleName, $objectName,true);
|
||||
global $dictionary;
|
||||
$module->mbvardefs->vardefs = $dictionary[$objectName];
|
||||
|
||||
// $GLOBALS['log']->debug('vardefs from dictionary = '.print_r($module->mbvardefs->vardefs,true));
|
||||
$module->name = $moduleName;
|
||||
if(!$ac){
|
||||
$ac = new AjaxCompose();
|
||||
}
|
||||
$vardef = (!empty($module->mbvardefs->vardefs['fields'][$field_name]))? $module->mbvardefs->vardefs['fields'][$field_name]: array();
|
||||
if($isClone){
|
||||
unset($vardef['name']);
|
||||
}
|
||||
|
||||
if(empty($vardef['name'])){
|
||||
if(!empty($_REQUEST['type']))
|
||||
$vardef['type'] = $_REQUEST['type'];
|
||||
$fv->ss->assign('hideLevel', 0);
|
||||
}elseif(isset($vardef['custom_module'])){
|
||||
$fv->ss->assign('hideLevel', 2);
|
||||
}else{
|
||||
$action = 'saveSugarField'; // tyoung - for OOB fields we currently only support modifying the label
|
||||
$fv->ss->assign('hideLevel', 3);
|
||||
}
|
||||
if($isClone && isset($vardef['type']) && $vardef['type'] == 'datetime'){
|
||||
$vardef['type'] = 'datetimecombo';
|
||||
}
|
||||
|
||||
require_once ('modules/DynamicFields/FieldCases.php') ;
|
||||
$tf = get_widget ( empty($vardef [ 'type' ]) ? "" : $vardef [ 'type' ]) ;
|
||||
$tf->module = $module;
|
||||
$tf->populateFromRow($vardef);
|
||||
$vardef = array_merge($vardef, $tf->get_field_def());
|
||||
|
||||
// $GLOBALS['log']->debug('vardefs after loading = '.print_r($vardef,true));
|
||||
|
||||
|
||||
//Check if autoincrement fields are allowed
|
||||
$allowAutoInc = true;
|
||||
foreach($module->field_defs as $field => $def)
|
||||
{
|
||||
if (!empty($def['type']) && $def['type'] == "int" && !empty($def['auto_increment'])) {
|
||||
$allowAutoInc = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$fv->ss->assign( 'allowAutoInc', $allowAutoInc);
|
||||
|
||||
$GLOBALS['log']->warn('view.modulefield: hidelevel '.$fv->ss->get_template_vars('hideLevel')." ".print_r($vardef,true));
|
||||
if(!empty($vardef['vname'])){
|
||||
$fv->ss->assign('lbl_value', htmlentities(translate($vardef['vname'], $moduleName), ENT_QUOTES, 'UTF-8'));
|
||||
}
|
||||
$fv->ss->assign('module', $module);
|
||||
if(empty($module->mbvardefs->vardefs['fields']['parent_name']) || (isset($vardef['type']) && $vardef['type'] == 'parent'))
|
||||
$field_types['parent'] = $GLOBALS['mod_strings']['parent'];
|
||||
|
||||
$edit_or_add = 'editField' ;
|
||||
|
||||
} else
|
||||
{
|
||||
require_once('modules/ModuleBuilder/MB/ModuleBuilder.php');
|
||||
$mb = new ModuleBuilder();
|
||||
$module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
|
||||
$package =& $mb->packages[$_REQUEST['view_package']];
|
||||
$module->getVardefs();
|
||||
if(!$ac){
|
||||
$ac = new AjaxCompose();
|
||||
}
|
||||
$vardef = (!empty($module->mbvardefs->vardefs['fields'][$field_name]))? $module->mbvardefs->vardefs['fields'][$field_name]: array();
|
||||
if($isClone){
|
||||
unset($vardef['name']);
|
||||
}
|
||||
|
||||
if(empty($vardef['name'])){
|
||||
if(!empty($_REQUEST['type']))$vardef['type'] = $_REQUEST['type'];
|
||||
$fv->ss->assign('hideLevel', 0);
|
||||
}else{
|
||||
if(!empty($module->mbvardefs->vardef['fields'][$vardef['name']])){
|
||||
$fv->ss->assign('hideLevel', 1);
|
||||
}elseif(isset($vardef['custom_module'])){
|
||||
$fv->ss->assign('hideLevel', 2);
|
||||
}else{
|
||||
$fv->ss->assign('hideLevel', 3); // tyoung bug 17350 - effectively mark template derived fields as readonly
|
||||
}
|
||||
}
|
||||
|
||||
require_once ('modules/DynamicFields/FieldCases.php') ;
|
||||
$tf = get_widget ( empty($vardef [ 'type' ]) ? "" : $vardef [ 'type' ]) ;
|
||||
$tf->module = $module;
|
||||
$tf->populateFromRow($vardef);
|
||||
$vardef = array_merge($vardef, $tf->get_field_def());
|
||||
|
||||
|
||||
|
||||
$fv->ss->assign('module', $module);
|
||||
$fv->ss->assign('package', $package);
|
||||
$fv->ss->assign('MB','1');
|
||||
|
||||
if(isset($vardef['vname']))
|
||||
$fv->ss->assign('lbl_value', htmlentities($module->getLabel('en_us',$vardef['vname']), ENT_QUOTES, 'UTF-8'));
|
||||
if(empty($module->mbvardefs->vardefs['fields']['parent_name']) || (isset($vardef['type']) && $vardef['type'] == 'parent'))
|
||||
$field_types['parent'] = $GLOBALS['mod_strings']['parent'];
|
||||
|
||||
$edit_or_add = 'mbeditField';
|
||||
}
|
||||
|
||||
if($_REQUEST['action'] == 'RefreshField'){
|
||||
require_once('modules/DynamicFields/FieldCases.php');
|
||||
$field = get_widget($_POST['type']);
|
||||
$field->populateFromPost();
|
||||
$vardef = $field->get_field_def();
|
||||
$vardef['options'] = $_REQUEST['new_dropdown'];
|
||||
$fv->ss->assign('lbl_value', htmlentities($_REQUEST['labelValue'], ENT_QUOTES, 'UTF-8'));
|
||||
}
|
||||
|
||||
foreach(array("formula", "default", "comments", "help") as $toEscape)
|
||||
{
|
||||
if (!empty($vardef[$toEscape]) && is_string($vardef[$toEscape])) {
|
||||
$vardef[$toEscape] = htmlentities($vardef[$toEscape], ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($vardef['studio']) && is_array($vardef['studio']) && !empty($vardef['studio']['no_duplicate']) && $vardef['studio']['no_duplicate'] == true) {
|
||||
$fv->ss->assign('no_duplicate', true);
|
||||
}
|
||||
|
||||
$fv->ss->assign('action',$action);
|
||||
$fv->ss->assign('isClone', ($isClone ? 1 : 0));
|
||||
$json = getJSONobj();
|
||||
|
||||
$fv->ss->assign('field_name_exceptions', $json->encode($field_name_exceptions));
|
||||
ksort($field_types);
|
||||
$fv->ss->assign('field_types',$field_types);
|
||||
$fv->ss->assign('importable_options', $GLOBALS['app_list_strings']['custom_fields_importable_dom']);
|
||||
$fv->ss->assign('duplicate_merge_options', $GLOBALS['app_list_strings']['custom_fields_merge_dup_dom']);
|
||||
|
||||
$triggers = array () ;
|
||||
foreach ( $module->mbvardefs->vardefs['fields'] as $field )
|
||||
{
|
||||
if ($field [ 'type' ] == 'enum' || $field [ 'type'] == 'multienum' )
|
||||
{
|
||||
$triggers [] = $field [ 'name' ] ;
|
||||
}
|
||||
}
|
||||
$fv->ss->assign('triggers',$triggers);
|
||||
|
||||
$fv->ss->assign('mod_strings',$GLOBALS['mod_strings']);
|
||||
|
||||
// jchi #24880
|
||||
// end
|
||||
$layout = $fv->getLayout($vardef);
|
||||
|
||||
$fv->ss->assign('fieldLayout', $layout);
|
||||
if(empty($vardef['type']))
|
||||
$vardef['type'] = 'varchar';
|
||||
$fv->ss->assign('vardef', $vardef);
|
||||
|
||||
|
||||
if(empty($_REQUEST['field'])){
|
||||
$edit_or_add = 'addField';
|
||||
}
|
||||
|
||||
$fv->ss->assign('help_group', $edit_or_add);
|
||||
$body = $fv->ss->fetch('modules/ModuleBuilder/tpls/MBModule/field.tpl');
|
||||
$ac->addSection('east', translate('LBL_SECTION_FIELDEDITOR','ModuleBuilder'), $body );
|
||||
return $ac;
|
||||
}
|
||||
}
|
||||
210
modules/ModuleBuilder/views/view.modulefields.php
Executable file
210
modules/ModuleBuilder/views/view.modulefields.php
Executable file
@@ -0,0 +1,210 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
require_once('modules/ModuleBuilder/views/view.modulefield.php');
|
||||
|
||||
class ViewModulefields extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
$smarty = new Sugar_Smarty();
|
||||
global $mod_strings;
|
||||
$bak_mod_strings=$mod_strings;
|
||||
$smarty->assign('mod_strings', $mod_strings);
|
||||
|
||||
$module_name = $_REQUEST['view_module'];
|
||||
|
||||
if(! isset($_REQUEST['view_package']) || $_REQUEST['view_package'] == 'studio') {
|
||||
//$this->loadPackageHelp($module_name);
|
||||
$studioClass = new stdClass;
|
||||
$studioClass->name = $module_name;
|
||||
|
||||
global $beanList;
|
||||
$objectName = $beanList[$module_name];
|
||||
|
||||
if($objectName == 'aCase') // Bug 17614 - renamed aCase as Case in vardefs for backwards compatibililty with 451 modules
|
||||
$objectName = 'Case';
|
||||
|
||||
VardefManager::loadVardef($module_name, $objectName);
|
||||
global $dictionary;
|
||||
$f = array($mod_strings['LBL_HCUSTOM']=>array(), $mod_strings['LBL_HDEFAULT']=>array());
|
||||
|
||||
// TODO: replace this section to select fields to list with the algorithm in AbstractMetaDataImplmentation::validField()
|
||||
$def = $this->cullFields($dictionary[$objectName]['fields']);
|
||||
|
||||
foreach($dictionary[$objectName]['fields'] as $def) {
|
||||
if ($this->isValidStudioField($def))
|
||||
{
|
||||
//Custom relate fields will have a non-db source, but custom_module set
|
||||
if(isset($def['source']) && $def['source'] == 'custom_fields' || isset($def['custom_module'])) {
|
||||
$f[$mod_strings['LBL_HCUSTOM']][$def['name']] = $def;
|
||||
} else {
|
||||
$f[$mod_strings['LBL_HDEFAULT']][$def['name']] = $def;
|
||||
}
|
||||
}
|
||||
}
|
||||
$studioClass->mbvardefs->vardefs['fields'] = $f;
|
||||
$smarty->assign('module', $studioClass);
|
||||
|
||||
$package = new stdClass;
|
||||
$package->name = '';
|
||||
$smarty->assign('package', $package);
|
||||
$ajax = new AjaxCompose();
|
||||
$ajax->addCrumb($mod_strings['LBL_STUDIO'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")');
|
||||
$ajax->addCrumb(translate($module_name), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module='.$module_name.'")');
|
||||
$ajax->addCrumb($mod_strings['LBL_FIELDS'], '');
|
||||
$ajax->addSection('center', $mod_strings['LBL_EDIT_FIELDS'],$smarty->fetch('modules/ModuleBuilder/tpls/MBModule/fields.tpl'));
|
||||
$_REQUEST['field'] = '';
|
||||
|
||||
echo $ajax->getJavascript();
|
||||
} else {
|
||||
require_once('modules/ModuleBuilder/MB/ModuleBuilder.php');
|
||||
$mb = new ModuleBuilder();
|
||||
$mb->getPackage($_REQUEST['view_package']);
|
||||
$package = $mb->packages[$_REQUEST['view_package']];
|
||||
|
||||
$package->getModule($module_name);
|
||||
$this->module = $package->modules[$module_name];
|
||||
$this->loadPackageHelp($module_name);
|
||||
$this->module->getVardefs(true);
|
||||
$this->module->mbvardefs->vardefs['fields'] = array_reverse($this->module->mbvardefs->vardefs['fields'], true);
|
||||
$loadedFields = array();
|
||||
foreach($this->module->mbvardefs->vardefs['fields'] as $k=>$v){
|
||||
if($k != $module_name)
|
||||
$titleLBL[$k]=translate("LBL_".strtoupper($k),'ModuleBuilder');
|
||||
else{
|
||||
$titleLBL[$k]=$k;
|
||||
}
|
||||
foreach($v as $field => $def)
|
||||
{
|
||||
if (isset($loadedFields[$field]))
|
||||
unset($this->module->mbvardefs->vardefs['fields'][$k][$field]);
|
||||
else
|
||||
$loadedFields[$field] = true;
|
||||
}
|
||||
}
|
||||
$this->module->mbvardefs->vardefs['fields'][$module_name] = $this->cullFields($this->module->mbvardefs->vardefs['fields'][$module_name]);
|
||||
if(file_exists($this->module->path. '/language/'.$GLOBALS['current_language'].'.lang.php')){
|
||||
include($this->module->path .'/language/'. $GLOBALS['current_language'].'.lang.php');
|
||||
$this->module->setModStrings($GLOBALS['current_language'],$mod_strings);
|
||||
}
|
||||
elseif(file_exists($this->module->path. '/language/en_us.lang.php')){
|
||||
include($this->module->path .'/language/en_us.lang.php');
|
||||
$this->module->setModStrings('en_us',$mod_strings);
|
||||
}
|
||||
$smarty->assign('title', $titleLBL);
|
||||
$smarty->assign('package', $package);
|
||||
$smarty->assign('module', $this->module);
|
||||
$smarty->assign('editLabelsMb','1'); //need to merge MB labels and studio labels. quick fix for now.
|
||||
|
||||
|
||||
$ajax = new AjaxCompose();
|
||||
$ajax->addCrumb($bak_mod_strings['LBL_MODULEBUILDER'], 'ModuleBuilder.main("mb")');
|
||||
$ajax->addCrumb($package->name,'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package='.$package->name.'")');
|
||||
$ajax->addCrumb($module_name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package='.$package->name.'&view_module='. $module_name . '")');
|
||||
$ajax->addCrumb($bak_mod_strings['LBL_FIELDS'], '');
|
||||
$ajax->addSection('center', $bak_mod_strings["LBL_FIELDS"],$smarty->fetch('modules/ModuleBuilder/tpls/MBModule/fields.tpl'));
|
||||
$_REQUEST['field'] = '';
|
||||
|
||||
echo $ajax->getJavascript();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function loadPackageHelp(
|
||||
$name
|
||||
)
|
||||
{
|
||||
$this->module->help['default'] = (empty($name))?'create':'modify';
|
||||
$this->module->help['group'] = 'module';
|
||||
}
|
||||
|
||||
function cullFields(
|
||||
$def
|
||||
)
|
||||
{
|
||||
if(!empty($def['parent_id']))
|
||||
unset($def['parent_id']);
|
||||
if(!empty($def['parent_type']))
|
||||
unset($def['parent_type']);
|
||||
if(!empty($def['currency_id']))
|
||||
unset($def['currency_id']);
|
||||
return $def;
|
||||
}
|
||||
|
||||
function isValidStudioField(
|
||||
$def
|
||||
)
|
||||
{
|
||||
if (isset($def['studio'])) {
|
||||
if (is_array($def [ 'studio' ]))
|
||||
{
|
||||
if (isset($def['studio']['editField']) && $def['studio']['editField'] == true)
|
||||
return true;
|
||||
if (isset($def['studio']['required']) && $def['studio']['required'])
|
||||
return true;
|
||||
|
||||
} else
|
||||
{
|
||||
if ($def['studio'] == 'visible')
|
||||
return true;
|
||||
if ($def['studio'] == 'hidden' || $def['studio'] == 'false' || !$def['studio'] )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (empty($def ['source']) || $def ['source'] == 'db' || $def ['source'] == 'custom_fields')
|
||||
{
|
||||
if ($def ['type'] != 'id' && (empty($def ['dbType']) || $def ['dbType'] != 'id'))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
102
modules/ModuleBuilder/views/view.modulelabels.php
Executable file
102
modules/ModuleBuilder/views/view.modulelabels.php
Executable file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*
|
||||
* Created on Aug 6, 2007
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
||||
*/
|
||||
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
|
||||
class ViewModulelabels extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
global $mod_strings;
|
||||
$bak_mod_strings=$mod_strings;
|
||||
$smarty = new Sugar_Smarty();
|
||||
$smarty->assign('mod_strings', $mod_strings);
|
||||
$package_name = $_REQUEST['view_package'];
|
||||
$module_name = $_REQUEST['view_module'];
|
||||
|
||||
require_once('modules/ModuleBuilder/MB/ModuleBuilder.php');
|
||||
$mb = new ModuleBuilder();
|
||||
$mb->getPackage($_REQUEST['view_package']);
|
||||
$package = $mb->packages[$_REQUEST['view_package']];
|
||||
$package->getModule($module_name);
|
||||
$this->module = $package->modules[$module_name];
|
||||
$selected_lang = (!empty($_REQUEST['selected_lang'])?$_REQUEST['selected_lang']:$_SESSION['authenticated_user_language']);
|
||||
if(empty($selected_lang)){
|
||||
$selected_lang = $GLOBALS['sugar_config']['default_language'];
|
||||
}
|
||||
//need to change the following to interface with MBlanguage.
|
||||
$smarty->assign('MOD', $this->module->getModStrings($selected_lang));
|
||||
$smarty->assign('APP', $GLOBALS['app_strings']);
|
||||
$smarty->assign('selected_lang', $selected_lang);
|
||||
$smarty->assign('view_package', $package_name);
|
||||
$smarty->assign('view_module', $module_name);
|
||||
$smarty->assign('mb','1');
|
||||
$smarty->assign('available_languages', get_languages());
|
||||
///////////////////////////////////////////////////////////////////
|
||||
////ASSISTANT
|
||||
$smarty->assign('assistant',array('group'=>'module', 'key'=>'labels'));
|
||||
/////////////////////////////////////////////////////////////////
|
||||
////ASSISTANT
|
||||
|
||||
$ajax = new AjaxCompose();
|
||||
$ajax->addCrumb($bak_mod_strings['LBL_MODULEBUILDER'], 'ModuleBuilder.main("mb")');
|
||||
$ajax->addCrumb($package_name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package='.$package->name. '")');
|
||||
$ajax->addCrumb($module_name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&package='.$package->name.'&module='. $module_name . '")');
|
||||
$ajax->addCrumb($bak_mod_strings['LBL_LABELS'], '');
|
||||
$ajax->addSection('center', $bak_mod_strings['LBL_LABELS'],$smarty->fetch('modules/ModuleBuilder/tpls/labels.tpl'));
|
||||
echo $ajax->getJavascript();
|
||||
}
|
||||
}
|
||||
|
||||
141
modules/ModuleBuilder/views/view.package.php
Executable file
141
modules/ModuleBuilder/views/view.package.php
Executable file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
require_once('modules/ModuleBuilder/MB/ModuleBuilder.php');
|
||||
class Viewpackage extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
global $mod_strings;
|
||||
$smarty = new Sugar_Smarty();
|
||||
$mb = new ModuleBuilder();
|
||||
//if (!empty($_REQUEST['package'])) {
|
||||
if (empty($_REQUEST['package']) && empty($_REQUEST['new'])) {
|
||||
$this->generatePackageButtons($mb->getPackageList());
|
||||
|
||||
$smarty->assign('buttons', $this->buttons);
|
||||
$smarty->assign('title', $GLOBALS['mod_strings']['LBL_MODULEBUILDER']);
|
||||
$smarty->assign("question", $GLOBALS['mod_strings']['LBL_QUESTION_PACKAGE']);
|
||||
$smarty->assign("defaultHelp", "mbHelp");
|
||||
|
||||
$ajax = new AjaxCompose();
|
||||
$ajax->addCrumb($GLOBALS['mod_strings']['LBL_MODULEBUILDER'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package")');
|
||||
$ajax->addCrumb($GLOBALS['mod_strings']['LBL_PACKAGE_LIST'],'');
|
||||
$ajax->addSection('center', $GLOBALS['mod_strings']['LBL_PACKAGE_LIST'], $smarty->fetch('modules/ModuleBuilder/tpls/wizard.tpl'));
|
||||
echo $ajax->getJavascript();
|
||||
}
|
||||
else {
|
||||
$name = (!empty($_REQUEST['package']))?$_REQUEST['package']:'';
|
||||
$mb->getPackage($name);
|
||||
$this->package =& $mb->packages[$name];
|
||||
$this->loadModuleTypes();
|
||||
$this->loadPackageHelp($name);
|
||||
$this->package->date_modified = $GLOBALS['timedate']->to_display_date_time($this->package->date_modified);
|
||||
$smarty->assign('package', $this->package);
|
||||
$smarty->assign('mod_strings',$mod_strings);
|
||||
$smarty->assign('package_already_deployed', 'false');
|
||||
foreach($this->package->modules as $a_module){
|
||||
if(in_array($a_module->key_name, $GLOBALS['moduleList'])){
|
||||
$smarty->assign('package_already_deployed', 'true');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$ajax = new AjaxCompose();
|
||||
$ajax->addCrumb($GLOBALS['mod_strings']['LBL_MODULEBUILDER'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package")');
|
||||
if(empty($name))$name = $mod_strings['LBL_NEW_PACKAGE'];
|
||||
$ajax->addCrumb($name,'');
|
||||
$html=$smarty->fetch('modules/ModuleBuilder/tpls/MBPackage/package.tpl');
|
||||
if(!empty($_REQUEST['action']) && $_REQUEST['action']=='SavePackage')
|
||||
$html.="<script>ModuleBuilder.treeRefresh('ModuleBuilder')</script>";
|
||||
$ajax->addSection('center', translate('LBL_SECTION_PACKAGE', 'ModuleBuilder'), $html);
|
||||
echo $ajax->getJavascript();
|
||||
}
|
||||
}
|
||||
|
||||
function loadModuleTypes()
|
||||
{
|
||||
$this->package->moduleTypes = array();
|
||||
$this->package->loadModules();
|
||||
foreach(array_keys($this->package->modules) as $name){
|
||||
foreach($this->package->modules[$name]->config['templates'] as $template=>$var){
|
||||
|
||||
$this->package->moduleTypes[$name] = $template;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
function loadPackageHelp(
|
||||
$name
|
||||
)
|
||||
{
|
||||
$this->package->help['default'] = (empty($name))?'create':'modify';
|
||||
$this->package->help['group'] = 'package';
|
||||
}
|
||||
|
||||
function generatePackageButtons(
|
||||
$packages
|
||||
)
|
||||
{
|
||||
global $mod_strings;
|
||||
$this->buttons[$mod_strings['LBL_NEW_PACKAGE']] = array(
|
||||
'action' => "module=ModuleBuilder&action=package&new=1",
|
||||
'imageTitle' => 'package_create',
|
||||
'size' => '64',
|
||||
'help' => 'newPackage',
|
||||
);
|
||||
foreach($packages as $package) {
|
||||
$this->buttons[$package] = array(
|
||||
'action' =>"module=ModuleBuilder&action=package&package={$package}",
|
||||
'imageTitle' => 'package',
|
||||
'size' => '64',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
224
modules/ModuleBuilder/views/view.popupview.php
Executable file
224
modules/ModuleBuilder/views/view.popupview.php
Executable file
@@ -0,0 +1,224 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' ) ;
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
require_once ('modules/ModuleBuilder/views/view.listview.php') ;
|
||||
require_once 'modules/ModuleBuilder/parsers/constants.php' ;
|
||||
|
||||
class ViewPopupview extends ViewListView
|
||||
{
|
||||
function ViewPopupview()
|
||||
{
|
||||
$this->init ();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* Pseudo-constructor to enable subclasses to call a parent's constructor without knowing the parent in PHP4
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
$this->editModule = $_REQUEST [ 'view_module' ] ;
|
||||
$this->editLayout = $_REQUEST [ 'view' ] ;
|
||||
$this->editPackage = (isset ( $_REQUEST [ 'view_package' ] ) && ! empty ( $_REQUEST [ 'view_package' ] )) ? $_REQUEST [ 'view_package' ] : null ;
|
||||
|
||||
$this->fromModuleBuilder = isset ( $_REQUEST [ 'MB' ] ) || (isset($_REQUEST['view_package']) && $_REQUEST['view_package'] && $_REQUEST['view_package'] != 'studio') ;
|
||||
if (!$this->fromModuleBuilder)
|
||||
{
|
||||
global $app_list_strings ;
|
||||
$moduleNames = array_change_key_case ( $app_list_strings [ 'moduleList' ] ) ;
|
||||
$this->translatedEditModule = $moduleNames [ strtolower ( $this->editModule ) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
function preDisplay()
|
||||
{
|
||||
}
|
||||
|
||||
function display(
|
||||
$preview = false
|
||||
)
|
||||
{
|
||||
require_once 'modules/ModuleBuilder/parsers/ParserFactory.php' ;
|
||||
$parser = ParserFactory::getParser ( $this->editLayout, $this->editModule, $this->editPackage) ;
|
||||
|
||||
$smarty = $this->constructSmarty ( $parser ) ;
|
||||
if ($preview)
|
||||
{
|
||||
echo $smarty->fetch ( "modules/ModuleBuilder/tpls/Preview/listView.tpl" ) ;
|
||||
} else
|
||||
{
|
||||
$ajax = $this->constructAjax () ;
|
||||
$ajax->addSection ( 'center', translate('LBL_POPUP'), $smarty->fetch ( "modules/ModuleBuilder/tpls/listView.tpl" ) ) ;
|
||||
echo $ajax->getJavascript () ;
|
||||
}
|
||||
}
|
||||
|
||||
function constructAjax()
|
||||
{
|
||||
require_once ('modules/ModuleBuilder/MB/AjaxCompose.php') ;
|
||||
$ajax = new AjaxCompose ( ) ;
|
||||
|
||||
if ($this->fromModuleBuilder)
|
||||
{
|
||||
$ajax->addCrumb ( translate ( 'LBL_MODULEBUILDER', 'ModuleBuilder' ), 'ModuleBuilder.main("mb")' ) ;
|
||||
$ajax->addCrumb ( $_REQUEST [ 'view_package' ], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $this->editPackage . '")' ) ;
|
||||
$ajax->addCrumb ( $this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $this->editPackage . '&view_module=' . $this->editModule . '")' ) ;
|
||||
$ajax->addCrumb ( translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&layouts=1&MB=1&view_package='.$this->editPackage.'&view_module=' . $this->editModule . '")');
|
||||
$ajax->addCrumb ( translate('LBL_POPUP', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=popup&MB=1&view_package='.$this->editPackage.'&view_module=' . $this->editModule . '")' );
|
||||
|
||||
$ViewLabel = ($this->editLayout == MB_POPUPLIST) ? 'LBL_POPUPLISTVIEW' : 'LBL_POPUPSEARCH';
|
||||
$ajax->addCrumb ( translate ($ViewLabel, 'ModuleBuilder' ), '' ) ;
|
||||
}else{
|
||||
$ajax->addCrumb ( $this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_module=' . $this->editModule . '")' ) ;
|
||||
$ajax->addCrumb ( translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&layouts=1&view_module=' . $this->editModule . '")');
|
||||
$ajax->addCrumb ( translate('LBL_POPUP', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=popup&view_module=' . $this->editModule . '")' );
|
||||
$ViewLabel = ($this->editLayout == MB_POPUPLIST) ? 'LBL_POPUPLISTVIEW' : 'LBL_POPUPSEARCH';
|
||||
$ajax->addCrumb ( translate ($ViewLabel, 'ModuleBuilder' ), '' ) ;
|
||||
}
|
||||
return $ajax ;
|
||||
}
|
||||
|
||||
function constructSmarty(
|
||||
$parser
|
||||
)
|
||||
{
|
||||
$smarty = new Sugar_Smarty ( ) ;
|
||||
$smarty->assign ( 'translate', true ) ;
|
||||
$smarty->assign ( 'language', $parser->getLanguage () ) ;
|
||||
|
||||
$smarty->assign ( 'view', $this->editLayout ) ;
|
||||
$smarty->assign ( 'action', 'popupSave' ) ;
|
||||
$smarty->assign( 'module', 'ModuleBuilder');
|
||||
$smarty->assign ( 'view_module', $this->editModule ) ;
|
||||
$helpName = (isset( $_REQUEST['view']) && $_REQUEST['view']==MB_POPUPSEARCH) ? 'searchViewEditor' : 'popupListViewEditor';
|
||||
$smarty->assign ( 'helpName', $helpName ) ;
|
||||
$smarty->assign ( 'helpDefault', 'modify' ) ;
|
||||
if ($this->fromModuleBuilder) {
|
||||
$mb = new ModuleBuilder ( ) ;
|
||||
$module = & $mb->getPackageModule ( $this->editPackage, $this->editModule ) ;
|
||||
$smarty->assign('current_mod_strings', $module->getModStrings());
|
||||
}
|
||||
|
||||
$smarty->assign ( 'title', $this->_constructTitle () ) ;
|
||||
$groups = array ( ) ;
|
||||
foreach ( $parser->columns as $column => $function )
|
||||
{
|
||||
$groups [ $GLOBALS [ 'mod_strings' ] [ $column ] ] = $parser->$function () ;
|
||||
}
|
||||
foreach ( $groups as $groupKey => $group )
|
||||
{
|
||||
foreach ( $group as $fieldKey => $field )
|
||||
{
|
||||
if (isset ( $field [ 'width' ] ))
|
||||
{
|
||||
if (substr ( $field [ 'width' ], - 1, 1 ) == '%')
|
||||
{
|
||||
$groups [ $groupKey ] [ $fieldKey ] [ 'width' ] = substr ( $field [ 'width' ], 0, strlen ( $field [ 'width' ] ) - 1 ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign ( 'groups', $groups ) ;
|
||||
|
||||
global $image_path ;
|
||||
$imageSave = SugarThemeRegistry::current()->getImage('studio_save') ;
|
||||
|
||||
$histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")" ;
|
||||
if (isset($this->searchlayout))
|
||||
$histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$this->searchlayout}\")" ;
|
||||
|
||||
$buttons = array ( ) ;
|
||||
if (! $this->fromModuleBuilder)
|
||||
{
|
||||
$buttons [] = array ( 'name' => 'savebtn' , 'image' => $imageSave , 'text' => $GLOBALS [ 'mod_strings' ] [ 'LBL_BTN_SAVEPUBLISH' ] , 'actionScript' => "onclick='studiotabs.generateGroupForm(\"edittabs\");ModuleBuilder.state.isDirty=false;ModuleBuilder.submitForm(\"edittabs\" )'" ) ;
|
||||
} else
|
||||
{
|
||||
$buttons [] = array ( 'name' => 'mbsavebtn' , 'image' => $imageSave , 'text' => $GLOBALS [ 'mod_strings' ] [ 'LBL_BTN_SAVE' ] , 'actionScript' => "onclick='studiotabs.generateGroupForm(\"edittabs\");ModuleBuilder.state.isDirty=false;ModuleBuilder.submitForm(\"edittabs\" )'" ) ;
|
||||
}
|
||||
$buttons [] = array ( 'name' => 'historyBtn' , 'text' => translate ( 'LBL_HISTORY' ) , 'actionScript' => "onclick='$histaction'" ) ;
|
||||
$smarty->assign ( 'buttons', $this->_buildImageButtons ( $buttons ) ) ;
|
||||
$editImage = SugarThemeRegistry::current()->getImage('edit_inline') ;
|
||||
$smarty->assign ( 'editImage', $editImage ) ;
|
||||
$deleteImage = SugarThemeRegistry::current()->getImage('delete_inline') ;
|
||||
$smarty->assign ( 'deleteImage', $deleteImage ) ;
|
||||
$smarty->assign ( 'MOD', $GLOBALS [ 'mod_strings' ] ) ;
|
||||
|
||||
if ($this->fromModuleBuilder)
|
||||
{
|
||||
$smarty->assign ( 'MB', true ) ;
|
||||
$smarty->assign ( 'view_package', $this->editPackage ) ;
|
||||
$smarty->assign ( 'description', $GLOBALS [ 'mod_strings' ] [ 'LBL_LISTVIEW_DESCRIPTION' ] ) ;
|
||||
|
||||
} else
|
||||
{
|
||||
$smarty->assign ( 'description', $GLOBALS [ 'mod_strings' ] [ 'LBL_LISTVIEW_DESCRIPTION' ] ) ;
|
||||
}
|
||||
|
||||
return $smarty ;
|
||||
}
|
||||
|
||||
function _constructTitle()
|
||||
{
|
||||
|
||||
global $app_list_strings ;
|
||||
|
||||
if ($this->fromModuleBuilder)
|
||||
{
|
||||
$title = $this->editModule ;
|
||||
} else
|
||||
{
|
||||
$title = $app_list_strings [ 'moduleList' ] [ $this->editModule ] ;
|
||||
}
|
||||
return $GLOBALS [ 'mod_strings' ] [ 'LBL_LISTVIEW_EDIT' ] . ': ' . $title ;
|
||||
|
||||
}
|
||||
}
|
||||
131
modules/ModuleBuilder/views/view.property.php
Executable file
131
modules/ModuleBuilder/views/view.property.php
Executable file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once ('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
require_once ('include/MVC/View/SugarView.php');
|
||||
require_once ('modules/ModuleBuilder/parsers/ParserFactory.php');
|
||||
|
||||
class ViewProperty extends SugarView
|
||||
{
|
||||
function ViewProperty()
|
||||
{
|
||||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function init () // pseduo-constuctor - given a well-known name to allow subclasses to call this classes constructor
|
||||
{
|
||||
$this->editModule = (! empty($_REQUEST['view_module'])) ? $_REQUEST['view_module'] : null;
|
||||
$this->editPackage = (! empty($_REQUEST['view_package'])) ? $_REQUEST['view_package'] : null;
|
||||
$this->id = (! empty($_REQUEST['id'])) ? $_REQUEST['id'] : null;
|
||||
$this->subpanel = (! empty($_REQUEST['subpanel'])) ? $_REQUEST['subpanel'] : "";
|
||||
$this->properties = array();
|
||||
foreach($_REQUEST as $key=>$value)
|
||||
{
|
||||
if (substr($key,0,4) == 'name')
|
||||
{
|
||||
$this->properties[substr($key,5)]['name'] = $value;
|
||||
}
|
||||
if (substr($key,0,2) == 'id')
|
||||
{
|
||||
$this->properties[substr($key,3)]['id'] = $value;
|
||||
}
|
||||
if (substr($key,0,5) == 'value')
|
||||
{
|
||||
$this->properties[substr($key,6)]['value'] = $value;
|
||||
// tyoung - now a nasty hack to disable editing of labels which contain Smarty functions - this is envisaged to be a temporary fix to prevent admins modifying these functions then being unable to restore the original complicated value if they regret it
|
||||
if (substr($key,6) == 'label')
|
||||
{
|
||||
//#29796 , we disable the edit function for sub panel label
|
||||
if (preg_match('/\{.*\}/',$value) || !empty($this->subpanel))
|
||||
{
|
||||
$this->properties[substr($key,6)]['hidden'] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (substr($key,0,5) == 'title')
|
||||
{
|
||||
$this->properties[substr($key,6)]['title'] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
global $mod_strings;
|
||||
$ajax = new AjaxCompose();
|
||||
$smarty = new Sugar_Smarty();
|
||||
if (isset($_REQUEST['MB']) && $_REQUEST['MB'] == "1")
|
||||
{
|
||||
$smarty->assign("MB", $_REQUEST['MB']);
|
||||
$smarty->assign("view_package", $_REQUEST['view_package']);
|
||||
}
|
||||
|
||||
$selected_lang = (!empty($_REQUEST['selected_lang'])?$_REQUEST['selected_lang']:$_SESSION['authenticated_user_language']);
|
||||
if(empty($selected_lang)){
|
||||
$selected_lang = $GLOBALS['sugar_config']['default_language'];
|
||||
}
|
||||
$smarty->assign('available_languages', get_languages());
|
||||
$smarty->assign('selected_lang', $selected_lang);
|
||||
|
||||
ksort($this->properties);
|
||||
|
||||
$smarty->assign("properties",$this->properties);
|
||||
// $smarty->assign("id",$this->id);
|
||||
|
||||
$smarty->assign("mod_strings",$mod_strings);
|
||||
$smarty->assign('APP', $GLOBALS['app_strings']);
|
||||
$smarty->assign("view_module", $this->editModule);
|
||||
$smarty->assign("subpanel", $this->subpanel);
|
||||
if (isset($this->editPackage))
|
||||
$smarty->assign("view_package", $this->editPackage);
|
||||
|
||||
$ajax->addSection('east', translate('LBL_SECTION_PROPERTIES', 'ModuleBuilder'), $smarty->fetch('modules/ModuleBuilder/tpls/editProperty.tpl'));
|
||||
echo $ajax->getJavascript();
|
||||
}
|
||||
}
|
||||
272
modules/ModuleBuilder/views/view.relationship.php
Executable file
272
modules/ModuleBuilder/views/view.relationship.php
Executable file
@@ -0,0 +1,272 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once ('modules/ModuleBuilder/MB/AjaxCompose.php') ;
|
||||
require_once ('modules/ModuleBuilder/MB/ModuleBuilder.php') ;
|
||||
require_once ('modules/ModuleBuilder/Module/StudioModuleFactory.php') ;
|
||||
require_once ('modules/ModuleBuilder/Module/StudioBrowser.php') ;
|
||||
require_once ('modules/ModuleBuilder/parsers/constants.php') ;
|
||||
require_once 'modules/ModuleBuilder/parsers/relationships/RelationshipFactory.php' ;
|
||||
|
||||
class ViewRelationship extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function overrideDefinitionFromPOST(
|
||||
$definition
|
||||
)
|
||||
{
|
||||
require_once 'modules/ModuleBuilder/parsers/relationships/AbstractRelationship.php' ;
|
||||
foreach ( AbstractRelationship::$definitionKeys as $key )
|
||||
{
|
||||
if(!empty($_REQUEST ['ajaxLoad']) && in_array($key, array('label', 'rhs_label', 'lhs_label')) ){
|
||||
continue;
|
||||
}
|
||||
if (! empty ( $_REQUEST [ $key ] ))
|
||||
{
|
||||
$definition [ $key ] = $_REQUEST [ $key ] ;
|
||||
}
|
||||
}
|
||||
return $definition ;
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
$selected_lang = (!empty($_REQUEST['relationship_lang'])?$_REQUEST['relationship_lang']:$_SESSION['authenticated_user_language']);
|
||||
$this->smarty = new Sugar_Smarty ( ) ;
|
||||
$ac = new AjaxCompose ( ) ;
|
||||
$this->fromModuleBuilder = isset ( $_REQUEST [ 'MB' ] ) || (!empty ( $_REQUEST [ 'view_package' ] ) && $_REQUEST [ 'view_package' ] != 'studio') ;
|
||||
$this->smarty->assign ( 'fromModuleBuilder', $this->fromModuleBuilder ) ;
|
||||
|
||||
if (!$this->fromModuleBuilder)
|
||||
{
|
||||
$module = StudioModuleFactory::getStudioModule( $_REQUEST [ 'view_module' ] ) ;
|
||||
$moduleName = $_REQUEST [ 'view_module' ] ;
|
||||
$fields = $module->fields ;
|
||||
require_once 'modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php' ;
|
||||
$relatableModules = DeployedRelationships::findRelatableModules () ;
|
||||
$appStrings = return_app_list_strings_language( $selected_lang ) ;
|
||||
$modStrings = return_module_language( $selected_lang, $_REQUEST [ 'view_module' ], true ) ;
|
||||
$appStrings = $appStrings['moduleList'];
|
||||
} else
|
||||
{
|
||||
$mb = new ModuleBuilder ( ) ;
|
||||
$mb->getPackages();
|
||||
//display the latest module name rather than what is in or not in the loaded app_list_strings.
|
||||
$mb->getPackage($_REQUEST ['view_package'])->loadModuleTitles();
|
||||
$module = $mb->getPackageModule ( $_REQUEST [ 'view_package' ], $_REQUEST [ 'view_module' ] ) ;
|
||||
$moduleName = empty($module->key_name) ? $module->getModuleName() : $module->key_name;
|
||||
$this->smarty->assign ( 'view_package', $_REQUEST [ 'view_package' ] ) ;
|
||||
$mbvardefs = $module->getVardefs () ;
|
||||
$fields = $mbvardefs [ 'fields' ] ;
|
||||
require_once 'modules/ModuleBuilder/parsers/relationships/UndeployedRelationships.php' ;
|
||||
$relatableModules = UndeployedRelationships::findRelatableModules () ;
|
||||
$appStrings = $module->getModStrings( $selected_lang ) ;
|
||||
}
|
||||
|
||||
ksort( $relatableModules ) ;
|
||||
$lhs_subpanels = $module->getProvidedSubpanels () ;
|
||||
// Fix to re-add sorting of the subpanel names so that the 'default' subpanel always appears first in the list.
|
||||
// This assumes that subpanels are usually named ForXYZ which is the case currently, and hence 'default' will be sorted first.
|
||||
//I f this assumption is incorrect, then a better solution would be to remove 'default' from the subpanel list, then sort, and finally array_unshift it back on.
|
||||
natcasesort($lhs_subpanels);
|
||||
|
||||
$cardinality = array ( MB_ONETOONE => translate ( 'LBL_ONETOONE' ) , MB_ONETOMANY => translate ( 'LBL_ONETOMANY' ) , MB_MANYTOONE=> translate ( 'LBL_MANYTOONE' ), MB_MANYTOMANY => translate ( 'LBL_MANYTOMANY' ), ) ;
|
||||
|
||||
if (!$this->fromModuleBuilder)
|
||||
unset($cardinality[MB_MANYTOONE]);
|
||||
|
||||
$relationships = $module->getRelationships () ;
|
||||
|
||||
// if a description for this relationship already exists, then load it so it can be modified
|
||||
if (! empty ( $_REQUEST [ 'relationship_name' ] ))
|
||||
{
|
||||
$relationship = $relationships->get ( $_REQUEST [ 'relationship_name' ] ) ;
|
||||
$relationship->setName($_REQUEST [ 'relationship_name' ] );
|
||||
$definition = $relationship->getDefinition();
|
||||
if (!$this->fromModuleBuilder){
|
||||
$modStrings = return_module_language( $selected_lang, $relationship->rhs_module, true ) ;
|
||||
$definition['lhs_label'] = isset($modStrings[$relationship->getTitleKey()])?$modStrings[$relationship->getTitleKey()] : $relationship->lhs_module;
|
||||
$modStrings = return_module_language( $selected_lang, $relationship->lhs_module, true ) ;
|
||||
$definition['rhs_label'] = isset($modStrings[$relationship->getTitleKey(true)])?$modStrings[$relationship->getTitleKey(true)] : $relationship->rhs_module ;
|
||||
}else{
|
||||
#30624
|
||||
if(!empty($_REQUEST['rhs_module'])){
|
||||
$definition['rhs_label'] = $_REQUEST['rhs_module'];
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
$definition = array ( ) ;
|
||||
$firstModuleDefinition = each ( $relatableModules ) ;
|
||||
$definition [ 'rhs_module' ] = $firstModuleDefinition [ 'key' ] ;
|
||||
$definition [ 'lhs_module' ] = $moduleName ;
|
||||
$definition [ 'lhs_label' ] = translate($moduleName);
|
||||
$definition [ 'relationship_type' ] = MB_MANYTOMANY ;
|
||||
}
|
||||
// load the relationship from post - required as we can call view.relationship.php from Ajax when changing the rhs_module for example
|
||||
$definition = $this->overrideDefinitionFromPOST ( $definition ) ;
|
||||
|
||||
if (empty($definition ['rhs_label']))
|
||||
{
|
||||
$definition ['rhs_label'] = translate($definition [ 'rhs_module' ]);
|
||||
}
|
||||
if (empty($definition ['lhs_label']))
|
||||
{
|
||||
$definition ['lhs_label'] = translate($definition [ 'lhs_module' ]);
|
||||
}
|
||||
$relationship = RelationshipFactory::newRelationship ( $definition ) ;
|
||||
|
||||
$rhs_subpanels = $relatableModules [ $relationship->rhs_module ] ;
|
||||
// Fix to re-add sorting of the subpanel names so that the 'default' subpanel always appears first in the list. This assumes that subpanels are usually named ForXYZ which is the case currently, and hence 'default' will be sorted first. If this assumption is incorrect, then a better solution would be to remove 'default' from the subpanel list, then sort, and finally array_unshift it back on.
|
||||
natcasesort($rhs_subpanels);
|
||||
|
||||
if (empty ( $_REQUEST [ 'relationship_name' ] ))
|
||||
{
|
||||
// tidy up the options for the view based on the modules participating in the relationship and the cardinality
|
||||
// some modules (e.g., Knowledge Base/KBDocuments) lack subpanels. That means they can't be the lhs of a 1-many or many-many, or the rhs of a many-many for example
|
||||
|
||||
// fix up the available cardinality options
|
||||
$relationship_type = $relationship->getType () ;
|
||||
if (count ( $lhs_subpanels ) == 0 || count ( $rhs_subpanels ) == 0)
|
||||
{
|
||||
unset ( $cardinality [ MB_MANYTOMANY ] ) ;
|
||||
}
|
||||
if (count ( $rhs_subpanels ) == 0)
|
||||
{
|
||||
unset ( $cardinality [ MB_ONETOMANY ] ) ;
|
||||
}
|
||||
|
||||
if (isset ($definition['rhs_module']) && $definition['rhs_module'] == 'Activities') {
|
||||
$cardinality = array( MB_ONETOMANY => translate ( 'LBL_ONETOMANY' ));
|
||||
}
|
||||
//Bug 23139, Campaigns module current cannot display custom subpanels, so we need to ban it from any
|
||||
//relationships that would require a new subpanel to be shown in Campaigns.
|
||||
if (isset ($definition['lhs_module']) && $definition['lhs_module'] == 'Campaigns') {
|
||||
unset ( $cardinality [ MB_MANYTOMANY ] ) ;
|
||||
unset ( $cardinality [ MB_ONETOMANY ] ) ;
|
||||
}
|
||||
if (isset ($definition['rhs_module']) && $definition['rhs_module'] == 'Campaigns' && isset($cardinality [ MB_MANYTOMANY ])) {
|
||||
unset ( $cardinality [ MB_MANYTOMANY ] ) ;
|
||||
unset ( $cardinality [ MB_MANYTOONE ] );
|
||||
}
|
||||
if (! isset($cardinality[$relationship->getType()]))
|
||||
{
|
||||
end ($cardinality) ;
|
||||
$definition [ 'relationship_type' ] = key ( $cardinality ) ;
|
||||
$relationship = RelationshipFactory::newRelationship ( $definition ) ;
|
||||
}
|
||||
|
||||
$this->smarty->assign ( 'is_new', true ) ;
|
||||
} else {
|
||||
$this->smarty->assign ( 'is_new', false ) ;
|
||||
}
|
||||
|
||||
//Remove Activities if one-to-many is not availible
|
||||
if (!isset($cardinality [ MB_ONETOMANY ]) && isset ($relatableModules['Activities'])) {
|
||||
unset ($relatableModules['Activities']);
|
||||
}
|
||||
|
||||
|
||||
// now enforce the relationship_only requirement - that is, only construct the underlying relationship and link fields, and not the UI, if the subpanel code will have troubles displaying the UI
|
||||
$relationships->enforceRelationshipOnly ( $relationship ) ;
|
||||
$this->smarty->assign ( 'view_module', $_REQUEST['view_module'] ) ;
|
||||
$this->smarty->assign ( 'rel', $relationship->getDefinition () ) ;
|
||||
$this->smarty->assign ( 'mod_strings', $GLOBALS [ 'mod_strings' ] ) ;
|
||||
$this->smarty->assign ( 'module_key', $relationship->lhs_module ) ;
|
||||
$this->smarty->assign ( 'cardinality', array_keys ( $cardinality ) ) ;
|
||||
$this->smarty->assign ( 'translated_cardinality', $cardinality ) ;
|
||||
$this->smarty->assign ( 'selected_cardinality', translate ( $relationship->getType () ) ) ;
|
||||
|
||||
$relatable = array ( ) ;
|
||||
foreach ( $relatableModules as $name => $dummy )
|
||||
{
|
||||
$relatable [ $name ] = translate ( $name ) ;
|
||||
}
|
||||
unset($relatable [ 'KBDocuments' ] ) ;
|
||||
natcasesort ( $relatable ) ;
|
||||
$this->smarty->assign ( 'relatable', array_keys ( $relatable ) ) ;
|
||||
$this->smarty->assign ( 'translated_relatable', $relatable ) ;
|
||||
$this->smarty->assign ( 'rhspanels', $rhs_subpanels ) ;
|
||||
$this->smarty->assign ( 'lhspanels', $lhs_subpanels ) ;
|
||||
$this->smarty->assign('selected_lang', $selected_lang);
|
||||
$this->smarty->assign('available_languages',get_languages());
|
||||
|
||||
switch ( $relationship->relationship_type)
|
||||
{
|
||||
case MB_ONETOONE :
|
||||
break ;
|
||||
|
||||
case MB_ONETOMANY :
|
||||
if (empty ( $relationship->relationship_column_name ))
|
||||
{
|
||||
$validRoleColumnFields = array ( ) ;
|
||||
foreach ( $fields as $field )
|
||||
{
|
||||
$validRoleColumnFields [] = $field ;
|
||||
}
|
||||
$this->smarty->assign ( 'relationship_role_column_enum', $validRoleColumnFields ) ;
|
||||
}
|
||||
if (! empty ( $relationship->relationship_role_column_value ))
|
||||
$this->smarty->assign ( 'relationship_role_column_value', $relationship->relationship_role_column_value ) ;
|
||||
break ;
|
||||
case MB_MANYTOMANY :
|
||||
if (! empty ( $relationship->relationship_role_column_value ))
|
||||
$this->smarty->assign ( 'relationship_role_column_value', $relationship->relationship_role_column_value ) ;
|
||||
break ;
|
||||
}
|
||||
|
||||
//see if we use the new system
|
||||
if (isset ( $_REQUEST [ 'json' ] ) && $_REQUEST [ 'json' ] == 'false')
|
||||
{
|
||||
echo $this->smarty->fetch ( 'modules/ModuleBuilder/tpls/studioRelationship.tpl' ) ;
|
||||
} else
|
||||
{
|
||||
$ac->addSection ( 'east', $module->name . ' ' . $GLOBALS [ 'mod_strings' ] [ 'LBL_RELATIONSHIPS' ], $this->smarty->fetch ( 'modules/ModuleBuilder/tpls/studioRelationship.tpl' ) ) ;
|
||||
echo $ac->getJavascript () ;
|
||||
}
|
||||
}
|
||||
}
|
||||
151
modules/ModuleBuilder/views/view.relationships.php
Executable file
151
modules/ModuleBuilder/views/view.relationships.php
Executable file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once ('modules/ModuleBuilder/MB/AjaxCompose.php') ;
|
||||
require_once ('modules/ModuleBuilder/MB/ModuleBuilder.php') ;
|
||||
require_once ('modules/ModuleBuilder/views/view.relationship.php') ;
|
||||
require_once ('modules/ModuleBuilder/Module/StudioModule.php') ;
|
||||
require_once ('modules/ModuleBuilder/Module/StudioBrowser.php') ;
|
||||
|
||||
class ViewRelationships extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
$moduleName = ! empty ( $_REQUEST [ 'view_module' ] ) ? $_REQUEST [ 'view_module' ] : $_REQUEST [ 'edit_module' ] ;
|
||||
$smarty = new Sugar_Smarty ( ) ;
|
||||
// set the mod_strings as we can be called after doing a Repair and the mod_strings are set to Administration
|
||||
$GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], 'ModuleBuilder');
|
||||
$smarty->assign ( 'mod_strings', $GLOBALS [ 'mod_strings' ] ) ;
|
||||
$smarty->assign ( 'view_module', $moduleName ) ;
|
||||
|
||||
$ajax = new AjaxCompose ( ) ;
|
||||
$json = getJSONobj () ;
|
||||
$this->fromModuleBuilder = !empty ( $_REQUEST [ 'MB' ] ) || (!empty($_REQUEST['view_package']) && $_REQUEST['view_package'] != 'studio') ;
|
||||
$smarty->assign('fromModuleBuilder', $this->fromModuleBuilder);
|
||||
if (!$this->fromModuleBuilder)
|
||||
{
|
||||
$smarty->assign ( 'view_package', '' ) ;
|
||||
|
||||
$relationships = new DeployedRelationships ( $moduleName ) ;
|
||||
$ajaxRelationships = $this->getAjaxRelationships( $relationships ) ;
|
||||
$smarty->assign ( 'relationships', $json->encode ( $ajaxRelationships ) ) ;
|
||||
$smarty->assign ( 'empty', (sizeof ( $ajaxRelationships ) == 0) ) ;
|
||||
$smarty->assign ( 'studio', true ) ;
|
||||
|
||||
//crumb
|
||||
global $app_list_strings ;
|
||||
$moduleNames = array_change_key_case ( $app_list_strings [ 'moduleList' ] ) ;
|
||||
$translatedModule = $moduleNames [ strtolower ( $moduleName ) ] ;
|
||||
$ajax->addCrumb ( translate('LBL_STUDIO'), 'ModuleBuilder.main("studio")' ) ;
|
||||
$ajax->addCrumb ( $translatedModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $moduleName . '")' ) ;
|
||||
$ajax->addCrumb ( translate('LBL_RELATIONSHIPS'), '' ) ;
|
||||
$ajax->addSection ( 'center', $moduleName . ' ' . translate('LBL_RELATIONSHIPS'), $smarty->fetch ( 'modules/ModuleBuilder/tpls/studioRelationships.tpl' ) ) ;
|
||||
|
||||
} else
|
||||
{
|
||||
$smarty->assign ( 'view_package', $_REQUEST [ 'view_package' ] ) ;
|
||||
|
||||
$mb = new ModuleBuilder ( ) ;
|
||||
$module = & $mb->getPackageModule ( $_REQUEST [ 'view_package' ], $_REQUEST [ 'view_module' ] ) ;
|
||||
$package = $mb->packages [ $_REQUEST [ 'view_package' ] ] ;
|
||||
$package->loadModuleTitles();
|
||||
$relationships = new UndeployedRelationships ( $module->getModuleDir () ) ;
|
||||
$ajaxRelationships = $this->getAjaxRelationships( $relationships ) ;
|
||||
$smarty->assign ( 'relationships', $json->encode ( $ajaxRelationships ) ) ;
|
||||
$smarty->assign ( 'empty', (sizeof ( $ajaxRelationships ) == 0) ) ;
|
||||
|
||||
$module->help [ 'default' ] = (empty ( $_REQUEST [ 'view_module' ] )) ? 'create' : 'modify' ;
|
||||
$module->help [ 'group' ] = 'module' ;
|
||||
|
||||
$ajax->addCrumb ( translate('LBL_MODULEBUILDER'), 'ModuleBuilder.main("mb")' ) ;
|
||||
$ajax->addCrumb ( $package->name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $package->name . '")' ) ;
|
||||
$ajax->addCrumb ( $moduleName, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $package->name . '&view_module=' . $moduleName . '")' ) ;
|
||||
$ajax->addCrumb ( translate('LBL_RELATIONSHIPS'), '' ) ;
|
||||
$ajax->addSection ( 'center', $moduleName . ' ' . translate('LBL_RELATIONSHIPS'), //$smarty->fetch('modules/ModuleBuilder/tpls/MBRelationship/relationships.tpl'));
|
||||
$smarty->fetch ( 'modules/ModuleBuilder/tpls/studioRelationships.tpl' ) ) ;
|
||||
}
|
||||
echo $ajax->getJavascript () ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode the relationships for this module for display in the Ext grid layout
|
||||
*/
|
||||
function getAjaxRelationships ( $relationships )
|
||||
{
|
||||
$ajaxrels = array ( ) ;
|
||||
foreach ( $relationships->getRelationshipList () as $relationshipName )
|
||||
{
|
||||
$rel = $relationships->get ( $relationshipName )->getDefinition () ;
|
||||
$rel [ 'lhs_module' ] = translate( $rel [ 'lhs_module' ] ) ;
|
||||
$rel [ 'rhs_module' ] = translate( $rel [ 'rhs_module' ] ) ;
|
||||
|
||||
//#28668 , translate the relationship type before render it .
|
||||
switch($rel['relationship_type']){
|
||||
case 'one-to-one':
|
||||
$rel['relationship_type'] = translate ( 'LBL_ONETOONE' );
|
||||
break;
|
||||
case 'one-to-many':
|
||||
$rel['relationship_type'] = translate ( 'LBL_ONETOMANY' );
|
||||
break;
|
||||
case 'many-to-one':
|
||||
$rel['relationship_type'] = translate ( 'LBL_MANYTOONE' );
|
||||
break;
|
||||
case 'many-to-many':
|
||||
$rel['relationship_type'] = translate ( 'LBL_MANYTOMANY' );
|
||||
break;
|
||||
default: $rel['relationship_type'] = '';
|
||||
}
|
||||
$rel [ 'name' ] = $relationshipName ;
|
||||
if ($rel [ 'is_custom' ] && isset($rel [ 'from_studio' ]) && $rel [ 'from_studio' ]) {
|
||||
$rel [ 'name' ] = $relationshipName . "*";
|
||||
}
|
||||
$ajaxrels [] = $rel ;
|
||||
}
|
||||
return $ajaxrels ;
|
||||
}
|
||||
}
|
||||
248
modules/ModuleBuilder/views/view.resetmodule.php
Executable file
248
modules/ModuleBuilder/views/view.resetmodule.php
Executable file
@@ -0,0 +1,248 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once ('modules/ModuleBuilder/MB/AjaxCompose.php') ;
|
||||
require_once ('modules/ModuleBuilder/MB/ModuleBuilder.php') ;
|
||||
require_once ('modules/ModuleBuilder/Module/StudioModule.php') ;
|
||||
require_once ('modules/ModuleBuilder/Module/StudioBrowser.php') ;
|
||||
require_once ('modules/DynamicFields/DynamicField.php') ;
|
||||
require_once 'modules/ModuleBuilder/Module/StudioModuleFactory.php' ;
|
||||
require_once 'modules/ModuleBuilder/parsers/views/DeployedMetaDataImplementation.php';
|
||||
|
||||
class ViewResetmodule extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
$moduleName = $this->module = $_REQUEST['view_module'];
|
||||
if (isset($_REQUEST['handle']) && $_REQUEST['handle'] == "execute") {
|
||||
return $this->handleSave();
|
||||
}
|
||||
|
||||
$ajax = new AjaxCompose ( ) ;
|
||||
$ajax->addCrumb ( translate('LBL_STUDIO'), 'ModuleBuilder.main("studio")' ) ;
|
||||
$ajax->addCrumb ( translate($moduleName), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $moduleName . '")' ) ;
|
||||
$ajax->addCrumb ( translate('LBL_RESET') . " " . translate($moduleName) , '') ;
|
||||
|
||||
$smarty = new Sugar_Smarty ( ) ;
|
||||
$smarty->assign("module", $moduleName);
|
||||
$smarty->assign("actions", array(
|
||||
array("name" => "relationships", "label" => translate("LBL_CLEAR_RELATIONSHIPS")),
|
||||
array("name" => "fields", "label" => translate("LBL_REMOVE_FIELDS")),
|
||||
array("name" => "layouts", "label" => translate("LBL_RESET_LAYOUTS")),
|
||||
array("name" => "labels", "label" => translate("LBL_RESET_LABELS")),
|
||||
array("name" => "extensions", "label" => translate("LBL_CLEAR_EXTENSIONS")),
|
||||
));
|
||||
|
||||
$ajax->addSection (
|
||||
'center',
|
||||
"Reset ". translate($moduleName) ,
|
||||
$smarty->fetch('modules/ModuleBuilder/tpls/resetModule.tpl') //"This works now"
|
||||
) ;
|
||||
|
||||
echo $ajax->getJavascript () ;
|
||||
}
|
||||
|
||||
function handleSave()
|
||||
{
|
||||
$out = "<script>ajaxStatus.flashStatus(SUGAR.language.get('app_strings', 'LBL_REQUEST_PROCESSED'), 2000);</script>";
|
||||
|
||||
if (!empty($_REQUEST['relationships']))
|
||||
$out .= $this->removeCustomRelationships();
|
||||
|
||||
if (!empty($_REQUEST['fields']))
|
||||
$out .= $this->removeCustomFields();
|
||||
|
||||
if (!empty($_REQUEST['layouts']))
|
||||
$out .= $this->removeCustomLayouts();
|
||||
|
||||
if (!empty($_REQUEST['labels']))
|
||||
$out .= $this->removeCustomLabels();
|
||||
|
||||
if (!empty($_REQUEST['extensions']))
|
||||
$out .= $this->removeCustomExtensions();
|
||||
|
||||
|
||||
$out .= "Complete!";
|
||||
|
||||
$ajax = new AjaxCompose ( ) ;
|
||||
|
||||
$ajax->addCrumb ( translate('LBL_STUDIO'), 'ModuleBuilder.main("studio")' ) ;
|
||||
$ajax->addCrumb ( translate($this->module), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $this->module . '")' ) ;
|
||||
$ajax->addCrumb ( "Reset ". translate($this->module) , '') ;
|
||||
|
||||
|
||||
$ajax->addSection (
|
||||
'center',
|
||||
"Reset ". translate($this->module) ,
|
||||
$out
|
||||
) ;
|
||||
|
||||
echo $ajax->getJavascript () ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all custom fields created in studio
|
||||
*
|
||||
* @return html output record of the field deleted
|
||||
*/
|
||||
function removeCustomFields()
|
||||
{
|
||||
$moduleName = $this->module;
|
||||
$class_name = $GLOBALS [ 'beanList' ] [ $moduleName ] ;
|
||||
require_once ($GLOBALS [ 'beanFiles' ] [ $class_name ]) ;
|
||||
$seed = new $class_name ( ) ;
|
||||
$df = new DynamicField ( $moduleName ) ;
|
||||
$df->setup ( $seed ) ;
|
||||
|
||||
|
||||
$module = StudioModuleFactory::getStudioModule( $moduleName ) ;
|
||||
$customFields = array();
|
||||
foreach($seed->field_defs as $def) {
|
||||
if(isset($def['source']) && $def['source'] == 'custom_fields') {
|
||||
$field = $df->getFieldWidget($moduleName, $def['name']);
|
||||
$field->delete ( $df ) ;
|
||||
|
||||
$module->removeFieldFromLayouts( $def['name'] );
|
||||
$customFields[] = $def['name'];
|
||||
}
|
||||
}
|
||||
$out = "";
|
||||
foreach ($customFields as $field) {
|
||||
$out .= "Removed field $field<br/>";
|
||||
}
|
||||
return ($out);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the metadata files for all known studio layouts.
|
||||
*
|
||||
* @return html output record of the files deleted
|
||||
*/
|
||||
function removeCustomLayouts()
|
||||
{
|
||||
$module = StudioModuleFactory::getStudioModule( $this->module ) ;
|
||||
$sources = $module->getViewMetadataSources();
|
||||
|
||||
$out = "";
|
||||
foreach($sources as $view)
|
||||
{
|
||||
$file = DeployedMetaDataImplementation::getFileName($view['type'], $this->module);
|
||||
if (file_exists($file)) {
|
||||
unlink($file);
|
||||
$out .= "Removed layout {$view['type']}.php<br/>";
|
||||
}
|
||||
}
|
||||
|
||||
// now clear the cache
|
||||
include_once ('include/TemplateHandler/TemplateHandler.php') ;
|
||||
TemplateHandler::clearCache ( $this->module ) ;
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all custom relationships containing this module
|
||||
*
|
||||
* @return html output record of the files deleted
|
||||
*/
|
||||
function removeCustomRelationships()
|
||||
{
|
||||
require_once 'modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php' ;
|
||||
$out = "";
|
||||
$madeChanges = false;
|
||||
$relationships = new DeployedRelationships ( $this->module ) ;
|
||||
|
||||
foreach ( $relationships->getRelationshipList () as $relationshipName )
|
||||
{
|
||||
$rel = $relationships->get ( $relationshipName )->getDefinition () ;
|
||||
if ($rel [ 'is_custom' ] || (isset($rel [ 'from_studio' ]) && $rel [ 'from_studio' ])) {
|
||||
$relationships->delete ($relationshipName);
|
||||
$out .= "Removed relationship $relationshipName<br/>";
|
||||
}
|
||||
}
|
||||
if ($madeChanges)
|
||||
$relationships->save () ;
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
function removeCustomLabels()
|
||||
{
|
||||
$out = "";
|
||||
$languageDir = "custom/modules/{$this->module}/language";
|
||||
if (is_dir($languageDir)) {
|
||||
$files = scandir($languageDir);
|
||||
foreach ($files as $langFile) {
|
||||
if (substr($langFile, 0 ,1) == '.') continue;
|
||||
$language = substr($langFile, 0, strlen($langFile) - 9);
|
||||
unlink($languageDir . "/" . $langFile);
|
||||
|
||||
LanguageManager::clearLanguageCache ( $this->module, $language ) ;
|
||||
$out .= "Removed language file $langFile<br/>";
|
||||
}
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
function removeCustomExtensions()
|
||||
{
|
||||
$out = "";
|
||||
$extDir = "custom/Extension/modules/{$this->module}";
|
||||
if (is_dir($extDir)) {
|
||||
rmdir_recursive($extDir);
|
||||
require_once ('modules/Administration/QuickRepairAndRebuild.php') ;
|
||||
$rac = new RepairAndClear ( ) ;
|
||||
$rac->repairAndClearAll ( array ( 'clearAll' ), array ( $this->module ), true, false ) ;
|
||||
$rac->rebuildExtensions();
|
||||
$out .= "Cleared extensions for {$this->module}<br/>";
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
137
modules/ModuleBuilder/views/view.searchview.php
Executable file
137
modules/ModuleBuilder/views/view.searchview.php
Executable file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' ) ;
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once ('modules/ModuleBuilder/views/view.listview.php') ;
|
||||
require_once 'modules/ModuleBuilder/parsers/constants.php' ;
|
||||
|
||||
class ViewSearchView extends ViewListView
|
||||
{
|
||||
function ViewSearchView()
|
||||
{
|
||||
$this->init () ;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function init()
|
||||
{
|
||||
parent::init () ;
|
||||
if (!empty($_REQUEST['searchlayout'])) {
|
||||
$this->editLayout = $_REQUEST['searchlayout'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// DO NOT REMOVE - overrides parent ViewEdit preDisplay() which attempts to load a bean for a non-existent module
|
||||
function preDisplay()
|
||||
{
|
||||
}
|
||||
|
||||
function display(
|
||||
$preview = false
|
||||
)
|
||||
{
|
||||
$packageName = (isset ( $_REQUEST [ 'view_package' ] )) ? $_REQUEST [ 'view_package' ] : '' ;
|
||||
require_once 'modules/ModuleBuilder/parsers/ParserFactory.php' ;
|
||||
$parser = ParserFactory::getParser ( $this->editLayout , $this->editModule, $packageName ) ;
|
||||
|
||||
$smarty = parent::constructSmarty ( $parser ) ;
|
||||
$smarty->assign ( 'action', 'searchViewSave' ) ;
|
||||
$smarty->assign ( 'view', $this->editLayout ) ;
|
||||
$smarty->assign ( 'helpName', 'searchViewEditor' ) ;
|
||||
$smarty->assign ( 'helpDefault', 'modify' ) ;
|
||||
|
||||
if ($preview)
|
||||
{
|
||||
echo $smarty->fetch ( "modules/ModuleBuilder/tpls/Preview/listView.tpl" ) ;
|
||||
} else
|
||||
{
|
||||
$ajax = $this->constructAjax () ;
|
||||
$ajax->addSection ( 'center', translate ($this->title), $smarty->fetch ( "modules/ModuleBuilder/tpls/listView.tpl" ) ) ;
|
||||
echo $ajax->getJavascript () ;
|
||||
}
|
||||
}
|
||||
|
||||
function constructAjax()
|
||||
{
|
||||
require_once ('modules/ModuleBuilder/MB/AjaxCompose.php') ;
|
||||
$ajax = new AjaxCompose ( ) ;
|
||||
switch ( $this->editLayout )
|
||||
{
|
||||
default:
|
||||
$searchLabel = 'LBL_' . strtoupper ( $this->editLayout) ;
|
||||
}
|
||||
|
||||
$layoutLabel = 'LBL_LAYOUTS' ;
|
||||
$layoutView = 'layouts' ;
|
||||
|
||||
|
||||
if ($this->fromModuleBuilder)
|
||||
{
|
||||
$ajax->addCrumb ( translate ( 'LBL_MODULEBUILDER', 'ModuleBuilder' ), 'ModuleBuilder.main("mb")' ) ;
|
||||
$ajax->addCrumb ( $_REQUEST [ 'view_package' ], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $_REQUEST [ 'view_package' ] . '")' ) ;
|
||||
$ajax->addCrumb ( $this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $_REQUEST [ 'view_package' ] . "&view_module={$this->editModule}" . '")' ) ;
|
||||
$ajax->addCrumb ( translate ( $layoutLabel, 'ModuleBuilder' ), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view_module=' . $this->editModule. '&view_package=' . $_REQUEST['view_package'] . '")' ) ;
|
||||
if ( $layoutLabel == 'LBL_LAYOUTS' ) $ajax->addCrumb ( translate ( 'LBL_SEARCH_FORMS', 'ModuleBuilder' ), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view=search&view_module=' .$this->editModule . '&view_package=' . $_REQUEST [ 'view_package' ] . '")' ) ;
|
||||
$ajax->addCrumb ( translate ( $searchLabel, 'ModuleBuilder' ), '' ) ;
|
||||
} else
|
||||
{
|
||||
$ajax->addCrumb ( translate ( 'LBL_STUDIO', 'ModuleBuilder' ), 'ModuleBuilder.main("studio")' ) ;
|
||||
$ajax->addCrumb ( $this->translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $this->editModule . '")' ) ;
|
||||
$ajax->addCrumb ( translate ( $layoutLabel, 'ModuleBuilder' ), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view='.$layoutView.'&view_module=' . $this->editModule . '")' ) ;
|
||||
if ( $layoutLabel == 'LBL_LAYOUTS' ) $ajax->addCrumb ( translate ( 'LBL_SEARCH_FORMS', 'ModuleBuilder' ), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=search&view_module=' .$this->editModule . '")' ) ;
|
||||
$ajax->addCrumb ( translate ( $searchLabel, 'ModuleBuilder' ), '' ) ;
|
||||
}
|
||||
$this->title = $searchLabel;
|
||||
return $ajax ;
|
||||
}
|
||||
}
|
||||
80
modules/ModuleBuilder/views/view.tree.php
Executable file
80
modules/ModuleBuilder/views/view.tree.php
Executable file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/ModuleBuilder/MB/AjaxCompose.php');
|
||||
require_once('modules/ModuleBuilder/Module/StudioModule.php');
|
||||
require_once('modules/ModuleBuilder/Module/StudioBrowser.php') ;
|
||||
require_once('include/ytree/ExtNode.php') ;
|
||||
|
||||
class ViewHistory extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
//STUDIO LABELS ONLY//
|
||||
//TODO Bundle Studio and ModuleBuilder label handling to increase maintainability.
|
||||
function display()
|
||||
{
|
||||
$root = new ExtNode('root', 'root', true);
|
||||
$sb = new StudioBrowser();
|
||||
$sb->loadModules();
|
||||
foreach($sb->modules as $name => $studioMod) {
|
||||
$root->add_node($this->buildStudioNode($studioMod));
|
||||
}
|
||||
$json = getJSONobj();
|
||||
echo($json->encode($root));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ExtNode built from the passed StudioModule
|
||||
* @param $module StudioModule
|
||||
*/
|
||||
function buildStudioNode($module) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
339
modules/ModuleBuilder/views/view.wizard.php
Executable file
339
modules/ModuleBuilder/views/view.wizard.php
Executable file
@@ -0,0 +1,339 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* 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 or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once ('modules/ModuleBuilder/MB/AjaxCompose.php') ;
|
||||
require_once ('modules/ModuleBuilder/Module/StudioModuleFactory.php') ;
|
||||
require_once ('include/MVC/View/SugarView.php') ;
|
||||
|
||||
class ModuleBuilderViewWizard extends SugarView
|
||||
{
|
||||
private $view = null ; // the wizard view to display
|
||||
private $actions ;
|
||||
private $buttons ;
|
||||
private $question ;
|
||||
private $title ;
|
||||
private $help ;
|
||||
|
||||
private $editModule ;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
if ( isset ( $_REQUEST [ 'view' ] ) )
|
||||
$this->view = $_REQUEST [ 'view' ] ;
|
||||
|
||||
$this->editModule = (! empty ( $_REQUEST [ 'view_module' ] ) ) ? $_REQUEST [ 'view_module' ] : null ;
|
||||
$this->buttons = array(); // initialize so that modules without subpanels for example don't result in this being unset and causing problems in the smarty->assign
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
translate('LBL_MODULE_NAME','Administration'),
|
||||
$mod_strings['LBL_MODULEBUILDER'],
|
||||
);
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
$this->ajax = new AjaxCompose ( ) ;
|
||||
$smarty = new Sugar_Smarty ( ) ;
|
||||
|
||||
if (isset ( $_REQUEST [ 'MB' ] ))
|
||||
{
|
||||
$this->processMB ( $this->ajax ) ;
|
||||
} else
|
||||
{
|
||||
|
||||
$this->processStudio ( $this->ajax ) ;
|
||||
|
||||
}
|
||||
|
||||
$smarty->assign ( 'buttons', $this->buttons ) ;
|
||||
$smarty->assign ( 'image_path', $GLOBALS [ 'image_path' ] ) ;
|
||||
$smarty->assign ( "title", $this->title ) ;
|
||||
$smarty->assign ( "question", $this->question ) ;
|
||||
$smarty->assign ( "defaultHelp", $this->help ) ;
|
||||
$smarty->assign ( "actions", $this->actions ) ;
|
||||
|
||||
$this->ajax->addSection ( 'center', $this->title, $smarty->fetch ( 'modules/ModuleBuilder/tpls/wizard.tpl' ) ) ;
|
||||
echo $this->ajax->getJavascript () ;
|
||||
}
|
||||
|
||||
function processStudio(
|
||||
$ajax
|
||||
)
|
||||
{
|
||||
|
||||
$this->ajax->addCrumb ( translate( 'LBL_STUDIO' ), 'ModuleBuilder.main("studio")' ) ;
|
||||
|
||||
if (! isset ( $this->editModule ))
|
||||
{
|
||||
//Studio Select Module Page
|
||||
$this->generateStudioModuleButtons () ;
|
||||
$this->question = translate('LBL_QUESTION_EDIT') ;
|
||||
$this->title = translate( 'LBL_STUDIO' );
|
||||
global $current_user;
|
||||
if (is_admin($current_user))
|
||||
$this->actions = "<input class=\"button\" type=\"button\" id=\"exportBtn\" name=\"exportBtn\" onclick=\"ModuleBuilder.getContent('module=ModuleBuilder&action=exportcustomizations');\" value=\"" . translate ( 'LBL_BTN_EXPORT' ) . '">' ;
|
||||
|
||||
$this->help = 'studioHelp' ;
|
||||
} else
|
||||
{
|
||||
$module = StudioModuleFactory::getStudioModule( $this->editModule ) ;
|
||||
$this->ajax->addCrumb ( $module->name, !empty($this->view) ? 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $this->editModule . '")' : '' ) ;
|
||||
switch ( $this->view )
|
||||
{
|
||||
case 'layouts':
|
||||
//Studio Select Layout page
|
||||
$this->buttons = $module->getLayouts() ;
|
||||
$this->title = $module->name . " " . translate('LBL_LAYOUTS') ;
|
||||
$this->question = translate( 'LBL_QUESTION_LAYOUT' ) ;
|
||||
$this->help = 'layoutsHelp' ;
|
||||
$this->ajax->addCrumb ( translate( 'LBL_LAYOUTS' ), '' ) ;
|
||||
break;
|
||||
|
||||
|
||||
case 'subpanels':
|
||||
//Studio Select Subpanel page.
|
||||
$this->buttons = $module->getSubpanels() ;
|
||||
$this->title = $module->name . " " . translate( 'LBL_SUBPANELS' ) ;
|
||||
$this->question = translate( 'LBL_QUESTION_SUBPANEL' ) ;
|
||||
$this->ajax->addCrumb ( translate( 'LBL_SUBPANELS' ), '' ) ;
|
||||
$this->help = 'subpanelHelp' ;
|
||||
break;
|
||||
|
||||
case 'search':
|
||||
//Studio Select Search Layout page.
|
||||
$this->buttons = $module->getSearch() ;
|
||||
$this->title = $module->name . " " . translate('LBL_SEARCH');
|
||||
$this->question = translate( 'LBL_QUESTION_SEARCH' ) ;
|
||||
$this->ajax->addCrumb ( translate( 'LBL_LAYOUTS' ), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=layouts&view_module=' . $this->editModule . '")' ) ;
|
||||
$this->ajax->addCrumb ( translate( 'LBL_SEARCH' ), '' ) ;
|
||||
$this->help = 'searchHelp' ;
|
||||
break;
|
||||
|
||||
case 'dashlet':
|
||||
$this->generateStudioDashletButtons();
|
||||
$this->title = $this->editModule ." " .translate('LBL_DASHLET');
|
||||
$this->question = translate( 'LBL_QUESTION_DASHLET' ) ;
|
||||
$this->ajax->addCrumb ( translate( 'LBL_LAYOUTS' ), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=layouts&view_module=' . $this->editModule . '")' ) ;
|
||||
$this->ajax->addCrumb ( translate( 'LBL_DASHLET' ), '' ) ;
|
||||
$this->help = 'dashletHelp' ;
|
||||
break;
|
||||
|
||||
case 'popup':
|
||||
$this->generateStudioPopupButtons();
|
||||
$this->title = $this->editModule ." " .translate('LBL_POPUP');
|
||||
$this->question = translate( 'LBL_QUESTION_POPUP' ) ;
|
||||
$this->ajax->addCrumb ( translate( 'LBL_LAYOUTS' ), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=layouts&view_module=' . $this->editModule . '")' ) ;
|
||||
$this->ajax->addCrumb ( translate( 'LBL_POPUP' ), '' ) ;
|
||||
$this->help = 'popupHelp' ;
|
||||
break;
|
||||
default:
|
||||
//Studio Edit Module Page
|
||||
$this->buttons = $module->getModule () ;
|
||||
$this->question = translate( 'LBL_QUESTION_MODULE' ) ;
|
||||
$this->title = translate( 'LBL_EDIT' ) . " " . $module->name ;
|
||||
$this->help = 'moduleHelp' ;
|
||||
global $current_user;
|
||||
if (is_admin($current_user))
|
||||
$this->actions = "<input class=\"button\" type=\"button\" id=\"exportBtn\" name=\"exportBtn\" "
|
||||
. "onclick=\"ModuleBuilder.getContent('module=ModuleBuilder&action=resetmodule&view_module=$this->editModule');\" value=\""
|
||||
. "Reset Module". '">' ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function processMB (
|
||||
$ajax
|
||||
)
|
||||
{
|
||||
if (! isset ( $_REQUEST [ 'view_package' ] ))
|
||||
{
|
||||
sugar_die ( "no ModuleBuilder package set" ) ;
|
||||
}
|
||||
|
||||
$this->editModule = $_REQUEST [ 'view_module' ] ;
|
||||
$this->package = $_REQUEST [ 'view_package' ] ;
|
||||
|
||||
$ajax->addCrumb ( translate ( 'LBL_MODULEBUILDER', 'ModuleBuilder' ), 'ModuleBuilder.main("mb")' ) ;
|
||||
$ajax->addCrumb ( $this->package, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&view_package=' . $this->package . '")' ) ;
|
||||
$ajax->addCrumb ( $this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_module=' . $this->editModule . '&view_package=' . $this->package . '")') ;
|
||||
|
||||
switch ( $this->view )
|
||||
{
|
||||
case 'search':
|
||||
//MB Select Search Layout page.
|
||||
$this->generateMBSearchButtons () ;
|
||||
$this->title = $this->editModule . " " . translate( 'LBL_SEARCH' ) ;
|
||||
$this->question = translate( 'LBL_QUESTION_SEARCH' ) ;
|
||||
$ajax->addCrumb ( translate( 'LBL_LAYOUTS' ), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view_module=' . $this->editModule . '&view_package=' . $this->package . '")' ) ;
|
||||
$ajax->addCrumb ( translate( 'LBL_SEARCH_FORMS' ), '' ) ;
|
||||
$this->help = "searchHelp" ;
|
||||
break;
|
||||
|
||||
case 'subpanel':
|
||||
//ModuleBuilder Select Subpanel
|
||||
$ajax->addCrumb ( $this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_module=' . $this->editModule . '&view_package=' . $this->package . '")' ) ;
|
||||
$ajax->addCrumb ( translate( 'LBL_SUBPANELS' ), '' ) ;
|
||||
$this->question = translate( 'LBL_QUESTION_SUBPANEL' ) ;
|
||||
$this->help = 'subpanelHelp' ;
|
||||
break;
|
||||
|
||||
case 'dashlet':
|
||||
$this->generateMBDashletButtons ();
|
||||
$this->title = $this->editModule ." " .translate('LBL_DASHLET');
|
||||
$this->question = translate( 'LBL_QUESTION_DASHLET' ) ;
|
||||
$this->ajax->addCrumb ( translate( 'LBL_LAYOUTS' ), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=layouts&MB=1&view_package='.$this->package.'&view_module=' . $this->editModule . '")' ) ;
|
||||
$this->ajax->addCrumb ( translate( 'LBL_DASHLET' ), '' ) ;
|
||||
$this->help = 'dashletHelp' ;
|
||||
break;
|
||||
|
||||
|
||||
case 'popup':
|
||||
$this->generateMBPopupButtons();
|
||||
$this->title = $this->editModule ." " .translate('LBL_POPUP');
|
||||
$this->question = translate( 'LBL_QUESTION_POPUP' ) ;
|
||||
$this->ajax->addCrumb ( translate( 'LBL_LAYOUTS' ), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view=layouts&MB=1&view_package='.$this->package.'&view_module=' . $this->editModule . '")' ) ;
|
||||
$this->ajax->addCrumb ( translate( 'LBL_POPUP' ), '' ) ;
|
||||
$this->help = 'popupHelp' ;
|
||||
break;
|
||||
default:
|
||||
$ajax->addCrumb ( translate( 'LBL_LAYOUTS' ), '' ) ;
|
||||
$this->generateMBViewButtons () ;
|
||||
$this->title = $this->editModule . " " . translate( 'LBL_LAYOUTS' ) ;
|
||||
$this->question = translate( 'LBL_QUESTION_LAYOUT' ) ;
|
||||
$this->help = "layoutsHelp" ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function generateStudioModuleButtons()
|
||||
{
|
||||
require_once ('modules/ModuleBuilder/Module/StudioBrowser.php') ;
|
||||
$sb = new StudioBrowser ( ) ;
|
||||
$sb->loadModules () ;
|
||||
$nodes = $sb->getNodes () ;
|
||||
$this->buttons = array ( ) ;
|
||||
//$GLOBALS['log']->debug(print_r($nodes,true));
|
||||
foreach ( $nodes as $module )
|
||||
{
|
||||
$this->buttons [ $module [ 'name' ] ] = array ( 'action' => $module [ 'action' ] , 'imageTitle' => ucfirst ( $module [ 'module' ] . "_32" ) , 'size' => '32' ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function generateMBViewButtons()
|
||||
{
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ] [ 'LBL_EDITVIEW' ] ] =
|
||||
array (
|
||||
'action' => "module=ModuleBuilder&MB=true&action=editLayout&view=".MB_EDITVIEW."&view_module={$this->editModule}&view_package={$this->package}" ,
|
||||
'imageTitle' => 'EditView',
|
||||
'help'=>'viewBtnEditView'
|
||||
) ;
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ] [ 'LBL_DETAILVIEW' ] ] =
|
||||
array (
|
||||
'action' => "module=ModuleBuilder&MB=true&action=editLayout&view=".MB_DETAILVIEW."&view_module={$this->editModule}&view_package={$this->package}" ,
|
||||
'imageTitle' => 'DetailView',
|
||||
'help'=>'viewBtnListView'
|
||||
) ;
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ] [ 'LBL_LISTVIEW' ] ] =
|
||||
array (
|
||||
'action' => "module=ModuleBuilder&MB=true&action=editLayout&view=".MB_LISTVIEW."&view_module={$this->editModule}&view_package={$this->package}" ,
|
||||
'imageTitle' => 'ListView',
|
||||
'help'=>'viewBtnListView'
|
||||
) ;
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ] [ 'LBL_QUICKCREATE' ] ] =
|
||||
array (
|
||||
'action' => "module=ModuleBuilder&MB=true&action=editLayout&view=".MB_QUICKCREATE."&view_module={$this->editModule}&view_package={$this->package}" ,
|
||||
'imageTitle' => 'QuickCreate',
|
||||
'help'=>'viewBtnQuickCreate'
|
||||
) ;
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ] [ 'LBL_SEARCH' ] ] =
|
||||
array (
|
||||
'action' => "module=ModuleBuilder&MB=true&action=wizard&view=search&view_module={$this->editModule}&view_package={$this->package}" ,
|
||||
'imageTitle' => 'SearchForm' ,
|
||||
'help'=> 'searchBtn'
|
||||
) ;
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ] [ 'LBL_DASHLET' ] ] =
|
||||
array (
|
||||
'action' => "module=ModuleBuilder&MB=true&action=wizard&view=dashlet&view_module={$this->editModule}&view_package={$this->package}" ,
|
||||
'imageTitle' => 'Dashlet',
|
||||
'help'=>'viewBtnDashlet'
|
||||
) ;
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ] ['LBL_POPUP'] ] =
|
||||
array (
|
||||
'imageTitle' => 'Popup',
|
||||
'action' => "module=ModuleBuilder&MB=true&action=wizard&view=popup&view_module={$this->editModule}&view_package={$this->package}",
|
||||
'help'=>'PopupListViewBtn'
|
||||
);
|
||||
}
|
||||
|
||||
function generateMBDashletButtons()
|
||||
{
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ][ 'LBL_DASHLETLISTVIEW' ] ] = array('action'=> "module=ModuleBuilder&MB=true&action=editLayout&view=dashlet&view_module={$this->editModule}&view_package={$this->package}", 'imageTitle'=> $GLOBALS ['mod_strings']['LBL_DASHLETLISTVIEW'], 'imageName'=>'ListView', 'help'=>'DashletListViewBtn');
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ][ 'LBL_DASHLETSEARCHVIEW' ] ] = array('action'=> "module=ModuleBuilder&MB=true&action=editLayout&view=dashletsearch&view_module={$this->editModule}&view_package={$this->package}", 'imageTitle'=> $GLOBALS ['mod_strings']['LBL_DASHLETSEARCHVIEW'], 'imageName'=>'BasicSearch','help'=> 'DashletSearchViewBtn');
|
||||
}
|
||||
|
||||
function generateMBPopupButtons()
|
||||
{
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ][ 'LBL_POPUPLISTVIEW' ] ] = array('action'=> "module=ModuleBuilder&action=editLayout&view=popuplist&view_module={$this->editModule}&view_package={$this->package}", 'imageTitle'=> $GLOBALS ['mod_strings']['LBL_POPUPLISTVIEW'], 'imageName'=>'ListView', 'help'=>'PopupListViewBtn');
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ][ 'LBL_POPUPSEARCH' ] ] = array('action'=> "module=ModuleBuilder&action=editLayout&view=popupsearch&view_module={$this->editModule}&view_package={$this->package}", 'imageTitle'=> $GLOBALS ['mod_strings']['LBL_POPUPSEARCH'], 'imageName'=>'BasicSearch','help'=> 'PopupSearchViewBtn');
|
||||
}
|
||||
|
||||
function generateStudioDashletButtons()
|
||||
{
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ][ 'LBL_DASHLETLISTVIEW' ] ] = array('action'=> "module=ModuleBuilder&action=editLayout&view=dashlet&view_module={$this->editModule}", 'imageTitle'=> $GLOBALS ['mod_strings']['LBL_DASHLETLISTVIEW'], 'imageName'=>'ListView', 'help'=>'DashletListViewBtn');
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ][ 'LBL_DASHLETSEARCHVIEW' ] ] = array('action'=> "module=ModuleBuilder&action=editLayout&view=dashletsearch&view_module={$this->editModule}", 'imageTitle'=> $GLOBALS ['mod_strings']['LBL_DASHLETSEARCHVIEW'], 'imageName'=>'BasicSearch','help'=> 'DashletSearchViewBtn');
|
||||
}
|
||||
|
||||
function generateStudioPopupButtons()
|
||||
{
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ][ 'LBL_POPUPLISTVIEW' ] ] = array('action'=> "module=ModuleBuilder&action=editLayout&view=popuplist&view_module={$this->editModule}", 'imageTitle'=> $GLOBALS ['mod_strings']['LBL_POPUPLISTVIEW'], 'imageName'=>'ListView', 'help'=>'PopupListViewBtn');
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ][ 'LBL_POPUPSEARCH' ] ] = array('action'=> "module=ModuleBuilder&action=editLayout&view=popupsearch&view_module={$this->editModule}", 'imageTitle'=> $GLOBALS ['mod_strings']['LBL_POPUPSEARCH'], 'imageName'=>'BasicSearch','help'=> 'PopupSearchViewBtn');
|
||||
}
|
||||
|
||||
function generateMBSearchButtons()
|
||||
{
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ] [ 'LBL_BASIC' ] ] = array ( 'action' => "module=ModuleBuilder&MB=true&action=editLayout&view_module={$this->editModule}&view_package={$this->package}&view=SearchView&searchlayout=basic_search" , 'imageTitle' => $GLOBALS [ 'mod_strings' ] [ 'LBL_BASIC_SEARCH' ] , 'imageName' => 'BasicSearch','help' => "BasicSearchBtn" ) ;
|
||||
$this->buttons [ $GLOBALS [ 'mod_strings' ] [ 'LBL_ADVANCED' ] ] = array ( 'action' => "module=ModuleBuilder&MB=true&action=editLayout&view_module={$this->editModule}&view_package={$this->package}&view=SearchView&searchlayout=advanced_search" , 'imageTitle' => $GLOBALS [ 'mod_strings' ] [ 'LBL_ADVANCED_SEARCH' ] , 'imageName' => 'AdvancedSearch','help' => "AdvancedSearchBtn" ) ;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user