Пример #1
0
 public function body()
 {
     $qf = $this->init_module(Libs_QuickForm::module_name(), null, 'provider');
     list($providers, $providers_arr) = self::get_providers();
     if (empty($providers)) {
         print __('No fax providers installed or configured.');
         return;
     }
     $provider =& $this->get_module_variable('provider', current(array_keys($providers)));
     $qf->addElement('select', 'provider', __('Provider'), $providers, array('onChange' => $qf->get_submit_form_js()));
     $qf->setDefaults(array('provider' => $provider));
     if ($qf->validate()) {
         $provider = $qf->exportValue('provider');
     }
     $qf->display();
     if (!isset($providers_arr[$provider])) {
         print __('Invalid fax provider.');
         return;
     }
     set_time_limit(0);
     $tb = $this->init_module(Utils_TabbedBrowser::module_name());
     if (isset($providers_arr[$provider]['get_received_count_func']) && isset($providers_arr[$provider]['get_received_func'])) {
         $tb->set_tab('Received', array($this, 'received_tab'), array(array($provider . 'Common', $providers_arr[$provider]['get_received_count_func']), array($provider . 'Common', $providers_arr[$provider]['get_received_func'])));
     }
     if (isset($providers_arr[$provider]['get_queue_count_func']) && isset($providers_arr[$provider]['get_queue_func']) && isset($providers_arr[$provider]['queue_statuses'])) {
         $tb->set_tab('Current Queue', array($this, 'queue_tab'), array(array($provider . 'Common', $providers_arr[$provider]['get_queue_count_func']), array($provider . 'Common', $providers_arr[$provider]['get_queue_func']), $providers_arr[$provider]['queue_statuses']));
     }
     if (isset($providers_arr[$provider]['get_sent_count_func']) && isset($providers_arr[$provider]['get_sent_func']) && isset($providers_arr[$provider]['sent_statuses'])) {
         $tb->set_tab('Sent', array($this, 'sent_tab'), array(array($provider . 'Common', $providers_arr[$provider]['get_sent_count_func']), array($provider . 'Common', $providers_arr[$provider]['get_sent_func']), $providers_arr[$provider]['sent_statuses']));
     }
     $this->display_module($tb);
     $tb->tag();
     Base_ActionBarCommon::add('send', __('Send file'), $this->create_callback_href(array($this, 'send_file_tab')));
 }
Пример #2
0
 public function admin()
 {
     if ($this->is_back()) {
         $this->parent->reset();
     }
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     $tb = $this->init_module(Utils_TabbedBrowser::module_name());
     $tb->set_tab('Translations', array($this, 'translations'));
     $tb->set_tab('Settings', array($this, 'settings'));
     $this->display_module($tb);
     $tb->tag();
 }
Пример #3
0
 public function body()
 {
     $tb = $this->init_module(Utils_TabbedBrowser::module_name());
     $tb->set_tab('Manage Users', array($this, 'xxx'), 'users');
     $tb->set_tab('Manage Companies', array($this, 'xxx'), 'companies');
     $tb->set_tab('Manage Sales Categories', array($this, 'xxx'), 'categories', true);
     $tb->set_tab('XXX', array($this, 'xxx'), 'xxx', true);
     $tb->start_tab('XXX');
     print 'xXX';
     $tb->end_tab();
     $this->display_module($tb);
     //		$tb->tag();
     //------------------------------ print out src
     print '<hr><b>Install</b><br>';
     $this->pack_module(Utils_CatFile::module_name(), 'modules/Tests/TabbedBrowser/TabbedBrowserInstall.php');
     print '<hr><b>Main</b><br>';
     $this->pack_module(Utils_CatFile::module_name(), 'modules/Tests/TabbedBrowser/TabbedBrowser_0.php');
     print '<hr><b>Common</b><br>';
     $this->pack_module(Utils_CatFile::module_name(), 'modules/Tests/TabbedBrowser/TabbedBrowserCommon_0.php');
 }
Пример #4
0
 public function body()
 {
     /* Do not delete anything - all messages are kept in history
     		// to allow delete by admin uncomment below lines
     		// if i am admin add "clear shoutbox" actionbar button
     		if(Base_AclCommon::i_am_admin())
     			Base_ActionBarCommon::add('delete',__('Clear shoutbox'),$this->create_callback_href(array($this,'delete_all')));
     		*/
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     if ($this->is_back()) {
         $x = ModuleManager::get_instance('/Base_Box|0');
         if (!$x) {
             trigger_error('There is no base box module instance', E_USER_ERROR);
         }
         $x->pop_main();
         return;
     }
     $tb = $this->init_module(Utils_TabbedBrowser::module_name());
     $tb->set_tab(__('Chat'), array($this, 'chat'), true, null);
     $tb->set_tab(__('History'), array($this, 'history'), null);
     $this->display_module($tb);
 }
Пример #5
0
 public function file_history($attachment)
 {
     if ($this->is_back()) {
         $x = ModuleManager::get_instance('/Base_Box|0');
         if (!$x) {
             trigger_error('There is no base box module instance', E_USER_ERROR);
         }
         return $x->pop_main();
     }
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     $id = $attachment['id'];
     $tb =& $this->init_module(Utils_TabbedBrowser::module_name());
     $tb->start_tab('File history');
     $gb = $this->init_module(Utils_GenericBrowser::module_name(), null, 'hua' . $id);
     $gb->set_inline_display();
     $gb->set_table_columns(array(array('name' => __('Deleted'), 'order' => 'deleted', 'width' => 10), array('name' => __('Date'), 'order' => 'upload_on', 'width' => 25), array('name' => __('Who'), 'order' => 'upload_by', 'width' => 25), array('name' => __('Attachment'), 'order' => 'uaf.original')));
     $gb->set_default_order(array(__('Date') => 'DESC'));
     $ret = $gb->query_order_limit('SELECT uaf.id,uaf.deleted,uaf.filestorage_id,uaf.created_on as upload_on,uaf.created_by as upload_by,uaf.original FROM utils_attachment_file uaf WHERE uaf.attach_id=' . $id, 'SELECT count(*) FROM utils_attachment_file uaf WHERE uaf.attach_id=' . $id);
     while ($row = $ret->FetchRow()) {
         $r = $gb->get_new_row();
         if ($row['deleted']) {
             $r->add_action($this->create_confirm_callback_href(__('Are you sure you want to restore attached file?'), array($this, 'restore_file'), array($row['id'])), 'restore', __('Restore'));
         }
         $view_link = '';
         $lb = array();
         $lb['aid'] = $id;
         $lb['crypted'] = $attachment['crypted'];
         $lb['original'] = $row['original'];
         $lb['id'] = $row['id'];
         $lb['filestorage_id'] = $row['filestorage_id'];
         $file = '<a ' . Utils_AttachmentCommon::get_file_leightbox($lb, $view_link) . '>' . $row['original'] . '</a>';
         $r->add_data($row['deleted'] ? __('Yes') : __('No'), Base_RegionalSettingsCommon::time2reg($row['upload_on']), Base_UserCommon::get_user_label($row['upload_by']), $file);
     }
     $this->display_module($gb);
     $tb->end_tab();
     $tb->start_tab('File access history');
     $gb = $this->init_module(Utils_GenericBrowser::module_name(), null, 'hda' . $id);
     $gb->set_inline_display();
     $gb->set_table_columns(array(array('name' => __('Create date'), 'order' => 'created_on', 'width' => 15), array('name' => __('Download date'), 'order' => 'download_on', 'width' => 15), array('name' => __('Who'), 'order' => 'created_by', 'width' => 15), array('name' => __('IP Address'), 'order' => 'ip_address', 'width' => 15), array('name' => __('Host Name'), 'order' => 'host_name', 'width' => 15), array('name' => __('Method description'), 'order' => 'description', 'width' => 20), array('name' => __('Remote'), 'order' => 'remote', 'width' => 10)));
     $gb->set_default_order(array(__('Create date') => 'DESC'));
     $query = 'SELECT uad.created_on,uad.download_on,(SELECT l.login FROM user_login l WHERE uad.created_by=l.id) as created_by,uad.remote,uad.ip_address,uad.host_name,uad.description FROM utils_attachment_download uad INNER JOIN utils_attachment_file uaf ON uaf.id=uad.attach_file_id WHERE uaf.attach_id=' . $id;
     $query_qty = 'SELECT count(*) FROM utils_attachment_download uad INNER JOIN utils_attachment_file uaf ON uaf.id=uad.attach_file_id WHERE uaf.attach_id=' . $id;
     if (Base_AclCommon::check_permission('Attachments - view full download history')) {
         $ret = $gb->query_order_limit($query, $query_qty);
     } else {
         print 'You are allowed to see your own downloads only';
         $who = ' AND uad.created_by=' . Acl::get_user();
         $ret = $gb->query_order_limit($query . $who, $query_qty . $who);
     }
     while ($row = $ret->FetchRow()) {
         $r = $gb->get_new_row();
         $r->add_data(Base_RegionalSettingsCommon::time2reg($row['created_on']), $row['remote'] != 1 ? Base_RegionalSettingsCommon::time2reg($row['download_on']) : '', $row['created_by'], $row['ip_address'], $row['host_name'], $row['description'], $row['remote'] == 0 ? 'no' : 'yes');
     }
     $this->display_module($gb);
     $tb->end_tab();
     $this->display_module($tb);
     $this->caption = 'Note history';
     return true;
 }
Пример #6
0
 public function make_charts()
 {
     if (empty($this->ref_records)) {
         print 'There were no records to display report for.';
         return;
     }
     $this->cols_total = array();
     /***** MAIN TABLE *****/
     $row_count = 1;
     $gb_captions = $this->gb_captions;
     array_shift($gb_captions);
     if (!empty($this->categories)) {
         array_shift($gb_captions);
     }
     $tb = $this->init_module(Utils_TabbedBrowser::module_name());
     foreach ($this->ref_records as $k => $r) {
         $title = strip_tags(call_user_func($this->ref_record_display_callback, $r, true));
         $tb->set_tab($title, array($this, 'draw_chart'), array($r, $title, $gb_captions));
     }
     if (empty($this->categories)) {
         $title = 'All';
         $tb->set_tab($title, array($this, 'draw_category_chart'), array('', $gb_captions));
     } else {
         foreach ($this->categories as $q => $c) {
             $title = strip_tags($c);
             $tb->set_tab($title, array($this, 'draw_category_chart'), array($c, $gb_captions));
         }
     }
     $tb->set_tab('Summary', array($this, 'draw_summary_chart'), array($gb_captions));
     $this->display_module($tb);
     $this->tag();
 }
Пример #7
0
 public function construct($ev_mod, array $settings = null, $custom_new_event_href_js = null)
 {
     $this->custom_new_event_href_js = $custom_new_event_href_js;
     $this->settings = array_merge($this->settings, $settings);
     $this->event_module = str_replace('/', '_', $ev_mod);
     if (ModuleManager::is_installed($this->event_module) == -1) {
         trigger_error('Invalid event module: ' . $this->event_module, E_USER_ERROR);
     }
     $this->set_module_variable('event_module', $this->event_module);
     if (!is_array($this->settings['custom_rows'])) {
         $this->settings['custom_rows'] = array('timeless' => __('Timeless'));
     }
     //default views
     if ($this->settings['views'] === null) {
         $this->settings['views'] =& self::$views;
     }
     //default date
     if ($this->settings['default_date'] === null) {
         $this->settings['default_date'] = time();
     }
     $this->date =& $this->get_module_variable('date', $this->settings['default_date']);
     $this->date = strtotime(date('Y-m-d', $this->date));
     if ($this->isset_unique_href_variable('date')) {
         $this->set_date($this->get_unique_href_variable('date'));
     }
     if ($this->isset_unique_href_variable('week_date')) {
         $this->set_week_date($this->get_unique_href_variable('week_date'));
     }
     if ($this->isset_unique_href_variable('shift_week_day')) {
         $this->shift_week_day($this->get_unique_href_variable('shift_week_day'));
     }
     if (count($this->settings['views']) > 1) {
         $this->tb = $this->init_module(Utils_TabbedBrowser::module_name());
         foreach ($this->settings['views'] as $k => $v) {
             if (!in_array($v, self::$views)) {
                 trigger_error('Invalid view: ' . $v, E_USER_ERROR);
             }
             switch ($v) {
                 case 'Day':
                     $label = __('Day');
                     break;
                 case 'Week':
                     $label = __('Week');
                     break;
             }
             $this->tb->set_tab($label, array($this, strtolower($v)));
             if (strcasecmp($v, $this->settings['default_view']) == 0) {
                 $def_tab = $k;
             }
         }
         if (isset($def_tab)) {
             $this->tb->set_default_tab($def_tab);
         }
     }
     if ($this->isset_unique_href_variable('action')) {
         switch ($this->get_unique_href_variable('action')) {
             case 'add':
                 $this->push_event_action('add', array($this->get_unique_href_variable('time'), $this->get_unique_href_variable('timeless') == '0' ? false : $this->get_unique_href_variable('timeless')));
                 return;
             case 'switch':
                 $views = array_flip($this->settings['views']);
                 $view = $this->get_unique_href_variable('tab');
                 if (isset($views[$view])) {
                     $this->tb->switch_tab($views[$view]);
                 } else {
                     break;
                 }
                 $this->date = $this->get_unique_href_variable('time');
                 break;
         }
     } elseif (isset($_REQUEST['UCaction']) && isset($_REQUEST['UCev_id'])) {
         switch ($_REQUEST['UCaction']) {
             case 'delete':
                 $this->delete_event($_REQUEST['UCev_id']);
                 break;
             case 'move':
                 $this->move_event($_REQUEST['UCev_id'], $_REQUEST['UCdate']);
                 break;
             case 'view':
             case 'edit':
                 $this->push_event_action($_REQUEST['UCaction'], array($_REQUEST['UCev_id']));
                 return;
         }
     }
 }
Пример #8
0
 public function administrator_panel()
 {
     $_SESSION['client']['recordbrowser']['admin_access'] = Base_AdminCommon::get_access('Utils_RecordBrowser', 'records') == 2;
     Utils_RecordBrowserCommon::$admin_access = Base_AdminCommon::get_access('Utils_RecordBrowser', 'records') == 2;
     $this->init();
     $tb = $this->init_module(Utils_TabbedBrowser::module_name());
     $tabs = array(array('access' => 'fields', 'func' => array($this, 'setup_loader'), 'label' => __('Manage Fields'), 'args' => array()), array('access' => 'records', 'func' => array($this, 'show_data'), 'label' => __('Manage Records'), 'args' => array(array(), array(), array(), Base_AdminCommon::get_access('Utils_RecordBrowser', 'records') == 2)), array('access' => 'addons', 'func' => array($this, 'manage_addons'), 'label' => __('Manage Addons'), 'args' => array()), array('access' => 'permissions', 'func' => array($this, 'manage_permissions'), 'label' => __('Permissions'), 'args' => array()), array('access' => 'settings', 'func' => array($this, 'settings'), 'label' => __('Settings'), 'args' => array()), array('access' => 'pattern', 'func' => array($this, 'setup_clipboard_pattern'), 'label' => __('Clipboard Pattern'), 'args' => array()));
     foreach ($tabs as $t) {
         $access = Base_AdminCommon::get_access('Utils_RecordBrowser', $t['access']);
         if ($access != 0) {
             $tb->set_tab($t['label'], $t['func'], $t['args']);
         }
     }
     $tb->body();
     $tb->tag();
 }
Пример #9
0
 public function construct()
 {
     $this->tb = $this->init_module(Utils_TabbedBrowser::module_name());
     on_init(array('Base_ActionBarCommon', 'show_quick_access_shortcuts'), array(false));
 }
Пример #10
0
 public function addon($arg, $rb)
 {
     $rs = $rb->tab;
     $id = $arg['id'];
     if ($rs == 'contact' || $rs == 'company') {
         $emails = CRM_RoundcubeCommon::get_email_addresses($rs, $arg);
         if ($emails) {
             Base_ActionBarCommon::add('reload', __('Reload mails'), $this->create_callback_href(array('CRM_RoundcubeCommon', 'reload_mails'), array($rs, $id, $emails)));
         }
     }
     if (isset($_SESSION['rc_mails_cp']) && is_array($_SESSION['rc_mails_cp']) && !empty($_SESSION['rc_mails_cp'])) {
         $ok = true;
         $mails = Utils_RecordBrowserCommon::get_records('rc_mails', array('id' => $_SESSION['rc_mails_cp']), array('related', 'employee', 'contacts'));
         if (count($mails) != count($_SESSION['rc_mails_cp'])) {
             $ok = false;
         }
         if ($ok) {
             foreach ($mails as $mail) {
                 if (in_array($rs . '/' . $id, $mail['related']) || ($rs == 'contact' || $rs == 'company') && (in_array(($rs == 'contact' ? 'P:' : 'C:') . $id, $mail['contacts']) || $rs == 'contact' && $id == $mail['employee'])) {
                     $ok = false;
                     break;
                 }
             }
         }
         if ($ok) {
             $this->lp = $this->init_module('Utils_LeightboxPrompt');
             $this->lp->add_option('cancel', __('Cancel'), Base_ThemeCommon::get_template_file('Base_ActionBar', 'icons/back.png'), null);
             $this->lp->add_option('paste', __('Paste'), Base_ThemeCommon::get_template_file($this->get_type(), 'copy.png'), null);
             $content = '';
             foreach ($_SESSION['rc_mails_cp'] as $mid) {
                 $mail = Utils_RecordBrowserCommon::get_record('rc_mails', $mid);
                 $content .= '<div style="text-align:left"><b>' . __('From') . ':</b> <i>' . $mail['from'] . '</i><br /><b>' . __('To') . ':</b> <i>' . $mail['to'] . '</i><br /><b>' . __('Subject') . ':</b> <i>' . $mail['subject'] . '</i><br />' . substr(strip_tags($mail['body'], '<br><hr>'), 0, 200) . (strlen($mail['body']) > 200 ? '...' : '') . '</div>';
             }
             $this->display_module($this->lp, array(__('Paste e-mail'), array(), $content, false));
             $vals = $this->lp->export_values();
             if ($vals) {
                 if ($vals['option'] == 'paste') {
                     $this->paste($rs, $id);
                 }
             }
             Base_ActionBarCommon::add(Base_ThemeCommon::get_template_file($this->get_type(), 'copy.png'), __('Paste mail'), $this->lp->get_href());
             //$this->create_confirm_callback_href(__('Paste following email?'),array($this,'paste'),array($rs,$id)));
         }
     }
     $tb = $this->init_module(Utils_TabbedBrowser::module_name());
     $tb->set_tab(__('Threaded'), array($this, 'addon_threaded'), array($rs, $id));
     $tb->set_tab(__('Flat'), array($this, 'addon_flat'), array($rs, $id));
     $this->display_module($tb);
 }