merged master into typescript

This commit is contained in:
Ralf Becker 2020-02-03 15:16:51 +00:00
commit 2fc0666762
13 changed files with 1691 additions and 877 deletions

View File

@ -174,3 +174,10 @@ declare function et2_directChildrenByTagName(_node, _tagName);
declare function et2_filteredNodeIterator(_node, _callback, _context); declare function et2_filteredNodeIterator(_node, _callback, _context);
declare function et2_readAttrWithDefault(_node, _name, _default?); declare function et2_readAttrWithDefault(_node, _name, _default?);
declare function sprintf(format : string, ...args : any) : string; declare function sprintf(format : string, ...args : any) : string;
declare function fetchAll(ids, nextmatch, callback : Function) : boolean;
declare function doLongTask(idsArr : string[], all : boolean, _action : any, nextmatch : any) : boolean;
declare function nm_compare_field(_action, _senders, _target) : boolean;
declare function nm_open_popup(_action, _selected) : void;
declare function nm_submit_popup(button) : void;
declare function nm_hide_popup(element, div_id) : false;
declare function nm_activate_link(_action, _senders) : void;

View File

@ -440,7 +440,11 @@
// get TypeScript modules working with our loader // get TypeScript modules working with our loader
function require(_file) function require(_file)
{ {
switch(_file)
{
case 'jquery': // cropper mistakes this for commonJS (typeof exports === 'object')
return window.jQuery;
}
return window.exports; return window.exports;
} }
var exports = {}; var exports = {};

View File

