[eGroupWare-svn] r55981 - in /trunk/calendar: inc/ js/ sitemgr/
[email protected] Mon, 02 May 2016 19:22:52 -0000
| Newsgroups | gmane.comp.web.egroupware.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: nathangray
Date: Mon May 2 21:22:52 2016
New Revision: 55981
URL: http://svn.stylite.de/viewvc/egroupware?rev=55981&view=rev
Log:
Planner sitemgr module
- Check ACL and only offer users or resources anonymous user has access (read or free/busy) to
- Stop some errors from missing framework breaking the timegrid
- Fallback to be able to get resource labels in all cases
Modified:
trunk/calendar/inc/class.calendar_bo.inc.php
trunk/calendar/inc/class.calendar_owner_etemplate_widget.inc.php
trunk/calendar/js/app.js
trunk/calendar/js/et2_widget_planner.js
trunk/calendar/js/et2_widget_view.js
trunk/calendar/sitemgr/class.module_calendar_month.inc.php
trunk/calendar/sitemgr/class.module_calendar_planner.inc.php
Modified: trunk/calendar/inc/class.calendar_bo.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/inc/class.calendar_bo.inc.php?rev=55981&r1=55980&r2=55981&view=diff
==============================================================================
--- trunk/calendar/inc/class.calendar_bo.inc.php (original)
+++ trunk/calendar/inc/class.calendar_bo.inc.php Mon May 2 21:22:52 2016
@@ -262,7 +262,7 @@
);
Api\Cache::setSession('calendar', 'resources', $this->resources);
}
- //echo "registered resources="; _debug_array($this->resources);
+ //error_log(__METHOD__ . " registered resources=". array2string($this->resources));
$this->config = Api\Config::read('calendar'); // only used for horizont, regular calendar Api\Config is under phpgwapi
$this->require_acl_invite = $GLOBALS['egw_info']['server']['require_acl_invite'];
Modified: trunk/calendar/inc/class.calendar_owner_etemplate_widget.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/inc/class.calendar_owner_etemplate_widget.inc.php?rev=55981&r1=55980&r2=55981&view=diff
==============================================================================
--- trunk/calendar/inc/class.calendar_owner_etemplate_widget.inc.php (original)
+++ trunk/calendar/inc/class.calendar_owner_etemplate_widget.inc.php Mon May 2 21:22:52 2016
@@ -77,16 +77,13 @@
// Add external owners that a select account widget will not find
foreach($value as &$owner)
{
- // Make sure it's a string for comparison
- $owner = ''.$owner;
+ $label = self::get_owner_label($owner);
if(!is_numeric($owner))
{
$resource = $bo->resources[substr($owner, 0,1)];
- $label = Link::title($resource['app'], substr($owner,1));
}
else if (!in_array($owner, array_keys($accounts)))
{
- $label = Link::title('api-accounts',$owner);
$resource = array('app'=> 'api-accounts');
}
else
@@ -126,9 +123,15 @@
*
* @return Array List of matching results
*/
- public static function ajax_owner()
- {
- $bo = new calendar_bo();
+ public static function ajax_owner($id = null)
+ {
+ // Handle a request for a single ID
+ if($id)
+ {
+ $label = self::get_owner_label($id);
+ Api\Json\Response::get()->data($label);
+ return $label;
+ }
$query = $_REQUEST['query'];
// Arbitrarily limited to 50 / resource
@@ -190,4 +193,33 @@
echo json_encode($results);
exit();
}
+
+ /**
+ * Get just the label for a single owner
+ * @param string $id
+ */
+ protected static function get_owner_label($id)
+ {
+ static $bo;
+ if(!$bo) $bo = new calendar_bo();
+
+ $id = ''.$id;
+ if(!is_numeric($id))
+ {
+ $resource = $bo->resources[substr($id, 0,1)];
+ $label = Link::title($resource['app'], substr($id,1));
+
+ // Could not get via link, try via resources info
+ if($label === false)
+ {
+ $info = ExecMethod($resource['info'], substr($id,1));
+ $label = $info[0]['name'];
+ }
+ }
+ else
+ {
+ $label = Link::title('api-accounts',$id);
+ }
+ return $label;
+ }
}
Modified: trunk/calendar/js/app.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/js/app.js?rev=55981&r1=55980&r2=55981&view=diff
==============================================================================
--- trunk/calendar/js/app.js (original)
+++ trunk/calendar/js/app.js Mon May 2 21:22:52 2016
@@ -96,7 +96,7 @@
// Show loading div
egw.loading_prompt(
this.appname,true,egw.lang('please wait...'),
- framework.applications.calendar.tab.contentDiv,
+ typeof framework !== 'undefined' ? framework.applications.calendar.tab.contentDiv : false,
egwIsMobile()?'horizental':'spinner'
);
}
@@ -2833,7 +2833,7 @@
}
// Hide AJAX loader
- if(framework)
+ if(typeof framework !== 'undefined')
{
framework.applications.calendar.sidemenuEntry.hideAjaxLoader();
}
Modified: trunk/calendar/js/et2_widget_planner.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/js/et2_widget_planner.js?rev=55981&r1=55980&r2=55981&view=diff
==============================================================================
--- trunk/calendar/js/et2_widget_planner.js (original)
+++ trunk/calendar/js/et2_widget_planner.js Mon May 2 21:22:52 2016
@@ -349,9 +349,9 @@
}
else // users
{
- var label = this._get_owner_name(user)||'';
if(already_added.indexOf(user) < 0)
{
+ var label = this._get_owner_name(user)||'';
labels.push({id: user, label: label, data: {participants:user,owner:''}});
already_added.push(''+user);
}
@@ -1278,6 +1278,9 @@
* @param {type} actionLinks
*/
_init_links_dnd: function(mgr,actionLinks) {
+
+ if (this.options.readonly) return;
+
var self = this;
var drop_action = mgr.getActionById('egw_link_drop');
Modified: trunk/calendar/js/et2_widget_view.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/js/et2_widget_view.js?rev=55981&r1=55980&r2=55981&view=diff
==============================================================================
--- trunk/calendar/js/et2_widget_view.js (original)
+++ trunk/calendar/js/et2_widget_view.js Mon May 2 21:22:52 2016
@@ -335,6 +335,12 @@
user = app.calendar.sidebox_et2.getWidgetById('owner').options.select_options.find(function(element) {return element.id == user;}) || {};
label = user.label;
}
+ else
+ {
+ // No sidebox? Must be in home or sitemgr (no caching) - ask directly
+ label = '?';
+ egw.json('calendar_owner_etemplate_widget::ajax_owner',user,function(data) {label = data;}, this).sendRequest();
+ }
}
return label;
},
Modified: trunk/calendar/sitemgr/class.module_calendar_month.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/sitemgr/class.module_calendar_month.inc.php?rev=55981&r1=55980&r2=55981&view=diff
==============================================================================
--- trunk/calendar/sitemgr/class.module_calendar_month.inc.php (original)
+++ trunk/calendar/sitemgr/class.module_calendar_month.inc.php Mon May 2 21:22:52 2016
@@ -306,7 +306,6 @@
{
$GLOBALS['egw']->template = new Framework\Template;
}
- $html .= $this->ui->timeGridWidget($this->ui->tagWholeDayOnTop($week),$weeks == 2 ? 30 : 60,200,'',$title,0,$week_start+WEEK_s >= $last);
}
// Initialize Tooltips
$html .= '<script language="JavaScript" type="text/javascript" src="'.$GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/wz_tooltip/wz_tooltip.js"></script>'."\n";
Modified: trunk/calendar/sitemgr/class.module_calendar_planner.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/sitemgr/class.module_calendar_planner.inc.php?rev=55981&r1=55980&r2=55981&view=diff
==============================================================================
--- trunk/calendar/sitemgr/class.module_calendar_planner.inc.php (original)
+++ trunk/calendar/sitemgr/class.module_calendar_planner.inc.php Mon May 2 21:22:52 2016
@@ -113,6 +113,7 @@
'app' => 'calendar',
);
$accounts = $this->accounts->search($search_params);
+ $calendar_bo = new calendar_bo();
$users = array();
$groups = array();
// sort users and groups separately.
@@ -127,7 +128,7 @@
// get the rights for each account to check whether the anon user has read permissions.
$rights = $acl->get_rights($anon_user,'calendar');
// also add the anon user if it's his own calendar.
- if (($rights & Acl::READ) || ($entry['account_id'] == $anon_user))
+ if ($calendar_bo->check_perms(Acl::READ|calendar_bo::ACL_READ_FOR_PARTICIPANTS|calendar_bo::ACL_FREEBUSY,0,$entry['account_id'],'ts',null,$anon_user) || ($entry['account_id'] == $anon_user))
{
$has_read_permissions = true;
}
@@ -171,12 +172,17 @@
$this->arguments['owner']['multiple'] = true;
}
- $calendar_bo = new calendar_bo();
$query = '';
$options = array('start' => 0, 'num_rows' => 50);
+
+ $acl = new Acl($anon_user);
+ $acl->read_repository();
foreach ($calendar_bo->resources as $type => $data)
{
- if ($type != '' && $data['app'] && Link::get_registry($data['app'], 'query'))
+ // Check anon user's permissions - must have at least run for the hook to be available
+ if($acl->check('run',EGW_ACL_READ, $data['app']) &&
+ $type != '' && $data['app'] && Link::get_registry($data['app'], 'query')
+ )
{
$_results = Link::query($data['app'], $query,$options);
}
@@ -184,11 +190,15 @@
$_results = array_unique($_results);
foreach ($_results as $key => $value)
{
- $this->arguments['resources']['options'][$type.$key] = $value;
+ if($calendar_bo->check_perms(Acl::READ,0,$type.$key,'ts',null,$anon_user))
+ {
+ $this->arguments['resources']['options'][$type.$key] = $value;
+ }
}
}
$this->arguments['resources']['options'] = array_unique($this->arguments['resources']['options']);
$this->arguments['resources']['multiple'] = count($this->arguments['resources']['options']) ? 4 : 0;
+
return parent::get_user_interface();
}
@@ -309,12 +319,13 @@
$tmpl->exec(__METHOD__, $content,array(), array('__ALL__' => true),array(),2);
$html .= ob_get_contents();
$html .= '<script>'
- . '$j(function() {app.calendar.set_state(' . json_encode(array(
+ . ' window.egw_LAB.wait(function() {$j(function() {'
+ . 'app.calendar.set_state(' . json_encode(array(
'owner' => $search_params['owner'],
'sortby' => $ui->sortby,
'filter' => $arguments['filter']
)).');'
- . '});'
+ . '});});'
. '</script>';
}
else
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z