init
This commit is contained in:
73
modules/Home/Dashlets/iFrameDashlet/configure.tpl
Executable file
73
modules/Home/Dashlets/iFrameDashlet/configure.tpl
Executable file
@@ -0,0 +1,73 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
|
||||
|
||||
<div style='width:100%'>
|
||||
<form name='configure_{$id}' action="index.php" method="post" onSubmit='return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage);'>
|
||||
<input type='hidden' name='id' value='{$id}'>
|
||||
<input type='hidden' name='module' value='Home'>
|
||||
<input type='hidden' name='action' value='ConfigureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$titleLBL}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="title" size='20' maxlength='80' value='{$title}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$urlLBL}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="url" size='20' maxlength='255' value='{$url}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$heightLBL}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="height" size='20' maxlength='80' value='{$height}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' class='button' value='{$saveLBL}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
45
modules/Home/Dashlets/iFrameDashlet/iFrameDashlet.meta.php
Executable file
45
modules/Home/Dashlets/iFrameDashlet/iFrameDashlet.meta.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
global $app_strings;
|
||||
|
||||
$dashletMeta['iFrameDashlet'] = array('module' => 'Home',
|
||||
'title' => translate('LBL_DASHLET_TITLE', 'Home'),
|
||||
'description' => 'A customizeable portal page',
|
||||
'icon' => 'themes/default/images/icon_iFrames_32.gif',
|
||||
'category' => 'Web',
|
||||
'hidden' => true);
|
||||
124
modules/Home/Dashlets/iFrameDashlet/iFrameDashlet.php
Executable file
124
modules/Home/Dashlets/iFrameDashlet/iFrameDashlet.php
Executable file
@@ -0,0 +1,124 @@
|
||||
<?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/Dashlets/Dashlet.php');
|
||||
|
||||
|
||||
class iFrameDashlet extends Dashlet {
|
||||
var $displayTpl = 'modules/Home/Dashlets/iFrameDashlet/display.tpl';
|
||||
var $configureTpl = 'modules/Home/Dashlets/iFrameDashlet/configure.tpl';
|
||||
var $defaultURL = 'http://apps.sugarcrm.com/dashlet/sugarcrm-news-dashlet.html?lang=@@LANG@@&edition=@@EDITION@@&ver=@@VER@@';
|
||||
var $url;
|
||||
protected $allowed_schemes = array("http", "https");
|
||||
|
||||
function iFrameDashlet($id, $options = null) {
|
||||
parent::Dashlet($id);
|
||||
$this->isConfigurable = true;
|
||||
|
||||
if(empty($options['title'])) {
|
||||
$this->title = translate('LBL_DASHLET_TITLE', 'Home');
|
||||
$this->title = translate('LBL_DASHLET_DISCOVER_SUGAR_PRO', 'Home');
|
||||
} else {
|
||||
$this->title = $options['title'];
|
||||
}
|
||||
if(empty($options['url'])) {
|
||||
$this->url = $this->defaultURL;
|
||||
$this->url = 'http://apps.sugarcrm.com/dashlet/go-pro.html?lang=@@LANG@@&edition=@@EDITION@@&ver=@@VER@@';
|
||||
} else {
|
||||
$this->url = $options['url'];
|
||||
}
|
||||
|
||||
$this->checkURL();
|
||||
|
||||
if(empty($options['height']) || (int)$options['height'] < 1 ) {
|
||||
$this->height = 315;
|
||||
} else {
|
||||
$this->height = (int)$options['height'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function checkURL()
|
||||
{
|
||||
$scheme = parse_url($this->url, PHP_URL_SCHEME);
|
||||
if(!in_array($scheme, $this->allowed_schemes)) {
|
||||
$this->url = 'about:blank';
|
||||
}
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
global $app_strings;
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('titleLBL', translate('LBL_DASHLET_OPT_TITLE', 'Home'));
|
||||
$ss->assign('urlLBL', translate('LBL_DASHLET_OPT_URL', 'Home'));
|
||||
$ss->assign('heightLBL', translate('LBL_DASHLET_OPT_HEIGHT', 'Home'));
|
||||
$ss->assign('title', $this->title);
|
||||
$ss->assign('url', $this->url);
|
||||
$ss->assign('id', $this->id);
|
||||
$ss->assign('height', $this->height);
|
||||
$ss->assign('saveLBL', $app_strings['LBL_SAVE_BUTTON_LABEL']);
|
||||
|
||||
return $ss->fetch('modules/Home/Dashlets/iFrameDashlet/configure.tpl');
|
||||
}
|
||||
|
||||
function saveOptions($req) {
|
||||
$options = array();
|
||||
|
||||
if ( isset($req['title']) ) {
|
||||
$options['title'] = $req['title'];
|
||||
}
|
||||
if ( isset($req['url']) ) {
|
||||
$options['url'] = $req['url'];
|
||||
}
|
||||
if ( isset($req['height']) ) {
|
||||
$options['height'] = (int)$req['height'];
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
function display(){
|
||||
|
||||
$sugar_edition = 'COM';
|
||||
|
||||
$out_url = str_replace(
|
||||
array('@@LANG@@','@@VER@@','@@EDITION@@'),
|
||||
array($GLOBALS['current_language'],$GLOBALS['sugar_config']['sugar_version'],$sugar_edition),
|
||||
$this->url);
|
||||
return parent::display() . "<iframe class='teamNoticeBox' src='".$out_url."' height='".$this->height."px'></iframe>";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user