Example #1
0
 public static function print_event($ev, $mode = '', $with_div = true)
 {
     $th = Base_ThemeCommon::init_smarty();
     $ex = self::process_event($ev);
     $th->assign('event_id', $ev['id']);
     $th->assign('draggable', !isset($ev['draggable']) || $ev['draggable'] === true);
     $title = $ev['title'];
     $title_st = strip_tags($ev['title']);
     $title_s = $title;
     $th->assign('with_div', $with_div);
     $th->assign('title', $title);
     $th->assign('title_s', $title_s);
     $th->assign('description', $ev['description']);
     $th->assign('color', $ev['color']);
     $th->assign('start', $ex['start']);
     $th->assign('start_time', $ex['start_time']);
     $th->assign('end_time', $ex['end_time']);
     $th->assign('start_date', $ex['start_date']);
     $th->assign('end_date', $ex['end_date']);
     $th->assign('start_day', $ex['start_day']);
     $th->assign('end_day', $ex['end_day']);
     $th->assign('end', $ex['end']);
     $th->assign('duration', $ex['duration']);
     $th->assign('show_hide_info', __('Click to show / hide menu'));
     $th->assign('additional_info', $ev['additional_info']);
     $th->assign('additional_info2', $ev['additional_info2']);
     if (isset($ev['custom_tooltip'])) {
         $th->assign('custom_tooltip', $ev['custom_tooltip']);
     }
     ob_start();
     Base_ThemeCommon::display_smarty($th, 'Utils_Calendar', 'event_tip');
     $tip = ob_get_clean();
     $th->assign('tip_tag_attrs', Utils_TooltipCommon::open_tag_attrs($tip, false));
     if (!isset($ev['view_action']) || $ev['view_action'] === true) {
         $th->assign('view_href', Module::create_href(array('UCev_id' => $ev['id'], 'UCaction' => 'view')));
     } elseif ($ev['view_action'] !== false) {
         $th->assign('view_href', $ev['view_action']);
     }
     if (!isset($ev['edit_action']) || $ev['edit_action'] === true) {
         $th->assign('edit_href', Module::create_href(array('UCev_id' => $ev['id'], 'UCaction' => 'edit')));
     } elseif ($ev['edit_action'] !== false) {
         $th->assign('edit_href', $ev['edit_action']);
     }
     $link_text = Module::create_href_js(array('UCev_id' => $ev['id'], 'UCaction' => 'move', 'UCdate' => '__YEAR__-__MONTH__-__DAY__'));
     if (!isset($ev['move_action']) || $ev['move_action'] === true) {
         $th->assign('move_href', Utils_PopupCalendarCommon::create_href('move_event' . str_replace(array('#', '-'), '_', $ev['id']), $link_text, null, null, 'popup.clonePosition(\'utils_calendar_event:' . $ev['id'] . '\',{setWidth:false,setHeight:false,offsetTop:$(\'utils_calendar_event:' . $ev['id'] . '\').getHeight()})'));
     }
     if (!isset($ev['delete_action']) || $ev['delete_action'] === true) {
         $th->assign('delete_href', Module::create_confirm_href(__('Delete this event?'), array('UCev_id' => $ev['id'], 'UCaction' => 'delete')));
     } elseif ($ev['delete_action'] !== false) {
         $th->assign('delete_href', $ev['delete_action']);
     }
     $th->assign('handle_class', 'handle');
     $th->assign('custom_actions', $ev['actions']);
     Base_ThemeCommon::display_smarty($th, 'Utils_Calendar', 'event' . ($mode ? '_' . $mode : ''));
 }
Example #2
0
 public static function create_new_record_href($tab, $def, $id = 'none', $check_defaults = true, $multiple_defaults = false)
 {
     if ($multiple_defaults) {
         static $done = false;
         if ($done) {
             return Libs_LeightboxCommon::get_open_href('actionbar_rb_new_record');
         }
         eval_js_once('actionbar_rb_new_record_deactivate = function(){leightbox_deactivate(\'actionbar_rb_new_record\');}');
         $th = Base_ThemeCommon::init_smarty();
         $cds = array();
         foreach ($def as $k => $v) {
             $cds[] = array('label' => _V($k), 'open' => '<a OnClick="actionbar_rb_new_record_deactivate();' . Module::create_href_js(self::get_new_record_href($tab, $v['defaults'], $id, $check_defaults)) . '">', 'icon' => $v['icon'], 'close' => '</a>');
         }
         $th->assign('custom_defaults', $cds);
         ob_start();
         Base_ThemeCommon::display_smarty($th, 'Utils_RecordBrowser', 'new_record_leightbox');
         $panel = ob_get_clean();
         Libs_LeightboxCommon::display('actionbar_rb_new_record', $panel, __('New record'));
         $done = true;
         return Libs_LeightboxCommon::get_open_href('actionbar_rb_new_record');
     } else {
         return Module::create_href(self::get_new_record_href($tab, $def, $id, $check_defaults));
     }
 }
Example #3
0
 public static function homepage_icon()
 {
     Utils_ShortcutCommon::add(array('Ctrl', 'H'), 'function(){' . Module::create_href_js(array('Base_HomePage_load' => '1')) . '}');
 }
Example #4
0
	public function get_jump_to_id_button() {
        $jump_to_id = DB::GetOne('SELECT jump_to_id FROM recordbrowser_table_properties WHERE tab=%s', array($this->tab));
        if (!$jump_to_id) {
            return '';
        }
		$link = Module::create_href_js(Utils_RecordBrowserCommon::get_record_href_array($this->tab, '__ID__'));
		if (isset($_REQUEST['__jump_to_RB_record'])) Base_StatusBarCommon::message(__('Record not found'), 'warning');
		$link = str_replace('__ID__', '\'+this.value+\'', $link);
		return ' <a '.Utils_TooltipCommon::open_tag_attrs(__('Jump to record by ID')).' href="javascript:void(0);" onclick="jump_to_record_id(\''.$this->tab.'\')"><img border="0" src="'.Base_ThemeCommon::get_template_file('Utils_RecordBrowser','jump_to.png').'"></a><input type="text" id="jump_to_record_input" style="display:none;width:50px;" onkeypress="if(event.keyCode==13)'.$link.'">';
	}
Example #5
0
    public static function get_file_leightbox($row, & $view_link = '') {
        static $th;
        if(!isset($th)) $th = Base_ThemeCommon::init_smarty();

        if($row['original']==='') return '';

        $links = array();

        $lid = 'get_file_'.md5(serialize($row));
        if(isset($_GET['save_google_docs']) && $_GET['save_google_docs']==$lid) {
            self::save_google_docs($row['id']);
        }
        if(isset($_GET['discard_google_docs']) && $_GET['discard_google_docs']==$lid) {
            self::discard_google_docs($row['id']);
        }

        $close_leightbox_js = 'leightbox_deactivate(\''.$lid.'\');';
        if (Variable::get('utils_attachments_google_user',false) && preg_match('/\.(xlsx?|docx?|txt|odt|ods|csv)$/i',$row['original'])) {
            $label = __('Open with Google Docs');
            $label = explode(' ', $label);
            $mid = floor(count($label) / 2);
            $label = implode('&nbsp;', array_slice($label, 0, $mid)).' '.implode('&nbsp;', array_slice($label, $mid));
            $script = 'get_google_docs';
            $onclick = '$(\'attachment_save_options_'.$row['id'].'\').style.display=\'\';$(\'attachment_download_options_'.$row['id'].'\').hide();';
            $th->assign('save_options_id','attachment_save_options_'.$row['id']);
            $links['save'] = '<a href="javascript:void(0);" onclick="'.$close_leightbox_js.Module::create_href_js(array('save_google_docs'=>$lid)).'">'.__('Save Changes').'</a><br>';
            $links['discard'] ='<a href="javascript:void(0);" onclick="'.$close_leightbox_js.Module::create_href_js(array('discard_google_docs'=>$lid)).'">'.__('Discard Changes').'</a><br>';
        } else {
            $label = __('View');
            $th->assign('save_options_id','');
            $script = 'get';
            $onclick = $close_leightbox_js;
        }
        $th->assign('download_options_id','attachment_download_options_'.$row['id']);

        $view_link = 'modules/Utils/Attachment/'.$script.'.php?'.http_build_query(array('id'=>$row['id'],'cid'=>CID,'view'=>1));
        $links['view'] = '<a href="'.$view_link.'" target="_blank" onClick="'.$onclick.'">'.$label.'</a><br>';
        $links['download'] = '<a href="modules/Utils/Attachment/get.php?'.http_build_query(array('id'=>$row['id'],'cid'=>CID)).'" onClick="leightbox_deactivate(\''.$lid.'\')">'.__('Download').'</a><br>';

        load_js('modules/Utils/Attachment/remote.js');
        if(!$row['crypted']) {
            $links['link'] = '<a href="javascript:void(0)" onClick="utils_attachment_get_link('.$row['id'].', '.CID.',\'get link\');leightbox_deactivate(\''.$lid.'\')">'.__('Get link').'</a><br>';
        }
        $th->assign('filename',$row['original']);
        $f_filename = DATA_DIR.'/Utils_Attachment/'.$row['aid'].'/'.$row['id'];
        if(!file_exists($f_filename)) return 'missing file: '.$f_filename;
        $th->assign('file_size',__('File size: %s',array(filesize_hr($f_filename))));

        $th->assign('labels',array(
            'filename'=>__('Filename'),
            'file_size'=>__('File size')
        ));

        foreach($links as $key=>&$l) {
            $th->assign($key,$l);
            $l = Base_ThemeCommon::parse_links($key, $l);
        }
        $th->assign('__link',$links);

        $custom_getters = array();
        if(!$row['crypted']) {
            $getters = ModuleManager::call_common_methods('attachment_getters');
            foreach($getters as $mod=>$arr) {
                if (is_array($arr))
                    foreach($arr as $caption=>$func) {
                        $cus_id = md5($mod.$caption.serialize($func));
                        if(isset($_GET['utils_attachment_custom_getter']) && $_GET['utils_attachment_custom_getter']==$cus_id)
                            call_user_func_array(array($mod.'Common',$func['func']),array($f_filename,$row['original'],$row['id']));
                        $custom_getters[] = array('open'=>'<a href="javascript:void(0)" onClick="'.Epesi::escapeJS(Module::create_href_js(array('utils_attachment_custom_getter'=>$cus_id)),true,false).';leightbox_deactivate(\''.$lid.'\')">','close'=>'</a>','text'=>$caption,'icon'=>$func['icon']);
                    }
            }
        }
        $th->assign('custom_getters',$custom_getters);

        ob_start();
        Base_ThemeCommon::display_smarty($th,'Utils_Attachment','download');
        $c = ob_get_clean();

        Libs_LeightboxCommon::display($lid,$c,__('Attachment'));
        return Libs_LeightboxCommon::get_open_href($lid);
    }
Example #6
0
 public static function create_href_js($parent_module, $module, $function = null, array $arguments = null, array $constructor_args = null, array $other_href_args = array())
 {
     return Module::create_href_js(array_merge($other_href_args, Base_BoxCommon::create_href_array($parent_module, $module, $function, $arguments, $constructor_args)));
 }
Example #7
0
 public static function get_file_leightbox($row, &$view_link = '')
 {
     static $th;
     if (!isset($th)) {
         $th = Base_ThemeCommon::init_smarty();
     }
     if ($row['original'] === '') {
         return '';
     }
     $links = array();
     $lid = 'get_file_' . md5(serialize($row));
     $close_leightbox_js = 'leightbox_deactivate(\'' . $lid . '\');';
     $label = __('View');
     $th->assign('save_options_id', '');
     $script = 'get';
     $onclick = $close_leightbox_js;
     $th->assign('download_options_id', 'attachment_download_options_' . $row['id']);
     $view_link = 'modules/Utils/Attachment/' . $script . '.php?' . http_build_query(array('id' => $row['id'], 'cid' => CID, 'view' => 1));
     $links['view'] = '<a href="' . $view_link . '" target="_blank" onClick="' . $onclick . '">' . $label . '</a><br>';
     $links['download'] = '<a href="modules/Utils/Attachment/get.php?' . http_build_query(array('id' => $row['id'], 'cid' => CID)) . '" onClick="leightbox_deactivate(\'' . $lid . '\')">' . __('Download') . '</a><br>';
     load_js('modules/Utils/Attachment/remote.js');
     if (!$row['crypted']) {
         $links['link'] = '<a href="javascript:void(0)" onClick="utils_attachment_get_link(' . $row['id'] . ', ' . CID . ',\'get link\');leightbox_deactivate(\'' . $lid . '\')">' . __('Get link') . '</a><br>';
     }
     $th->assign('filename', $row['original']);
     $meta = Utils_FileStorageCommon::meta($row['filestorage_id']);
     $f_filename = $meta['file'];
     if (!file_exists($f_filename)) {
         return 'missing file: ' . $f_filename;
     }
     $th->assign('file_size', __('File size: %s', array(filesize_hr($f_filename))));
     $th->assign('labels', array('filename' => __('Filename'), 'file_size' => __('File size')));
     foreach ($links as $key => &$l) {
         $th->assign($key, $l);
         $l = Base_ThemeCommon::parse_links($key, $l);
     }
     $th->assign('__link', $links);
     $custom_getters = array();
     if (!$row['crypted']) {
         $getters = ModuleManager::call_common_methods('attachment_getters');
         foreach ($getters as $mod => $arr) {
             if (is_array($arr)) {
                 foreach ($arr as $caption => $func) {
                     $cus_id = md5($mod . $caption . serialize($func));
                     if (isset($_GET['utils_attachment_custom_getter']) && $_GET['utils_attachment_custom_getter'] == $cus_id) {
                         call_user_func_array(array($mod . 'Common', $func['func']), array($f_filename, $row['original'], $row['id']));
                     }
                     $custom_getters[] = array('open' => '<a href="javascript:void(0)" onClick="' . Epesi::escapeJS(Module::create_href_js(array('utils_attachment_custom_getter' => $cus_id)), true, false) . ';leightbox_deactivate(\'' . $lid . '\')">', 'close' => '</a>', 'text' => $caption, 'icon' => $func['icon']);
                 }
             }
         }
     }
     $th->assign('custom_getters', $custom_getters);
     ob_start();
     Base_ThemeCommon::display_smarty($th, 'Utils_Attachment', 'download');
     $c = ob_get_clean();
     Libs_LeightboxCommon::display($lid, $c, __('Attachment'));
     return Libs_LeightboxCommon::get_open_href($lid);
 }