Add print item in infolog context menu and onload print functionality

This commit is contained in:
Hadi Nategh 2014-05-20 10:51:37 +00:00
parent f4f6fba2c4
commit d322ee7ec4
2 changed files with 37 additions and 1 deletions

View File

@ -1117,6 +1117,12 @@ class infolog_ui
'allowOnMultiple' => false, 'allowOnMultiple' => false,
'disableClass' => 'rowNoCloseAll', 'disableClass' => 'rowNoCloseAll',
), ),
'print' => array(
'caption' => 'Print',
'icon' => 'print',
'group' => $group,
'onExecute' => 'javaScript:app.infolog.infolog_menu_print'
)
); );
++$group; // integration with other apps ++$group; // integration with other apps
if ($GLOBALS['egw_info']['user']['apps']['filemanager']) if ($GLOBALS['egw_info']['user']['apps']['filemanager'])

View File

@ -64,7 +64,13 @@ app.classes.infolog = AppJS.extend(
case 'infolog.index': case 'infolog.index':
this.filter_change(); this.filter_change();
break; 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();
},
/** /**
* *
*/ */