mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 12:39:25 +01:00
Calendar sidebox:
- Move today button to sidebox calendar header - Resources now add & remove from current owner, not replace it
This commit is contained in:
parent
e1640a94a8
commit
67b48d11c3
@ -2539,11 +2539,30 @@ app.classes.calendar = AppJS.extend(
|
|||||||
.find('.egw_fw_ui_category_content').not(sidebox.parent())
|
.find('.egw_fw_ui_category_content').not(sidebox.parent())
|
||||||
.on('change.sidebox', 'select:not(.et2_selectbox),input', this, function(event) {
|
.on('change.sidebox', 'select:not(.et2_selectbox),input', this, function(event) {
|
||||||
var state = {};
|
var state = {};
|
||||||
|
var name = this.name.replace('[]','');
|
||||||
|
var value = $j(this).val();
|
||||||
|
|
||||||
|
// Handle special value like r0, which removes all r
|
||||||
|
if(typeof value == 'string' && parseInt(value.substring(1)==0) ||
|
||||||
|
value[0] && typeof value[0] == 'string' && parseInt(value[0].substring(1))==0)
|
||||||
|
{
|
||||||
|
value = typeof value == 'string' ? value : value[0];
|
||||||
|
var type = value.substring(0,1);
|
||||||
|
state[name] = [];
|
||||||
|
for(var key in app.calendar.state[name])
|
||||||
|
{
|
||||||
|
var cur_item = app.calendar.state[name][key];
|
||||||
|
if(cur_item && (cur_item+'').substring(0,1) != type)
|
||||||
|
{
|
||||||
|
state[name].push(cur_item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$j('option', this).removeAttr('selected');
|
||||||
|
return app.calendar.update_state(state);
|
||||||
|
}
|
||||||
// Here we look for things like owner: ['r1,r2'] and change them
|
// Here we look for things like owner: ['r1,r2'] and change them
|
||||||
// to owner: ['r1','r2']
|
// to owner: ['r1','r2']
|
||||||
state[this.name.replace('[]','')] = $j(this).val();
|
state[name] = value;
|
||||||
$j('option', this).removeAttr('selected');
|
|
||||||
for(var key in state)
|
for(var key in state)
|
||||||
{
|
{
|
||||||
if(state[key] && typeof state[key].length !== 'undefined')
|
if(state[key] && typeof state[key].length !== 'undefined')
|
||||||
@ -2557,6 +2576,11 @@ app.classes.calendar = AppJS.extend(
|
|||||||
jQuery.extend(state[key], explode_me.split(','));
|
jQuery.extend(state[key], explode_me.split(','));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Add to, not replace, current value
|
||||||
|
if(typeof state[key] == 'object' && typeof app.calendar.state[key])
|
||||||
|
{
|
||||||
|
jQuery.extend(state[key],app.calendar.state[key]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
app.calendar.update_state(state);
|
app.calendar.update_state(state);
|
||||||
@ -2575,8 +2599,8 @@ app.classes.calendar = AppJS.extend(
|
|||||||
var date = this.sidebox_et2.getWidgetById('date');
|
var date = this.sidebox_et2.getWidgetById('date');
|
||||||
if(date)
|
if(date)
|
||||||
{
|
{
|
||||||
date.input_date.datepicker("option", {
|
var datepicker = date.input_date.datepicker("option", {
|
||||||
showButtonPanel: true,
|
showButtonPanel: false,
|
||||||
onChangeMonthYear: function(year, month, inst)
|
onChangeMonthYear: function(year, month, inst)
|
||||||
{
|
{
|
||||||
// Switch to month view for that month
|
// Switch to month view for that month
|
||||||
@ -2662,6 +2686,24 @@ app.classes.calendar = AppJS.extend(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Today
|
||||||
|
var today = et2_createWidget('buttononly', {image: 'calendar/today', label: 'Today', id: 'today'},date);
|
||||||
|
today.set_image('calendar/today');
|
||||||
|
var today_button = $j(today.getDOMNode());
|
||||||
|
today_button
|
||||||
|
.prependTo(date.getDOMNode())
|
||||||
|
.on('click', function() {
|
||||||
|
var inst = $j.datepicker._getInst(datepicker[0]);
|
||||||
|
inst.drawMonth = new Date().getUTCMonth();
|
||||||
|
inst.drawYear = new Date().getFullYear();
|
||||||
|
jQuery.datepicker._updateDatepicker(inst);
|
||||||
|
});
|
||||||
|
var position_today = function() {
|
||||||
|
var week_col = $j('#calendar-sidebox_date th.ui-datepicker-week-col');
|
||||||
|
today_button.position({my: 'left top', at: 'left top', of: week_col,collision:'none'});
|
||||||
|
};
|
||||||
|
window.setTimeout(position_today,0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
#calendar-sidebox_date td.ui-datepicker-week-col {
|
#calendar-sidebox_date td.ui-datepicker-week-col {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
#calendar-sidebox_date img.et2_button {
|
||||||
|
position: absolute;
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
#calendar-sidebox_date .calendar_calHoliday {
|
#calendar-sidebox_date .calendar_calHoliday {
|
||||||
background: inherit;
|
background: inherit;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user