Author: nathangray
New Revision: 55419
URL: http://svn.stylite.de/viewvc/egroupware?rev=55419&view=rev
Log:
Get planner sitemanager module working
Modified:
trunk/calendar/inc/class.calendar_uiviews.inc.php
trunk/calendar/js/app.js
trunk/calendar/js/et2_widget_event.js
trunk/calendar/js/et2_widget_planner.js
trunk/calendar/sitemgr/class.module_calendar_planner.inc.php
— trunk/calendar/inc/class.calendar_uiviews.inc.php (original)
+++ trunk/calendar/inc/class.calendar_uiviews.inc.php Fri Mar 18 16:49:11 2016
@@ -524,11 +524,11 @@
// Loop through, using egw_time to handle DST
$week = 0;
@@ -1717,7 +1717,30 @@
}
return ‘’;
}
-
-
/**
-
- Calculates a brighter color for a given color
-
-
-
@param $rgb string color as #rrggbb value
-
-
@param $decr int value to add to each component, default 64
-
-
@return string the brighter color
-
*/
-
static function brighter($rgb,$decr=64)
-
{
-
if (!preg_match('/^#?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/',$rgb,$components))
-
{
-
return '#ffffff';
-
}
-
$brighter = '#';
-
for ($i = 1; $i <=3; ++$i)
-
{
-
$val = hexdec($components[$i]) + $decr;
-
if ($val > 255) $val = 255;
-
$brighter .= sprintf('%02x',$val);
-
}
-
//echo "brighter($rgb=".print_r($components,True).")=$brighter</p>\n";
-
return $brighter;
-
}
/**
- Calculates the brightness of a hexadecimal rgb color (median of the r, g and b components)
— trunk/calendar/js/app.js (original)
+++ trunk/calendar/js/app.js Fri Mar 18 16:49:11 2016
@@ -810,7 +810,7 @@
}
);
*/
@@ -1620,7 +1620,7 @@
update_state: function update_state(_set)
{
// Make sure we’re running in top window
@@ -1643,7 +1643,7 @@
{
// This activates calendar app if you call setState from a different app
// such as home. If we change state while not active, sizing is wrong.
@@ -2599,7 +2599,10 @@
csv_export: false
});
// Show ajax loader
-
if(typeof framework !== 'undefined')
-
{
-
framework.applications.calendar.sidemenuEntry.showAjaxLoader();
-
}
// Already in progress?
var query_string = JSON.stringify(query);
@@ -2693,7 +2696,10 @@
}
// Hide AJAX loader
— trunk/calendar/js/et2_widget_event.js (original)
+++ trunk/calendar/js/et2_widget_event.js Fri Mar 18 16:49:11 2016
@@ -233,18 +233,21 @@
}
// Copy actions set in parent
-
var action_parent = this;
-
while(action_parent != null && !action_parent.options.actions &&
-
!action_parent.instanceOf(et2_container)
-
)
-
{
-
action_parent = action_parent.getParent();
-
}
-
try {
-
this._link_actions(action_parent.options.actions||{});
-
} catch (e) {
-
// something went wrong, but keep quiet about it
-
debugger;
-
if(!this.options.readonly && !this._parent.options.readonly)
-
{
-
var action_parent = this;
-
while(action_parent != null && !action_parent.options.actions &&
-
!action_parent.instanceOf(et2_container)
-
)
-
{
-
action_parent = action_parent.getParent();
-
}
-
try {
-
this._link_actions(action_parent.options.actions||{});
-
} catch (e) {
-
// something went wrong, but keep quiet about it
-
debugger;
-
}
}
// Make sure category stuff is there
@@ -267,11 +270,14 @@
.append(this.title)
.append(this.body);
}
-
if(!this._parent.options.readonly && !this.options.readonly)
-
{
-
this.div
-
// Let timegrid always get the drag
-
.droppable('option','greedy',false);
-
}
// DOM nodes
this.div
-
// Let timegrid always get the drag
-
.droppable('option','greedy',false)
-
// Set full day flag
.attr('data-full_day', event.whole_day)
— trunk/calendar/js/et2_widget_planner.js (original)
+++ trunk/calendar/js/et2_widget_planner.js Fri Mar 18 16:49:11 2016
@@ -473,7 +473,7 @@
for(var i = 0; i < 12; i++)
{
// Not using UTC because we corrected for timezone offset
@@ -829,6 +829,8 @@
// Draw the rows
for(var key in labels)
{
-
if (!labels.hasOwnProperty(key)) continue;
-
// Skip sub-categories (events are merged into top level)
if(this.options.group_by == 'category' &&
(!app.calendar.state.cat_id || app.calendar.state.cat_id == '') &&
@@ -873,7 +875,8 @@
label: label,
start_date: start,
end_date: end,
@@ -900,8 +903,8 @@
var end = new Date(this.options.end_date);
end = new Date(end.valueOf() + end.getTimezoneOffset() * 60 * 1000);
-
var title = app.calendar.egw.lang(date('F',start))+' '+date('Y',start)+' - '+
-
app.calendar.egw.lang(date('F',end))+' '+date('Y',end);
-
var title = this.egw().lang(date('F',start))+' '+date('Y',start)+' - '+
-
this.egw().lang(date('F',end))+' '+date('Y',end);
content += '<div class="calendar_plannerMonthScale th et2_link" style="left: 0; width: 100%;">'+
title+"</div>";
@@ -946,7 +949,7 @@
{
days_in_month = days - i;
}
@@ -1000,7 +1003,7 @@
week_width = 100 / days * Math.min(days, days_in_week);
@@ -1053,15 +1056,15 @@
if (days <= 3)
{
-
title = app.calendar.egw.lang(date('l',t))+', '+date('j',t)+'. '+app.calendar.egw.lang(date('F',t));
-
title = this.egw().lang(date('l',t))+', '+date('j',t)+'. '+this.egw().lang(date('F',t));
}
else if (days <= 7)
{
-
title = this.egw().lang(date('D',t)).substr(0,2)+'<br />'+date('j',t);
}
state = new Date(t.valueOf() - start.getTimezoneOffset() * 60 * 1000).toJSON();
@@ -1740,7 +1743,7 @@
var result = true;
// Is this click in the event stuff, or in the header?
@@ -1795,7 +1798,7 @@
}
app.calendar.update_state(_ev.data);
}
— trunk/calendar/sitemgr/class.module_calendar_planner.inc.php (original)
+++ trunk/calendar/sitemgr/class.module_calendar_planner.inc.php Fri Mar 18 16:49:11 2016
@@ -16,15 +16,19 @@
class module_calendar_planner extends Module
{
/**
-
- Default callendar CSS file
-
- Default calendar CSS file
*/
const CALENDAR_CSS = ‘/calendar/templates/default/app.css’;
-
-
const ETEMPLATE_CSS = ‘/etemplate/templates/default/etemplate2.css’;
/**
- Constructor
*/
function __construct()
{
-
parent::__construct();
-
$this->arguments = array(
'sortby' => array(
'type' => 'select',
@@ -32,8 +36,7 @@
‘options’ => array(
0 => lang(‘Planner by category’),
‘user’ => lang(‘Planner by user’),
-
'month' => lang('Yearly Planner'),
-
'yearly' => lang('Yearly Planner').' ('.lang('initially year aligned').')',
@@ -186,10 +189,9 @@
*/
function get_content(&$arguments,$properties)
{
-
translation::add_app('calendar');
-
-
//_debug_array($arguments);
-
$arguments['view'] = 'planner';
@@ -200,7 +202,7 @@
$arguments[‘date’] = substr($arguments[‘date’],0,4).‘0101’;
}
if (isset($_GET[‘date’])) $arguments[‘date’] = $_GET[‘date’];
@@ -221,28 +223,94 @@
$html = '<style type="text/css">'."\n";
$html .= '@import url('.$GLOBALS['egw_info']['server']['webserver_url'].self::CALENDAR_CSS.");\n";
-
$html .= '@import url('.$GLOBALS['egw_info']['server']['webserver_url'].self::ETEMPLATE_CSS.");\n";
-
$html .= '@import url('.$GLOBALS['egw_info']['server']['webserver_url'].categories::css(categories::GLOBAL_APPNAME).");\n";
-
$html .= '@import url('.$GLOBALS['egw_info']['server']['webserver_url'].categories::css('calendar').");\n";
-
$html .= '.popupMainDiv #calendar-planner { position: static;}
-
#calendar-planner .calendar_plannerWidget, #calendar-planner div.calendar_plannerRows {
- height: auto !important;
+}
- '."\n";
-
$html .= html::image('sitemgr', 'left', lang('Previous'), 'onclick=\'app.calendar.toolbar_action({id:"previous"});\'')
-
. html::image('sitemgr', 'right', lang('Next'), 'style="float: right;" onclick=\'app.calendar.toolbar_action({id:"next"});\'');
if (is_array($params['owner']))
{
-
$params['owner'] = implode(',', $params['owner']);
-
-
$uiviews = new calendar_uiviews($params);
-
$uiviews->allowEdit = false; // switches off all edit popups
-
-
// Initialize Tooltips
-
static $wz_tooltips;
-
if (!$wz_tooltips++) $html .= '<script language="JavaScript" type="text/javascript" src="'.$GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/wz_tooltip/wz_tooltip.js"></script>'."\n";
-
-
// replacing egw-urls with sitemgr ones, allows to use navigation links
-
$html .= str_replace($GLOBALS['egw_info']['server']['webserver_url'].'/index.php?',
-
$this->link().'&',
-
$uiviews->planner(true));
-
// Buffer, and add anything that gets cleared to the content
-
ob_start(function($buffer) use(&$html) {
-
$html .= $buffer;
-
return '';
-
});
-
egw_framework::$header_done = true;
-
$ui = new calendar_uiviews();
-
$ui->sortby = $arguments['sortby'];
-
$ui->owner = $params['owner'];
-
-
if (!$ui->planner_view || $ui->planner_view == 'month') // planner monthview
-
{
-
if ($ui->day < 15) // show one complete month
-
{
-
$ui->_week_align_month($ui->first,$ui->last);
-
}
-
else // show 2 half month
-
{
-
$ui->_week_align_month($ui->first,$ui->last,15);
-
}
-
}
-
elseif ($ui->planner_view == 'week' || $ui->planner_view == 'weekN') // weeekview
-
{
-
$ui->first = $ui->datetime->get_weekday_start($ui->year,$ui->month,$ui->day);
-
$ui->last = $ui->bo->date2array($this->first);
-
$ui->last['day'] += ($ui->planner_view == 'week' ? 7 : 7 * $ui->cal_prefs['multiple_weeks'])-1;
-
$ui->last['hour'] = 23; $ui->last['minute'] = $ui->last['sec'] = 59;
-
unset($ui->last['raw']);
-
$ui->last = $ui->bo->date2ts($ui->last);
-
}
-
else // dayview
-
{
-
$ui->first = $ui->bo->date2ts($ui->date);
-
$ui->last = $ui->bo->date2array($ui->first);
-
$ui->last['day'] += 0;
-
$ui->last['hour'] = 23; $ui->last['minute'] = $ui->last['sec'] = 59;
-
unset($ui->last['raw']);
-
$ui->last = $ui->bo->date2ts($ui->last);
-
}
-
-
$search_params = $ui->search_params;
-
$search_params['daywise'] = false;
-
$search_params['start'] = $ui->first;
-
$search_params['end'] = $ui->last;
-
$search_params['owner'] = $ui->owner;
-
$search_params['enum_groups'] = $ui->sortby == 'user';
-
$content['planner'] = $ui->bo->search($search_params);
-
foreach($content['planner'] as &$event)
-
{
-
$ui->to_client($event);
-
}
-
-
$tmpl = new etemplate_new('calendar.planner');
-
-
$tmpl->setElementAttribute('planner','start_date', egw_time::to($ui->first, egw_time::ET2));
-
$tmpl->setElementAttribute('planner','end_date', egw_time::to($ui->last, egw_time::ET2));
-
$tmpl->setElementAttribute('planner','owner', $search_params['users']);
-
$tmpl->setElementAttribute('planner','group_by', $ui->sortby);
-
$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(
-
'owner' => $search_params['users'],
-
'sortby' => $ui->sortby,
-
'filter' => $arguments['filter']
-
)).');'
-
. '});'
-
. '</script>';
}
else
{
$html .= '<div class="message" align="center">'.lang('No owner selected').'</div>';
}
-
-
while(@ob_end_clean());
return $html;
}
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs