source: trunk/home.php @ 2623

Revision 2623, 5.1 KB checked in by rodsouza, 14 years ago (diff)

Ticket #1009 - Organizando o HTML do template default.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * eGroupWare                                                               *
4        * http://www.egroupware.org                                                *
5        * The file written by Joseph Engo <jengo@phpgroupware.org>                 *
6        * This file modified by Greg Haygood <shrykedude@bellsouth.net>            *
7        * --------------------------------------------                             *
8        *  This program is free software; you can redistribute it and/or modify it *
9        *  under the terms of the GNU General Public License as published by the   *
10        *  Free Software Foundation; either version 2 of the License, or (at your  *
11        *  option) any later version.                                              *
12        \**************************************************************************/
13        $phpgw_info = array();
14        if (!is_file('header.inc.php'))
15        {
16                Header('Location: setup/index.php');
17                exit;
18        }
19
20        $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid'];
21        if (!isset($GLOBALS['sessionid']) || !$GLOBALS['sessionid'])
22        {
23                Header('Location: login.php?cd=10');
24                exit;
25        }
26
27        $GLOBALS['phpgw_info']['flags'] = array(
28                'currentapp'              => 'home',
29                //'noheader'                => ( ( array_key_exists( 'HTTP_BACKGROUNDREQUEST', $_SERVER ) ) ? true : false ),
30                //'nonavbar'                => ( ( array_key_exists( 'HTTP_BACKGROUNDREQUEST', $_SERVER ) ) ? true : false ),
31                'enable_network_class'    => True,
32                'enable_contacts_class'   => True,
33                'enable_nextmatchs_class' => True
34        );
35
36        include('header.inc.php');
37        $GLOBALS['phpgw_info']['flags']['app_header']=lang('home');
38
39        // Commented by alpeb: The following prevented anonymous users to get a home page. Perhaps it was done with anonymous users such as the ones
40        // used by  wiki and sitemgr in mind. However, if you mark a normal user as anonymous just to avoid being shown in sessions and access log (like you would for an admin that doesn't want to be noticed), the user won't be able to login anymore. That's why I commented the code.
41        /*if ($GLOBALS['phpgw']->session->session_flags == 'A')
42        {
43                if ($_SERVER['HTTP_REFERER'] && strstr($_SERVER['HTTP_REFERER'],'home.php') === False)
44                {
45                        $GLOBALS['phpgw']->redirect($_SERVER['HTTP_REFERER']);
46                }
47                else
48                {
49                        // redirect to the login-page, better then giving an empty page
50                        $GLOBALS['phpgw']->redirect('login.php');
51                }
52                exit;
53        }*/
54
55        if ($GLOBALS['phpgw_info']['server']['force_default_app'] && $GLOBALS['phpgw_info']['server']['force_default_app'] != 'user_choice')
56        {
57                $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] = $GLOBALS['phpgw_info']['server']['force_default_app'];
58        }
59
60        if ($_GET['cd']=='yes' && $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] &&
61                $GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['user']['preferences']['common']['default_app']])
62        {
63                $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/' . $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] . '/' . 'index.php'));
64        }
65        // Default Applications (Home Page)
66        $default_apps = Array(                 
67                        'workflow',                     
68                        'expressoMail1_2',
69                        'calendar',
70                        'news_admin'
71                );
72        $sorted_apps = array();
73        $user_apps = $GLOBALS['phpgw_info']['user']['apps'];
74        @reset($user_apps);     
75        for($i = 0; $i < count($default_apps);$i++) {
76                if(array_key_exists($default_apps[$i], $user_apps)){
77                        $sorted_apps[] = $default_apps[$i];
78                }               
79        }
80       
81        foreach($GLOBALS['phpgw_info']['user']['apps'] as $i => $p) {
82                $sorted_apps[] = $p['name'];
83        }
84       
85        $portal_oldvarnames = array('mainscreen_showevents', 'homeShowEvents','homeShowLatest','mainscreen_showmail','mainscreen_showbirthdays','mainscreen_show_new_updated');
86        $done = array();
87        // Display elements, within appropriate table cells     
88        @reset($sorted_apps);
89        $idx = 1;
90        echo "<table width='100%' cellpadding=5>";
91        foreach($sorted_apps as $appname)
92        {
93                if((int)$done[$appname] == 1 || empty($appname)){
94                        continue;
95                }               
96                $varnames = $portal_oldvarnames;
97                $varnames[] = 'homepage_display';
98                $thisd = 0;
99                $tmp = '';
100               
101                foreach($varnames as $varcheck)
102                {
103                                                                       
104                        /*if($appname == 'expressoMail1_2') {
105                                $tmp = $appname;
106                                $appname = 'expressoMail';
107                        }*/                             
108
109                        if(array_search($appname, $default_apps) !== False){
110                                $thisd = 1;
111                                break;
112                        }
113                        if($GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck]=='True') {
114                                $thisd = 1;
115                                break;
116                        }
117                        else  {
118                                $_thisd = (int)$GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck];
119                                if($_thisd > 0) {
120                                        $thisd = $_thisd;
121                                        break;
122                                }
123                        }
124                }
125
126                if($thisd > 0)
127                {
128                        if($tmp) {
129                $appname = $tmp;
130                                $tmp = '';
131                        }
132                        if($idx == 0) {                         
133                                print '<tr>';
134                        }
135                        print '<td style="vertical-align:top;" width="45%">';
136                        $GLOBALS['phpgw']->hooks->single('home',$appname);                     
137                        print '</td>';
138                       
139                        if($idx == 2){
140                                $idx = 0;
141                                print '</tr>';
142                        }                       
143                        $idx++;
144                        $neworder[] = $appname;
145                }
146                $done[$appname] = 1;
147        }
148        print '</table>';
149        $GLOBALS[ 'phpgw' ] -> common -> phpgw_footer( );
150        $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'currentapp' ] = 'home';
151?>
Note: See TracBrowser for help on using the repository browser.