Author: ralfbecker
New Revision: 55923
URL: http://svn.stylite.de/viewvc/egroupware?rev=55923&view=rev
Log:
use new api in home and portlets
Modified:
trunk/addressbook/inc/class.addressbook_favorite_portlet.inc.php
trunk/calendar/inc/class.calendar_favorite_portlet.inc.php
trunk/egroupware/home/inc/class.home_birthday_portlet.inc.php
trunk/egroupware/home/inc/class.home_favorite_portlet.inc.php
trunk/egroupware/home/inc/class.home_legacy_portlet.inc.php
trunk/egroupware/home/inc/class.home_link_portlet.inc.php
trunk/egroupware/home/inc/class.home_list_portlet.inc.php
trunk/egroupware/home/inc/class.home_note_portlet.inc.php
trunk/egroupware/home/inc/class.home_portlet.inc.php
trunk/egroupware/home/inc/class.home_tutorial_ui.inc.php
trunk/egroupware/home/inc/class.home_ui.inc.php
trunk/egroupware/home/inc/class.home_weather_portlet.inc.php
trunk/egroupware/home/index.php
trunk/filemanager/inc/class.filemanager_favorite_portlet.inc.php
trunk/infolog/inc/class.infolog_favorite_portlet.inc.php
trunk/news_admin/inc/class.news_admin_favorite_portlet.inc.php
trunk/projectmanager/inc/class.projectmanager_favorite_portlet.inc.php
trunk/resources/inc/class.resources_favorite_portlet.inc.php
trunk/tracker/inc/class.tracker_favorite_portlet.inc.php
— trunk/addressbook/inc/class.addressbook_favorite_portlet.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_favorite_portlet.inc.php Thu Apr 28 20:06:46 2016
@@ -1,6 +1,5 @@
<?php
-/*
+/**
- Egroupware - Addressbook - A portlet for displaying a list of entries
-
@license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
-
@package addressbook
@@ -9,6 +8,11 @@
-
@author Nathan Gray
-
@version $Id$
*/
+use EGroupware\Api;
+use EGroupware\Api\Framework;
+use EGroupware\Api\Acl;
+use EGroupware\Api\Etemplate;
/**
- The addressbook_list_portlet uses a nextmatch / favorite
@@ -24,7 +28,7 @@
public function __construct(Array &$context = array(), &$need_reload = false)
{
$context[‘appname’] = ‘addressbook’;
@@ -45,11 +49,11 @@
);
}
- public function exec($id = null, etemplate_new &$etemplate = null)
- public function exec($id = null, Etemplate &$etemplate = null)
{
$ui = new addressbook_ui();
-
$this->context['sel_options']['filter'] = $this->context['sel_options']['owner'] = $ui->get_addressbooks(EGW_ACL_READ,lang('All'));
-
$this->context['sel_options']['filter2'] = $ui->get_lists(EGW_ACL_READ,array('' => lang('none')));
-
$this->context['sel_options']['filter'] = $this->context['sel_options']['owner'] = $ui->get_addressbooks(Acl::READ,lang('All'));
-
$this->context['sel_options']['filter2'] = $ui->get_lists(Acl::READ,array('' => lang('none')));
$this->nm_settings['actions'] = $ui->get_actions($this->nm_settings['col_filter']['tid'], $this->nm_settings['org_view']);
parent::exec($id, $etemplate);
@@ -76,7 +80,7 @@
* output is handled by parent.
*
* @param type $id
-
-
@param etemplate_new $etemplate
-
-
@param Etemplate $etemplate
*/
public static function process($values = array())
{
@@ -86,34 +90,33 @@
{
if (!count($values[‘nm’][‘selected’]) && !$values[‘nm’][‘select_all’])
{
-
$success = $failed = $action_msg = $msg = null;
if ($ui->action($values['nm']['action'],$values['nm']['selected'],$values['nm']['select_all'],
$success,$failed,$action_msg,$values['do_email'] ? 'email' : 'index',$msg,$values['nm']['checkboxes']))
{
$msg .= lang('%1 contact(s) %2',$success,$action_msg);
-
Api\Json\Response::get()->apply('egw.message',array($msg,'success'));
foreach($values['nm']['selected'] as &$id)
{
$id = 'addressbook::'.$id;
}
// Directly request an update - this will get addressbook tab too
-
Api\Json\Response::get()->apply('egw.dataRefreshUIDs',array($values['nm']['selected']));
}
elseif(is_null($msg))
{
$msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed);
-
Api\Json\Response::get()->apply('egw.message',array($msg,'error'));
}
elseif($msg)
{
$msg .= "\n".lang('%1 entries %2, %3 failed.',$success,$action_msg,$failed);
— trunk/calendar/inc/class.calendar_favorite_portlet.inc.php (original)
+++ trunk/calendar/inc/class.calendar_favorite_portlet.inc.php Thu Apr 28 20:06:46 2016
@@ -1,14 +1,18 @@
<?php
-/*
-
- Egroupware - Addressbook - A portlet for displaying a list of entries
+/**
-
- Egroupware - Calendar - A portlet for displaying a list of entries
-
+use EGroupware\Api;
+use EGroupware\Api\Framework;
+use EGroupware\Api\Etemplate;
/**
-
The addressbook_list_portlet uses a nextmatch / favorite
@@ -32,7 +36,6 @@
if($this->favorite['state']['view'] == 'listview')
{
@@ -55,16 +58,16 @@
$need_reload = $reload && $need_reload;
}
- public function exec($id = null, etemplate_new &$etemplate = null)
-
public function exec($id = null, Etemplate &$etemplate = null)
{
// Always load app's javascript, so most actions have a chance of working
-
egw_framework::includeCSS('calendar', 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) ||
-
egw_framework::includeCSS('calendar','app');
-
-
Framework::includeCSS('calendar', 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) ||
-
Framework::includeCSS('calendar','app');
-
if($this->favorite['state']['view'] == 'listview' || is_array($this->favorite) && !$this->favorite['state']['view'])
{
$ui = new calendar_uilist();
@@ -98,11 +101,8 @@
case ‘listview’:
$this->context[‘sel_options’][‘filter’] = &$ui->date_filters;
$this->nm_settings[‘actions’] = $ui->get_actions($this->nm_settings[‘col_filter’][‘tid’], $this->nm_settings[‘org_view’]);
// Early exit
return parent::exec($id, $etemplate);
@@ -121,7 +121,7 @@
$etemplate->read(‘calendar.view’);
$etemplate->set_dom_id($id);
$this->actions =& $etemplate->getElementAttribute(‘view’, ‘actions’);
@@ -150,7 +150,7 @@
unset($GLOBALS['egw_info']['flags']['app_header']);
// Force loading of CSS
@@ -184,8 +184,7 @@
* Here we need to handle any incoming data. Setup is done in the constructor,
* output is handled by parent.
*
-
-
-
@param etemplate_new $etemplate
-
-
@param $values =array()
*/
public static function process($values = array())
{
@@ -195,39 +194,39 @@
{
if (!count($values[‘nm’][‘selected’]) && !$values[‘nm’][‘select_all’])
{
-
$success = $failed = $action_msg = $msg = null;
if ($ui->action($values['nm']['action'],$values['nm']['selected'],$values['nm']['select_all'],
$success,$failed,$action_msg,'calendar_list',$msg, $values['nm']['checkboxes']['no_notifications']))
{
$msg .= lang('%1 event(s) %2',$success,$action_msg);
-
Api\Json\Response::get()->apply('egw.message',array($msg,'success'));
foreach($values['nm']['selected'] as &$id)
{
$id = 'calendar::'.$id;
}
// Directly request an update - this will get addressbook tab too
-
Api\Json\Response::get()->apply('egw.dataRefreshUIDs',array($values['nm']['selected']));
}
elseif(is_null($msg))
{
$msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed);
-
Api\Json\Response::get()->apply('egw.message',array($msg,'error'));
}
elseif($msg)
{
$msg .= "\n".lang('%1 entries %2, %3 failed.',$success,$action_msg,$failed);
- /**
- No filters default favorite causes problems with calendar’s special state handling,
- so just remove it.
— trunk/egroupware/home/inc/class.home_birthday_portlet.inc.php (original)
+++ trunk/egroupware/home/inc/class.home_birthday_portlet.inc.php Thu Apr 28 20:06:46 2016
@@ -1,6 +1,5 @@
<?php
+use EGroupware\Api;
+use EGroupware\Api\Etemplate;
/**
*/
- class home_birthday_portlet extends home_portlet {
- /**
- class home_birthday_portlet extends home_portlet
+{
- /**
- Constructor sets up the portlet according to the user’s saved property values
- for this particular portlet. It is possible to have multiple instances of the
- same portlet with different properties.
@@ -29,6 +31,9 @@
*/
public function __construct(Array &$context = array(), &$need_reload = false)
{
-
unset($need_reload); // not used, but required by function signature
-
if (false) parent::__construct();
-
$this->context = $context;
}
@@ -57,15 +62,15 @@
*
* @param id String unique ID, provided to the portlet so it can make sure content is
* unique, if needed.
-
-
@param etemplate etemplate_new Etemplate to generate content
- */
- public function exec($id = null, etemplate_new &$etemplate = null)
-
-
@param etemplate Etemplate Etemplate to generate content
-
*/
-
public function exec($id = null, Etemplate &$etemplate = null)
{
$content = array();
$etemplate->read('home.birthdays');
@@ -79,7 +84,7 @@
*/
protected function get_birthdays()
{
@@ -110,6 +115,7 @@
unset($month_start); unset($month_end);
if ($bdays)
{
@@ -117,7 +123,7 @@
{
if(substr($contact[‘bday’],-6) == $day)
{
@@ -130,7 +136,7 @@
list($y,$m,$d) = explode(’-’,$contact[‘bday’]);
if ($GLOBALS[‘egw_info’][‘server’][‘hide_birthdays’] == ‘dateonly’) $y = ‘’;
$text = lang(“In %1 days (%2) is %3’s birthday.”,$n,
-
$GLOBALS['egw']->common->dateformatorder($y,$m,$d,true),
-
common::dateformatorder($y,$m,$d,true),
$contact['n_given'].' '.$contact['n_family']);
break;
}
— trunk/egroupware/home/inc/class.home_favorite_portlet.inc.php (original)
+++ trunk/egroupware/home/inc/class.home_favorite_portlet.inc.php Thu Apr 28 20:06:46 2016
@@ -1,5 +1,5 @@
<?php
-/**
+/***
* EGroupware - Home - A simple portlet for displaying a list of entries
*
* @link www.egroupware.org
@@ -11,6 +11,10 @@
* @version $Id: class.home_list_portlet.inc.php 49321 2014-11-06 21:40:03Z nathangray $
*/
+use EGroupware\Api;
+use EGroupware\Api\Framework;
+use EGroupware\Api\Etemplate;
+
/**
* The home_favorite_portlet uses a nextmatch to display the entries for a particular
@@ -26,10 +30,10 @@
'appname' => '',
'favorite' => 'blank'
);
-
+
/**
* Nextmatch settings
- * @see etemplate_widget_nextmatch
+ * @see Etemplate\Widget\Nextmatch
* @var array
*/
protected $nm_settings = array(
@@ -55,6 +59,8 @@
*/
public function __construct(Array &$context = array(), &$need_reload = false)
{
+ if (false) parent::__construct();
+
// Process dropped data (Should be [appname => , id => ]) into something useable
if($context['dropped_data'])
{
@@ -67,7 +73,7 @@
}
unset($context['dropped_data']);
-
+
$need_reload = true;
}
// Favorite not set for new widgets created via context menu
@@ -76,14 +82,14 @@
// Set initial size to 6x3, default is way too small
$context['width'] = max($context['width'], 6);
$context['height'] = max($context['height'], 3);
-
+
$need_reload = true;
}
// Load and copy favorite
if($context['favorite'] && !is_array($context['favorite']))
{
- $favorites = egw_favorites::get_favorites($context['appname']);
+ $favorites = Framework\Favorites::get_favorites($context['appname']);
$context['favorite'] = $favorites[$context['favorite']];
$need_reload = true;
}
@@ -101,13 +107,14 @@
}
$this->nm_settings['columnselection_pref'] = "nextmatch-home.{$this->context['id']}";
- translation::add_app($context['appname']);
- }
- public function exec($id = null, etemplate_new &$etemplate = null)
+ Api\Translation::add_app($context['appname']);
+ }
+
+ public function exec($id = null, Etemplate &$etemplate = null)
{
if($etemplate == null)
{
- $etemplate = new etemplate_new();
+ $etemplate = new Etemplate();
}
$etemplate->read('home.favorite');
@@ -121,11 +128,11 @@
// Always load app's css
- egw_framework::includeCSS($this->context['appname'], 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) ||
- egw_framework::includeCSS($this->context['appname'],'app');
+ Framework::includeCSS($this->context['appname'], 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) ||
+ Framework::includeCSS($this->context['appname'],'app');
// Always load app's javascript, so most actions have a chance of working
- egw_framework::validate_file('.','app',$this->context['appname']);
+ Framework::includeJS('.','app',$this->context['appname']);
// Set this so app's JS gets initialized
$old_app = $GLOBALS['egw_info']['flags']['currentapp'];
@@ -138,19 +145,21 @@
public static function process($content = array())
{
+ unset($content); // not used, but required by function signature
+
// We need to keep the template going, thanks.
- etemplate_widget::setElementAttribute('','','');
+ Etemplate\Widget::setElementAttribute('','','');
}
public function get_actions(){
return array();
}
-
+
/**
* Some descriptive information about the portlet, so that users can decide if
* they want it or not, and for inclusion in lists, hover text, etc.
*
- * These should be already translated, no further translation will be done.
+ * These should be already translated, no further Api\Translation will be done.
*
* @return Array with keys
* - displayName: Used in lists
@@ -171,7 +180,7 @@
* Settings should be in the same style as for preferences. It is OK to return an empty array
* for no customizable settings.
*
- * These should be already translated, no further translation will be done.
+ * These should be already translated, no further Api\Translation will be done.
*
* @see preferences/inc/class.preferences_settings.inc.php
* @return Array of settings. Each setting should have the following keys:
@@ -184,7 +193,7 @@
public function get_properties()
{
$properties = parent::get_properties();
- $favorites = egw_favorites::get_favorites($this->context['appname']);
+ $favorites = Framework\Favorites::get_favorites($this->context['appname']);
$favorite_list = array();
foreach($favorites as $id => $favorite)
{
Modified: trunk/egroupware/home/inc/class.home_legacy_portlet.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/home/inc/class.home_legacy_portlet.inc.php?rev=55923&r1=55922&r2=55923&view=diff
==============================================================================
--- trunk/egroupware/home/inc/class.home_legacy_portlet.inc.php (original)
+++ trunk/egroupware/home/inc/class.home_legacy_portlet.inc.php Thu Apr 28 20:06:46 2016
@@ -11,6 +11,9 @@
* @version $Id$
*/
+use EGroupware\Api;
+use EGroupware\Api\Etemplate;
+
class home_legacy_portlet extends home_portlet
{
@@ -18,33 +21,36 @@
* Context for this portlet
*/
protected $context = array();
-
+
/**
* Custom title from hook
*/
protected $title = 'Legacy';
-
+
/**
* @var String Content generated by hook
*/
protected $content = '';
-
+
public function __construct(array &$context = array(), &$need_reload = false)
{
+ unset($need_reload); // not used, but required by function signature
+ if (false) parent::__construct();
+
$this->context = $context;
-
+
// Try to load content here, so all needed info is available
$appname = $this->context['app'];
- if(!$appname || !$GLOBALS['egw']->hooks->hook_exists('home', $appname))
+ if(!$appname || !Api\Hooks::exists('home', $appname))
{
return;
}
// Set a fallback title for if we can't extract it
$this->title = lang($this->context['app']);
-
+
// Execute hook to get content
ob_start();
- $_content = $GLOBALS['egw']->hooks->single('home',$appname);
+ $_content = Api\Hooks::single('home',$appname);
if (!$_content || $_content == 1) // content has been echoed and not returned
{
$_content = ob_get_contents();
@@ -57,24 +63,23 @@
libxml_use_internal_errors(true);
$dom->loadHTML($_content,LIBXML_NOWARNING + LIBXML_NOERROR);
$finder = new DOMXPath($dom);
-
+
// Find header for title
$title = $finder->query("//div[contains(@class,'divSideboxHeader')]/descendant::strong");
if($title->length)
{
$this->title = $title->item(0)->textContent;
}
-
+
// Remove header
$content = $finder->query("//div[contains(@class,'divSideboxHeader')]/descendant::strong/ancestor::tr");
for($i = 0; $i < $content->length; $i++)
{
$content->item($i)->parentNode->removeChild($content->item($i));
}
-
+
// Content remains
- $content = $dom->saveHTML();
- $this->content = $content;
+ $this->content = $dom->saveHTML();
}
}
@@ -90,7 +95,7 @@
* unique, if needed.
* @return string HTML fragment for display
*/
- public function exec($id = null, etemplate_new &$etemplate = null)
+ public function exec($id = null, Etemplate &$etemplate = null)
{
$etemplate->read('home.legacy');
@@ -119,4 +124,3 @@
);
}
}
-?>
— trunk/egroupware/home/inc/class.home_link_portlet.inc.php (original)
+++ trunk/egroupware/home/inc/class.home_link_portlet.inc.php Thu Apr 28 20:06:46 2016
@@ -11,6 +11,11 @@
+use EGroupware\Api\Link;
+use EGroupware\Api\Framework;
+use EGroupware\Api\Vfs;
+use EGroupware\Api\Etemplate;
+
/**
- A single entry is displayed with its application icon and title
*/
@@ -46,6 +51,8 @@
*/
public function __construct(Array &$context = array(), &$need_reload = false)
{
@@ -53,9 +60,9 @@
unset($context[‘dropped_data’]);
$need_reload = true;
}
-
if($context['entry'] && is_array($context['entry']));
-
{
-
$this->title = $context['entry']['title'] = egw_link::title($context['entry']['app'], $context['entry']['id']);
-
if($context['entry'] && is_array($context['entry']))
-
{
-
$this->title = $context['entry']['title'] = Link::title($context['entry']['app'], $context['entry']['id']);
// Reload to get the latest title
// TODO: This is a performance hit, it would be good to do this less
@@ -90,7 +97,7 @@
* @param id String unique ID, provided to the portlet so it can make sure content is
* unique, if needed.
*/
- public function exec($id = null, etemplate_new &$etemplate = null)
-
public function exec($id = null, Etemplate &$etemplate = null)
{
// Check for custom template for app
$custom_template = false;
@@ -107,7 +114,7 @@
$etemplate->set_dom_id($id);
@@ -117,9 +124,9 @@
{
// Always load app's css
-
egw_framework::includeCSS($this->context['entry']['app'], 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) ||
-
egw_framework::includeCSS($this->context['entry']['app'],'app');
-
-
Framework::includeCSS($this->context['entry']['app'], 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) ||
-
Framework::includeCSS($this->context['entry']['app'],'app');
-
try
{
$classname = $this->context['entry']['app'] . '_egw_record';
@@ -153,7 +160,7 @@
error_log("Problem loading record " . array2string($this->context[‘entry’]));
throw $e;
}
@@ -173,8 +180,8 @@
{
$this->context[‘entry’][‘app’] = ‘file’;
$this->context[‘entry’][‘path’] = $this->context[‘entry’][‘title’] = $this->context[‘entry’][‘id’];
-
$this->context['entry']['type'] = egw_vfs::mime_content_type($this->context['entry']['id']);
-
$content['image'] = egw_framework::link('/api/thumbnail.php',array('path' => $this->context['entry']['id']));
-
$this->context['entry']['type'] = Vfs::mime_content_type($this->context['entry']['id']);
-
$content['image'] = Framework::link('/api/thumbnail.php',array('path' => $this->context['entry']['id']));
}
$content += $this->context;
@@ -193,7 +200,7 @@
* Settings should be in the same style as for preferences. It is OK to return an empty array
* for no customizable settings.
*
-
- These should be already translated, no further translation will be done.
-
- These should be already translated, no further Api\Translation will be done.
-
-
@see preferences/inc/class.preferences_settings.inc.php
-
@return Array of settings. Each setting should have the following keys:
— trunk/egroupware/home/inc/class.home_list_portlet.inc.php (original)
+++ trunk/egroupware/home/inc/class.home_list_portlet.inc.php Thu Apr 28 20:06:46 2016
@@ -11,6 +11,8 @@
+use EGroupware\Api\Vfs;
+use EGroupware\Api\Etemplate;
/**
- The home_list_portlet uses the link system and its associated link-list widget
@@ -38,6 +40,8 @@
*/
public function __construct(Array &$context = array(), &$need_reload = false)
{
@@ -65,7 +69,7 @@
if($item[‘app’] == ‘filemanager’ || $item[‘app’] == ‘file’)
{
$item[‘app’] = ‘file’;
@@ -78,7 +82,7 @@
* Some descriptive information about the portlet, so that users can decide if
* they want it or not, and for inclusion in lists, hover text, etc.
*
-
- These should be already translated, no further translation will be done.
-
- These should be already translated, no further Api\Translation will be done.
-
-
@return Array with keys
-
- displayName: Used in lists
@@ -101,7 +105,7 @@
- unique, if needed.
-
@return string HTML fragment for display
*/
- public function exec($id = null, etemplate_new &$etemplate = null)
- public function exec($id = null, Etemplate &$etemplate = null)
{
$etemplate->read(‘home.list’);
@@ -119,7 +123,7 @@
{
$list[‘app’] = ‘file’;
$list[‘path’] = $list[‘title’] = $list[‘icon’] = $list[‘id’];
@@ -132,7 +136,7 @@
* Settings should be in the same style as for preferences. It is OK to return an empty array
* for no customizable settings.
*
-
- These should be already translated, no further translation will be done.
-
- These should be already translated, no further Api\Translation will be done.
-
-
@see preferences/inc/class.preferences_settings.inc.php
-
@return Array of settings. Each setting should have the following keys:
— trunk/egroupware/home/inc/class.home_note_portlet.inc.php (original)
+++ trunk/egroupware/home/inc/class.home_note_portlet.inc.php Thu Apr 28 20:06:46 2016
@@ -1,6 +1,5 @@
<?php
+use EGroupware\Api;
+use EGroupware\Api\Etemplate;
/**
- A simple HTML note-to-self
@@ -24,12 +26,14 @@
public $public_functions = array(
‘edit’ => true
);
@@ -39,7 +43,7 @@
$need_reload = true;
}
@@ -54,34 +58,31 @@
if($content['group'] && $GLOBALS['egw_info']['apps']['admin'])
{
-
$type = is_numeric($group) ? "user" : $group;
-
$portlets = $prefs->read_repository();
-
$portlets = $portlets['home'];
-
$type = is_numeric($content['group']) ? "user" : $content['group'];
-
$arr = $prefs->read_repository();
-
$portlets = $arr['home'];
if($content['button'])
{
-
// Save updated Api\Preferences
$portlets[$id]['note'] = $content['note'];
$prefs->add('home', $id, $portlets[$id],$type);
$prefs->save_repository(True,$type);
// Yay for AJAX submit
-
Api\Json\Response::get()->apply('window.opener.app.home.refresh',array($id));
-
if(key($content['button'])=='save')
{
-
$content = array(
-
'note' => $portlets[$id]['note']
-
);
$etemplate->setElementAttribute('note', 'width', '99%');
$etemplate->setElementAttribute('note', 'height', $height);
$preserve = array(
@@ -89,10 +90,12 @@
‘height’ => $height,
‘group’ => $portlets[$id][‘group’]
);
-
$etemplate->exec('home.home_note_portlet.edit',$content, array(),array('note'=>false,'save'=>false), $preserve);
-
$etemplate->exec('home.home_note_portlet.edit',array(
-
'note' => $portlets[$id]['note']
-
), array(),array('note'=>false,'save'=>false), $preserve);
}
- public function exec($id = null, etemplate_new &$etemplate = null)
- public function exec($id = null, Etemplate &$etemplate = null)
{
// Allow to submit directly back here
if(is_array($id) && $id[‘id’])
@@ -107,7 +110,7 @@
if(!$content[‘note’])
{
$content[‘note’] = ‘’;
-
Api\Json\Response::get()->apply('app.home.note_edit',array($id));
}
$etemplate->exec('home.home_note_portlet.exec',$content,array(),array('__ALL__'=>true),array('id' =>$id));
— trunk/egroupware/home/inc/class.home_portlet.inc.php (original)
+++ trunk/egroupware/home/inc/class.home_portlet.inc.php Thu Apr 28 20:06:46 2016
@@ -10,6 +10,8 @@
+use EGroupware\Api\Etemplate;
abstract class home_portlet
{
@@ -33,7 +35,7 @@
* @param boolean $need_reload Flag to indicate that the portlet needs to be reloaded (exec will be called)
*/
public abstract function __construct(Array &$context = array(), &$need_reload = false);
- /**
- Some descriptive information about the portlet, so that users can decide if
- they want it or not, and for inclusion in lists, hover text, etc.
@@ -52,9 +54,9 @@
-
-
@param id String unique ID, provided to the portlet so it can make sure content is
- unique, if needed.
-
-
@param etemplate etemplate_new Etemplate to generate content
-
-
@param Etemplate $etemplate eTemplate to generate content
*/
- public abstract function exec($id = null, etemplate_new &$etemplate = null);
- /**
- If this portlet can accept, display, or otherwise handle multiple
- EgroupWare entries. Used for drag and drop processing. How the entries
— trunk/egroupware/home/inc/class.home_tutorial_ui.inc.php (original)
+++ trunk/egroupware/home/inc/class.home_tutorial_ui.inc.php Thu Apr 28 20:06:46 2016
@@ -9,6 +9,10 @@
+use EGroupware\Api;
+use EGroupware\Api\Framework;
+use EGroupware\Api\Etemplate;
class home_tutorial_ui
{
@@ -32,15 +36,13 @@
if (!EGroupware\Api\Hooks::exists(‘sidebox_all’, ‘home’) ||
EGroupware\Api\Hooks::exists(‘sidebox_all’, ‘home’, true) != ‘home_tutorial_ui::tutorial_menu’)
{
-
$setup_info = array();
-
include(EGW_SERVER_ROOT.'/home/setup/setup.inc.php');
-
$GLOBALS['egw']->hooks->register_hooks('home', $setup_info['home']['hooks']);
@@ -92,7 +94,7 @@
else
{
$content = array();
-
Framework::message(lang('You do not have permission to see this tutorial!'));
}
$tmpl->exec('home.home_tutorial_ui.popup', $content, $sel_options, array(), array(), 2);
@@ -103,7 +105,7 @@
*/
function ajax_data()
{
@@ -114,13 +116,13 @@
*/
static function getJsonData()
{
-
if (!($json = Api\Cache::getCache(Api\Cache::TREE, 'home', 'egw_tutorial_json')))
{
$json = file_get_contents('http://www.egroupware.de/videos/tutorials.json');
// Fallback tutorials.json
if (!$json) $json = file_get_contents('home/setup/tutorials.json');
// Cache the json object for two hours
-
egw_cache::setCache(egw_cache::TREE, 'home', 'egw_tutorial_json', $json, 7200);
-
Api\Cache::setCache(Api\Cache::TREE, 'home', 'egw_tutorial_json', $json, 7200);
}
return $json;
@@ -132,7 +134,7 @@
*/
public static function tutorial_menu()
{
— trunk/egroupware/home/inc/class.home_ui.inc.php (original)
+++ trunk/egroupware/home/inc/class.home_ui.inc.php Thu Apr 28 20:06:46 2016
@@ -9,6 +9,10 @@
+use EGroupware\Api;
+use EGroupware\Api\Framework;
+use EGroupware\Api\Etemplate;
/**
-
General user interface object of the Home app
@@ -37,9 +41,9 @@
self::setup_default_home();
// CSS for Gridster grid layout
@@ -51,13 +55,13 @@
$GLOBALS[‘egw_info’][‘flags’][‘currentapp’] = ‘home’;
// Main screen message
-
translation::add_app('mainscreen');
-
$greeting = translation::translate('mainscreen_message',false,'');
-
Api\Translation::add_app('mainscreen');
-
$greeting = Api\Translation::translate('mainscreen_message',false,'');
if($greeting == 'mainscreen_message'|| empty($greeting))
{
-
translation::add_app('mainscreen','en'); // trying the en one
-
$greeting = translation::translate('mainscreen_message',false,'');
-
Api\Translation::add_app('mainscreen','en'); // trying the en one
-
$greeting = Api\Translation::translate('mainscreen_message',false,'');
}
if(!($greeting == 'mainscreen_message'|| empty($greeting)))
{
@@ -67,6 +71,7 @@
$template->exec(‘home.home_ui.index’, $content);
// Now run the portlets themselves
@@ -152,7 +157,7 @@
* Actual portlet content is provided by each portlet.
* @param template etemplate so attributes can be set
*/
- protected function get_user_portlets(etemplate_new &$template)
- protected function get_user_portlets(Etemplate &$template)
{
$portlets = array();
@@ -228,9 +233,9 @@
// This should be set already, but just in case the execution path
// is different from normal...
@@ -239,7 +244,7 @@
$desc = $portlet->get_description();
// Pre-set up etemplate so it only needs done once
@@ -285,7 +290,7 @@
$appname = $app;
}
}
@@ -320,7 +325,7 @@
break;
}
}
@@ -344,7 +349,7 @@
*/
protected function get_portlet_list()
{
@@ -411,7 +416,7 @@
}, array(), 60);
// Filter list by current user's permissions
@@ -457,11 +462,11 @@
// If it’s a group, we’d like to know which
if($location == ‘group’)
{
-
$options = array('account_type' => $type);
-
$groups = accounts::link_query('',$options);
-
foreach($groups as $gid => $name)
-
$options = array('account_type' => 'groups');
-
$groups = Api\Accounts::link_query('',$options);
-
foreach(array_keys($groups) as $gid)
{
@@ -472,7 +477,7 @@
}
$actions[‘remove_default_’.$location] = array(
‘type’ => ‘popup’,
-
'caption' => lang('Remove as default for %1',is_numeric($location) ? accounts::id2name($location,'account_fullname') : $location),
-
'caption' => lang('Remove as default for %1',is_numeric($location) ? Api\Accounts::id2name($location,'account_fullname') : $location),
'onExecute' => 'javaScript:app.home.set_default',
'group' => 'Admins',
'portlet_group' => $location
@@ -526,7 +531,7 @@
}
if($group && $GLOBALS[‘egw_info’][‘user’][‘apps’][‘admin’])
{
@@ -536,7 +541,7 @@
$prefs->read_repository();
@@ -588,6 +593,7 @@
$add = true;
$classname = substr($classname, 4);
}
-
$content = null;
$portlet = $this->get_portlet($portlet_id, $context, $content, $attributes, $full_exec);
$context['class'] = get_class($portlet);
@@ -637,7 +643,7 @@
// Load the appropriate group
if($group)
{
@@ -651,7 +657,7 @@
{
foreach($portlet_ids as $id)
{
-
Api\Json\Response::get()->call('egw.message', lang("Set default"));
// Current user is setting the default, copy their settings
$settings = $GLOBALS['egw_info']['user']['preferences']['home'][$id];
$settings['group'] = $group;
@@ -666,16 +672,16 @@
{
foreach($portlet_ids as $id)
{
-
Api\Json\Response::get()->call('egw.message', lang("Removed default"));
$prefs->delete('home',$id, $type);
}
}
$prefs->save_repository(false,$type);
-
Api\Json\Response::get()->call('egw.set_preferences', (array)$pref['home'], 'home');
}
/**
@@ -697,12 +703,12 @@
$lang = $preferences->default[‘common’][‘lang’];
if (empty($lang)) $lang = ‘en’;
@@ -776,12 +782,12 @@
{
foreach($prefs as $name => $value)
{
-
Api\Preferences::delete_preference($app, $name, 'default');
$preferences->add($app, $name, $value, 'default');
}
}
// remove tutorial from home, as it is now in sidebox
-
Api\Preferences::delete_preference('home', 'portlet_setup142t', 'default');
$preferences->delete('home', 'portlet_setup142t', 'default');
// assigning saved preferences to egw_info, which is used for this request
@@ -802,7 +808,7 @@
default:
call_user_func(array(__CLASS__, 'setup_default_home_'.str_replace('.', '_', self::CURRENT_HOME_VERSION)));
— trunk/egroupware/home/inc/class.home_weather_portlet.inc.php (original)
+++ trunk