[gen] Calendar field: added the notion of layer.
This commit is contained in:
parent
be159b33be
commit
def1b6ab70
5 changed files with 160 additions and 43 deletions
|
@ -39,7 +39,8 @@ class BaseMixin:
|
|||
* initiator is the initiator (Zope or Appy) object;
|
||||
* field is the Ref instance.
|
||||
'''
|
||||
rq = self.REQUEST
|
||||
rq = getattr(self, 'REQUEST', None)
|
||||
if not rq: return None, None
|
||||
if not rq.get('nav', '').startswith('ref.'): return None, None
|
||||
splitted = rq['nav'].split('.')
|
||||
initiator = self.getTool().getObject(splitted[1])
|
||||
|
|
|
@ -200,4 +200,4 @@ td.search { padding-top: 8px }
|
|||
.highlight { background-color: yellow }
|
||||
.globalActions { margin-bottom: 4px }
|
||||
.objectActions { margin: 2px 0 }
|
||||
.smallbox { margin: 0; vertical-align: middle }
|
||||
.smallbox { margin: 0 0 0 3px; vertical-align: middle }
|
||||
|
|
|
@ -950,8 +950,8 @@ function closePopup(popupId, clean) {
|
|||
popup.style.width = null;
|
||||
// Clean field "clean" if specified
|
||||
if (clean) {
|
||||
var f = popup.getElementsByTagName('form')[0];
|
||||
f.elements[clean].value = '';
|
||||
var elem = popup.getElementsByTagName('form')[0].elements[clean];
|
||||
if (elem) elem.value = '';
|
||||
}
|
||||
if (popupId == 'iframePopup') {
|
||||
// Reinitialise the enclosing iframe
|
||||
|
|
|
@ -182,3 +182,25 @@ function onCheckCbCell(cb, hook, totalRows, totalCols) {
|
|||
}
|
||||
}
|
||||
}
|
||||
// Switches a layer on/off within a calendar
|
||||
function switchCalendarLayer(hookId, checkbox) {
|
||||
/* Update the ajax data about active layers from p_checkbox, that represents
|
||||
the status of some layer */
|
||||
var layer = checkbox.id.split('_').pop();
|
||||
var d = getAjaxHook(hookId)['ajax'];
|
||||
var activeLayers = d.params['activeLayers'];
|
||||
if (checkbox.checked) {
|
||||
// Add the layer to active layers
|
||||
activeLayers = (!activeLayers)? layer: activeLayers + ',' + layer;
|
||||
}
|
||||
else {
|
||||
// Remove the layer from active layers
|
||||
var res = [];
|
||||
var splitted = activeLayers.split(',');
|
||||
for (var i=0; i<splitted.length; i++) {
|
||||
if (splitted[i] != layer) res.push(splitted[i]);
|
||||
}
|
||||
activeLayers = res.join();
|
||||
}
|
||||
askAjax(hookId, null, {'activeLayers': activeLayers});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue