From d322ee7ec40927237bb8553bca0ce97bbcd7330e Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 20 May 2014 10:51:37 +0000 Subject: [PATCH] Add print item in infolog context menu and onload print functionality --- infolog/inc/class.infolog_ui.inc.php | 6 ++++++ infolog/js/app.js | 32 +++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 5a56e7b14b..c7facfa549 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -1117,6 +1117,12 @@ class infolog_ui 'allowOnMultiple' => false, 'disableClass' => 'rowNoCloseAll', ), + 'print' => array( + 'caption' => 'Print', + 'icon' => 'print', + 'group' => $group, + 'onExecute' => 'javaScript:app.infolog.infolog_menu_print' + ) ); ++$group; // integration with other apps if ($GLOBALS['egw_info']['user']['apps']['filemanager']) diff --git a/infolog/js/app.js b/infolog/js/app.js index ec9c002a52..bc5fbf60f1 100644 --- a/infolog/js/app.js +++ b/infolog/js/app.js @@ -64,7 +64,13 @@ app.classes.infolog = AppJS.extend( case 'infolog.index': this.filter_change(); break; + case 'infolog.edit.print': + // Trigger print command if the infolog oppend for printing porpuse + var that = this; + jQuery('#infolog-edit-print').bind('load',function(){that.infolog_print_preview();}); } + + }, /** @@ -314,7 +320,31 @@ app.classes.infolog = AppJS.extend( } } }, - + + /** + * Open infolog entry for printing + * + * @param {aciton object} _action + * @param {object} _selected + */ + infolog_menu_print: function(_action, _selected) + { + var id = _selected[0].id.replace(/^infolog::/g,''); + egw_open(id,'infolog','edit',{print:1}); + + }, + + /** + * Trigger print() function to print the current window + * + * + */ + infolog_print_preview: function () + { + this.egw.message('Printing....'); + this.egw.window.print(); + }, + /** * */