init
This commit is contained in:
53
modules/Home/Dashlets/RSSDashlet/RSSDashlet.en_us.lang.php
Executable file
53
modules/Home/Dashlets/RSSDashlet/RSSDashlet.en_us.lang.php
Executable file
@@ -0,0 +1,53 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['RSSDashlet'] = array('LBL_TITLE' => 'News Feed',
|
||||
'LBL_DESCRIPTION' => 'News Feed',
|
||||
'LBL_SAVING' => 'Parsing ...',
|
||||
'LBL_SAVED' => 'Complete',
|
||||
'LBL_AUTO_SCROLL' => 'Auto Scroll',
|
||||
'LBL_SCROLL_SPEED' => 'Scroll Speed (%)',
|
||||
'LBL_CONFIGURE_TITLE' => 'Title',
|
||||
'LBL_CONFIGURE_HEIGHT' => 'Height (1 - 300)',
|
||||
'LBL_CONFIGURE_RSSURL' => 'RSS Url',
|
||||
'LBL_DBLCLICK_HELP' => '',
|
||||
'ERR_LOADING_FEED' => 'Failed loading RSS Feed',
|
||||
);
|
||||
?>
|
||||
46
modules/Home/Dashlets/RSSDashlet/RSSDashlet.meta.php
Executable file
46
modules/Home/Dashlets/RSSDashlet/RSSDashlet.meta.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?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, $current_language;
|
||||
|
||||
$dashletMeta['RSSDashlet'] = array('title' => 'LBL_TITLE', // array index in language pack
|
||||
'description' => 'LBL_DESCRIPTION', // array index in language pack
|
||||
'category' => 'Web',
|
||||
'hidden' => true);
|
||||
?>
|
||||
175
modules/Home/Dashlets/RSSDashlet/RSSDashlet.php
Executable file
175
modules/Home/Dashlets/RSSDashlet/RSSDashlet.php
Executable file
@@ -0,0 +1,175 @@
|
||||
<?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');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
|
||||
class RSSDashlet extends Dashlet
|
||||
{
|
||||
protected $url = 'http://www.sugarcrm.com/crm/aggregator/rss/1';
|
||||
protected $height = '200'; // height of the pad
|
||||
protected $images_dir = 'modules/Home/Dashlets/RSSDashlet/images';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @global string current language
|
||||
* @param guid $id id for the current dashlet (assigned from Home module)
|
||||
* @param array $def options saved for this dashlet
|
||||
*/
|
||||
public function __construct($id, $def)
|
||||
{
|
||||
$this->loadLanguage('RSSDashlet', 'modules/Home/Dashlets/'); // load the language strings here
|
||||
|
||||
if(!empty($def['height'])) // set a default height if none is set
|
||||
$this->height = $def['height'];
|
||||
|
||||
if(!empty($def['url']))
|
||||
$this->url = $def['url'];
|
||||
|
||||
if(!empty($def['title']))
|
||||
$this->title = $def['title'];
|
||||
else
|
||||
$this->title = $this->dashletStrings['LBL_TITLE'];
|
||||
|
||||
parent::Dashlet($id); // call parent constructor
|
||||
|
||||
$this->isConfigurable = true; // dashlet is configurable
|
||||
$this->hasScript = false; // dashlet has javascript attached to it
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the dashlet
|
||||
*
|
||||
* @return string html to display dashlet
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
|
||||
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
|
||||
$ss->assign('id', $this->id);
|
||||
$ss->assign('height', $this->height);
|
||||
$ss->assign('rss_output', $this->getRSSOutput($this->url));
|
||||
$str = $ss->fetch('modules/Home/Dashlets/RSSDashlet/RSSDashlet.tpl');
|
||||
return parent::display($this->dashletStrings['LBL_DBLCLICK_HELP']) . $str; // return parent::display for title and such
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the configuration form for the dashlet
|
||||
*
|
||||
* @return string html to display form
|
||||
*/
|
||||
public function displayOptions() {
|
||||
global $app_strings, $sugar_version, $sugar_config;
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('titleLbl', $this->dashletStrings['LBL_CONFIGURE_TITLE']);
|
||||
$ss->assign('heightLbl', $this->dashletStrings['LBL_CONFIGURE_HEIGHT']);
|
||||
$ss->assign('rssUrlLbl', $this->dashletStrings['LBL_CONFIGURE_RSSURL']);
|
||||
$ss->assign('saveLbl', $app_strings['LBL_SAVE_BUTTON_LABEL']);
|
||||
$ss->assign('title', $this->title);
|
||||
$ss->assign('height', $this->height);
|
||||
$ss->assign('url', $this->url);
|
||||
$ss->assign('id', $this->id);
|
||||
|
||||
return parent::displayOptions() . $ss->fetch('modules/Home/Dashlets/RSSDashlet/RSSDashletOptions.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* called to filter out $_REQUEST object when the user submits the configure dropdown
|
||||
*
|
||||
* @param array $req $_REQUEST
|
||||
* @return array filtered options to save
|
||||
*/
|
||||
public function saveOptions(
|
||||
array $req
|
||||
)
|
||||
{
|
||||
$options = array();
|
||||
$options['title'] = $req['title'];
|
||||
$options['url'] = $req['url'];
|
||||
$options['height'] = $req['height'];
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
protected function getRSSOutput(
|
||||
$url
|
||||
)
|
||||
{
|
||||
// suppress XML errors
|
||||
libxml_use_internal_errors(true);
|
||||
$rssdoc = simplexml_load_file($url);
|
||||
// return back the error message if the loading wasn't successful
|
||||
if (!$rssdoc)
|
||||
return $this->dashletStrings['ERR_LOADING_FEED'];
|
||||
|
||||
$output = "<table class='edit view'>";
|
||||
if ( isset($rssdoc->channel) ) {
|
||||
foreach ( $rssdoc->channel as $channel ) {
|
||||
if ( isset($channel->item ) ) {
|
||||
foreach ( $channel->item as $item ) {
|
||||
$output .= <<<EOHTML
|
||||
<tr>
|
||||
<td>
|
||||
<h3><a href="{$item->link}" target="_child">{$item->title}</a></h3>
|
||||
{$item->description}
|
||||
</td>
|
||||
</tr>
|
||||
EOHTML;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach ( $rssdoc->entry as $entry ) {
|
||||
$output .= <<<EOHTML
|
||||
<tr>
|
||||
<td>
|
||||
<h3><a href="{$entry->link}" target="_child">{$entry->title}</a></h3>
|
||||
{$entry->summary}
|
||||
</td>
|
||||
</tr>
|
||||
EOHTML;
|
||||
}
|
||||
}
|
||||
$output .= "</table>";
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
43
modules/Home/Dashlets/RSSDashlet/RSSDashlet.tpl
Executable file
43
modules/Home/Dashlets/RSSDashlet/RSSDashlet.tpl
Executable file
@@ -0,0 +1,43 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* 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 id='rss_{$id}' style='overflow: auto; width: 100%; height: {$height}px; border: 1px #ddd solid'>
|
||||
{$rss_output}
|
||||
</div>
|
||||
76
modules/Home/Dashlets/RSSDashlet/RSSDashletOptions.tpl
Executable file
76
modules/Home/Dashlets/RSSDashlet/RSSDashletOptions.tpl
Executable file
@@ -0,0 +1,76 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* 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: 500px'>
|
||||
<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="400" cellpadding="0" cellspacing="0" border="0" class="edit view" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap scope='row'>{$titleLbl}</td>
|
||||
<td valign='top'>
|
||||
<input class="text" name="title" size='20' value='{$title}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap scope='row'>{$rssUrlLbl}</td>
|
||||
<td valign='top'>
|
||||
<input class="text" name="url" size='20' value='{$url}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap scope='row'>{$heightLbl}</td>
|
||||
<td valign='top'>
|
||||
<input class="text" name="height" size='3' value='{$height}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' class='button' value='{$saveLbl}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user