[795] | 1 | <?php |
---|
| 2 | /**************************************************************************\ |
---|
| 3 | * eGroupWare * |
---|
| 4 | * http://www.egroupware.org * |
---|
| 5 | * -------------------------------------------- * |
---|
| 6 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 7 | * under the terms of the GNU General Public License as published by the * |
---|
| 8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 9 | * option) any later version. * |
---|
| 10 | \**************************************************************************/ |
---|
| 11 | |
---|
| 12 | require_once dirname(__FILE__) . SEP . 'class.ui_ajaxinterface.inc.php'; |
---|
| 13 | /** |
---|
| 14 | * @package Workflow |
---|
| 15 | * @license http://www.gnu.org/copyleft/gpl.html GPL |
---|
| 16 | * @author Sidnei Augusto Drovetto Jr. - drovetto@gmail.com |
---|
| 17 | */ |
---|
| 18 | class ui_external_applications extends ui_ajaxinterface |
---|
| 19 | { |
---|
| 20 | /** |
---|
| 21 | * @var array $public_functions |
---|
| 22 | * @access public |
---|
| 23 | */ |
---|
| 24 | var $public_functions = array( |
---|
| 25 | 'draw' => true, |
---|
| 26 | 'upload_image' => true |
---|
| 27 | ); |
---|
| 28 | |
---|
| 29 | /** |
---|
| 30 | * @var array $workflow_acl |
---|
| 31 | * @access public |
---|
| 32 | */ |
---|
| 33 | var $workflow_acl; |
---|
| 34 | |
---|
| 35 | /** |
---|
| 36 | * Constructor |
---|
| 37 | * @access public |
---|
| 38 | * @return object |
---|
| 39 | */ |
---|
| 40 | function ui_external_applications() |
---|
| 41 | { |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | /** |
---|
| 45 | * Draw external applications interface |
---|
| 46 | * @return void |
---|
| 47 | * @access public |
---|
| 48 | */ |
---|
| 49 | function draw() |
---|
| 50 | { |
---|
[2372] | 51 | if (!Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id'])) |
---|
[795] | 52 | { |
---|
| 53 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 54 | echo parse_navbar(); |
---|
| 55 | echo lang('access not permitted'); |
---|
| 56 | $GLOBALS['phpgw']->log->message('F-Abort, Unauthorized access to workflow.ui_orgchart'); |
---|
| 57 | $GLOBALS['phpgw']->log->commit(); |
---|
| 58 | $GLOBALS['phpgw']->common->phpgw_exit(); |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['workflow']['title']; |
---|
| 62 | $GLOBALS['phpgw_info']['flags'] = array('noheader' => false, 'nonavbar' => false, 'currentapp' => 'workflow'); |
---|
[2372] | 63 | $smarty = Factory::getInstance('workflow_smarty'); |
---|
[795] | 64 | |
---|
| 65 | $this->set_wf_session(); |
---|
| 66 | |
---|
| 67 | $javaScripts = $this->get_common_js(); |
---|
| 68 | $javaScripts .= $this->get_js_link('workflow','scriptaculous', 'prototype'); |
---|
| 69 | $javaScripts .= $this->get_js_link('workflow','scriptaculous', 'scriptaculous', 'load=effects'); |
---|
| 70 | $javaScripts .= $this->get_js_link('workflow','external_applications', 'main'); |
---|
| 71 | |
---|
| 72 | $css = $this->get_common_css(); |
---|
| 73 | $css .= $this->get_css_link('external_applications'); |
---|
| 74 | |
---|
| 75 | $smarty->assign('header', $smarty->expressoHeader); |
---|
| 76 | $smarty->assign('footer', $smarty->expressoFooter); |
---|
| 77 | $smarty->assign('txt_loading', lang("loading")); |
---|
| 78 | $smarty->assign('javaScripts', $javaScripts); |
---|
| 79 | $smarty->assign('css', $css); |
---|
| 80 | $smarty->display('external_applications.tpl'); |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | /** |
---|
| 84 | * Upload image |
---|
| 85 | * @access public |
---|
| 86 | * @return void |
---|
| 87 | */ |
---|
| 88 | function upload_image() |
---|
| 89 | { |
---|
| 90 | if (isset($_FILES['image_tmp'])) |
---|
| 91 | { |
---|
| 92 | $data = array( |
---|
| 93 | 'name' => $_FILES['image_tmp']['name'], |
---|
| 94 | 'contents' => file_get_contents($_FILES['image_tmp']['tmp_name'])); |
---|
| 95 | $data = base64_encode(serialize($data)); |
---|
| 96 | $output = '<html><head><title>-</title ></head><body>'; |
---|
| 97 | $output .= '<script language="JavaScript" type="text/javascript">' . "\n"; |
---|
| 98 | $output .= 'window.parent.document.getElementById(\'image\').value = \'' . $data . '\';' . "\n"; |
---|
| 99 | $output .= 'window.parent.document.getElementById(\'buttonSave\').onclick();' . "\n"; |
---|
| 100 | $output .= '</script></body></html >'; |
---|
| 101 | echo $output; |
---|
| 102 | } |
---|
| 103 | } |
---|
| 104 | } |
---|
| 105 | ?> |
---|