Exemple #1
0
	public function body() {
		print "Tooltip Test<hr>";
		print(Utils_TooltipCommon::create('point mouse here', 'tip'));
		//------------------------------ print out src
		print('<hr><b>Main</b><br>');
		$this->pack_module('Utils/CatFile','modules/Tests/Tooltip/Tooltip_0.php');
		print('<hr><b>Common</b><br>');
		$this->pack_module('Utils/CatFile','modules/Tests/Tooltip/TooltipCommon_0.php');
		print('<hr><b>Install</b><br>');
		$this->pack_module('Utils/CatFile','modules/Tests/Tooltip/TooltipInstall.php');
	}
Exemple #2
0
 public function body()
 {
     print "Tooltip Test ver 1.5<hr>";
     print Utils_TooltipCommon::create('point mouse here', 'tip');
     //------------------------------ print out src
     print '<hr><b>Main</b><br>';
     $this->pack_module(Utils_CatFile::module_name(), 'modules/Tests/Tooltip/Tooltip_0.php');
     print '<hr><b>Common</b><br>';
     $this->pack_module(Utils_CatFile::module_name(), 'modules/Tests/Tooltip/TooltipCommon_0.php');
     print '<hr><b>Install</b><br>';
     $this->pack_module(Utils_CatFile::module_name(), 'modules/Tests/Tooltip/TooltipInstall.php');
 }
Exemple #3
0
	private function output($applet = false) {
		Base_ThemeCommon::load_css($this->get_type(), 'tray');

		$tray_settings = Utils_TrayCommon::get_trays();

		$tray_def = array();
		$total_pending = 0;
		$displayed = 0;

		foreach ($tray_settings as $module=>$module_settings) {
			foreach ($module_settings as $tab=>$tab_settings) {
				if (!isset($tab_settings['__title__'])) continue;

				$tray = Utils_TrayCommon::get_tray($tab, $tab_settings);

				if (!isset($tray['__slots__']) || count($tray['__slots__'])==0) continue;

				$tray_id = $this->get_type().'__'.Utils_RecordBrowserCommon::get_field_id($tray['__title__']);

				$tray_def += array($tray_id =>array('__title__' => $tray['__title__'], '__weight__'=>isset($tray['__weight__'])?$tray['__weight__']:0));

				foreach ($tray['__slots__'] as $slot_id=>$slot_def) {
					$total_pending += $slot_def['__count__'];
					$displayed += $slot_def['__count__'];

					$tray_def[$tray_id]['__slots__'][$slot_id]['__weight__'] = isset($slot_def['__weight__'])? $slot_def['__weight__']: 0;

					$icon = $this->get_icon($slot_def['__count__']);
					$tray_count_width = ($slot_def['__count__']>99)? 'style="width:28px;"':'';

					$tip_text = __('Click to view %s items from %s<br><br>%d item(s)', array(_V($slot_def['__name__']),_V($tray['__title__']), $slot_def['__count__']));

					$tray_def[$tray_id]['__slots__'][$slot_id]['__html__'] = '<td><a '.$this->create_main_href($module, null, array($tab), null, array('tray_slot'=>$slot_id)).'><div class="Utils_Tray__slot">'.
					Utils_TooltipCommon::create('<img src="'.$icon.'">
					<div class="Utils_Tray__count" '.$tray_count_width.'>'.$slot_def['__count__'].'</div><div>'._V($slot_def['__name__']).'</div>',$tip_text).'</div></a></td>';				
				}
			}
		}

		Utils_TrayCommon::sort_trays($tray_def);

		$trays = array();
		$tray_slots_html = array();
		$current_tray = 0;

		$tray_cols = $applet? 2:$this->get_tray_cols();

		foreach ($tray_def as $tray_id=>$def) {
			$current_tray += 1;
			$current_row = max(array(round($current_tray/$tray_cols), 1));
			$current_col = $current_tray - $tray_cols*($current_row-1);

			if (isset($this->max_trays) && $this->max_trays != '__NULL__') {
				//allow only trays in applet mode as per setting
				if (count($trays) >= $this->max_trays) 	break;
			}

			if (self::get_tray_layout()=='checkered')
			$class = (($current_row+$current_col) % 2)?'Utils_Tray__group_even':'Utils_Tray__group_odd';
			else
			$class = 'Utils_Tray__group_even';

			$trays[] = array(
			'class' => $class,
			'col'=>$current_col,
			'title'=>_V($def['__title__']),
			'id'=>$tray_id);

			foreach ($def['__slots__'] as $slot) {
				$tray_slots_html[$tray_id][] = $slot['__html__'];

				if (isset($this->max_slots) && $this->max_slots != '__NULL__') {
					//allow slots in applet mode as per setting
					if (count($tray_slots_html[$tray_id]) >= $this->max_slots) continue 2;
				}
			}
		}

		eval_js(
		'function Utils_Tray__trays() {
			var trays = '.json_encode($tray_slots_html).';
			return trays;		
		}
		
		jq( document ).ready(function() {
			var resizeId;
			jq(window).resize(function(){
				clearTimeout(resizeId);
				resizeId = setTimeout(Utils_Tray__resize, 300);
			});	
			Utils_Tray__resize();	
		});');

		load_js($this->get_module_dir().'tray.js');

		$theme = $this->init_module('Base/Theme');
		$icon = Base_ThemeCommon::get_template_file($this->get_type(),'pile2.png');

		$theme->assign('main_page', !$applet);
		$theme->assign('caption', Utils_TrayCommon::caption());
		$theme->assign('icon', $icon);
		$theme->assign('trays', $trays);
		$theme->assign('tray_cols', $tray_cols);

		if ($total_pending!=$displayed) {
			print (__('Displaying %d of %d pending', array($displayed, $total_pending)));
		}

		$theme->display('tray');
	}
Exemple #4
0
 public static function display_deadline($record, $nolink, $desc)
 {
     if (!$record['deadline']) {
         return '';
     }
     $deadline = strtotime($record['deadline'] . ' ' . date('H:i:s', strtotime($record['deadline_time'])));
     $ret = Base_RegionalSettingsCommon::time2reg($record['deadline'], false);
     if ($deadline < time()) {
         $ret = '<span style="color:red;font-weight:bold;">' . $ret . '</span>';
     }
     return Utils_TooltipCommon::create($ret, Base_RegionalSettingsCommon::time2reg($deadline));
 }
Exemple #5
0
 public function body()
 {
     if (isset(Base_BoxCommon::$override_box_main)) {
         $this->pack_module(Base_BoxCommon::$override_box_main);
         return;
     }
     $theme = $this->pack_module(Base_Theme::module_name());
     $ini = Base_BoxCommon::get_ini_file();
     if (!$ini) {
         print __('Unable to read Base/Box/default.ini file! Please create one, or change theme.');
         $this->pack_module(Base_Theme_Administrator::module_name(), null, 'admin');
         return;
     }
     $ini_file = parse_ini_file($ini, true);
     $logged = Base_AclCommon::is_user();
     $theme->assign('logged', $logged);
     $containers = array();
     $containers['main'] = array('module' => null, 'name' => '');
     //so 'main' is first in array
     $name = 0;
     foreach ($ini_file as $tag => $opts) {
         $name++;
         if ($logged && $opts['display'] == 'anonymous' || !$logged && $opts['display'] == 'logged') {
             continue;
         }
         if (isset($opts['function'])) {
             $containers[$tag]['function'] = $opts['function'];
             $containers[$tag]['arguments'] = null;
         }
         if (isset($opts['arguments'])) {
             $containers[$tag]['arguments'] = $opts['arguments'];
         }
         if (isset($opts['module'])) {
             $containers[$tag]['module'] = $opts['module'];
         } else {
             trigger_error('No module specified.', E_USER_ERROR);
         }
         $containers[$tag]['name'] = $tag;
     }
     if (isset($containers['main'])) {
         $containers['main']['name'] = 'main_0';
     }
     if (isset($_REQUEST['base_box_pop_main'])) {
         $pop_main = $_REQUEST['base_box_pop_main'];
         unset($_REQUEST['base_box_pop_main']);
     } else {
         $pop_main = false;
     }
     if ($this->isset_module_variable('main')) {
         $mains = $this->get_module_variable('main');
         if ($pop_main) {
             while ($pop_main--) {
                 array_pop($mains);
             }
             $pop_main = true;
         }
         $main = array_pop($mains);
         if (isset($main['module']) && $main['module'] != null) {
             $containers['main'] =& $main;
         }
         foreach ($mains as $k => $m) {
             if (ModuleManager::is_installed($m['module']) >= 0) {
                 $this->freeze_module($m['module'], isset($m['name']) ? $m['name'] : null);
             }
         }
     } else {
         $mains = array();
     }
     if (isset($_REQUEST['box_main_href'])) {
         if (!isset($_SESSION['client']['base_box_hrefs'])) {
             $_SESSION['client']['base_box_hrefs'] = array();
         }
         $hs =& $_SESSION['client']['base_box_hrefs'];
         if (isset($hs[$_REQUEST['box_main_href']])) {
             $rh = $hs[$_REQUEST['box_main_href']];
             $href = $rh['m'];
             $containers['main']['module'] = $href;
             if (isset($rh['f'])) {
                 $containers['main']['function'] = $rh['f'];
             } else {
                 unset($containers['main']['function']);
             }
             if (isset($rh['a'])) {
                 $containers['main']['arguments'] = $rh['a'];
             } else {
                 unset($containers['main']['arguments']);
             }
             if (isset($rh['c'])) {
                 $containers['main']['constructor_arguments'] = $rh['c'];
             } else {
                 unset($containers['main']['constructor_arguments']);
             }
             $mains = array();
             $pop_main = true;
         }
         unset($_REQUEST['box_main_href']);
         $hs = array();
     }
     array_push($mains, $containers['main']);
     $main_length = count($mains);
     $this->set_module_variable('main', $mains);
     //      Epesi::alert(print_r($mains,true));
     //      $containers['main']['name'] .= '_'.$main_length;
     //print_r($containers);
     $this->modules = array();
     foreach ($containers as $k => $v) {
         ob_start();
         if (ModuleManager::is_installed($v['module']) != -1) {
             $module_type = str_replace('/', '_', $v['module']);
             if (!isset($v['name'])) {
                 $v['name'] = null;
             }
             if (isset($href) && $k == 'main') {
                 $this->modules[$k] = $this->init_module($module_type, isset($v['constructor_arguments']) ? $v['constructor_arguments'] : null, $v['name'], true);
             } else {
                 $this->modules[$k] = $this->init_module($module_type, isset($v['constructor_arguments']) ? $v['constructor_arguments'] : null, $v['name']);
             }
             if ($k == 'main' && $pop_main) {
                 $this->modules[$k]->set_reload(true);
             }
             if (isset($v['function'])) {
                 $this->display_module($this->modules[$k], isset($v['arguments']) ? $v['arguments'] : null, $v['function']);
             } elseif (isset($v['arguments'])) {
                 $this->display_module($this->modules[$k], $v['arguments']);
             } else {
                 $this->display_module($this->modules[$k]);
             }
         }
         $theme->assign($k, ob_get_contents());
         ob_end_clean();
     }
     //main output
     $version_no = Base_BoxCommon::update_version_check_indicator();
     if (SUGGEST_DONATION) {
         $theme->assign('donate', Utils_TooltipCommon::create('<a target="_blank" href="http://epe.si/donate/">' . __('Support EPESI!') . '</a>', '<center>' . __('If you find our software useful, please support us by making a %s.', array(__('donation'))) . '<br/>' . __('Your funding will help to ensure continued development of this project.') . '<br/>' . __('Click for details.') . '</center>', false, 500));
     }
     // Consider moving this code properly as initated module by *.ini file
     $theme->assign('home', array('href' => Base_HomePageCommon::get_href(), 'label' => __('Home')));
     $theme->assign('version_no', $version_no);
     $theme->display();
 }
Exemple #6
0
	public function manage_permissions() {
		$this->help('Permissions Editor','permissions');
		$this->init();
        $gb = $this->init_module('Utils/GenericBrowser','permissions_'.$this->tab, 'permissions_'.$this->tab);
		$gb->set_table_columns(array(
				array('name'=>__('Access type'), 'width'=>'100px'),
				array('name'=>__('Clearance required'), 'width'=>'30'),
				array('name'=>__('Applies to records'), 'width'=>'60'),
				array('name'=>__('Fields'), 'width'=>'100px')
		));
		$ret = DB::Execute('SELECT * FROM '.$this->tab.'_access AS acs ORDER BY action DESC');
		
		$tmp = DB::GetAll('SELECT * FROM '.$this->tab.'_access_clearance AS acs');
		$clearance = array();
		foreach ($tmp as $t) $clearance[$t['rule_id']][] = $t['clearance'];
		
		$tmp = DB::GetAll('SELECT * FROM '.$this->tab.'_access_fields AS acs');
		$fields = array();
		foreach ($tmp as $t) $fields[$t['rule_id']][] = $t['block_field'];
		
		$all_clearances = array_flip(Base_AclCommon::get_clearance(true));
		$all_fields = array();
		foreach ($this->table_rows as $v)
			$all_fields[$v['id']] = $v['name'];
		$actions = $this->get_permission_actions();
		$rules = array();
		while ($row = $ret->FetchRow()) {
			if (!isset($clearance[$row['id']])) $clearance[$row['id']] = array();
			if (!isset($fields[$row['id']])) $fields[$row['id']] = array();
			$action = $actions[$row['action']];
			$crits = Utils_RecordBrowserCommon::parse_access_crits($row['crits'], true);
			$crits = Utils_RecordBrowserCommon::crits_to_words($this->tab, $crits, false);
			$crits_text = '';
			foreach ($crits as $c) {
				switch ($c) {
					case 'and': $crits_text .= '<span class="joint">'.__('and').'</span><br>'; break;
					case 'or': $crits_text .= '<span class="joint">'.__('or').'</span> '; break;
					default: $crits_text .= $c.' ';
				}
			}
			foreach ($fields[$row['id']] as $k=>$v)
				if (isset($all_fields[$v]))
					$fields[$row['id']][$k] = $all_fields[$v];
				else
					unset($fields[$row['id']][$k]);
			foreach ($clearance[$row['id']] as $k=>$v)
				if (isset($all_clearances[$v])) $clearance[$row['id']][$k] = $all_clearances[$v];
				else unset($clearance[$row['id']][$k]);
			$c_all_fields = count($all_fields);
			$c_fields = count($fields[$row['id']]);

			$props = $c_all_fields?($c_all_fields-$c_fields)/$c_all_fields:0;
			$color = dechex(255-68*$props).dechex(187+68*$props).'BB';
			$fields_value = ($c_all_fields-$c_fields).' / '.$c_all_fields;
			if ($props!=1) $fields_value = Utils_TooltipCommon::create($fields_value, '<b>'.__('Excluded fields').':</b><hr>'.implode('<br>',$fields[$row['id']]), false);
			$rules[$row['action']][$row['id']] = array(
				$action, 
				'<span class="Utils_RecordBrowser__permissions_crits">'.implode(' <span class="joint">'.__('and').'</span><br>',$clearance[$row['id']]).'</span>', 
				array('value'=>'<span class="Utils_RecordBrowser__permissions_crits">'.$crits_text.'</span>', 'overflow_box'=>false), 
				array('style'=>'background-color:#'.$color, 'value'=>$fields_value)
			);
		}
		foreach ($actions as $a=>$l)
			if (isset($rules[$a]))
				foreach ($rules[$a] as $id=>$vals) {
					$gb_row = $gb->get_new_row();
					$gb_row->add_data_array($vals);
					if (Base_AdminCommon::get_access('Utils_RecordBrowser', 'permissions')==2) {
						$gb_row->add_action($this->create_callback_href(array($this, 'edit_permissions_rule'), array($id)), 'edit', 'Edit');
						$gb_row->add_action($this->create_callback_href(array($this, 'edit_permissions_rule'), array($id, true)), 'copy', __('Clone rule'), Base_ThemeCommon::get_template_file('Utils/Attachment','copy_small.png'));
						$gb_row->add_action($this->create_confirm_callback_href(__('Are you sure you want to delete this rule?'), array($this, 'delete_permissions_rule'), array($id)), 'delete', 'Delete');
				}
		}
		if (Base_AdminCommon::get_access('Utils_RecordBrowser', 'permissions')==2) 
			Base_ActionBarCommon::add('add',__('Add new rule'), $this->create_callback_href(array($this, 'edit_permissions_rule'), array(null)));
		Base_ThemeCommon::load_css('Utils_RecordBrowser', 'edit_permissions');
		$this->display_module($gb);
		eval_js('utils_recordbrowser__crits_initialized = false;');
	}
Exemple #7
0
}
@set_time_limit(0);
$rec = Utils_RecordBrowserCommon::get_record('rc_accounts', $_POST['acc_id']);
if ($rec['epesi_user'] !== Acl::get_user()) {
    die('invalid account id');
}
$port = $rec['security'] == 'ssl' ? 993 : 143;
$server_str = '{' . $rec['server'] . '/imap/readonly/novalidate-cert' . ($rec['security'] ? '/' . $rec['security'] : '') . ':' . $port . '}';
$mailbox = @imap_open(imap_utf7_encode($server_str), imap_utf7_encode($rec['login']), imap_utf7_encode($rec['password']), OP_READONLY || OP_SILENT);
$err = imap_errors();
if (!$mailbox || $err) {
    die(Utils_TooltipCommon::create(__('Connection error'), $err, false));
}
$uns = @imap_search($mailbox, 'UNSEEN ALL');
$unseen = array();
if ($uns) {
    $l = @imap_fetch_overview($mailbox, implode(',', $uns), 0);
    $err = imap_errors();
    if (!$l || $err) {
        die('error reading messages overview');
    }
    foreach ($l as $msg) {
        $from = isset($msg->from) ? $msg->from : '<unknown>';
        $subject = isset($msg->subject) ? $msg->subject : '<no subject>';
        $unseen[] = htmlspecialchars(imap_utf8($from)) . ': <i>' . htmlspecialchars(imap_utf8($subject)) . '</i>';
    }
}
print Utils_TooltipCommon::create(count($unseen), implode('<br />', $unseen));
$err = imap_errors();
print_r('<span style="display:none;">' . $err . '</span>');
imap_close($mailbox);
Exemple #8
0
 public function applet($conf, &$opts)
 {
     $opts['go'] = true;
     $gb = $this->init_module(Utils_GenericBrowser::module_name(), null, 'agendaX');
     $columns = array(array('name' => __('Start'), 'order' => 'e.starts', 'width' => 25, 'wrapmode' => 'nowrap'), array('name' => __('Title'), 'order' => 'e.title', 'width' => 50));
     $gb->set_table_columns($columns);
     $start = date('Y-m-d', time());
     $end = date('Y-m-d', time() + $conf['days'] * 24 * 60 * 60);
     $gb->set_default_order(array(__('Start') => 'ASC'));
     CRM_Calendar_EventCommon::$filter = '(' . CRM_FiltersCommon::get_my_profile() . ')';
     $data = array();
     Base_ThemeCommon::load_css('CRM_Calendar', 'agenda');
     $custom_events = DB::GetAssoc('SELECT id, handler_callback FROM crm_calendar_custom_events_handlers ORDER BY group_name');
     $ret = array();
     if (!empty($custom_events)) {
         $c = 0;
         foreach ($custom_events as $id => $cb) {
             if ($conf['events_handlers__' . $id]) {
                 $cb = explode('::', $cb);
                 if (!is_callable($cb)) {
                     continue;
                 }
                 $add = call_user_func($cb, 'get_all', $start, $end, CRM_Calendar_EventCommon::$filter);
                 foreach ($add as $v) {
                     $ret[str_pad($v['start'], 16, '0', STR_PAD_LEFT) . '__' . $c] = $v;
                     $c++;
                 }
             }
         }
     }
     ksort($ret);
     foreach ($ret as $row) {
         if (isset($row['status']) && $row['status'] == 'closed') {
             continue;
         }
         if (!isset($row['view_action'])) {
             $ex = Utils_CalendarCommon::process_event($row);
             $view_action = '<a ' . $this->create_callback_href(array($this, 'view_event'), $row['id']) . '>';
             $ev_id = explode('_', $row['id'], 2);
             $ev_id = $ev_id[0];
         } else {
             $tmp = Utils_CalendarCommon::process_event($row);
             $ex = $row;
             $ex['start'] = $tmp['start'];
             $view_action = '<a ' . $row['view_action'] . '>';
         }
         //////////////////////////
         // left column
         $date = $ex['start'];
         ///////////////////
         // right column
         $title = Utils_TooltipCommon::create($row['title'], $row['custom_tooltip']);
         $day = isset($row['timeless']) && $row['timeless'] ? $row['timeless'] : Base_RegionalSettingsCommon::time2reg($row['start'], false, true, true, false);
         if ($day < date('Y-m-d')) {
             $class = 'past';
         } elseif ($day == date('Y-m-d')) {
             $class = 'today';
         } elseif ($day == date('Y-m-d', strtotime('+1 day'))) {
             $class = 'tomorrow';
         } else {
             $class = 'other';
         }
         $gb_row = $gb->get_new_row();
         $gb_row->set_attrs('class="CRM_Calendar_applet__' . $class . '"');
         $gb_row->add_data(array('value' => $date, 'order_value' => isset($row['timeless']) && $row['timeless'] ? strtotime($row['timeless']) : $row['start']), array('value' => $view_action . $title . '</a>'));
     }
     $this->display_module($gb, array(false), 'automatic_display');
 }
Exemple #9
0
	public function agenda() {
		$theme = $this->pack_module('Base/Theme');
		Base_ThemeCommon::load_css('Utils_Calendar', 'common');

		/////////////// controls ////////////////////////
		$start = & $this->get_module_variable('agenda_start',date('Y-m-d',$this->date));
		$end = & $this->get_module_variable('agenda_end',date('Y-m-d',$this->date + (7 * 24 * 60 * 60)));

		$form = $this->init_module('Libs/QuickForm',null,'agenda_frm');

		$form->addElement('datepicker', 'start', __('From'));
		$form->addElement('datepicker', 'end', __('To'));
		$form->addElement('submit', 'submit_button', __('Show'));
		$form->addRule('start', 'Field required', 'required');
		$form->addRule('end', 'Field required', 'required');
		$form->setDefaults(array('start'=>$start,'end'=>$end));

		if($form->validate()) {
			$data = $form->exportValues();
			$start = $data['start'];
			$end = $data['end'];
			$end = date('Y-m-d',strtotime($end)+86400);
		}
		$form->assign_theme('form', $theme, new HTML_QuickForm_Renderer_TCMSArraySmarty());

		if (is_callable(array($this->event_module, 'get_navigation_bar_additions'))) {
			$event_module_instance = $this->init_module($this->event_module);
			$navigation_bar_additions = call_user_func(array($event_module_instance,'get_navigation_bar_additions'), '', '');
		}
		$theme->assign('navigation_bar_additions', $navigation_bar_additions);

		//////////////// data ////////////////////////
		$gb = $this->init_module('Utils/GenericBrowser', null, 'agenda');
		$columns = array(
			array('name'=>__('Start'), 'order'=>'start', 'width'=>10),
			array('name'=>__('Duration'), 'order'=>'end', 'width'=>5),
			array('name'=>__('Title'), 'order'=>'title','width'=>10));
		$add_cols = array();
		if(is_array($this->settings['custom_agenda_cols'])) {
			$w = 50/count($this->settings['custom_agenda_cols']);
			foreach($this->settings['custom_agenda_cols'] as $k=>$col) {
				if (!is_array($col)) $col = array('name'=>$col, 'order'=>'cus_col_'.$k,'width'=>$w);
				$columns[] = $col;
				$add_cols[] = $k;
			}
		}
		$gb->set_table_columns( $columns );
		$gb->set_default_order(array(__('Start')=>'ASC'));

		//add data
		$ret = $this->get_events($start,$end);
		$this->displayed_events = array('start'=>$start, 'end'=>$end,'events'=>$ret);
		foreach($ret as $row) {
			$r = $gb->get_new_row();
			if (isset($row['status']) && $row['status']=='closed') continue;
			$view_h = $this->create_callback_href(array($this,'push_event_action'),array('view',$row['id']));
			$edit_h = $this->create_callback_href(array($this,'push_event_action'),array('edit',$row['id']));
			$del_h = $this->create_confirm_callback_href(__('Delete this event?'),array($this,'delete_event'),$row['id']);
			if (isset($row['view_action'])) $view_h = $row['view_action'];
			if (isset($row['edit_action'])) $edit_h = $row['edit_action'];
			if (isset($row['delete_action'])) $del_h = $row['delete_action'];

			$ex = Utils_CalendarCommon::process_event($row);

			$rrr = array(array('value'=>$ex['start'],'order_value'=>$row['start']),Utils_TooltipCommon::create($ex['duration'],$ex['end'],false),'<a '.$view_h.'>'.$row['title'].'</a>');
			foreach($add_cols as $a)
				if (isset($row['custom_agenda_col_'.$a]))
					$rrr[] = $row['custom_agenda_col_'.$a];
				else
					$rrr[] = '';

			$r->add_data_array($rrr);

			if($row['additional_info']!=='' || $row['additional_info2'])
				$r->add_info($row['additional_info'].(($row['additional_info']!=='' && $row['additional_info2']!=='')?'<hr>':'').$row['additional_info2']);

			$r->add_action($del_h,'Delete');
			$r->add_action($edit_h,'Edit');
			$r->add_action($view_h,'View');
		}

		$theme->assign('agenda',$this->get_html_of_module($gb,array(false),'automatic_display'));

		//////////////// display ///////////////
		$theme->display('agenda');
	}
Exemple #10
0
 public function sent_tab($count_f, $get_f, $statuses)
 {
     $t = time();
     $start =& $this->get_module_variable('start', date('Y-m-d', $t - 7 * 24 * 60 * 60));
     $end =& $this->get_module_variable('end', date('Y-m-d', $t));
     $status =& $this->get_module_variable('sent_status', current(array_keys($statuses)));
     $offset =& $this->get_module_variable('sent_offset', 0);
     $form = $this->init_module(Libs_QuickForm::module_name());
     $theme = $this->pack_module(Base_Theme::module_name());
     $form->addElement('select', 'status', __('Status'), $statuses);
     $form->addElement('datepicker', 'start', __('From'));
     $form->addElement('datepicker', 'end', __('To'));
     $form->addElement('submit', 'submit_button', __('Show'));
     $form->addRule('start', 'Field required', 'required');
     $form->addRule('status', 'Field required', 'required');
     $form->addRule('end', 'Field required', 'required');
     $form->setDefaults(array('status' => $status, 'start' => $start, 'end' => $end));
     if ($form->validate()) {
         $data = $form->exportValues();
         $start = $data['start'];
         $end = $data['end'];
         $end = date('Y-m-d', strtotime($end) + 86400);
         if (array_key_exists($data['status'], $statuses)) {
             $status = $data['status'];
         }
         $offset = 0;
     }
     $form->assign_theme('form', $theme);
     $m = $this->init_module(Utils_GenericBrowser::module_name(), null, 'sent');
     $m->set_table_columns(array(array('name' => 'To', 'width' => 30, 'order' => 'toNumber'), array('name' => 'Status', 'width' => 10), array('name' => 'Date', 'width' => 10, 'order' => 'sentDate'), array('name' => 'Pages', 'width' => 10), array('name' => 'Cost', 'width' => 10), array('name' => 'File', 'width' => 30)));
     $m->set_default_order(array('Date' => 'DESC'));
     $count = call_user_func($count_f, $start, $end, $status);
     if ($count === false) {
         $count = 0;
     }
     $limits = $m->get_limit($count);
     $order = $m->get_order();
     if ($count != 0) {
         $data = call_user_func($get_f, $start, $end, $status, $order[0]['order'], $order[0]['direction'], $limits['numrows'], (string) ($limits['offset'] + 1));
     }
     if ($count == 0 || $data === false) {
         $data = array();
     }
     foreach ($data as $row) {
         $from_rec = CRM_ContactsCommon::get_contacts(array('fax' => $row['toNumber']));
         foreach ($from_rec as &$rec) {
             $rec = CRM_ContactsCommon::contact_format_default($rec);
         }
         $from_rec_comp = CRM_ContactsCommon::get_companies(array('fax' => $row['toNumber']));
         foreach ($from_rec_comp as $rec) {
             $from_rec[] = Utils_RecordBrowserCommon::create_linked_label('company', 'Company Name', $rec);
         }
         $m->add_row(empty($from_rec) ? $row['toNumber'] : ' (' . implode(', ', $from_rec) . ')', Utils_TooltipCommon::create($statuses[$row['faxStatus']], $row['faxStatusDetails']), Base_RegionalSettingsCommon::time2reg($row['sentDate']), $row['noPages'], $row['sentCost'], '<a href="' . $row['fileUrl'] . '" target="_blank">' . $row['fileName'] . '</a>');
     }
     $theme->assign('table_data', $this->get_html_of_module($m));
     $theme->display();
 }
Exemple #11
0
 public static function home_maplink($r, $nolink, $desc)
 {
     if (!$nolink) {
         return Utils_TooltipCommon::create('<a ' . self::create_home_map_href($r) . '>' . $r[$desc['id']] . '</a>', __('Click here to search this location using google maps'));
     }
     return $r[$desc['id']];
 }
Exemple #12
0
	public static function search_categories() {
	        return array('files'=>__('Files'),'downloads'=>Utils_TooltipCommon::create(__('Downloads'),__('Paste file download remote URL as "Keyword"')));
	}
Exemple #13
0
 public static function update_version_check_indicator($force = false)
 {
     $version_no = __('version %s', array(EPESI_VERSION));
     if (CHECK_VERSION && Base_EpesiStoreInstall::is_installed()) {
         load_js('modules/Base/Box/check_for_new_version.js');
         if ($force) {
             eval_js('jq("#epesi_new_version").attr("done","0");');
         }
         eval_js('check_for_new_version();');
         $version_no = '<span id="epesi_new_version">' . Utils_TooltipCommon::create($version_no, __('Checking if there are updates available...'), false) . '</span>';
         if (isset($_REQUEST['go_to_epesi_store_for_updates'])) {
             Base_BoxCommon::push_module('Base_EpesiStore', 'admin');
             return;
         }
     }
     return $version_no;
 }
Exemple #14
0
 public static function display_subject($record, $nolink, $desc)
 {
     /*    static $last_message_id = null;*/
     if (isset($record['body'])) {
         $chars_count = 100;
         $body_preview = strip_tags($record['body']);
         if (strlen($body_preview) > $chars_count) {
             $body_preview = substr($body_preview, 0, $chars_count) . " ...";
         }
         $subject_label = Utils_RecordBrowserCommon::create_linked_label_r('rc_mails', 'subject', $record, $nolink);
         $subject_label = Utils_TooltipCommon::create($subject_label, "<pre class=\"wrap\">{$body_preview}</pre>", false);
         $ret = $subject_label . '<br />From: ' . $record['from'] . '<br />To: ' . $record['to'] . '<br />';
     } else {
         $ret = Utils_RecordBrowserCommon::create_linked_label_r('rc_mail_threads', 'subject', $record, $nolink);
     }
     /*        $replies = '<div style="text-align:center;float:right;width:20px;font-size:16px;line-height:20px;padding:8px;border-radius:18px;height:20px;background-color:gray;color:white;" class="num_of_replies"></div>';
             if(!$record['references'] || !$last_message_id || strpos($record['references'],$last_message_id)===false) {
                 $last_message_id = $record['message_id'];
                 return $replies.$ret;
             }
             if(!$last_message_id) return $replies.$ret;
             return '<div style="margin-left:20px" class="reply parent_'.md5($last_message_id).'">'.$ret.'</div>';*/
     return $ret;
 }
Exemple #15
0
 public function body()
 {
     if (!Base_AclCommon::check_permission('View Activity Report')) {
         return;
     }
     $rb_tabs = DB::GetAssoc('SELECT tab, caption FROM recordbrowser_table_properties ORDER BY caption');
     foreach ($rb_tabs as $k => $v) {
         $rb_tabs[$k] = Utils_RecordBrowserCommon::get_caption($k);
     }
     $form = $this->init_module('Libs/QuickForm');
     $users_count = DB::GetOne('SELECT COUNT(id) FROM user_login') > Base_User_SettingsCommon::get('Utils_RecordBrowser', 'enable_autocomplete');
     if ($users_count) {
         $crits = array('!login' => '');
         $fcallback = array('CRM_ContactsCommon', 'contact_format_no_company');
         $form->addElement('autoselect', 'user', __('User'), array(), array(array('CRM_ContactsCommon', 'autoselect_contact_suggestbox'), array($crits, $fcallback)), $fcallback);
     } else {
         $users = DB::GetAssoc('SELECT id, id FROM user_login');
         foreach ($users as $k => $u) {
             $users[$k] = Base_UserCommon::get_user_label($u, true);
         }
         asort($users);
         $users = array('' => '[' . __('All') . ']') + $users;
         $form->addElement('select', 'user', __('User'), $users);
     }
     $form->addElement('multiselect', 'recordsets', __('Record Type'), $rb_tabs);
     $form->addElement('checkbox', 'new', __('New record'));
     $form->addElement('checkbox', 'edit', __('Record edit'));
     $form->addElement('checkbox', 'delete_restore', __('Record Delete/restore'));
     $form->addElement('checkbox', 'file', __('Files'));
     $form->addElement('datepicker', 'start_date', __('Start Date'));
     $form->addElement('datepicker', 'end_date', __('End Date'));
     //$form->addElement('submit', 'submit', __('Show'));
     Base_ActionBarCommon::add('search', __('Show'), $form->get_submit_form_href());
     $filters = $this->get_module_variable('filters', array('user' => '', 'new' => 1, 'edit' => 1, 'delete_restore' => 1, 'recordsets' => array_keys($rb_tabs), 'start_date' => date('Y-m-01'), 'end_date' => date('Y-m-d')));
     if ($form->validate()) {
         $filters = $form->exportValues();
         $this->set_module_variable('filters', $filters);
     }
     $form->setDefaults($filters);
     $theme = $this->init_module('Base/Theme');
     $form->assign_theme('form', $theme);
     $theme->display();
     $filters['recordsets'] = array_flip($filters['recordsets']);
     foreach ($rb_tabs as $k => $v) {
         if (!isset($filters['recordsets'][$k])) {
             unset($rb_tabs[$k]);
         }
     }
     $gb = $this->init_module('Utils/GenericBrowser', null, 'activity_report');
     $gb->set_table_columns(array(array('name' => __('Date'), 'width' => 40), array('name' => __('User'), 'width' => 40), array('name' => __('Type'), 'width' => 40), array('name' => __('Label')), array('name' => __('Actions taken'), 'width' => 40)));
     $tables = array();
     if ($users_count) {
         $filters['user'] = CRM_ContactsCommon::get_contact($filters['user']);
         $filters['user'] = $filters['user']['login'];
     }
     $af_where = array();
     foreach ($rb_tabs as $k => $t) {
         $af_where[] = 'ual.local ' . DB::like() . ' ' . DB::Concat(DB::qstr($k . '/'), DB::qstr('%'));
     }
     $af_where = count($af_where) ? ' (' . implode(' OR ', $af_where) . ')' : 'TRUE ';
     $e_where = array();
     $c_where = '';
     if ($filters['user']) {
         $e_where[] = ' edited_by = ' . $filters['user'];
         $c_where = ' created_by = ' . $filters['user'];
         $af_where .= ' AND uaf.created_by = ' . $filters['user'];
     }
     if (isset($filters['edit'])) {
         if (!isset($filters['delete_restore'])) {
             $e_where[] = ' ehd.field!=' . DB::qstr('id');
         }
     } else {
         if (isset($filters['delete_restore'])) {
             $e_where[] = ' ehd.field=' . DB::qstr('id');
         }
     }
     if ($filters['start_date']) {
         $date = DB::qstr(date('Y-m-d', strtotime($filters['start_date'])));
         $af_where .= ' AND uaf.created_on >= ' . $date;
         $c_where .= ($c_where ? ' AND' : '') . ' created_on >= ' . $date;
         $e_where[] = ' edited_on >= ' . $date;
     }
     if ($filters['end_date']) {
         $date = DB::qstr(date('Y-m-d 23:59:59', strtotime($filters['end_date'])));
         $af_where .= ' AND uaf.created_on <= ' . $date;
         $c_where .= ($c_where ? ' AND' : '') . ' created_on <= ' . $date;
         $e_where[] = ' edited_on <= ' . $date;
     }
     if (!empty($e_where)) {
         $e_where = ' WHERE' . implode(' AND', $e_where);
     } else {
         $e_where = '';
     }
     if ($c_where) {
         $c_where = ' WHERE' . $c_where;
     }
     $postgre_cast_type = DB::is_postgresql() ? '::varchar' : '';
     // **** files ****
     if (isset($filters['file'])) {
         $tables[] = 'SELECT uaf.id AS id,uaf.created_on AS edited_on,uaf.created_by AS edited_by, ual.local AS r_id, ' . DB::qstr('') . ' AS tab, ' . DB::qstr('file') . ' AS action FROM utils_attachment_file uaf INNER JOIN utils_attachment_data_1 ua ON uaf.attach_id=ua.id INNER JOIN utils_attachment_local ual ON ua.id=ual.attachment WHERE original!=' . DB::qstr('') . ' AND ' . $af_where;
     }
     // **** edit ****
     if (isset($filters['edit']) || isset($filters['delete_restore'])) {
         foreach ($rb_tabs as $k => $t) {
             $tables[] = 'SELECT id, edited_on, edited_by, ' . $k . '_id' . $postgre_cast_type . ' as r_id, ' . DB::qstr($k) . ' as tab, ' . DB::qstr('edit') . ' as action FROM ' . $k . '_edit_history eh LEFT JOIN ' . $k . '_edit_history_data ehd ON ehd.edit_id=eh.id' . $e_where;
         }
     }
     // **** create ****
     if (isset($filters['new'])) {
         foreach ($rb_tabs as $k => $t) {
             $tables[] = 'SELECT 0 AS id, created_on AS edited_on, created_by AS edited_by, id' . $postgre_cast_type . ' as r_id, ' . DB::qstr($k) . ' as tab, ' . DB::qstr('create') . ' as action FROM ' . $k . '_data_1' . $c_where;
         }
     }
     if (!empty($tables)) {
         $tables = implode(' UNION ', $tables);
         $limit = DB::GetOne('SELECT COUNT(*) FROM (' . $tables . ') AS tmp');
         $limit = $gb->get_limit($limit);
         $ret = DB::SelectLimit('SELECT * FROM (' . $tables . ') AS tmp ORDER BY edited_on DESC', $limit['numrows'], $limit['offset']);
         while ($row = $ret->FetchRow()) {
             $user = Base_UserCommon::get_user_label($row['edited_by']);
             $action = '';
             $link = '';
             switch ($row['action']) {
                 case 'edit':
                     $details = DB::GetAssoc('SELECT field, old_value FROM ' . $row['tab'] . '_edit_history_data WHERE edit_id=%d', array($row['id']));
                     if (isset($details['id'])) {
                         $action = $details['id'] == 'DELETED' ? __('Deleted') : __('Restored');
                     } else {
                         $action = __('Edited');
                         $action = '<a ' . Utils_TooltipCommon::tooltip_leightbox_mode() . ' ' . Utils_TooltipCommon::ajax_open_tag_attrs(array('Utils_RecordBrowserCommon', 'get_edit_details_label'), array($row['tab'], $row['r_id'], $row['id']), 500) . '>' . $action . '</a>';
                     }
                     $r_id = $row['r_id'];
                     break;
                 case 'create':
                     $action = __('Created');
                     $r_id = $row['r_id'];
                     break;
                 case 'file':
                     $action = __('Attachment') . ': ';
                     $action .= $row['id'] == 0 ? __('New') : __('Updated');
                     $id = explode('/', $row['r_id']);
                     $row['tab'] = $id[0];
                     $r_id = $id[1];
                     break;
                 case 'note':
                     $action = __('Note') . ': ';
                     $action .= $row['id'] == 0 ? __('New') : __('Updated');
                     $id = explode('/', $row['r_id']);
                     $row['tab'] = $id[0];
                     $r_id = $id[1];
                     break;
             }
             if (!Utils_RecordBrowserCommon::get_access($row['tab'], 'view', Utils_RecordBrowserCommon::get_record($row['tab'], $r_id))) {
                 $link = __('Access restricted');
                 $action = strip_tags($action);
             } else {
                 $link = Utils_TooltipCommon::create('<img src="' . Base_ThemeCommon::get_template_file('Utils_RecordBrowser', 'info.png') . '">', Utils_RecordBrowserCommon::get_html_record_info($row['tab'], $r_id), false);
                 $link .= '&nbsp;';
                 $link .= Utils_RecordBrowserCommon::create_default_linked_label($row['tab'], $r_id, false, false);
             }
             $gb->add_row(Base_RegionalSettingsCommon::time2reg($row['edited_on']), $user, $rb_tabs[$row['tab']], $link, $action);
         }
     }
     Base_ThemeCommon::load_css('Utils_RecordBrowser', 'changes_list');
     $this->display_module($gb);
 }
 * @subpackage tooltip
 */
if (!isset($_POST['cid'])) {
    die('Invalid request' . print_r($_POST, true));
}
define('JS_OUTPUT', 1);
define('CID', $_POST['cid']);
define('READ_ONLY_SESSION', 1);
require_once '../../../include.php';
ModuleManager::load_modules();
$registered = Base_EssClientCommon::is_registered();
$ver = __('version %s', array(EPESI_VERSION));
if (!$registered) {
    print $ver;
    return;
}
$updates = Base_EpesiStoreCommon::is_update_available();
if (!$updates) {
    print $ver;
    return;
}
if (Base_AclCommon::i_am_sa()) {
    $tooltip = __('There are updates available for download, click to go to EPESI store.');
} else {
    $tooltip = __('There are updates available for download. Please contact your administrator.');
}
$message = Utils_TooltipCommon::create(__('version %s', array(EPESI_VERSION)) . '<br/><b>(' . __('Updates Available!') . ')</b>', $tooltip, false);
if (Base_AclCommon::i_am_sa()) {
    $message = '<a ' . Module::create_href(array('go_to_epesi_store_for_updates' => true)) . 'class="version">' . $message . '</a>';
}
print $message;