Esempio n. 1
0
 public static function applet_caption()
 {
     if (!Base_AclCommon::check_permission('Calendar')) {
         return false;
     }
     return __('Agenda');
 }
Esempio n. 2
0
 public static function menu()
 {
     if (!Acl::is_user() || !Base_AclCommon::check_permission('Fax - Browse')) {
         return array();
     }
     return array(_M('CRM') => array('__submenu__' => 1, _M('Fax') => array()));
 }
Esempio n. 3
0
 public function uninstall()
 {
     Base_AclCommon::delete_permission('Fax - Browse');
     Base_AclCommon::delete_permission('Fax - Send');
     Base_ThemeCommon::uninstall_default_theme($this->get_type());
     return true;
 }
Esempio n. 4
0
 public static function menu()
 {
     if (Base_AclCommon::check_permission('Advanced User Settings')) {
         return array(_M('My settings') => array('__weight__' => 10, '__submenu__' => 1, _M('Control panel') => array()));
     }
     return array();
 }
Esempio n. 5
0
 public function uninstall()
 {
     Base_AclCommon::delete_permission('Calendar');
     DB::DropTable('crm_calendar_custom_events_handlers');
     Base_ThemeCommon::uninstall_default_theme('CRM/Calendar');
     return true;
 }
Esempio n. 6
0
	public function uninstall() {
		Base_AclCommon::delete_permission('Messenger Alerts');
		$ret = true;
		$ret &= DB::DropTable('utils_messenger_users');
		$ret &= DB::DropTable('utils_messenger_message');
		return $ret;
	}
Esempio n. 7
0
 public static function menu()
 {
     if (Base_AclCommon::check_permission('Search')) {
         return array(_M('Search') => array());
     }
     return array();
 }
Esempio n. 8
0
 public function uninstall()
 {
     $ret = true;
     $ret &= DB::DropTable('apps_shoutbox_messages');
     Base_AclCommon::delete_permission('Shoutbox');
     Base_ThemeCommon::uninstall_default_theme($this->get_type());
     return $ret;
 }
Esempio n. 9
0
 public function uninstall()
 {
     Base_AclCommon::delete_permission('Advanced User Settings');
     global $database;
     $ret = true;
     $ret &= DB::DropTable('base_user_settings');
     Base_ThemeCommon::uninstall_default_theme(Base_User_SettingsInstall::module_name());
     return $ret;
 }
Esempio n. 10
0
 public function uninstall()
 {
     Base_AclCommon::delete_permission('Manage Perspective');
     $ret = true;
     $ret &= DB::DropTable('crm_filters_contacts');
     $ret &= DB::DropTable('crm_filters_group');
     Base_ThemeCommon::uninstall_default_theme($this->get_type());
     return $ret;
 }
Esempio n. 11
0
 public static function menu()
 {
     if (Base_AclCommon::check_permission('Dashboard')) {
         $tray_settings = Utils_TrayCommon::get_trays();
         if (count($tray_settings) > 0) {
             return array(_M('Tray') => array('__icon__' => 'pile_small.png'));
         }
     }
     return array();
 }
Esempio n. 12
0
 public static function admin_access()
 {
     if (DEMO_MODE) {
         return false;
     }
     if (Variable::get('anonymous_setup')) {
         return true;
     }
     return Base_AclCommon::i_am_admin();
 }
Esempio n. 13
0
 public function uninstall()
 {
     Base_AclCommon::delete_permission('Attachments - view full download history');
     $ret = true;
     $ret &= DB::DropTable('utils_attachment_download');
     $ret &= DB::DropTable('utils_attachment_file');
     $ret &= DB::DropTable('utils_attachment_local');
     Utils_RecordBrowserCommon::uninstall_recordset('utils_attachment');
     Base_ThemeCommon::uninstall_default_theme($this->get_type());
     return $ret;
 }
Esempio n. 14
0
 public function uninstall()
 {
     Base_AclCommon::delete_permission('Dashboard');
     Base_ThemeCommon::uninstall_default_theme($this->get_type());
     $ret = true;
     $ret &= DB::DropTable('base_dashboard_settings');
     $ret &= DB::DropTable('base_dashboard_applets');
     $ret &= DB::DropTable('base_dashboard_default_settings');
     $ret &= DB::DropTable('base_dashboard_default_applets');
     $ret &= DB::DropTable('base_dashboard_users');
     return $ret;
 }
Esempio n. 15
0
 private function create_admin_modules_instances()
 {
     foreach (get_declared_classes() as $class) {
         $rclass = new ReflectionClass($class);
         if ($rclass->isSubclassOf("AdminModule") && !$rclass->isAbstract()) {
             $module = new $class();
             if (Base_AclCommon::i_am_sa() || Base_AclCommon::i_am_admin() && $module->access_admin() || Base_AclCommon::i_am_user() && $module->access_user()) {
                 $this->admin_modules[$class] = $module;
             }
         }
     }
     ksort($this->admin_modules);
 }
Esempio n. 16
0
 /**
  * Replace all registered special values.
  *
  * Object will be cloned. Current object will not be changed.
  *
  * @param bool $human_readable Use special value or it's human readable form
  *
  * @return Utils_RecordBrowser_CritsInterface New object with replaced values
  */
 public function replace_special_values($human_readable = false)
 {
     $new = clone $this;
     $user = Base_AclCommon::get_user();
     $replace_values = self::get_replace_values($user);
     /** @var Utils_RecordBrowser_ReplaceValue $rv */
     foreach ($replace_values as $rv) {
         $replacement = $human_readable ? $rv->get_human_readable() : $rv->get_replace();
         $deactivate = $human_readable ? false : $rv->get_deactivate();
         $new->replace_value($rv->get_value(), $replacement, $deactivate);
     }
     return $new;
 }
Esempio n. 17
0
 public function update_observer($type, $message, $errfile, $errline, $errcontext, $backtrace)
 {
     $mail = Variable::get('error_mail');
     if ($mail) {
         $backtrace = htmlspecialchars_decode(str_replace(array('<br />', '&nbsp;'), array("\n", ' '), $backtrace));
         $x = "who=" . Base_AclCommon::get_user() . "\ntype=" . $type . "\nmessage=" . $message . "\nerror file=" . $errfile . "\nerror line=" . $errline . "\n" . $backtrace;
         $d = ModuleManager::get_data_dir('Base/Error') . md5($x) . '.txt';
         file_put_contents($d, $x);
         $url = get_epesi_url();
         Base_MailCommon::send($mail, 'Epesi Error - ' . $url, substr($x, 0, strpos($x, "error backtrace")) . "\n" . $url . '/' . $d, null, null, false, true);
     }
     return true;
 }
Esempio n. 18
0
 protected function load_epesi()
 {
     if (self::$epesi_loaded) {
         return;
     }
     define('CID', false);
     define('READ_ONLY_SESSION', true);
     require_once '../../../include.php';
     ModuleManager::load_modules();
     self::$epesi_loaded = true;
     if (!Base_AclCommon::is_user()) {
         throw new ErrorException('Not logged in');
     }
 }
Esempio n. 19
0
	public function install() {
		Base_ThemeCommon::install_default_theme($this->get_type());
		$ret = true;
		$ret &= DB::CreateTable('utils_watchdog_category',
					'id I AUTO KEY,'.
					'name C(32),'.
					'callback C(128)',
			array('constraints'=>''));
		if(!$ret){
			print('Unable to create table utils_watchdog_category.<br>');
			return false;
		}
		$ret &= DB::CreateTable('utils_watchdog_event',
					'id I AUTO KEY,'.
					'category_id I,'.
					'internal_id I,'.
					'message C(64),'.
					'event_time T',
			array('constraints'=>', FOREIGN KEY (category_id) REFERENCES utils_watchdog_category(id)'));
		if(!$ret){
			print('Unable to create table utils_watchdog_event.<br>');
			return false;
		}
		$ret &= DB::CreateTable('utils_watchdog_subscription',
					'category_id I,'.
					'internal_id I,'.
					'last_seen_event I,'.
					'user_id I',
			array('constraints'=>', FOREIGN KEY (user_id) REFERENCES user_login(id)'));
		if(!$ret){
			print('Unable to create table utils_watchdog_subscription.<br>');
			return false;
		}
		$ret &= DB::CreateTable('utils_watchdog_category_subscription',
					'category_id I,'.
					'user_id I',
			array('constraints'=>', FOREIGN KEY (user_id) REFERENCES user_login(id), FOREIGN KEY (category_id) REFERENCES utils_watchdog_category(id)'));
		if(!$ret){
			print('Unable to create table utils_watchdog_category_subscription.<br>');
			return false;
		}

		DB::CreateIndex('utils_watchdog_event__internal_id__idx', 'utils_watchdog_event', 'internal_id');
		DB::CreateIndex('utils_watchdog_event__cat_int__idx', 'utils_watchdog_event', array('category_id','internal_id'));
		DB::CreateIndex('utils_watchdog_subscription__cat_int__idx', 'utils_watchdog_subscription', array('category_id','internal_id'));
		DB::CreateIndex('utils_watchdog_subscription__user__idx', 'utils_watchdog_subscription', 'user_id');
		Base_AclCommon::add_permission(_M('Watchdog - subscribe to categories'),array('ACCESS:employee','ACCESS:manager'));
		return $ret;
	}
Esempio n. 20
0
 public static function get_my_homepage()
 {
     $clearance = Base_AclCommon::get_clearance();
     $sql = 'SELECT home_page FROM base_home_page AS bhp WHERE ';
     $vals = array();
     if ($clearance != null) {
         $sql .= ' NOT EXISTS (SELECT * FROM base_home_page_clearance WHERE home_page_id=bhp.id AND ' . implode(' AND ', array_fill(0, count($clearance), 'clearance!=%s')) . ')';
         $vals = array_values($clearance);
     } else {
         $sql .= ' NOT EXISTS (SELECT * FROM base_home_page_clearance WHERE home_page_id=bhp.id)';
     }
     $sql .= ' ORDER BY priority';
     $page = DB::GetOne($sql, $vals);
     $pages = self::get_home_pages();
     return isset($pages[$page]) ? $pages[$page] : array();
 }
Esempio n. 21
0
 public static function quick_access_menu()
 {
     if (!Base_AclCommon::i_am_user()) {
         return array();
     }
     self::get_options();
     $qa_menu = array('__submenu__' => 1);
     foreach (self::$options as $v) {
         if (Base_User_SettingsCommon::get(Base_Menu_QuickAccessCommon::module_name(), $v['name'] . '_m')) {
             $qa_menu[$v['label']] = $v['link'];
         }
     }
     if ($qa_menu == array('__submenu__' => 1)) {
         return array();
     }
     return array(__('Quick Access') => $qa_menu);
 }
Esempio n. 22
0
 public static function has_access_to_report($contact_record = null)
 {
     $has_permission = Base_AclCommon::check_permission('View Activity Report');
     if ($contact_record === null && $has_permission) {
         return true;
     }
     if (isset($contact_record['login']) && $contact_record['login']) {
         if ($has_permission) {
             return true;
         }
         $id = isset($contact_record['id']) ? $contact_record['id'] : false;
         if (!$id) {
             return false;
         }
         $my_record = CRM_ContactsCommon::get_my_record();
         return $id == $my_record['id'];
     }
 }
Esempio n. 23
0
 public static function notification()
 {
     $time = time() - 24 * 3600;
     $arr = DB::GetAll('SELECT ul.login, ul.id as user_id, asm.id, asm.message, asm.posted_on, asm.to_user_login_id FROM apps_shoutbox_messages asm LEFT JOIN user_login ul ON ul.id=asm.base_user_login_id WHERE asm.posted_on>=%T AND asm.base_user_login_id!=%d AND (asm.to_user_login_id=%d OR asm.to_user_login_id is null) ORDER BY asm.posted_on DESC LIMIT 10', array($time, Base_AclCommon::get_user(), Base_AclCommon::get_user()));
     if (empty($arr)) {
         return array();
     }
     //print it out
     $ret = array();
     $tray = array();
     foreach ($arr as $row) {
         if (!$row['login']) {
             $row['login'] = '******';
         }
         $ret['shoutbox_' . $row['id']] = vsprintf('<font color="gray">[%s]</font><font color="blue">%s</font>: %s', array(Base_RegionalSettingsCommon::time2reg($row['posted_on']), $row['login'], $row['message']));
         $tray['shoutbox_' . $row['id']] = array('title' => __('Shoutbox Message'), 'body' => $row['to_user_login_id'] ? __('%s wrote to you: %s', array(Base_UserCommon::get_user_label($row['user_id'], true), $row['message'])) : __('%s wrote to all: %s', array(Base_UserCommon::get_user_label($row['user_id'], true), $row['message'])));
     }
     return array('notifications' => $ret, 'tray' => $tray);
 }
Esempio n. 24
0
 static function form()
 {
     try {
         $anonymous = Variable::get('anonymous_setup');
     } catch (NoSuchVariableException $e) {
         $anonymous = true;
     }
     if (!Base_AclCommon::is_user() && Base_User_LoginCommon::is_banned()) {
         return self::t('You have exceeded the number of allowed login attempts.');
     }
     require_once 'modules/Libs/QuickForm/requires.php';
     if (!Base_AclCommon::is_user() && !$anonymous) {
         Base_User_LoginCommon::autologin();
     }
     if (!Base_AclCommon::is_user() && !$anonymous) {
         $get = count($_GET) ? '?' . http_build_query($_GET) : '';
         $form = new HTML_QuickForm('loginform', 'post', $_SERVER['PHP_SELF'] . $get);
         $form->setRequiredNote('<span style="font-size:80%; color:#ff0000;">*</span><span style="font-size:80%;">' . self::t('denotes required field') . '</span>');
         $form->addElement('text', 'username', self::t('Username'));
         $form->addRule('username', 'Field required', 'required');
         $form->addElement('password', 'password', self::t('Password'));
         $form->addRule('password', 'Field required', 'required');
         // register and add a rule to check if user is banned
         $form->registerRule('check_user_banned', 'callback', 'rule_login_banned', 'Base_User_LoginCommon');
         $form->addRule('username', self::t('You have exceeded the number of allowed login attempts.'), 'check_user_banned');
         // register and add a rule to check if user and password exists
         $form->registerRule('check_login', 'callback', 'submit_login', 'Base_User_LoginCommon');
         $form->addRule(array('username', 'password'), self::t('Login or password incorrect'), 'check_login', $form);
         $form->addElement('submit', null, self::t('Login'));
         if ($form->validate()) {
             $user = $form->exportValue('username');
             Base_AclCommon::set_user(Base_UserCommon::get_user_id($user), true);
             // redirect below is used to better browser refresh behavior.
             header('Location: ' . $_SERVER['REQUEST_URI']);
         } else {
             return "<center>" . $form->toHtml() . "</center>";
         }
     }
 }
Esempio n. 25
0
<?php

/**
 * 
 * @author Georgi Hristov <*****@*****.**>
 * @copyright Copyright &copy; 2014, Xoff Software GmbH
 * @license MIT
 * @version 1.0
 * @package epesi-notify
 * 
 */
ob_start();
define('CID', $_REQUEST['cid']);
require_once '../../../include.php';
ModuleManager::load_modules();
if (!Base_AclCommon::is_user()) {
    exit;
}
$general_setting = Base_NotifyCommon::get_general_setting();
if ($general_setting == -1) {
    echo json_encode(array('disable' => 1));
    exit;
}
$ret = null;
$notify_count = 0;
$group_similar = Base_NotifyCommon::group_similar();
$notifications = Base_NotifyCommon::get_notifications();
foreach ($notifications as $module => $notify) {
    if (!isset($notify['tray'])) {
        continue;
    }
Esempio n. 26
0
	public function set_filters($rb, $display_tray_select = true, $filter_defaults = array()) {
		if(!Base_AclCommon::check_permission('Dashboard')) return;
		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->push_main('Utils_Tray');
		}

		if (isset($_REQUEST['tray_slot'])) {
			Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
			$this->set_module_variable('tray_slot', $_REQUEST['tray_slot']);
		}

		$tray_func = $this->parent->get_type().'Common::tray';
		if (!is_callable($tray_func)) return;

		$settings = call_user_func($tray_func);

		if (!isset($settings[$rb->tab])) return;

		$slot_defs = Utils_TrayCommon::get_slots($rb->tab, $settings[$rb->tab]);
		Utils_TrayCommon::sort_trays($slot_defs);

		if ($display_tray_select) {
			$tray_slot_select_options = array('__NULL__'=>'---');
			foreach ($slot_defs as $slot_id=>$slot_def) {
				$tray_slot_select_options[$slot_id] = _V($slot_def['__name__']);
			}

			$form = $this->init_module('Libs/QuickForm');
			$form->addElement('select', 'tray_slot_select', __('Tray'), $tray_slot_select_options, array('style'=>'width: 130px','onchange'=>$form->get_submit_form_js()));
			if ($form->validate()) {
				$tray_slot = $form->exportValue('tray_slot_select');
				$this->set_module_variable('tray_slot',$tray_slot);
				
				$rb->unset_module_variable('def_filter');
			}
		}

		$tray_slot = $this->get_module_variable('tray_slot');
		
		if (isset($slot_defs[$tray_slot]['__filters__'])) {
			$filters_changed = Utils_TrayCommon::are_filters_changed($slot_defs[$tray_slot]['__filters__']);
		}
		else {
			$filters_changed = true;
		}

		if (!isset($_REQUEST['__location']) && ($tray_slot!='__NULL__') && isset($tray_slot) && !$filters_changed){
			$rb->set_additional_caption(_V($slot_defs[$tray_slot]['__name__']));
		}
		else {
			$this->unset_module_variable('tray_slot');
			$tray_slot='__NULL__';
		}

		if ($display_tray_select) {
			$form->setDefaults(array('tray_slot_select'=>$tray_slot));

			ob_start();
			$form->display_as_row();
			$html = ob_get_clean();
			print('<div style="position: absolute;right:120px;">'.$html.'</div>');
		}
		
		if (is_null($tray_slot) || $tray_slot=='__NULL__') {
			$rb->set_filters_defaults($filter_defaults);
			return;
		}
		
		$rb->disable_browse_mode_switch();

		$rb->set_filters_defaults($slot_defs[$tray_slot]['__filters__']);
	}
Esempio n. 27
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;
 }
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
Base_AclCommon::add_permission(_M('Watchdog - subscribe to categories'), array('ACCESS:employee', 'ACCESS:manager'));
Esempio n. 29
0
 public function addon($arg, $rb)
 {
     $rs = $rb->tab;
     $id = $arg['id'];
     if ($rs == 'contact' && Base_AclCommon::i_am_admin()) {
         Base_ActionBarCommon::add('reload', __('Reload mails'), $this->create_callback_href(array($this, 'reload_mails'), $arg['id']));
     }
     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');
     $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);
 }
Esempio n. 30
0
 public static function display_status($record, $nolink, $desc)
 {
     $prefix = 'crm_tasks_leightbox';
     $v = $record[$desc['id']];
     if (!$v) {
         $v = 0;
     }
     $status = Utils_CommonDataCommon::get_translated_array('CRM/Status');
     if ($v >= 3 || $nolink) {
         return $status[$v];
     }
     CRM_FollowupCommon::drawLeightbox($prefix);
     if (!Utils_RecordBrowserCommon::get_access('task', 'edit', $record) && !Base_AclCommon::i_am_admin()) {
         return $status[$v];
     }
     if (isset($_REQUEST['form_name']) && $_REQUEST['form_name'] == $prefix . '_follow_up_form' && $_REQUEST['id'] == $record['id']) {
         unset($_REQUEST['form_name']);
         $v = $_REQUEST['closecancel'];
         $action = $_REQUEST['action'];
         $note = $_REQUEST['note'];
         if ($note) {
             if (get_magic_quotes_gpc()) {
                 $note = stripslashes($note);
             }
             $note = str_replace("\n", '<br />', $note);
             Utils_AttachmentCommon::add('task/' . $record['id'], 0, Acl::get_user(), $note);
         }
         if ($action == 'set_in_progress') {
             $v = 1;
         }
         Utils_RecordBrowserCommon::update_record('task', $record['id'], array('status' => $v));
         if ($action == 'set_in_progress') {
             location(array());
         }
         $values = $record;
         $values['date_and_time'] = date('Y-m-d H:i:s');
         $values['title'] = __('Follow-up') . ': ' . $values['title'];
         $values['status'] = 0;
         if ($action != 'none') {
             $x = ModuleManager::get_instance('/Base_Box|0');
             $values['follow_up'] = array('task', $record['id'], $record['title']);
             if ($action == 'new_task') {
                 $x->push_main('Utils/RecordBrowser', 'view_entry', array('add', null, $values), array('task'));
             }
             if ($action == 'new_meeting') {
                 $x->push_main('Utils/RecordBrowser', 'view_entry', array('add', null, array('title' => $values['title'], 'permission' => $values['permission'], 'priority' => $values['priority'], 'description' => $values['description'], 'date' => date('Y-m-d'), 'time' => date('H:i:s'), 'duration' => 3600, 'status' => 0, 'employees' => $values['employees'], 'customers' => $values['customers'], 'follow_up' => $values['follow_up'])), array('crm_meeting'));
             }
             if ($action == 'new_phonecall') {
                 $x->push_main('Utils/RecordBrowser', 'view_entry', array('add', null, array('subject' => $values['title'], 'permission' => $values['permission'], 'priority' => $values['priority'], 'description' => $values['description'], 'date_and_time' => date('Y-m-d H:i:s'), 'employees' => $values['employees'], 'status' => 0, 'customer' => !empty($values['customers']) ? array_pop($values['customers']) : '', 'follow_up' => $values['follow_up'])), array('phonecall'));
             }
             return false;
         }
         location(array());
     }
     if ($v == 0) {
         return '<a href="javascript:void(0)" onclick="' . $prefix . '_set_action(\'set_in_progress\');' . $prefix . '_set_id(\'' . $record['id'] . '\');' . $prefix . '_submit_form();">' . $status[$v] . '</a>';
     }
     return '<a href="javascript:void(0)" class="lbOn" rel="' . $prefix . '_followups_leightbox" onMouseDown="' . $prefix . '_set_id(' . $record['id'] . ');">' . $status[$v] . '</a>';
 }