Add php files
This commit is contained in:
107
modules/Configurator/views/view.addfontresult.php
Executable file
107
modules/Configurator/views/view.addfontresult.php
Executable file
@@ -0,0 +1,107 @@
|
||||
<?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/SugarView.php');
|
||||
class ConfiguratorViewAddFontResult extends SugarView {
|
||||
var $log="";
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function AddFontResult(){
|
||||
parent::SugarView();
|
||||
}
|
||||
/**
|
||||
* display the form
|
||||
*/
|
||||
public function display(){
|
||||
global $mod_strings, $app_list_strings, $app_strings, $current_user;
|
||||
if(!is_admin($current_user)){
|
||||
sugar_die('Admin Only');
|
||||
}
|
||||
$error = $this->addFont();
|
||||
|
||||
$this->ss->assign("MODULE_TITLE",
|
||||
get_module_title(
|
||||
$mod_strings['LBL_MODULE_ID'],
|
||||
$mod_strings['LBL_ADDFONTRESULT_TITLE'],
|
||||
false
|
||||
)
|
||||
);
|
||||
if($error){
|
||||
$this->ss->assign("error", $this->log);
|
||||
}else{
|
||||
$this->ss->assign("info", $this->log);
|
||||
}
|
||||
$this->ss->assign("MOD", $mod_strings);
|
||||
$this->ss->assign("APP", $app_strings);
|
||||
//display
|
||||
$this->ss->display('modules/Configurator/tpls/addFontResult.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* This method prepares the received data and call the addFont method of the fontManager
|
||||
* @return boolean true on success
|
||||
*/
|
||||
private function addFont(){
|
||||
$this->log="";
|
||||
$error=false;
|
||||
require_once('include/upload_file.php');
|
||||
$files = array("pdf_metric_file","pdf_font_file");
|
||||
foreach($files as $k){
|
||||
// handle uploaded file
|
||||
$uploadFile = new UploadFile($k);
|
||||
if (isset($_FILES[$k]) && $uploadFile->confirm_upload()){
|
||||
$uploadFile->final_move(basename($_FILES[$k]['name']));
|
||||
$uploadFileNames[$k] = $uploadFile->get_upload_path(basename($_FILES[$k]['name']));
|
||||
}else{
|
||||
$this->log = translate('ERR_PDF_NO_UPLOAD', "Configurator");
|
||||
$error=true;
|
||||
}
|
||||
}
|
||||
if(!$error){
|
||||
require_once('include/Sugarpdf/FontManager.php');
|
||||
$fontManager = new FontManager();
|
||||
$error = $fontManager->addFont($uploadFileNames["pdf_font_file"],$uploadFileNames["pdf_metric_file"], $_REQUEST['pdf_embedded'], $_REQUEST['pdf_encoding_table'], eval($_REQUEST['pdf_patch']), htmlspecialchars_decode($_REQUEST['pdf_cidinfo'],ENT_QUOTES), $_REQUEST['pdf_style_list']);
|
||||
$this->log .= $fontManager->log;
|
||||
if($error){
|
||||
$this->log .= implode("\n",$fontManager->errors);
|
||||
}
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
||||
85
modules/Configurator/views/view.addfontview.php
Executable file
85
modules/Configurator/views/view.addfontview.php
Executable file
@@ -0,0 +1,85 @@
|
||||
<?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/SugarView.php');
|
||||
require_once('include/Sugarpdf/FontManager.php');
|
||||
class ConfiguratorViewAddFontView extends SugarView {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function AddFontView(){
|
||||
parent::SugarView();
|
||||
}
|
||||
/**
|
||||
* display the form
|
||||
*/
|
||||
public function display(){
|
||||
global $mod_strings, $app_list_strings, $app_strings, $current_user;
|
||||
if(!is_admin($current_user)){
|
||||
sugar_die('Admin Only');
|
||||
}
|
||||
$this->ss->assign("MODULE_TITLE",
|
||||
get_module_title(
|
||||
$mod_strings['LBL_MODULE_ID'],
|
||||
$mod_strings['LBL_ADDFONT_TITLE'],
|
||||
true
|
||||
)
|
||||
);
|
||||
if(!empty($_REQUEST['error'])){
|
||||
$this->ss->assign("error", $_REQUEST['error']);
|
||||
}
|
||||
$this->ss->assign("MOD", $mod_strings);
|
||||
$this->ss->assign("APP", $app_strings);
|
||||
if(isset($_REQUEST['return_action'])){
|
||||
$this->ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
|
||||
}else{
|
||||
$this->ss->assign("RETURN_ACTION", 'FontManager');
|
||||
}
|
||||
$this->ss->assign("STYLE_LIST", array(
|
||||
"regular"=>$mod_strings["LBL_FONT_REGULAR"],
|
||||
"italic"=>$mod_strings["LBL_FONT_ITALIC"],
|
||||
"bold"=>$mod_strings["LBL_FONT_BOLD"],
|
||||
"boldItalic"=>$mod_strings["LBL_FONT_BOLDITALIC"]
|
||||
));
|
||||
$this->ss->assign("ENCODING_TABLE", array_combine(explode(",",PDF_ENCODING_TABLE_LIST), explode(",",PDF_ENCODING_TABLE_LABEL_LIST)));
|
||||
|
||||
//display
|
||||
$this->ss->display('modules/Configurator/tpls/addFontView.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
122
modules/Configurator/views/view.adminwizard.php
Executable file
122
modules/Configurator/views/view.adminwizard.php
Executable file
@@ -0,0 +1,122 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
require_once('modules/Configurator/Forms.php');
|
||||
require_once('modules/Administration/Forms.php');
|
||||
require_once('modules/Configurator/Configurator.php');
|
||||
|
||||
class ViewAdminwizard extends SugarView
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::SugarView();
|
||||
|
||||
$this->options['show_header'] = false;
|
||||
$this->options['show_footer'] = false;
|
||||
$this->options['show_javascript'] = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
global $current_user, $mod_strings, $app_list_strings, $sugar_config, $locale, $sugar_version;
|
||||
|
||||
if(!is_admin($current_user)){
|
||||
sugar_die('Admin Only');
|
||||
}
|
||||
|
||||
$themeObject = SugarThemeRegistry::current();
|
||||
|
||||
$configurator = new Configurator();
|
||||
$sugarConfig = SugarConfig::getInstance();
|
||||
$focus = new Administration();
|
||||
$focus->retrieveSettings();
|
||||
|
||||
$ut = $GLOBALS['current_user']->getPreference('ut');
|
||||
if(empty($ut))
|
||||
$this->ss->assign('SKIP_URL','index.php?module=Users&action=Wizard&skipwelcome=1');
|
||||
else
|
||||
$this->ss->assign('SKIP_URL','index.php?module=Home&action=index');
|
||||
|
||||
// Always mark that we have got past this point
|
||||
$focus->saveSetting('system','adminwizard',1);
|
||||
$css = $themeObject->getCSS();
|
||||
$favicon = $themeObject->getImageURL('sugar_icon.ico',false);
|
||||
$this->ss->assign('FAVICON_URL',getJSPath($favicon));
|
||||
$this->ss->assign('SUGAR_CSS', $css);
|
||||
$this->ss->assign('MOD_USERS',return_module_language($GLOBALS['current_language'], 'Users'));
|
||||
$this->ss->assign('CSS', '<link rel="stylesheet" type="text/css" href="'.SugarThemeRegistry::current()->getCSSURL('wizard.css').'" />');
|
||||
$this->ss->assign('LANGUAGES', get_languages());
|
||||
$this->ss->assign('config', $sugar_config);
|
||||
$this->ss->assign('SUGAR_VERSION', $sugar_version);
|
||||
$this->ss->assign('settings', $focus->settings);
|
||||
$this->ss->assign('exportCharsets', get_select_options_with_id($locale->getCharsetSelect(), $sugar_config['default_export_charset']));
|
||||
$this->ss->assign('getNameJs', $locale->getNameJs());
|
||||
$this->ss->assign('JAVASCRIPT',get_set_focus_js(). get_configsettings_js());
|
||||
$this->ss->assign('company_logo', SugarThemeRegistry::current()->getImageURL('company_logo.png'));
|
||||
$this->ss->assign('mail_smtptype', $focus->settings['mail_smtptype']);
|
||||
$this->ss->assign('mail_smtpserver', $focus->settings['mail_smtpserver']);
|
||||
$this->ss->assign('mail_smtpport', $focus->settings['mail_smtpport']);
|
||||
$this->ss->assign('mail_smtpuser', $focus->settings['mail_smtpuser']);
|
||||
$this->ss->assign('mail_smtppass', $focus->settings['mail_smtppass']);
|
||||
$this->ss->assign('mail_smtpauth_req', ($focus->settings['mail_smtpauth_req']) ? "checked='checked'" : '');
|
||||
$this->ss->assign('MAIL_SSL_OPTIONS', get_select_options_with_id($app_list_strings['email_settings_for_ssl'], $focus->settings['mail_smtpssl']));
|
||||
$this->ss->assign('notify_allow_default_outbound_on', (!empty($focus->settings['notify_allow_default_outbound']) && $focus->settings['notify_allow_default_outbound'] == 2) ? 'CHECKED' : '');
|
||||
$this->ss->assign('THEME', SugarThemeRegistry::current()->__toString());
|
||||
|
||||
// get javascript
|
||||
ob_start();
|
||||
$this->options['show_javascript'] = true;
|
||||
$this->renderJavascript();
|
||||
$this->options['show_javascript'] = false;
|
||||
$this->ss->assign("SUGAR_JS",ob_get_contents().$themeObject->getJS());
|
||||
ob_end_clean();
|
||||
|
||||
$this->ss->assign('START_PAGE', !empty($_REQUEST['page']) ? $_REQUEST['page'] : 'welcome');
|
||||
|
||||
$this->ss->display('modules/Configurator/tpls/adminwizard.tpl');
|
||||
}
|
||||
}
|
||||
137
modules/Configurator/views/view.edit.php
Executable file
137
modules/Configurator/views/view.edit.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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* 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/Configurator/Forms.php');
|
||||
require_once('modules/Administration/Forms.php');
|
||||
require_once('modules/Configurator/Configurator.php');
|
||||
require_once('include/SugarLogger/SugarLogger.php');
|
||||
|
||||
class ConfiguratorViewEdit extends ViewEdit
|
||||
{
|
||||
/**
|
||||
* @see SugarView::preDisplay()
|
||||
*/
|
||||
public function preDisplay()
|
||||
{
|
||||
if(!is_admin($GLOBALS['current_user']))
|
||||
sugar_die('Admin Only');
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
"<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
|
||||
$mod_strings['LBL_SYSTEM_SETTINGS']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
global $current_user, $mod_strings, $app_strings, $app_list_strings, $sugar_config, $locale;
|
||||
|
||||
$configurator = new Configurator();
|
||||
$sugarConfig = SugarConfig::getInstance();
|
||||
$focus = new Administration();
|
||||
$configurator->parseLoggerSettings();
|
||||
|
||||
$focus->retrieveSettings();
|
||||
if(!empty($_POST['restore'])){
|
||||
$configurator->restoreConfig();
|
||||
}
|
||||
|
||||
$this->ss->assign('MOD', $mod_strings);
|
||||
$this->ss->assign('APP', $app_strings);
|
||||
$this->ss->assign('APP_LIST', $app_list_strings);
|
||||
$this->ss->assign('config', $configurator->config);
|
||||
$this->ss->assign('error', $configurator->errors);
|
||||
$this->ss->assign('THEMES', SugarThemeRegistry::availableThemes());
|
||||
$this->ss->assign('LANGUAGES', get_languages());
|
||||
$this->ss->assign("JAVASCRIPT",get_set_focus_js(). get_configsettings_js());
|
||||
$this->ss->assign('company_logo', SugarThemeRegistry::current()->getImageURL('company_logo.png'));
|
||||
$this->ss->assign("settings", $focus->settings);
|
||||
$this->ss->assign("mail_sendtype_options", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $focus->settings['mail_sendtype']));
|
||||
if(!empty($focus->settings['proxy_on'])){
|
||||
$this->ss->assign("PROXY_CONFIG_DISPLAY", 'inline');
|
||||
}else{
|
||||
$this->ss->assign("PROXY_CONFIG_DISPLAY", 'none');
|
||||
}
|
||||
if(!empty($focus->settings['proxy_auth'])){
|
||||
$this->ss->assign("PROXY_AUTH_DISPLAY", 'inline');
|
||||
}else{
|
||||
$this->ss->assign("PROXY_AUTH_DISPLAY", 'none');
|
||||
}
|
||||
if (!empty($configurator->config['logger']['level'])) {
|
||||
$this->ss->assign('log_levels', get_select_options_with_id( LoggerManager::getLoggerLevels(), $configurator->config['logger']['level']));
|
||||
} else {
|
||||
$this->ss->assign('log_levels', get_select_options_with_id( LoggerManager::getLoggerLevels(), ''));
|
||||
}
|
||||
if (!empty($configurator->config['logger']['file']['suffix'])) {
|
||||
$this->ss->assign('filename_suffix', get_select_options_with_id( SugarLogger::$filename_suffix,$configurator->config['logger']['file']['suffix']));
|
||||
} else {
|
||||
$this->ss->assign('filename_suffix', get_select_options_with_id( SugarLogger::$filename_suffix,''));
|
||||
}
|
||||
|
||||
echo $this->getModuleTitle();
|
||||
|
||||
$this->ss->display('modules/Configurator/tpls/EditView.tpl');
|
||||
|
||||
$javascript = new javascript();
|
||||
$javascript->setFormName("ConfigureSettings");
|
||||
$javascript->addFieldGeneric("notify_fromaddress", "email", $mod_strings['LBL_NOTIFY_FROMADDRESS'], TRUE, "");
|
||||
$javascript->addFieldGeneric("notify_subject", "varchar", $mod_strings['LBL_NOTIFY_SUBJECT'], TRUE, "");
|
||||
$javascript->addFieldGeneric("proxy_host", "varchar", $mod_strings['LBL_PROXY_HOST'], TRUE, "");
|
||||
$javascript->addFieldGeneric("proxy_port", "int", $mod_strings['LBL_PROXY_PORT'], TRUE, "");
|
||||
$javascript->addFieldGeneric("proxy_password", "varchar", $mod_strings['LBL_PROXY_PASSWORD'], TRUE, "");
|
||||
$javascript->addFieldGeneric("proxy_username", "varchar", $mod_strings['LBL_PROXY_USERNAME'], TRUE, "");
|
||||
echo $javascript->getScript();
|
||||
}
|
||||
}
|
||||
244
modules/Configurator/views/view.fontmanager.php
Executable file
244
modules/Configurator/views/view.fontmanager.php
Executable file
@@ -0,0 +1,244 @@
|
||||
<?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/Sugarpdf/sugarpdf_config.php');
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
require_once('include/Sugarpdf/FontManager.php');
|
||||
class ConfiguratorViewFontManager extends SugarView {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function FontManager(){
|
||||
parent::SugarView();
|
||||
}
|
||||
/**
|
||||
* display the form
|
||||
*/
|
||||
public function display(){
|
||||
global $mod_strings, $app_list_strings, $app_strings, $current_user;
|
||||
$error="";
|
||||
if(!is_admin($current_user)){
|
||||
sugar_die('Admin Only');
|
||||
}
|
||||
$fontManager = new FontManager();
|
||||
if(!$fontManager->listFontFiles()){
|
||||
$error = implode("<br>",$fontManager->errors);
|
||||
}
|
||||
|
||||
$this->ss->assign("MODULE_TITLE",
|
||||
get_module_title(
|
||||
$mod_strings['LBL_MODULE_ID'],
|
||||
$mod_strings['LBL_FONTMANAGER_TITLE'],
|
||||
false
|
||||
)
|
||||
);
|
||||
if(!empty($_REQUEST['error'])){
|
||||
$error .= "<br>".$_REQUEST['error'];
|
||||
}
|
||||
$this->ss->assign("error", $error);
|
||||
$this->ss->assign("MOD", $mod_strings);
|
||||
$this->ss->assign("APP", $app_strings);
|
||||
$this->ss->assign("JAVASCRIPT", $this->_getJS());
|
||||
if(isset($_REQUEST['return_action'])){
|
||||
$this->ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
|
||||
}else{
|
||||
$this->ss->assign("RETURN_ACTION", 'SugarpdfSettings');
|
||||
}
|
||||
$this->ss->assign("K_PATH_FONTS", K_PATH_FONTS);
|
||||
// YUI List
|
||||
$this->ss->assign("COLUMNDEFS", $this->getYuiColumnDefs($fontManager->fontList));
|
||||
$this->ss->assign("DATASOURCE", $this->getYuiDataSource($fontManager->fontList));
|
||||
$this->ss->assign("RESPONSESCHEMA", $this->getYuiResponseSchema());
|
||||
|
||||
//display
|
||||
$this->ss->display('modules/Configurator/tpls/fontmanager.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns JS used in this view
|
||||
*/
|
||||
private function _getJS()
|
||||
{
|
||||
global $mod_strings;
|
||||
return <<<EOJAVASCRIPT
|
||||
|
||||
EOJAVASCRIPT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the columnDefs for the YUI datatable
|
||||
* @return String
|
||||
*/
|
||||
private function getYuiColumnDefs($fontList){
|
||||
global $mod_strings;
|
||||
// Do not show the column with the delete buttons if there is only core fonts
|
||||
$removeColumn = '{key:"button", label:"", formatter:removeFormatter}';
|
||||
if($this->isAllOOBFont($fontList))
|
||||
$removeColumn = '';
|
||||
|
||||
$return = <<<BSOFR
|
||||
[
|
||||
{key:"name", minWidth:140, label:"{$mod_strings['LBL_FONT_LIST_NAME']}", sortable:true},
|
||||
{key:"filename", minWidth:120, label:"{$mod_strings['LBL_FONT_LIST_FILENAME']}", sortable:true},
|
||||
{key:"type", minWidth:100, label:"{$mod_strings['LBL_FONT_LIST_TYPE']}", sortable:true},
|
||||
{key:"style", minWidth:90, label:"{$mod_strings['LBL_FONT_LIST_STYLE']}", sortable:true},
|
||||
{key:"filesize", minWidth:70, label:"{$mod_strings['LBL_FONT_LIST_FILESIZE']}", formatter:YAHOO.widget.DataTable.formatNumber, sortable:true},
|
||||
{key:"enc", minWidth:80, label:"{$mod_strings['LBL_FONT_LIST_ENC']}", sortable:true},
|
||||
{key:"embedded", minWidth:70, label:"{$mod_strings['LBL_FONT_LIST_EMBEDDED']}", sortable:true},
|
||||
$removeColumn
|
||||
]
|
||||
BSOFR;
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the dataSource for the YUI Data Table
|
||||
* @param $fontList
|
||||
* @return String
|
||||
*/
|
||||
private function getYuiDataSource($fontList){
|
||||
$return = "[";
|
||||
$first=true;
|
||||
foreach($fontList as $k=>$v){
|
||||
if($first){
|
||||
$first=false;
|
||||
}else{
|
||||
$return .= ',';
|
||||
}
|
||||
$return .= '{';
|
||||
if(!empty($v['displayname'])){
|
||||
$return .= 'name:"'.$v['displayname'].'"';
|
||||
}else if(!empty($v['name'])){
|
||||
$return .= 'name:"'.$v['name'].'"';
|
||||
}
|
||||
$return .= ', filename:"'.$v['filename'].'"';
|
||||
$return .= ', fontpath:"'.$v['fontpath'].'"';
|
||||
$return .= ', style:"'.$this->formatStyle($v['style']).'"';
|
||||
$return .= ', type:"'.$this->formatType($v['type']).'"';
|
||||
$return .= ', filesize:'.$v['filesize'];
|
||||
if(!empty($v['enc'])){
|
||||
$return .= ', enc:"'.$v['enc'].'"';
|
||||
}
|
||||
if($v['embedded'] == true){
|
||||
$return .= ', embedded:"<input type=\'checkbox\' checked disabled/>"}';
|
||||
}else{
|
||||
$return .= ', embedded:"<input type=\'checkbox\' disabled/>"}';
|
||||
}
|
||||
}
|
||||
$return .= "]";
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Response Schema for the YUI data table
|
||||
* @return String
|
||||
*/
|
||||
private function getYuiResponseSchema(){
|
||||
return <<<BSOFR
|
||||
{
|
||||
fields: [{key:"name", parser:"string"},
|
||||
{key:"filename", parser:"string"},
|
||||
{key:"fontpath", parser:"string"},
|
||||
{key:"type", parser:"string"},
|
||||
{key:"style", parser:"string"},
|
||||
{key:"filesize", parser:"number"},
|
||||
{key:"enc", parser:"string"},
|
||||
{key:"embedded", parser:"string"}]
|
||||
}
|
||||
BSOFR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the label of the passed style
|
||||
* @param $style
|
||||
* @return String
|
||||
*/
|
||||
private function formatStyle($style){
|
||||
global $mod_strings;
|
||||
$return = "";
|
||||
if(count($style) == 2){
|
||||
$return .= "<b><i>".$mod_strings['LBL_FONT_BOLDITALIC']."</b></i>";
|
||||
}else{
|
||||
switch($style[0]){
|
||||
case "bold":
|
||||
$return .= "<b>".$mod_strings['LBL_FONT_BOLD']."</b>";
|
||||
break;
|
||||
case "italic":
|
||||
$return .= "<i>".$mod_strings['LBL_FONT_ITALIC']."</i>";
|
||||
break;
|
||||
default:
|
||||
$return .= $mod_strings['LBL_FONT_REGULAR'];
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
private function formatType($type){
|
||||
global $mod_strings;
|
||||
switch($type){
|
||||
case "cidfont0":
|
||||
$return = $mod_strings['LBL_FONT_TYPE_CID0'];break;
|
||||
case "core":
|
||||
$return = $mod_strings['LBL_FONT_TYPE_CORE'];break;
|
||||
case "TrueType":
|
||||
$return = $mod_strings['LBL_FONT_TYPE_TRUETYPE'];break;
|
||||
case "Type1":
|
||||
$return = $mod_strings['LBL_FONT_TYPE_TYPE1'];break;
|
||||
case "TrueTypeUnicode":
|
||||
$return = $mod_strings['LBL_FONT_TYPE_TRUETYPEU'];break;
|
||||
default:
|
||||
$return = "";
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if all the fonts are core fonts
|
||||
* @param $fontList
|
||||
* @return boolean return true if all the fonts are core type
|
||||
*/
|
||||
private function isAllOOBFont($fontList){
|
||||
foreach($fontList as $v){
|
||||
if($v['type'] != "core" && $v['fontpath'] != K_PATH_FONTS)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user