@ -40,6 +40,15 @@ declare interface Iapplication
icon_app? : string; icon_app? : string;
} }
/**
* Data stored by egw_data
*/
declare interface IegwData
{
timestamp: number;
data: {[key:string]: any};
}
/** /**
* Interface for all window global methods (existing only in top window) * Interface for all window global methods (existing only in top window)
*/ */
@ -111,15 +120,15 @@ declare interface IegwGlobal
* @param _uid is the uid for which should be checked whether it has some * @param _uid is the uid for which should be checked whether it has some
* data. * data.
*/ */
dataGetUIDdata(_uid : string) : object; dataGetUIDdata(_uid : string) : IegwData;
/** /**
* Returns all uids that have the given prefix * Returns all uids that have the given prefix
* *
* @param {string} _prefix * @param {string} _prefix
* @return {array} * @return {array} of uids
* TODO: Improve this * TODO: Improve this
*/ */
dataKnownUIDs(_prefix : string) : any[]; dataKnownUIDs(_prefix : string) : string[];
/** /**
* Stores data for the uid and calls all callback functions registered * Stores data for the uid and calls all callback functions registered
* for that uid. * for that uid.
@ -682,6 +691,7 @@ declare class JsonRequest
*/ */
declare interface IegwWndLocal extends IegwGlobal declare interface IegwWndLocal extends IegwGlobal
{ {
window : Window;
/** /**
* implemented in egw_css.js * implemented in egw_css.js
*/ */
@ -938,7 +948,7 @@ declare interface IegwWndLocal extends IegwGlobal
* @param {boolean} _check_popup_blocker TRUE check if browser pop-up blocker is on/off, FALSE no check * @param {boolean} _check_popup_blocker TRUE check if browser pop-up blocker is on/off, FALSE no check
* - This option only makes sense to be enabled when the open_link requested without user interaction * - This option only makes sense to be enabled when the open_link requested without user interaction
*/ */
open(id_data : string|number|object, app? : string, type? : "edit"|"view"|"view_list"|"add", open(id_data : string|number|object, app? : string, type? : "edit"|"view"|"view_list"|"add"|"list",
extra? : string|object, target? : string, target_app? : string, _check_popup_blocker? : boolean) : string; extra? : string|object, target? : string, target_app? : string, _check_popup_blocker? : boolean) : string;
/** /**
* Open a link, which can be either a menuaction, a EGroupware relative url or a full url * Open a link, which can be either a menuaction, a EGroupware relative url or a full url
@ -1185,12 +1195,13 @@ declare interface IegwAppLocal extends IegwWndLocal
declare function egw_getFramework() : any; declare function egw_getFramework() : any;
declare var chrome : any; declare var chrome : any;
declare var InstallTrigger : any; declare var InstallTrigger : any;
declare var app : {classes: any}; declare var app : {classes: any, [propName: string]: any};
declare var egw_globalObjectManager : any; declare var egw_globalObjectManager : any;
declare var framework : any; declare var framework : any;
declare var egw_LAB : any; declare var egw_LAB : any;
declare function egwIsMobile() : boolean; declare function egwIsMobile() : string|null;
declare var mailvelope : any; declare var mailvelope : any;
declare function egw_refresh(_msg : string, app : string, id? : string|number, _type?, targetapp?, replace?, _with?, msgtype?); declare function egw_refresh(_msg : string, app : string, id? : string|number, _type?, targetapp?, replace?, _with?, msgtype?);
declare function egw_open();

View File

@ -14,7 +14,7 @@ $setup_info['api']['title'] = 'EGroupware API';
$setup_info['api']['version'] = '19.1.003'; $setup_info['api']['version'] = '19.1.003';
$setup_info['api']['versions']['current_header'] = '1.29'; $setup_info['api']['versions']['current_header'] = '1.29';
// maintenance release in sync with changelog in doc/rpm-build/debian.changes // maintenance release in sync with changelog in doc/rpm-build/debian.changes
$setup_info['api']['versions']['maintenance_release'] = '19.1.20191220'; $setup_info['api']['versions']['maintenance_release'] = '19.1.20200130';
$setup_info['api']['enable'] = 3; $setup_info['api']['enable'] = 3;
$setup_info['api']['app_order'] = 1; $setup_info['api']['app_order'] = 1;
$setup_info['api']['license'] = 'GPL'; $setup_info['api']['license'] = 'GPL';

View File

@ -144,7 +144,7 @@ class Taglist extends Etemplate\Widget
foreach((array) $value as $key => $val) foreach((array) $value as $key => $val)
{ {
if($this->type == 'taglist-account') if($this->type == 'taglist-account' && !$this->attrs['allowFreeEntries'])
{ {
// If in allowed options, skip account check to support app-specific options // If in allowed options, skip account check to support app-specific options
if(count($allowed) > 0 && in_array($val, $allowed)) continue; if(count($allowed) > 0 && in_array($val, $allowed)) continue;

View File

@ -783,10 +783,11 @@ class Translation
* @param string $lang language code * @param string $lang language code
* @return the full path of the filename for the requested app and language * @return the full path of the filename for the requested app and language
*/ */
static function get_lang_file($app,$lang) static function get_lang_file($app,$lang,$root=EGW_SERVER_ROOT)
{ {
if ($app == 'common') $app = 'phpgwapi'; if ($app == 'common') $app = 'api';
return EGW_SERVER_ROOT.'/'.$app.'/'.self::LANG_DIR.'/'.self::LANGFILE_PREFIX.$lang.self::LANGFILE_EXTENSION;
return $root.'/'.$app.'/'.self::LANG_DIR.'/'.self::LANGFILE_PREFIX.$lang.self::LANGFILE_EXTENSION;
} }
/** /**

View File

@ -1,3 +1,19 @@
egroupware-docker (19.1.20200130) hardy; urgency=low
* SECURITY AND MAINTENANCE RELEASE: PLEASE UPDATE IMMEDIATELY (includes 17.1 and before!)
* Sharing: temporary disable cleaning of deleted files, causing all shares to get deleted
* Api: Fix SQL error from doubled table name in group statement
* Admin: Fix group email got lost on save
* CalDAV/Calendar: fix for first recurence being an exception cause it to be deleted by mac calendar
* CalDAV/Calendar: virtual exceptions (different status for recurrences) were not exported
* Mail: Fix broken link mail in infolog via drag and drop action
* Collabora: explicit save creates no new version if last one was an autosave
* Projectmanager: Fix Gantt chart to use all available vertical space
* ProjectManager/PostgreSQL: fix SQL error / regression in last maintenance release
* Tracker: using RowsIterator to export more rows then the memory-limit
-- Ralf Becker <rb@egroupware.org> Thu, 30 Jan 2020 13:56:32 +0100
egroupware-docker (19.1.20191220) hardy; urgency=low egroupware-docker (19.1.20191220) hardy; urgency=low
* All apps: make list columns being sortable via column-selector dialog * All apps: make list columns being sortable via column-selector dialog

View File

@ -59,3 +59,13 @@ sed -e 's/egroupware-docker (/<h3>/g' \
-e 's/^ \* \(.*\)/<li>\1<\/li>/g' > /tmp/README_UPDATE -e 's/^ \* \(.*\)/<li>\1<\/li>/g' > /tmp/README_UPDATE
$debug univention-appcenter-control upload $ucs/egroupware=$version.$packaging$postfix /tmp/README_UPDATE $debug univention-appcenter-control upload $ucs/egroupware=$version.$packaging$postfix /tmp/README_UPDATE
# replace images so Univention can automatic fetch them into their repo
#uni_version=$(curl https://appcenter-test.software-univention.de/univention-repository/4.4/maintained/component/ 2>/dev/null | grep egroupware_$packaging | sed 's|.*href="\(egroupware_[0-9]*\)/".*|\1|')
#curl https://appcenter-test.software-univention.de/univention-repository/4.4/maintained/component/$uni_version/compose 2>/dev/null > /tmp/compose
univention-appcenter-control get 4.4/egroupware=$version.$packaging$postfix --json | jq -r .compose > /tmp/compose
sed -i "" \
-e "s|image:.*docker.software-univention.de/egroupware-egroupware.*|image:download.egroupware.org/egroupware/epl:$version.$packaging|" \
-e "s|image:.*docker.software-univention.de/egroupware-nginx.*|image:nginx:stable-alpine|" \
/tmp/compose
$debug univention-appcenter-control upload $ucs/egroupware=$version.$packaging$postfix /tmp/compose

View File

@ -1,43 +1,58 @@
"use strict";
/** /**
* EGroupware - Infolog - Javascript UI * EGroupware - Infolog - Javascript UI
* *
* @link http://www.egroupware.org * @link: https://www.egroupware.org
* @package infolog * @package infolog
* @author Hadi Nategh <hn-AT-stylite.de> * @author Hadi Nategh <hn-AT-stylite.de>
* @copyright (c) 2008-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de> * @copyright (c) 2008-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/ */
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/*egw:uses
/api/js/jsapi/egw_app.js
*/
require("jquery");
require("jqueryui");
require("../jsapi/egw_global");
require("../etemplate/et2_types");
var egw_app_1 = require("../../api/js/jsapi/egw_app");
/** /**
* UI for Infolog * UI for Infolog
* *
* @augments AppJS * @augments AppJS
*/ */
app.classes.infolog = AppJS.extend( var InfologApp = /** @class */ (function (_super) {
{ __extends(InfologApp, _super);
appname: 'infolog',
/** /**
* Constructor * Constructor
* *
* @memberOf app.infolog * @memberOf app.infolog
*/ */
init: function() function InfologApp() {
{
// call parent // call parent
this._super.apply(this, arguments); return _super.call(this) || this;
}, }
/** /**
* Destructor * Destructor
*/ */
destroy: function() InfologApp.prototype.destroy = function () {
{
// call parent // call parent
this._super.apply(this, arguments); _super.prototype.destroy.apply(this, arguments);
}, };
/** /**
* This function is called when the etemplate2 object is loaded * This function is called when the etemplate2 object is loaded
* and ready. If you must store a reference to the et2 object, * and ready. If you must store a reference to the et2 object,
@ -46,13 +61,10 @@ app.classes.infolog = AppJS.extend(
* @param {etemplate2} _et2 newly ready object * @param {etemplate2} _et2 newly ready object
* @param {string} _name template name * @param {string} _name template name
*/ */
et2_ready: function(_et2, _name) InfologApp.prototype.et2_ready = function (_et2, _name) {
{
// call parent // call parent
this._super.apply(this, arguments); _super.prototype.et2_ready.apply(this, arguments);
switch (_name) {
switch(_name)
{
case 'infolog.index': case 'infolog.index':
this.filter_change(); this.filter_change();
// Show / hide descriptions according to details filter // Show / hide descriptions according to details filter
@ -61,46 +73,40 @@ app.classes.infolog = AppJS.extend(
this.show_details(filter2.value == 'all', nm.getDOMNode(nm)); this.show_details(filter2.value == 'all', nm.getDOMNode(nm));
// Remove the rule added by show_details() if the template is removed // Remove the rule added by show_details() if the template is removed
jQuery(_et2.DOMContainer).on('clear', jQuery.proxy(function () { egw.css(this); }, '#' + nm.getDOMNode(nm).id + ' .et2_box.infoDes')); jQuery(_et2.DOMContainer).on('clear', jQuery.proxy(function () { egw.css(this); }, '#' + nm.getDOMNode(nm).id + ' .et2_box.infoDes'));
// Enable decrypt on hover // Enable decrypt on hover
if(this.egw.user('apps').stylite) if (this.egw.user('apps').stylite) {
{
this._get_stylite(function () { this.mailvelopeAvailable(function () { app.stylite.decrypt_hover(nm); }); }); this._get_stylite(function () { this.mailvelopeAvailable(function () { app.stylite.decrypt_hover(nm); }); });
} }
break; break;
case 'infolog.edit.print': case 'infolog.edit.print':
if (this.et2.getArrayMgr('content').data.info_des.indexOf(this.begin_pgp_message) != -1) if (this.et2.getArrayMgr('content').data.info_des.indexOf(this.begin_pgp_message) != -1) {
{
this.mailvelopeAvailable(this.printEncrypt); this.mailvelopeAvailable(this.printEncrypt);
} }
else else {
{
// Trigger print command if the infolog oppend for printing purpose // Trigger print command if the infolog oppend for printing purpose
this.infolog_print_preview_onload(); this.infolog_print_preview_onload();
} }
break; break;
case 'infolog.edit': case 'infolog.edit':
if (this.et2.getArrayMgr('content').data.info_des && if (this.et2.getArrayMgr('content').data.info_des &&
this.et2.getArrayMgr('content').data.info_des.indexOf(this.begin_pgp_message) != -1) this.et2.getArrayMgr('content').data.info_des.indexOf(this.begin_pgp_message) != -1) {
{ this._get_stylite(jQuery.proxy(function () {
this._get_stylite(jQuery.proxy(function() {this.mailvelopeAvailable(jQuery.proxy(function() { this.mailvelopeAvailable(jQuery.proxy(function () {
this.toggleEncrypt(); this.toggleEncrypt();
// Decrypt history on hover // Decrypt history on hover
var history = this.et2.getWidgetById('history'); var history = this.et2.getWidgetById('history');
app.stylite.decrypt_hover(history, 'span'); app.stylite.decrypt_hover(history, 'span');
jQuery(history.getDOMNode(history)) jQuery(history.getDOMNode(history))
.tooltip('option', 'position', { my: 'top left', at: 'top left', of: history.getDOMNode(history) }); .tooltip('option', 'position', { my: 'top left', at: 'top left', of: history.getDOMNode(history) });
}, this));
},this));},this)); }, this));
// This disables the diff in history // This disables the diff in history
var history = this.et2.getArrayMgr('content').getEntry('history'); var history = this.et2.getArrayMgr('content').getEntry('history');
history['status-widgets'].De = 'description'; history['status-widgets'].De = 'description';
} }
break; break;
} }
}, };
/** /**
* Observer method receives update notifications from all applications * Observer method receives update notifications from all applications
* *
@ -120,28 +126,23 @@ app.classes.infolog = AppJS.extend(
* @param {object|null} _links app => array of ids of linked entries * @param {object|null} _links app => array of ids of linked entries
* or null, if not triggered on server-side, which adds that info * or null, if not triggered on server-side, which adds that info
*/ */
observer: function(_msg, _app, _id, _type, _msg_type, _links) InfologApp.prototype.observer = function (_msg, _app, _id, _type, _msg_type, _links) {
{ if (typeof _links != 'undefined') {
if (typeof _links != 'undefined') if (typeof _links.infolog != 'undefined') {
{ switch (_app) {
if (typeof _links.infolog != 'undefined')
{
switch (_app)
{
case 'timesheet': case 'timesheet':
var nm = this.et2 ? this.et2.getWidgetById('nm') : null; var nm = this.et2 ? this.et2.getWidgetById('nm') : null;
if (nm) nm.applyFilters(); if (nm)
nm.applyFilters();
break; break;
} }
} }
} }
// Refresh handler for Addressbook CRM view // Refresh handler for Addressbook CRM view
if (_app == 'infolog' && this.et2.getInstanceManager() && this.et2.getInstanceManager().app == 'addressbook' && this.et2.getInstanceManager().name == 'infolog.index') if (_app == 'infolog' && this.et2.getInstanceManager() && this.et2.getInstanceManager().app == 'addressbook' && this.et2.getInstanceManager().name == 'infolog.index') {
{
this.et2._inst.refresh(_msg, _app, _id, _type); this.et2._inst.refresh(_msg, _app, _id, _type);
} }
}, };
/** /**
* Retrieve the current state of the application for future restoration * Retrieve the current state of the application for future restoration
* *
@ -150,26 +151,20 @@ app.classes.infolog = AppJS.extend(
* *
* @return {object} Application specific map representing the current state * @return {object} Application specific map representing the current state
*/ */
getState: function() InfologApp.prototype.getState = function () {
{
// call parent // call parent
var state = this._super.apply(this, arguments); var state = _super.prototype.observer.apply(this, arguments);
var nm = {}; var nm = {};
// Get index etemplate // Get index etemplate
var et2 = etemplate2.getById('infolog-index'); var et2 = etemplate2.getById('infolog-index');
if(et2) if (et2) {
{
var content = et2.widgetContainer.getArrayMgr('content'); var content = et2.widgetContainer.getArrayMgr('content');
nm = content && content.data && content.data.nm ? content.data.nm : {}; nm = content && content.data && content.data.nm ? content.data.nm : {};
} }
state.action = nm.action || null; state.action = nm.action || null;
state.action_id = nm.action_id || null; state.action_id = nm.action_id || null;
return state; return state;
}, };
/** /**
* Set the application's state to the given state. * Set the application's state to the given state.
* *
@ -180,39 +175,33 @@ app.classes.infolog = AppJS.extend(
* *
* @return {boolean} false - Returns false to stop event propagation * @return {boolean} false - Returns false to stop event propagation
*/ */
setState: function(state) InfologApp.prototype.setState = function (state) {
{
// as we have to set state.state.action, we have to set all other // as we have to set state.state.action, we have to set all other
// for "No filter" favorite to work as expected // for "No filter" favorite to work as expected
var to_set = { col_filter: null, filter: '', filter2: '', cat_id: '', search: '', action: null }; var to_set = { col_filter: null, filter: '', filter2: '', cat_id: '', search: '', action: null };
if (typeof state.state == 'undefined') state.state = {}; if (typeof state.state == 'undefined')
for(var name in to_set) state.state = {};
{ for (var name in to_set) {
if (typeof state.state[name] == 'undefined') state.state[name] = to_set[name]; if (typeof state.state[name] == 'undefined')
state.state[name] = to_set[name];
} }
return this._super.apply(this, arguments); return _super.prototype.setState.apply(this, arguments);
}, };
/** /**
* Enable or disable the date filter * Enable or disable the date filter
* *
* If the filter is set to something that needs dates, we enable the * If the filter is set to something that needs dates, we enable the
* header_left template. Otherwise, it is disabled. * header_left template. Otherwise, it is disabled.
*/ */
filter_change: function() InfologApp.prototype.filter_change = function () {
{
var filter = this.et2.getWidgetById('filter'); var filter = this.et2.getWidgetById('filter');
var nm = this.et2.getWidgetById('nm'); var nm = this.et2.getWidgetById('nm');
var dates = this.et2.getWidgetById('infolog.index.dates'); var dates = this.et2.getWidgetById('infolog.index.dates');
if(nm && filter) if (nm && filter) {
{ switch (filter.getValue()) {
switch(filter.getValue())
{
case 'bydate': case 'bydate':
case 'duedate': case 'duedate':
if (filter && dates) {
if (filter && dates)
{
dates.set_disabled(false); dates.set_disabled(false);
window.setTimeout(function () { window.setTimeout(function () {
jQuery(dates.getWidgetById('startdate').getDOMNode()).find('input').focus(); jQuery(dates.getWidgetById('startdate').getDOMNode()).find('input').focus();
@ -220,15 +209,13 @@ app.classes.infolog = AppJS.extend(
} }
break; break;
default: default:
if (dates) if (dates) {
{
dates.set_disabled(true); dates.set_disabled(true);
} }
break; break;
} }
} }
}, };
/** /**
* show or hide the details of rows by selecting the filter2 option * show or hide the details of rows by selecting the filter2 option
* either 'all' for details or 'no_description' for no details * either 'all' for details or 'no_description' for no details
@ -236,44 +223,33 @@ app.classes.infolog = AppJS.extend(
* @param {Event} event Change event * @param {Event} event Change event
* @param {et2_nextmatch} nm The nextmatch widget that owns the filter * @param {et2_nextmatch} nm The nextmatch widget that owns the filter
*/ */
filter2_change: function(event, nm) InfologApp.prototype.filter2_change = function (event, nm) {
{
var filter2 = nm.getWidgetById('filter2'); var filter2 = nm.getWidgetById('filter2');
if (nm && filter2) {
if (nm && filter2)
{
// Show / hide descriptions // Show / hide descriptions
this.show_details(filter2.get_value() === 'all', nm.getDOMNode(nm)); this.show_details(filter2.get_value() === 'all', nm.getDOMNode(nm));
} }
// Only change columns for a real user event, to avoid interfering with // Only change columns for a real user event, to avoid interfering with
// favorites // favorites
if (nm && filter2 && !nm.update_in_progress) if (nm && filter2 && !nm.update_in_progress) {
{
// Store selection as implicit preference // Store selection as implicit preference
egw.set_preference('infolog', nm.options.settings.columnselection_pref.replace('-details', '') + '-details-pref', filter2.value); egw.set_preference('infolog', nm.options.settings.columnselection_pref.replace('-details', '') + '-details-pref', filter2.value);
// Change preference location - widget is nextmatch // Change preference location - widget is nextmatch
nm.options.settings.columnselection_pref = nm.options.settings.columnselection_pref.replace('-details', '') + (filter2.value == 'all' ? '-details' : ''); nm.options.settings.columnselection_pref = nm.options.settings.columnselection_pref.replace('-details', '') + (filter2.value == 'all' ? '-details' : '');
// Load new preferences // Load new preferences
var colData = nm.columns.slice(); var colData = nm.columns.slice();
for(var i = 0; i < nm.columns.length; i++) colData[i].visible=false; for (var i = 0; i < nm.columns.length; i++)
colData[i].visible = false;
if(egw.preference(nm.options.settings.columnselection_pref,'infolog')) if (egw.preference(nm.options.settings.columnselection_pref, 'infolog')) {
{
nm.set_columns(egw.preference(nm.options.settings.columnselection_pref, 'infolog').split(',')); nm.set_columns(egw.preference(nm.options.settings.columnselection_pref, 'infolog').split(','));
} }
nm._applyUserPreferences(nm.columns, colData); nm._applyUserPreferences(nm.columns, colData);
// Now apply them to columns // Now apply them to columns
for(var i = 0; i < colData.length; i++) for (var i = 0; i < colData.length; i++) {
{
nm.dataview.getColumnMgr().columns[i].set_width(colData[i].width); nm.dataview.getColumnMgr().columns[i].set_width(colData[i].width);
nm.dataview.getColumnMgr().columns[i].set_visibility(colData[i].visible); nm.dataview.getColumnMgr().columns[i].set_visibility(colData[i].visible);
} }
nm.dataview.getColumnMgr().updated = true; nm.dataview.getColumnMgr().updated = true;
// Update page - set update_in_progress to true to avoid triggering // Update page - set update_in_progress to true to avoid triggering
// the change handler and looping if the user has a custom field // the change handler and looping if the user has a custom field
// column change // column change
@ -285,51 +261,39 @@ app.classes.infolog = AppJS.extend(
nm.update_in_progress = in_progress; nm.update_in_progress = in_progress;
} }
return false; return false;
}, };
/** /**
* Show or hide details by changing the CSS class * Show or hide details by changing the CSS class
* *
* @param {boolean} show * @param {boolean} show
* @param {DOMNode} dom_node * @param {DOMNode} dom_node
*/ */
show_details: function(show, dom_node) InfologApp.prototype.show_details = function (show, dom_node) {
{
// Show / hide descriptions // Show / hide descriptions
egw.css((dom_node && dom_node.id ? "#" + dom_node.id + ' ' : '') + ".et2_box.infoDes", "display:" + (show ? "block;" : "none;")); egw.css((dom_node && dom_node.id ? "#" + dom_node.id + ' ' : '') + ".et2_box.infoDes", "display:" + (show ? "block;" : "none;"));
if (egwIsMobile()) if (egwIsMobile()) {
{
var $select = jQuery('.infoDetails'); var $select = jQuery('.infoDetails');
(show) ? $select.each(function (i, e) { jQuery(e).hide(); }) : $select.each(function (i, e) { jQuery(e).show(); }); (show) ? $select.each(function (i, e) { jQuery(e).hide(); }) : $select.each(function (i, e) { jQuery(e).show(); });
} }
}, };
InfologApp.prototype.confirm_delete_2 = function (_action, _senders) {
confirm_delete_2: function (_action, _senders)
{
var children = false; var children = false;
var child_button = jQuery('#delete_sub').get(0) || jQuery('[id*="delete_sub"]').get(0); var child_button = jQuery('#delete_sub').get(0) || jQuery('[id*="delete_sub"]').get(0);
if(child_button) if (child_button) {
{ for (var i = 0; i < _senders.length; i++) {
for(var i = 0; i < _senders.length; i++) if (jQuery(_senders[i].iface.node).hasClass('infolog_rowHasSubs')) {
{
if (jQuery(_senders[i].iface.node).hasClass('infolog_rowHasSubs'))
{
children = true; children = true;
break; break;
} }
} }
child_button.style.display = children ? 'block' : 'none'; child_button.style.display = children ? 'block' : 'none';
} }
var callbackDeleteDialog = function (button_id) var callbackDeleteDialog = function (button_id) {
{ if (button_id == et2_dialog.YES_BUTTON) {
if (button_id == et2_dialog.YES_BUTTON )
{
} }
}; };
et2_dialog.show_dialog(callbackDeleteDialog, this.egw.lang("Do you really want to DELETE this Rule"), this.egw.lang("Delete"), {}, et2_dialog.BUTTONS_YES_NO_CANCEL, et2_dialog.WARNING_MESSAGE); et2_dialog.show_dialog(callbackDeleteDialog, this.egw.lang("Do you really want to DELETE this Rule"), this.egw.lang("Delete"), {}, et2_dialog.BUTTONS_YES_NO_CANCEL, et2_dialog.WARNING_MESSAGE);
}, };
/** /**
* Confirm delete * Confirm delete
* If entry has children, asks if you want to delete children too * If entry has children, asks if you want to delete children too
@ -337,16 +301,12 @@ app.classes.infolog = AppJS.extend(
*@param _action *@param _action
*@param _senders *@param _senders
*/ */
confirm_delete: function(_action, _senders) InfologApp.prototype.confirm_delete = function (_action, _senders) {
{
var children = false; var children = false;
var child_button = jQuery('#delete_sub').get(0) || jQuery('[id*="delete_sub"]').get(0); var child_button = jQuery('#delete_sub').get(0) || jQuery('[id*="delete_sub"]').get(0);
if(child_button) if (child_button) {
{ for (var i = 0; i < _senders.length; i++) {
for(var i = 0; i < _senders.length; i++) if (jQuery(_senders[i].iface.getDOMNode()).hasClass('infolog_rowHasSubs')) {
{
if (jQuery(_senders[i].iface.getDOMNode()).hasClass('infolog_rowHasSubs'))
{
children = true; children = true;
break; break;
} }
@ -354,30 +314,23 @@ app.classes.infolog = AppJS.extend(
child_button.style.display = children ? 'block' : 'none'; child_button.style.display = children ? 'block' : 'none';
} }
nm_open_popup(_action, _senders); nm_open_popup(_action, _senders);
}, };
/** /**
* Add email from addressbook * Add email from addressbook
* *
* @param ab_id * @param ab_id
* @param info_cc * @param info_cc
*/ */
add_email_from_ab: function(ab_id,info_cc) InfologApp.prototype.add_email_from_ab = function (ab_id, info_cc) {
{
var ab = document.getElementById(ab_id); var ab = document.getElementById(ab_id);
if (!ab || !ab.value) {
if (!ab || !ab.value)
{
jQuery("tr.hiddenRow").css("display", "table-row"); jQuery("tr.hiddenRow").css("display", "table-row");
} }
else else {
{
var cc = document.getElementById(info_cc); var cc = document.getElementById(info_cc);
for (var i = 0; i < ab.options.length && ab.options[i].value != ab.value; ++i)
for(var i=0; i < ab.options.length && ab.options[i].value != ab.value; ++i) ; ;
if (i < ab.options.length) {
if (i < ab.options.length)
{
cc.value += (cc.value ? ', ' : '') + ab.options[i].text.replace(/^.* <(.*)>$/, '$1'); cc.value += (cc.value ? ', ' : '') + ab.options[i].text.replace(/^.* <(.*)>$/, '$1');
ab.value = ''; ab.value = '';
ab.onchange(); ab.onchange();
@ -385,8 +338,7 @@ app.classes.infolog = AppJS.extend(
} }
} }
return false; return false;
}, };
/** /**
* If one of info_status, info_percent or info_datecompleted changed --> set others to reasonable values * If one of info_status, info_percent or info_datecompleted changed --> set others to reasonable values
* *
@ -395,94 +347,73 @@ app.classes.infolog = AppJS.extend(
* @param {string} percent_id * @param {string} percent_id
* @param {string} datecompleted_id * @param {string} datecompleted_id
*/ */
status_changed: function(changed_id, status_id, percent_id, datecompleted_id) InfologApp.prototype.status_changed = function (changed_id, status_id, percent_id, datecompleted_id) {
{
// Make sure this doesn't get executed while template is loading // Make sure this doesn't get executed while template is loading
if(this.et2 == null || this.et2.getInstanceManager() == null) return; if (this.et2 == null || this.et2.getInstanceManager() == null)
return;
var status = document.getElementById(status_id); var status = document.getElementById(status_id);
var percent = document.getElementById(percent_id); var percent = document.getElementById(percent_id);
var datecompleted = document.getElementById(datecompleted_id + '[str]'); var datecompleted = document.getElementById(datecompleted_id + '[str]');
if(!datecompleted) if (!datecompleted) {
{
datecompleted = jQuery('#' + datecompleted_id + ' input').get(0); datecompleted = jQuery('#' + datecompleted_id + ' input').get(0);
} }
var completed; var completed;
switch (changed_id) {
switch(changed_id)
{
case status_id: case status_id:
completed = status.value == 'done' || status.value == 'billed'; completed = status.value == 'done' || status.value == 'billed';
if (completed || status.value == 'not-started' || if (completed || status.value == 'not-started' ||
(status.value == 'ongoing') != (percent.value > 0 && percent.value < 100)) (status.value == 'ongoing') != (percent.value > 0 && percent.value < 100)) {
{ if (completed) {
if(completed)
{
percent.value = 100; percent.value = 100;
} }
else if (status.value == 'not-started') else if (status.value == 'not-started') {
{
percent.value = 0; percent.value = 0;
} }
else if (!completed && (percent.value == 0 || percent.value == 100)) else if (!completed && (percent.value == 0 || percent.value == 100)) {
{
percent.value = 10; percent.value = 10;
} }
} }
break; break;
case percent_id: case percent_id:
completed = percent.value == 100; completed = percent.value == 100;
if (completed != (status.value == 'done' || status.value == 'billed') || if (completed != (status.value == 'done' || status.value == 'billed') ||
(status.value == 'not-started') != (percent.value == 0)) (status.value == 'not-started') != (percent.value == 0)) {
{
status.value = percent.value == 0 ? (jQuery('[value="not-started"]', status).length ? 'not-started' : 'ongoing') : (percent.value == 100 ? 'done' : 'ongoing'); status.value = percent.value == 0 ? (jQuery('[value="not-started"]', status).length ? 'not-started' : 'ongoing') : (percent.value == 100 ? 'done' : 'ongoing');
} }
break; break;
case datecompleted_id + '[str]': case datecompleted_id + '[str]':
case datecompleted_id: case datecompleted_id:
completed = datecompleted.value != ''; completed = datecompleted.value != '';
if (completed != (status.value == 'done' || status.value == 'billed')) if (completed != (status.value == 'done' || status.value == 'billed')) {
{
status.value = completed ? 'done' : 'not-started'; status.value = completed ? 'done' : 'not-started';
} }
if (completed != (percent.value == 100)) if (completed != (percent.value == 100)) {
{
percent.value = completed ? 100 : 0; percent.value = completed ? 100 : 0;
} }
break; break;
} }
if (!completed && datecompleted && datecompleted.value != '') if (!completed && datecompleted && datecompleted.value != '') {
{
datecompleted.value = ''; datecompleted.value = '';
} }
else if (completed && datecompleted && datecompleted.value == '') else if (completed && datecompleted && datecompleted.value == '') {
{
// todo: set current date in correct format // todo: set current date in correct format
} }
}, };
/** /**
* handle "print" action from "Actions" selectbox in edit infolog window. * handle "print" action from "Actions" selectbox in edit infolog window.
* check if the template is dirty then submit the template otherwise just open new window as print. * check if the template is dirty then submit the template otherwise just open new window as print.
* *
*/ */
edit_actions: function() InfologApp.prototype.edit_actions = function () {
{
var widget = this.et2.getWidgetById('action'); var widget = this.et2.getWidgetById('action');
var template = this.et2._inst; var template = this.et2._inst;
if (template) if (template) {
{
var id = template.widgetContainer.getArrayMgr('content').data['info_id']; var id = template.widgetContainer.getArrayMgr('content').data['info_id'];
} }
if (widget) if (widget) {
{ switch (widget.get_value()) {
switch (widget.get_value())
{
case 'print': case 'print':
if (template.isDirty()) if (template.isDirty()) {
{
template.submit(); template.submit();
} }
egw_open(id, 'infolog', 'edit', { print: 1 }); egw_open(id, 'infolog', 'edit', { print: 1 });
@ -494,25 +425,21 @@ app.classes.infolog = AppJS.extend(
template.submit(); template.submit();
} }
} }
}, };
/** /**
* Open infolog entry for printing * Open infolog entry for printing
* *
* @param {aciton object} _action * @param {aciton object} _action
* @param {object} _selected * @param {object} _selected
*/ */
infolog_menu_print: function(_action, _selected) InfologApp.prototype.infolog_menu_print = function (_action, _selected) {
{
var id = _selected[0].id.replace(/^infolog::/g, ''); var id = _selected[0].id.replace(/^infolog::/g, '');
egw_open(id, 'infolog', 'edit', { print: 1 }); egw_open(id, 'infolog', 'edit', { print: 1 });
}, };
/** /**
* Trigger print() onload window * Trigger print() onload window
*/ */
infolog_print_preview_onload: function () InfologApp.prototype.infolog_print_preview_onload = function () {
{
var that = this; var that = this;
jQuery('#infolog-edit-print').bind('load', function () { jQuery('#infolog-edit-print').bind('load', function () {
var isLoadingCompleted = true; var isLoadingCompleted = true;
@ -524,32 +451,26 @@ app.classes.infolog = AppJS.extend(
isLoadingCompleted = false; isLoadingCompleted = false;
}, 1000); }, 1000);
var interval = setInterval(function () { var interval = setInterval(function () {
if (!isLoadingCompleted) if (!isLoadingCompleted) {
{
clearInterval(interval); clearInterval(interval);
that.infolog_print_preview(); that.infolog_print_preview();
} }
}, 100); }, 100);
}); });
}, };
/** /**
* Trigger print() function to print the current window * Trigger print() function to print the current window
*/ */
infolog_print_preview: function() InfologApp.prototype.infolog_print_preview = function () {
{
this.egw.message(this.egw.lang('Printing...')); this.egw.message(this.egw.lang('Printing...'));
this.egw.window.print(); this.egw.window.print();
}, };
/** /**
* *
*/ */
add_link_sidemenu: function() InfologApp.prototype.add_link_sidemenu = function () {
{
egw.open('', 'infolog', 'add'); egw.open('', 'infolog', 'add');
}, };
/** /**
* Wrapper so add -> New actions in the context menu can pass current * Wrapper so add -> New actions in the context menu can pass current
* filter values into new edit dialog * filter values into new edit dialog
@ -559,18 +480,12 @@ app.classes.infolog = AppJS.extend(
* @param {egwAction} action * @param {egwAction} action
* @param {egwActionObject[]} selected * @param {egwActionObject[]} selected
*/ */
add_action_handler: function(action, selected) InfologApp.prototype.add_action_handler = function (action, selected) {
{
var nm = action.getManager().data.nextmatch || false; var nm = action.getManager().data.nextmatch || false;
if(nm) if (nm) {
{ this.add_with_extras(nm, action.id, nm.getArrayMgr('content').getEntry('action'), nm.getArrayMgr('content').getEntry('action_id'));
this.add_with_extras(nm,action.id,
nm.getArrayMgr('content').getEntry('action'),
nm.getArrayMgr('content').getEntry('action_id')
);
} }
}, };
/** /**
* Opens a new edit dialog with some extra url parameters pulled from * Opens a new edit dialog with some extra url parameters pulled from
* standard locations. Done with a function instead of hardcoding so * standard locations. Done with a function instead of hardcoding so
@ -581,28 +496,22 @@ app.classes.infolog = AppJS.extend(
* @param _action string Special action for new infolog entry * @param _action string Special action for new infolog entry
* @param _action_id string ID for special action * @param _action_id string ID for special action
*/ */
add_with_extras: function(widget,_type, _action, _action_id) InfologApp.prototype.add_with_extras = function (widget, _type, _action, _action_id) {
{
// We use widget.getRoot() instead of this.et2 for the case when the // We use widget.getRoot() instead of this.et2 for the case when the
// addressbook tab is viewing a contact + infolog list, there's 2 infolog // addressbook tab is viewing a contact + infolog list, there's 2 infolog
// etemplates // etemplates
var nm = widget.getRoot().getWidgetById('nm'); var nm = widget.getRoot().getWidgetById('nm');
var nm_value = nm.getValue() || {}; var nm_value = nm.getValue() || {};
// It's important that all these keys are here, they override the link // It's important that all these keys are here, they override the link
// registry. // registry.
var action_id = nm_value.action_id ? nm_value.action_id : (_action_id != '0' ? _action_id : "") || ""; var action_id = nm_value.action_id ? nm_value.action_id : (_action_id != '0' ? _action_id : "") || "";
if(typeof action_id == "object" && typeof action_id.length == "undefined") if (typeof action_id == "object" && typeof action_id.length == "undefined") {
{
// Need a real array here // Need a real array here
action_id = jQuery.map(action_id, function (val) { return val; }); action_id = jQuery.map(action_id, function (val) { return val; });
} }
// No action? Try the linked filter, in case it's set // No action? Try the linked filter, in case it's set
if(!_action && !_action_id) if (!_action && !_action_id) {
{ if (nm_value.col_filter && nm_value.col_filter.linked) {
if(nm_value.col_filter && nm_value.col_filter.linked)
{
var split = nm_value.col_filter.linked.split(':') || ''; var split = nm_value.col_filter.linked.split(':') || '';
_action = split[0] || ''; _action = split[0] || '';
action_id = split[1] || ''; action_id = split[1] || '';
@ -612,33 +521,29 @@ app.classes.infolog = AppJS.extend(
type: _type || nm_value.col_filter.info_type || "task", type: _type || nm_value.col_filter.info_type || "task",
cat_id: nm_value.cat_id || "", cat_id: nm_value.cat_id || "",
action: nm_value.action || _action || "", action: nm_value.action || _action || "",
// egw_link can handle arrays, but server is expecting CSV // egw_link can handle arrays; but server is expecting CSV
action_id: typeof action_id.join != "undefined" ? action_id.join(',') : action_id action_id: typeof action_id.join != "undefined" ? action_id.join(',') : action_id
}; };
egw.open('', 'infolog', 'add', extras); egw.open('', 'infolog', 'add', extras);
}, };
/** /**
* Get title in order to set it as document title * Get title in order to set it as document title
* @returns {string} * @returns {string}
*/ */
getWindowTitle: function() InfologApp.prototype.getWindowTitle = function () {
{
var widget = this.et2.getWidgetById('info_subject'); var widget = this.et2.getWidgetById('info_subject');
if(widget) return widget.options.value; if (widget)
}, return widget.options.value;
};
/** /**
* View parent entry with all children * View parent entry with all children
* *
* @param {aciton object} _action * @param {aciton object} _action
* @param {object} _selected * @param {object} _selected
*/ */
view_parent: function(_action, _selected) InfologApp.prototype.view_parent = function (_action, _selected) {
{
var data = egw.dataGetUIDdata(_selected[0].id); var data = egw.dataGetUIDdata(_selected[0].id);
if (data && data.data && data.data.info_id_parent) if (data && data.data && data.data.info_id_parent) {
{
egw.link_handler(egw.link('/index.php', { egw.link_handler(egw.link('/index.php', {
menuaction: "infolog.infolog_ui.index", menuaction: "infolog.infolog_ui.index",
action: "sp", action: "sp",
@ -646,8 +551,7 @@ app.classes.infolog = AppJS.extend(
ajax: "true" ajax: "true"
}), "infolog"); }), "infolog");
} }
}, };
/** /**
* Mess with the query for parent widget to exclude self * Mess with the query for parent widget to exclude self
* *
@ -655,23 +559,18 @@ app.classes.infolog = AppJS.extend(
* @param {et2_link_entry} widget * @param {et2_link_entry} widget
* @returns {boolean} * @returns {boolean}
*/ */
parent_query: function(request, widget) InfologApp.prototype.parent_query = function (request, widget) {
{
// No ID yet, no need to filter // No ID yet, no need to filter
if(!widget.getRoot().getArrayMgr('content').getEntry('info_id')) if (!widget.getRoot().getArrayMgr('content').getEntry('info_id')) {
{
return true; return true;
} }
if(!request.options) if (!request.options) {
{
request.options = {}; request.options = {};
} }
// Exclude self from results - no app needed since it's just one app // Exclude self from results - no app needed since it's just one app
request.options.exclude = [widget.getRoot().getArrayMgr('content').getEntry('info_id')]; request.options.exclude = [widget.getRoot().getArrayMgr('content').getEntry('info_id')];
return true; return true;
}, };
/** /**
* View a list of timesheets for the linked infolog entry * View a list of timesheets for the linked infolog entry
* *
@ -680,39 +579,31 @@ app.classes.infolog = AppJS.extend(
* @param {egwAction} _action * @param {egwAction} _action
* @param {egwActionObject[]} _selected * @param {egwActionObject[]} _selected
*/ */
timesheet_list: function(_action, _selected) InfologApp.prototype.timesheet_list = function (_action, _selected) {
{
var extras = { var extras = {
link_app: 'infolog', link_app: 'infolog',
link_id: false link_id: false
}; };
for(var i = 0; i < _selected.length; i++) for (var i = 0; i < _selected.length; i++) {
{
// Remove UID prefix for just contact_id // Remove UID prefix for just contact_id
var ids = _selected[i].id.split('::'); var ids = _selected[i].id.split('::');
ids.shift(); ids.shift();
ids = ids.join('::'); ids = ids.join('::');
extras.link_id = ids; extras.link_id = ids;
break; break;
} }
egw.open("", "timesheet", "list", extras, 'timesheet'); egw.open("", "timesheet", "list", extras, 'timesheet');
}, };
/** /**
* Go to parent entry * Go to parent entry
* *
* @param {aciton object} _action * @param {aciton object} _action
* @param {object} _selected * @param {object} _selected
*/ */
has_parent: function(_action, _selected) InfologApp.prototype.has_parent = function (_action, _selected) {
{
var data = egw.dataGetUIDdata(_selected[0].id); var data = egw.dataGetUIDdata(_selected[0].id);
return data && data.data && data.data.info_id_parent > 0; return data && data.data && data.data.info_id_parent > 0;
}, };
/** /**
* Submit template if widget has a value * Submit template if widget has a value
* *
@ -721,11 +612,10 @@ app.classes.infolog = AppJS.extend(
* @param {DOMNode} _node * @param {DOMNode} _node
* @param {et2_widget} _widget * @param {et2_widget} _widget
*/ */
submit_if_not_empty: function(_node, _widget) InfologApp.prototype.submit_if_not_empty = function (_node, _widget) {
{ if (_widget.get_value())
if (_widget.get_value()) this.et2._inst.submit(); this.et2._inst.submit();
}, };
/** /**
* Toggle encryption * Toggle encryption
* *
@ -733,16 +623,13 @@ app.classes.infolog = AppJS.extend(
* @param {et2_button} _widget * @param {et2_button} _widget
* @param {DOMNode} _node * @param {DOMNode} _node
*/ */
toggleEncrypt: function(_event, _widget, _node) InfologApp.prototype.toggleEncrypt = function (_event, _widget, _node) {
{ if (!this.egw.user('apps').stylite) {
if (!this.egw.user('apps').stylite)
{
this.egw.message(this.egw.lang('InfoLog encryption requires EPL Subscription') + ': <a href="http://www.egroupware.org/EPL">www.egroupware.org/EPL</a>'); this.egw.message(this.egw.lang('InfoLog encryption requires EPL Subscription') + ': <a href="http://www.egroupware.org/EPL">www.egroupware.org/EPL</a>');
return; return;
} }
this._get_stylite(function () { app.stylite.toggleEncrypt.call(app.stylite, _event, _widget, _node); }); this._get_stylite(function () { app.stylite.toggleEncrypt.call(app.stylite, _event, _widget, _node); });
}, };
/** /**
* Make sure stylite javascript is loaded, and call the given callback when it is * Make sure stylite javascript is loaded, and call the given callback when it is
* *
@ -750,45 +637,35 @@ app.classes.infolog = AppJS.extend(
* @param {object} attrs * @param {object} attrs
* *
*/ */
_get_stylite: function(callback,attrs) InfologApp.prototype._get_stylite = function (callback, attrs) {
{
// use app object from etemplate2, which might be private and not just window.app // use app object from etemplate2, which might be private and not just window.app
var app = this.et2.getInstanceManager().app_obj; var app = this.et2.getInstanceManager().app_obj;
if (!app.stylite) {
if (!app.stylite)
{
var self = this; var self = this;
egw_LAB.script('stylite/js/infolog-encryption.js?'+this.et2.getArrayMgr('content').data.encryption_ts).wait(function() egw_LAB.script('stylite/js/infolog-encryption.js?' + this.et2.getArrayMgr('content').data.encryption_ts).wait(function () {
{
app.stylite = new app.classes.stylite; app.stylite = new app.classes.stylite;
app.stylite.et2 = self.et2; app.stylite.et2 = self.et2;
if(callback) if (callback) {
{
callback.apply(app.stylite, attrs); callback.apply(app.stylite, attrs);
} }
}); });
} }
else else {
{
app.stylite.et2 = this.et2; app.stylite.et2 = this.et2;
callback.apply(app.stylite, attrs); callback.apply(app.stylite, attrs);
} }
}, };
/** /**
* OnChange callback for responsible * OnChange callback for responsible
* *
* @param {jQuery.Event} _event * @param {jQuery.Event} _event
* @param {et2_widget} _widget * @param {et2_widget} _widget
*/ */
onchangeResponsible: function(_event, _widget) InfologApp.prototype.onchangeResponsible = function (_event, _widget) {
{ if (app.stylite && app.stylite.onchangeResponsible) {
if (app.stylite && app.stylite.onchangeResponsible)
{
app.stylite.onchangeResponsible.call(app.stylite, _event, _widget); app.stylite.onchangeResponsible.call(app.stylite, _event, _widget);
} }
}, };
/** /**
* Action handler for context menu change responsible action * Action handler for context menu change responsible action
* *
@ -797,59 +674,48 @@ app.classes.infolog = AppJS.extend(
* @param {egwAction} _action * @param {egwAction} _action
* @param {egwActionObject[]} _selected * @param {egwActionObject[]} _selected
*/ */
change_responsible: function(_action, _selected) InfologApp.prototype.change_responsible = function (_action, _selected) {
{
var et2 = _selected[0].manager.data.nextmatch.getInstanceManager(); var et2 = _selected[0].manager.data.nextmatch.getInstanceManager();
var responsible = et2.widgetContainer.getWidgetById('responsible'); var responsible = et2.widgetContainer.getWidgetById('responsible');
if(responsible) if (responsible) {
{
responsible.set_value([]); responsible.set_value([]);
et2.widgetContainer.getWidgetById('responsible_action[title]').set_value(''); et2.widgetContainer.getWidgetById('responsible_action[title]').set_value('');
et2.widgetContainer.getWidgetById('responsible_action[title]').set_class(''); et2.widgetContainer.getWidgetById('responsible_action[title]').set_class('');
et2.widgetContainer.getWidgetById('responsible_action[ok]').set_disabled(_selected.length !== 1); et2.widgetContainer.getWidgetById('responsible_action[ok]').set_disabled(_selected.length !== 1);
et2.widgetContainer.getWidgetById('responsible_action[add]').set_disabled(_selected.length === 1) et2.widgetContainer.getWidgetById('responsible_action[add]').set_disabled(_selected.length === 1);
et2.widgetContainer.getWidgetById('responsible_action[delete]').set_disabled(_selected.length === 1) et2.widgetContainer.getWidgetById('responsible_action[delete]').set_disabled(_selected.length === 1);
} }
if (_selected.length === 1) {
if(_selected.length === 1)
{
var data = egw.dataGetUIDdata(_selected[0].id); var data = egw.dataGetUIDdata(_selected[0].id);
if (responsible && data && data.data) {
if(responsible && data && data.data)
{
et2.widgetContainer.getWidgetById('responsible_action[title]').set_value(data.data.info_subject); et2.widgetContainer.getWidgetById('responsible_action[title]').set_value(data.data.info_subject);
et2.widgetContainer.getWidgetById('responsible_action[title]').set_class(data.data.sub_class) et2.widgetContainer.getWidgetById('responsible_action[title]').set_class(data.data.sub_class);
responsible.set_value(data.data.info_responsible); responsible.set_value(data.data.info_responsible);
} }
} }
nm_open_popup(_action, _selected); nm_open_popup(_action, _selected);
}, };
/** /**
* Handle encrypted info_desc for print purpose * Handle encrypted info_desc for print purpose
* and triggers print action after decryption * and triggers print action after decryption
* *
* @param {Keyring} _keyring Mailvelope keyring to use * @param {Keyring} _keyring Mailvelope keyring to use
*/ */
printEncrypt: function (_keyring) InfologApp.prototype.printEncrypt = function (_keyring) {
{
//this.mailvelopeAvailable(this.toggleEncrypt); //this.mailvelopeAvailable(this.toggleEncrypt);
var info_desc = this.et2.getWidgetById('info_des'); var info_desc = this.et2.getWidgetById('info_des');
var self = this; var self = this;
mailvelope.createDisplayContainer('#infolog-edit-print_info_des', info_desc.value, _keyring).then(function(_container) mailvelope.createDisplayContainer('#infolog-edit-print_info_des', info_desc.value, _keyring).then(function (_container) {
{
var $info_des_dom = jQuery(self.et2.getWidgetById('info_des').getDOMNode()); var $info_des_dom = jQuery(self.et2.getWidgetById('info_des').getDOMNode());
// $info_des_dom.children('iframe').height($info_des_dom.height()); // $info_des_dom.children('iframe').height($info_des_dom.height());
$info_des_dom.children('span').hide(); $info_des_dom.children('span').hide();
//Trigger print action //Trigger print action
self.infolog_print_preview(); self.infolog_print_preview();
}, }, function (_err) {
function(_err)
{
self.egw.message(_err, 'error'); self.egw.message(_err, 'error');
}); });
} };
return InfologApp;
}); }(egw_app_1.EgwApp));
app.classes.infolog = InfologApp;
//# sourceMappingURL=app.js.map

869
infolog/js/app.ts Normal file
View File

@ -0,0 +1,869 @@
/**
* EGroupware - Infolog - Javascript UI
*
* @link: https://www.egroupware.org
* @package infolog
* @author Hadi Nategh <hn-AT-stylite.de>
* @copyright (c) 2008-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
*/
/*egw:uses
/api/js/jsapi/egw_app.js
*/
import 'jquery';
import 'jqueryui';
import '../jsapi/egw_global';
import '../etemplate/et2_types';
import { EgwApp } from '../../api/js/jsapi/egw_app';
/**
* UI for Infolog
*
* @augments AppJS
*/
class InfologApp extends EgwApp
{
readonly appname = 'infolog';
/**
* Constructor
*
* @memberOf app.infolog
*/
constructor()
{
// call parent
super();
}
/**
* Destructor
*/
destroy()
{
// call parent
super.destroy.apply(this, arguments);
}
/**
* This function is called when the etemplate2 object is loaded
* and ready. If you must store a reference to the et2 object,
* make sure to clean it up in destroy().
*
* @param {etemplate2} _et2 newly ready object
* @param {string} _name template name
*/
et2_ready(_et2, _name)
{
// call parent
super.et2_ready.apply(this, arguments);
switch(_name)
{
case 'infolog.index':
this.filter_change();
// Show / hide descriptions according to details filter
var nm = this.et2.getWidgetById('nm');
var filter2 = nm.getWidgetById('filter2');
this.show_details(filter2.value == 'all',nm.getDOMNode(nm));
// Remove the rule added by show_details() if the template is removed
jQuery(_et2.DOMContainer).on('clear', jQuery.proxy(function() {egw.css(this);}, '#' + nm.getDOMNode(nm).id + ' .et2_box.infoDes'));
// Enable decrypt on hover
if(this.egw.user('apps').stylite)
{
this._get_stylite(function() {this.mailvelopeAvailable(function() {app.stylite.decrypt_hover(nm);});});
}
break;
case 'infolog.edit.print':
if (this.et2.getArrayMgr('content').data.info_des.indexOf(this.begin_pgp_message) != -1)
{
this.mailvelopeAvailable(this.printEncrypt);
}
else
{
// Trigger print command if the infolog oppend for printing purpose
this.infolog_print_preview_onload();
}
break;
case 'infolog.edit':
if (this.et2.getArrayMgr('content').data.info_des &&
this.et2.getArrayMgr('content').data.info_des.indexOf(this.begin_pgp_message) != -1)
{
this._get_stylite(jQuery.proxy(function() {this.mailvelopeAvailable(jQuery.proxy(function() {
this.toggleEncrypt();
// Decrypt history on hover
var history = this.et2.getWidgetById('history');
app.stylite.decrypt_hover(history,'span');
jQuery(history.getDOMNode(history))
.tooltip('option','position',{my:'top left', at: 'top left', of: history.getDOMNode(history)});
},this));},this));
// This disables the diff in history
var history = this.et2.getArrayMgr('content').getEntry('history');
history['status-widgets'].De = 'description';
}
break;
}
}
/**
* Observer method receives update notifications from all applications
*
* InfoLog currently reacts to timesheet updates, as it might show time-sums.
* @todo only trigger update, if times are shown
*
* @param {string} _msg message (already translated) to show, eg. 'Entry deleted'
* @param {string} _app application name
* @param {(string|number)} _id id of entry to refresh or null
* @param {string} _type either 'update', 'edit', 'delete', 'add' or null
* - update: request just modified data from given rows. Sorting is not considered,
* so if the sort field is changed, the row will not be moved.
* - edit: rows changed, but sorting may be affected. Requires full reload.
* - delete: just delete the given rows clientside (no server interaction neccessary)
* - add: requires full reload for proper sorting
* @param {string} _msg_type 'error', 'warning' or 'success' (default)
* @param {object|null} _links app => array of ids of linked entries
* or null, if not triggered on server-side, which adds that info
*/
observer(_msg, _app, _id, _type, _msg_type, _links)
{
if (typeof _links != 'undefined')
{
if (typeof _links.infolog != 'undefined')
{
switch (_app)
{
case 'timesheet':
var nm = this.et2 ? this.et2.getWidgetById('nm') : null;
if (nm) nm.applyFilters();
break;
}
}
}
// Refresh handler for Addressbook CRM view
if (_app == 'infolog' && this.et2.getInstanceManager() && this.et2.getInstanceManager().app == 'addressbook' && this.et2.getInstanceManager().name == 'infolog.index')
{
this.et2._inst.refresh(_msg, _app, _id, _type);
}
}
/**
* Retrieve the current state of the application for future restoration
*
* Reimplemented to add action/action_id from content set by server
* when eg. viewing infologs linked to contacts.
*
* @return {object} Application specific map representing the current state
*/
getState()
{
// call parent
var state = super.observer.apply(this, arguments);
var nm : any = {};
// Get index etemplate
var et2 = etemplate2.getById('infolog-index');
if(et2)
{
var content = et2.widgetContainer.getArrayMgr('content');
nm = content && content.data && content.data.nm ? content.data.nm: {};
}
state.action = nm.action || null;
state.action_id = nm.action_id || null;
return state;
}
/**
* Set the application's state to the given state.
*
* Reimplemented to also reset action/action_id.
*
* @param {{name: string, state: object}|string} state Object (or JSON string) for a state.
* Only state is required, and its contents are application specific.
*
* @return {boolean} false - Returns false to stop event propagation
*/
setState(state)
{
// as we have to set state.state.action, we have to set all other
// for "No filter" favorite to work as expected
var to_set = {col_filter: null, filter: '', filter2: '', cat_id: '', search: '', action: null};
if (typeof state.state == 'undefined') state.state = {};
for(var name in to_set)
{
if (typeof state.state[name] == 'undefined') state.state[name] = to_set[name];
}
return super.setState.apply(this, arguments);
}
/**
* Enable or disable the date filter
*
* If the filter is set to something that needs dates, we enable the
* header_left template. Otherwise, it is disabled.
*/
filter_change()
{
var filter = this.et2.getWidgetById('filter');
var nm = this.et2.getWidgetById('nm');
var dates = this.et2.getWidgetById('infolog.index.dates');
if(nm && filter)
{
switch(filter.getValue())
{
case 'bydate':
case 'duedate':
if (filter && dates)
{
dates.set_disabled(false);
window.setTimeout(function() {
jQuery(dates.getWidgetById('startdate').getDOMNode()).find('input').focus();
},0);
}
break;
default:
if (dates)
{
dates.set_disabled(true);
}
break;
}
}
}
/**
* show or hide the details of rows by selecting the filter2 option
* either 'all' for details or 'no_description' for no details
*
* @param {Event} event Change event
* @param {et2_nextmatch} nm The nextmatch widget that owns the filter
*/
filter2_change(event, nm)
{
var filter2 = nm.getWidgetById('filter2');
if (nm && filter2)
{
// Show / hide descriptions
this.show_details(filter2.get_value() === 'all', nm.getDOMNode(nm));
}
// Only change columns for a real user event, to avoid interfering with
// favorites
if (nm && filter2 && !nm.update_in_progress)
{
// Store selection as implicit preference
egw.set_preference('infolog', nm.options.settings.columnselection_pref.replace('-details','')+'-details-pref', filter2.value);
// Change preference location - widget is nextmatch
nm.options.settings.columnselection_pref = nm.options.settings.columnselection_pref.replace('-details','') + (filter2.value == 'all' ? '-details' :'');
// Load new preferences
var colData = nm.columns.slice();
for(var i = 0; i < nm.columns.length; i++) colData[i].visible=false;
if(egw.preference(nm.options.settings.columnselection_pref,'infolog'))
{
nm.set_columns((<String>egw.preference(nm.options.settings.columnselection_pref,'infolog')).split(','));
}
nm._applyUserPreferences(nm.columns, colData);
// Now apply them to columns
for(var i = 0; i < colData.length; i++)
{
nm.dataview.getColumnMgr().columns[i].set_width(colData[i].width);
nm.dataview.getColumnMgr().columns[i].set_visibility(colData[i].visible);
}
nm.dataview.getColumnMgr().updated = true;
// Update page - set update_in_progress to true to avoid triggering
// the change handler and looping if the user has a custom field
// column change
var in_progress = nm.update_in_progress;
nm.update_in_progress = true;
// Set the actual filter value here
nm.activeFilters.filter2 = filter2.get_value();
nm.dataview.updateColumns();
nm.update_in_progress = in_progress;
}
return false;
}
/**
* Show or hide details by changing the CSS class
*
* @param {boolean} show
* @param {DOMNode} dom_node
*/
show_details(show, dom_node)
{
// Show / hide descriptions
egw.css((dom_node && dom_node.id ? "#"+dom_node.id+' ' : '') + ".et2_box.infoDes","display:" + (show ? "block;" : "none;"));
if (egwIsMobile())
{
var $select = jQuery('.infoDetails');
(show)? $select.each(function(i,e){jQuery(e).hide();}): $select.each(function(i,e){jQuery(e).show();});
}
}
confirm_delete_2(_action, _senders)
{
var children = false;
var child_button = jQuery('#delete_sub').get(0) || jQuery('[id*="delete_sub"]').get(0);
if(child_button)
{
for(var i = 0; i < _senders.length; i++)
{
if (jQuery(_senders[i].iface.node).hasClass('infolog_rowHasSubs'))
{
children = true;
break;
}
}
child_button.style.display = children ? 'block' : 'none';
}
var callbackDeleteDialog = function (button_id)
{
if (button_id == et2_dialog.YES_BUTTON )
{
}
};
et2_dialog.show_dialog(callbackDeleteDialog, this.egw.lang("Do you really want to DELETE this Rule"),this.egw.lang("Delete"), {},et2_dialog.BUTTONS_YES_NO_CANCEL, et2_dialog.WARNING_MESSAGE);
}
/**
* Confirm delete
* If entry has children, asks if you want to delete children too
*
*@param _action
*@param _senders
*/
confirm_delete(_action, _senders)
{
var children = false;
var child_button = jQuery('#delete_sub').get(0) || jQuery('[id*="delete_sub"]').get(0);
if(child_button)
{
for(var i = 0; i < _senders.length; i++)
{
if (jQuery(_senders[i].iface.getDOMNode()).hasClass('infolog_rowHasSubs'))
{
children = true;
break;
}
}
child_button.style.display = children ? 'block' : 'none';
}
nm_open_popup(_action, _senders);
}
/**
* Add email from addressbook
*
* @param ab_id
* @param info_cc
*/
add_email_from_ab(ab_id,info_cc)
{
var ab = <HTMLSelectElement>document.getElementById(ab_id);
if (!ab || !ab.value)
{
jQuery("tr.hiddenRow").css("display", "table-row");
}
else
{
var cc = <HTMLInputElement>document.getElementById(info_cc);
for(var i=0; i < ab.options.length && ab.options[i].value != ab.value; ++i) ;
if (i < ab.options.length)
{
cc.value += (cc.value?', ':'')+ab.options[i].text.replace(/^.* <(.*)>$/,'$1');
ab.value = '';
// @ts-ignore
ab.onchange();
jQuery("tr.hiddenRow").css("display", "none");
}
}
return false;
}
/**
* If one of info_status, info_percent or info_datecompleted changed --> set others to reasonable values
*
* @param {string} changed_id id of changed element
* @param {string} status_id
* @param {string} percent_id
* @param {string} datecompleted_id
*/
status_changed(changed_id, status_id, percent_id, datecompleted_id)
{
// Make sure this doesn't get executed while template is loading
if(this.et2 == null || this.et2.getInstanceManager() == null) return;
var status = <HTMLInputElement>document.getElementById(status_id);
var percent = <HTMLInputElement>document.getElementById(percent_id);
var datecompleted = <HTMLInputElement>document.getElementById(datecompleted_id+'[str]');
if(!datecompleted)
{
datecompleted = <HTMLInputElement>jQuery('#'+datecompleted_id +' input').get(0);
}
var completed;
switch(changed_id)
{
case status_id:
completed = status.value == 'done' || status.value == 'billed';
if (completed || status.value == 'not-started' ||
(status.value == 'ongoing') != (parseFloat(percent.value) > 0 && parseFloat(percent.value) < 100))
{
if(completed)
{
percent.value = '100';
}
else if (status.value == 'not-started')
{
percent.value = '0';
}
else if (!completed && (parseInt(percent.value) == 0 || parseInt(percent.value) == 100))
{
percent.value = '10';
}
}
break;
case percent_id:
completed = parseInt(percent.value) == 100;
if (completed != (status.value == 'done' || status.value == 'billed') ||
(status.value == 'not-started') != (parseInt(percent.value) == 0))
{
status.value = parseInt(percent.value) == 0 ? (jQuery('[value="not-started"]',status).length ?
'not-started':'ongoing') : (parseInt(percent.value) == 100 ? 'done' : 'ongoing');
}
break;
case datecompleted_id+'[str]':
case datecompleted_id:
completed = datecompleted.value != '';
if (completed != (status.value == 'done' || status.value == 'billed'))
{
status.value = completed ? 'done' : 'not-started';
}
if (completed != (parseInt(percent.value) == 100))
{
percent.value = completed ? '100' : '0';
}
break;
}
if (!completed && datecompleted && datecompleted.value != '')
{
datecompleted.value = '';
}
else if (completed && datecompleted && datecompleted.value == '')
{
// todo: set current date in correct format
}
}
/**
* handle "print" action from "Actions" selectbox in edit infolog window.
* check if the template is dirty then submit the template otherwise just open new window as print.
*
*/
edit_actions()
{
var widget = this.et2.getWidgetById('action');
var template = this.et2._inst;
if (template)
{
var id = template.widgetContainer.getArrayMgr('content').data['info_id'];
}
if (widget)
{
switch (widget.get_value())
{
case 'print':
if (template.isDirty())
{
template.submit();
}
egw.open(id,'infolog','edit',{print:1});
break;
case 'ical':
template.postSubmit();
break;
default:
template.submit();
}
}
}
/**
* Open infolog entry for printing
*
* @param {aciton object} _action
* @param {object} _selected
*/
infolog_menu_print(_action, _selected)
{
var id = _selected[0].id.replace(/^infolog::/g,'');
egw.open(id,'infolog','edit',{print:1});
}
/**
* Trigger print() onload window
*/
infolog_print_preview_onload()
{
var that = this;
jQuery('#infolog-edit-print').bind('load',function(){
var isLoadingCompleted = true;
jQuery('#infolog-edit-print').bind("DOMSubtreeModified",function(event){
isLoadingCompleted = false;
jQuery('#infolog-edit-print').unbind("DOMSubtreeModified");
});
setTimeout(function() {
isLoadingCompleted = false;
}, 1000);
var interval = setInterval(function(){
if (!isLoadingCompleted)
{
clearInterval(interval);
that.infolog_print_preview();
}
}, 100);
});
}
/**
* Trigger print() function to print the current window
*/
infolog_print_preview()
{
this.egw.message(this.egw.lang('Printing...'));
this.egw.window.print();
}
/**
*
*/
add_link_sidemenu()
{
egw.open('','infolog','add');
}
/**
* Wrapper so add -> New actions in the context menu can pass current
* filter values into new edit dialog
*
* @see add_with_extras
*
* @param {egwAction} action
* @param {egwActionObject[]} selected
*/
add_action_handler(action, selected)
{
var nm = action.getManager().data.nextmatch || false;
if(nm)
{
this.add_with_extras(nm,action.id,
nm.getArrayMgr('content').getEntry('action'),
nm.getArrayMgr('content').getEntry('action_id')
);
}
}
/**
* Opens a new edit dialog with some extra url parameters pulled from
* standard locations. Done with a function instead of hardcoding so
* the values can be updated if user changes them in UI.
*
* @param {et2_widget} widget Originating/calling widget
* @param _type string Type of infolog entry
* @param _action string Special action for new infolog entry
* @param _action_id string ID for special action
*/
add_with_extras(widget,_type, _action, _action_id)
{
// We use widget.getRoot() instead of this.et2 for the case when the
// addressbook tab is viewing a contact + infolog list, there's 2 infolog
// etemplates
var nm = widget.getRoot().getWidgetById('nm');
var nm_value = nm.getValue() || {};
// It's important that all these keys are here, they override the link
// registry.
var action_id = nm_value.action_id ? nm_value.action_id : (_action_id != '0' ? _action_id : "") || "";
if(typeof action_id == "object" && typeof action_id.length == "undefined")
{
// Need a real array here
action_id = jQuery.map(action_id,function(val) {return val;});
}
// No action? Try the linked filter, in case it's set
if(!_action && !_action_id)
{
if(nm_value.col_filter && nm_value.col_filter.linked)
{
var split = nm_value.col_filter.linked.split(':') || '';
_action = split[0] || '';
action_id = split[1] || '';
}
}
var extras = {
type: _type || nm_value.col_filter.info_type || "task",
cat_id: nm_value.cat_id || "",
action: nm_value.action || _action || "",
// egw_link can handle arrays; but server is expecting CSV
action_id: typeof action_id.join != "undefined" ? action_id.join(',') : action_id
};
egw.open('','infolog','add',extras);
}
/**
* Get title in order to set it as document title
* @returns {string}
*/
getWindowTitle()
{
var widget = this.et2.getWidgetById('info_subject');
if(widget) return widget.options.value;
}
/**
* View parent entry with all children
*
* @param {aciton object} _action
* @param {object} _selected
*/
view_parent(_action, _selected)
{
var data = egw.dataGetUIDdata(_selected[0].id);
if (data && data.data && data.data.info_id_parent)
{
egw.link_handler(egw.link('/index.php', {
menuaction: "infolog.infolog_ui.index",
action: "sp",
action_id: data.data.info_id_parent,
ajax: "true"
}), "infolog");
}
}
/**
* Mess with the query for parent widget to exclude self
*
* @param {Object} request
* @param {et2_link_entry} widget
* @returns {boolean}
*/
parent_query(request, widget)
{
// No ID yet, no need to filter
if(!widget.getRoot().getArrayMgr('content').getEntry('info_id'))
{
return true;
}
if(!request.options)
{
request.options = {};
}
// Exclude self from results - no app needed since it's just one app
request.options.exclude = [widget.getRoot().getArrayMgr('content').getEntry('info_id')];
return true;
}
/**
* View a list of timesheets for the linked infolog entry
*
* Only one infolog entry at a time is allowed, we just pick the first one
*
* @param {egwAction} _action
* @param {egwActionObject[]} _selected
*/
timesheet_list(_action, _selected)
{
var extras = {
link_app: 'infolog',
link_id: false
};
for(var i = 0; i < _selected.length; i++)
{
// Remove UID prefix for just contact_id
var ids = _selected[i].id.split('::');
ids.shift();
ids = ids.join('::');
extras.link_id = ids;
break;
}
egw.open("","timesheet","list", extras, 'timesheet');
}
/**
* Go to parent entry
*
* @param {aciton object} _action
* @param {object} _selected
*/
has_parent(_action, _selected)
{
var data = egw.dataGetUIDdata(_selected[0].id);
return data && data.data && data.data.info_id_parent > 0;
}
/**
* Submit template if widget has a value
*
* Used for project-selection to update pricelist items from server
*
* @param {DOMNode} _node
* @param {et2_widget} _widget
*/
submit_if_not_empty(_node, _widget)
{
if (_widget.get_value()) this.et2._inst.submit();
}
/**
* Toggle encryption
*
* @param {jQuery.Event} _event
* @param {et2_button} _widget
* @param {DOMNode} _node
*/
toggleEncrypt(_event, _widget, _node)
{
if (!this.egw.user('apps').stylite)
{
this.egw.message(this.egw.lang('InfoLog encryption requires EPL Subscription')+': <a href="http://www.egroupware.org/EPL">www.egroupware.org/EPL</a>');
return;
}
this._get_stylite(function() {app.stylite.toggleEncrypt.call(app.stylite,_event,_widget,_node);});
}
/**
* Make sure stylite javascript is loaded, and call the given callback when it is
*
* @param {function} callback
* @param {object} attrs
*
*/
_get_stylite(callback : Function, attrs? : any[])
{
// use app object from etemplate2, which might be private and not just window.app
var app = this.et2.getInstanceManager().app_obj;
if (!app.stylite)
{
var self = this;
egw_LAB.script('stylite/js/infolog-encryption.js?'+this.et2.getArrayMgr('content').data.encryption_ts).wait(function()
{
app.stylite = new app.classes.stylite;
app.stylite.et2 = self.et2;
if(callback)
{
callback.apply(app.stylite,attrs);
}
});
}
else
{
app.stylite.et2 = this.et2;
callback.apply(app.stylite,attrs);
}
}
/**
* OnChange callback for responsible
*
* @param {jQuery.Event} _event
* @param {et2_widget} _widget
*/
onchangeResponsible(_event, _widget)
{
if (app.stylite && app.stylite.onchangeResponsible)
{
app.stylite.onchangeResponsible.call(app.stylite, _event, _widget);
}
}
/**
* Action handler for context menu change responsible action
*
* We populate the dialog with the current value.
*
* @param {egwAction} _action
* @param {egwActionObject[]} _selected
*/
change_responsible(_action, _selected)
{
var et2 = _selected[0].manager.data.nextmatch.getInstanceManager();
var responsible = et2.widgetContainer.getWidgetById('responsible');
if(responsible)
{
responsible.set_value([]);
et2.widgetContainer.getWidgetById('responsible_action[title]').set_value('');
et2.widgetContainer.getWidgetById('responsible_action[title]').set_class('');
et2.widgetContainer.getWidgetById('responsible_action[ok]').set_disabled(_selected.length !== 1);
et2.widgetContainer.getWidgetById('responsible_action[add]').set_disabled(_selected.length === 1)
et2.widgetContainer.getWidgetById('responsible_action[delete]').set_disabled(_selected.length === 1)
}
if(_selected.length === 1)
{
var data = egw.dataGetUIDdata(_selected[0].id);
if(responsible && data && data.data)
{
et2.widgetContainer.getWidgetById('responsible_action[title]').set_value(data.data.info_subject);
et2.widgetContainer.getWidgetById('responsible_action[title]').set_class(data.data.sub_class)
responsible.set_value(data.data.info_responsible);
}
}
nm_open_popup(_action, _selected);
}
/**
* Handle encrypted info_desc for print purpose
* and triggers print action after decryption
*
* @param {Keyring} _keyring Mailvelope keyring to use
*/
printEncrypt(_keyring)
{
//this.mailvelopeAvailable(this.toggleEncrypt);
var info_desc = this.et2.getWidgetById('info_des');
var self = this;
mailvelope.createDisplayContainer('#infolog-edit-print_info_des', info_desc.value, _keyring).then(function(_container)
{
var $info_des_dom = jQuery(self.et2.getWidgetById('info_des').getDOMNode());
// $info_des_dom.children('iframe').height($info_des_dom.height());
$info_des_dom.children('span').hide();
//Trigger print action
self.infolog_print_preview();
},
function(_err)
{
self.egw.message(_err, 'error');
});
}
}
app.classes.infolog = InfologApp;

View File

@ -108,7 +108,7 @@ class mail_acl
/** /**
* Edit folder ACLs of account(s) * Edit folder ACLs of account(s)
* *
* @param string $content = null * @param array $content = null
* @param string $msg = '' * @param string $msg = ''
* *
*/ */
@ -132,8 +132,7 @@ class mail_acl
$account = Mail\Account::read($acc_id, $account_id); $account = Mail\Account::read($acc_id, $account_id);
$this->imap = $account->imapServer(isset($account_id) ? (int)$account_id : false); $this->imap = $account->imapServer(isset($account_id) ? (int)$account_id : false);
$mailbox = $_GET['mailbox']? base64_decode($_GET['mailbox']): $mailbox = $_GET['mailbox']? base64_decode($_GET['mailbox']): self::_extract_mailbox($content['mailbox'], $acc_id);
preg_replace("/^".$acc_id."::/",'',$content['mailbox'][0]);
if (empty($mailbox)) if (empty($mailbox))
{ {
$mailbox = $this->imap->isAdminConnection ? $this->imap->getUserMailboxString($account_id) : 'INBOX'; $mailbox = $this->imap->isAdminConnection ? $this->imap->getUserMailboxString($account_id) : 'INBOX';
@ -148,7 +147,7 @@ class mail_acl
//Todo: Implement autocomplete_url function with admin stuffs consideration //Todo: Implement autocomplete_url function with admin stuffs consideration
} }
// Unset the content if folder is changed, in order to read acl rights for new selected folder // Unset the content if folder is changed, in order to read acl rights for new selected folder
if (!is_array($content['button']) && is_array($content['mailbox']) && !is_array($content['grid']['delete'])) unset($content); if (!is_array($content['button']) && self::_extract_mailbox($content['mailbox'], $acc_id) && !is_array($content['grid']['delete'])) unset($content);
if (!is_array($content)) if (!is_array($content))
{ {
@ -210,13 +209,15 @@ class mail_acl
{ {
$button = 'delete'; $button = 'delete';
} }
$data = $content;
$data['mailbox'] = self::_extract_mailbox($content['mailbox'], $acc_id);
switch ($button) switch ($button)
{ {
case 'save': case 'save':
case 'apply': case 'apply':
if ($content) if ($content)
{ {
$validation_err = $this->update_acl($content,$msg); $validation_err = $this->update_acl($data,$msg);
if ($validation_err) if ($validation_err)
{ {
foreach ($validation_err as &$row) foreach ($validation_err as &$row)
@ -240,7 +241,7 @@ class mail_acl
exit; exit;
case 'delete': case 'delete':
$aclRvmCnt = $this->remove_acl($content, $msg); $aclRvmCnt = $this->remove_acl($data, $msg);
if (is_array($aclRvmCnt)) if (is_array($aclRvmCnt))
{ {
$content['grid'] = $aclRvmCnt; $content['grid'] = $aclRvmCnt;
@ -337,10 +338,9 @@ class mail_acl
* Update ACL rights of a folder or including subfolders for an account(s) * Update ACL rights of a folder or including subfolders for an account(s)
* *
* @param array $content content including the acl rights * @param array $content content including the acl rights
* @param Boolean $recursive boolean flag FALSE|TRUE. If it is FALSE, only the folder take in to account, but in case of TRUE
* the mailbox including all its subfolders will be considered.
* @param string $msg Message * @param string $msg Message
* *
* @return Array | void return array of validation messages or nothing
*/ */
function update_acl ($content, &$msg) function update_acl ($content, &$msg)
{ {
@ -401,6 +401,10 @@ class mail_acl
/** /**
* Retrieve Folder ACL rights * Retrieve Folder ACL rights
* @param string $mailbox
* @param string &$msg
*
* @return Array | Boolean returns array of acl or false on failure
* @todo rights 'c' and 'd' should be fixed * @todo rights 'c' and 'd' should be fixed
*/ */
function retrieve_acl ($mailbox, &$msg) function retrieve_acl ($mailbox, &$msg)
@ -425,7 +429,7 @@ class mail_acl
* @param Array $content content array of popup window * @param Array $content content array of popup window
* @param string $msg message * @param string $msg message
* *
* @return Array An array as new content for grid * @return Array | Boolean An array as new content for grid or false in case of error
*/ */
function remove_acl($content, &$msg) function remove_acl($content, &$msg)
{ {
@ -562,14 +566,13 @@ class mail_acl
* Get ACL rights of a folder from an account * Get ACL rights of a folder from an account
* *
* @param String $mailbox folder name that needs to be read * @param String $mailbox folder name that needs to be read
* @return Boolean FALSE in case of any exceptions and if TRUE in case of success, * @return Array|Boolean FALSE in case of any exceptions and returns Array in case of success,
*/ */
function getACL ($mailbox) function getACL ($mailbox)
{ {
try try
{ {
$acl = $this->imap->getACL($mailbox); return $this->imap->getACL($mailbox);
return $acl;
} catch (Exception $e) { } catch (Exception $e) {
error_log(__METHOD__. "Could not get ACL rights from folder " . $mailbox . "." .$e->getMessage()); error_log(__METHOD__. "Could not get ACL rights from folder " . $mailbox . "." .$e->getMessage());
return false; return false;
@ -587,4 +590,16 @@ class mail_acl
{ {
return is_array($acc_id)?$acc_id[0]:$acc_id; return is_array($acc_id)?$acc_id[0]:$acc_id;
} }
/**
* @param string | array $mailbox
* @param string $acc_id
*
* @return string | NULL return sanitate mailbox of acc id and delimiter and return it as string
*/
private static function _extract_mailbox ($mailbox, $acc_id)
{
$mailbox = is_array($mailbox) ? $mailbox[0] : $mailbox;
return preg_replace("/^".$acc_id."::/",'', $mailbox);
}
} }

View File

@ -426,7 +426,7 @@ class mail_tree
//User defined folders icons //User defined folders icons
$data[Tree::IMAGE_LEAF] = $data[Tree::IMAGE_LEAF] =
$data[Tree::IMAGE_FOLDER_OPEN] = $data[Tree::IMAGE_FOLDER_OPEN] =
$data [Tree::IMAGE_FOLDER_CLOSED] = "MailFolder".$key.".png"; $data [Tree::IMAGE_FOLDER_CLOSED] = basename(Api\Image::find('mail', 'dhtmlxtree/'."MailFolder".$key));
} }
elseif(stripos(array2string($data['folderarray']['attributes']),'\noselect')!== false) elseif(stripos(array2string($data['folderarray']['attributes']),'\noselect')!== false)
{ {

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<?xml-stylesheet type="text/css" href="../less/svg.css" ?>
<svg version="1.1" id="pixelegg_apply" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve">
<g>
<g>
<path fill="#696969" d="M9.454,26.628h13.092v-1.062H9.454V26.628z M23.515,1.12H1.816
v29.76h28.368V7.57L23.515,1.12z M8.362,3.245h8.729V8.56h4.364V3.245h2.183v7.44H8.362V3.245z M26.91,28.754H5.089v-8.503
c0-1.761,1.465-3.188,3.273-3.188h15.275c1.807,0,3.272,1.428,3.272,3.188V28.754z M9.454,23.44h13.092v-1.063H9.454V23.44z
M9.454,20.251h13.092v-1.062H9.454V20.251z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 953 B