Show
Ignore:
Timestamp:
09/10/05 20:05:18 (8 years ago)
Author:
benoitg
Message:

2005-09-10 Benoit Gr�goire <bock@…>

  • Add UI to add a new Network
  • Improve UI to add a new Node and new Content
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/wifidog/classes/MainUI.php

    r736 r742  
    2525 */ 
    2626require_once BASEPATH.'include/common.php'; 
    27         /** @note We put a call to validate_schema() here so it systematically called 
    28  * from any UI page, but not from any machine readable pages  
    29  */  
    30                 require_once BASEPATH.'include/schema_validate.php'; 
    31                 validate_schema(); 
    32                  
     27/** @note We put a call to validate_schema() here so it systematically called 
     28* from any UI page, but not from any machine readable pages  
     29*/ 
     30require_once BASEPATH.'include/schema_validate.php'; 
     31validate_schema(); 
     32 
    3333if (CONF_USE_CRON_FOR_DB_CLEANUP == false) 
    3434{ 
     
    5555                $this->title = Network :: getCurrentNetwork()->getName().' '._("authentication server"); //Default title 
    5656        } 
    57          
     57 
    5858        /** Check if the tool section is enabled 
    5959         *  
     
    6363                return $this->tool_section_enabled; 
    6464        } 
    65          
     65 
    6666        public function setToolSectionEnabled($status) 
    6767        { 
     
    103103                                $html = ''; 
    104104 
    105                 if ($current_user && $current_user->isNobody()) 
    106                 { 
    107                     $html .= _("You do not have permissions to access any administration functions."); 
    108                 } else { 
    109  
    110                     $html .= "<ul class='admin_menu_list'>\n"; 
    111  
    112                     if ($current_user && $current_user->isSuperAdmin()) 
    113                     { 
    114                         $html .= "<li><a href='user_log.php'>"._("User logs")."</a></li>\n"; 
    115                         $html .= "<li><a href='online_users.php'>"._("Online Users")."</a></li>\n"; 
    116                         $html .= "<li><a href='stats.php'>"._("Statistics")."</a></li>\n"; 
    117                         $html .= "<li><a href='import_user_database.php'>"._("Import NoCat user database")."</a></li>\n"; 
    118                         $html .= "<li><a href='content_admin.php'>"._("Content manager")."</a></li>\n"; 
    119                     } 
    120  
    121                     $html .= "</ul>\n"; 
    122  
    123                     // If the user is super admin OR owner of at least one hotspot show the menu 
    124                     if ($current_user && ($current_user->isSuperAdmin() || $current_user->isOwner())) 
    125                     { 
    126                         /* Node admin */ 
    127                         $html .= "<div class='admin_section_container'>\n"; 
    128                         $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
    129                         $html .= "<div class='admin_section_title'>"._("Node administration:")." </div>\n"; 
    130  
    131                         $html .= "<div class='admin_section_data'>\n"; 
    132  
    133                         if ($current_user->isSuperAdmin()) 
    134                             $sql_additional_where = ''; 
    135                         else 
    136                             $sql_additional_where = "AND node_id IN (SELECT node_id from node_stakeholders WHERE is_owner = true AND user_id='".$current_user->getId()."')"; 
    137                         $html .= "<div id='NodeSelector'>\n"; 
    138                         $html .= Node :: getSelectNodeUI('object_id', $sql_additional_where); 
    139                         $html .= "</div>\n"; 
    140                         $html .= "</div>\n"; 
    141                         $html .= "<div class='admin_section_tools'>\n"; 
    142  
    143                         $html .= "<input type='hidden' name='object_class' value='Node'>\n"; 
    144                         $html .= "<input type='hidden' name='action' value='edit'>\n"; 
    145                         $html .= "<input type='submit' name='edit_submit' value='"._("Edit")."'>\n"; 
    146  
    147                         $html .= "</div>\n"; 
    148                         $html .= '</form>'; 
    149                         $html .= "</div>\n"; 
    150                     } 
    151  
    152                     /* Network admin */ 
    153                     if ($current_user && $current_user->isSuperAdmin()) 
    154                     { 
    155                         $html .= "<div class='admin_section_container'>\n"; 
    156                         $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
    157                         $html .= "<div class='admin_section_title'>"._("Network administration:")." </div>\n"; 
    158  
    159                         $html .= "<div class='admin_section_data'>\n"; 
    160                         $html .= "<input type='hidden' name='action' value='edit'>\n"; 
    161                         $html .= "<input type='hidden' name='object_class' value='Network'><br>\n"; 
    162                         $html .= Network :: getSelectNetworkUI('object_id'); 
    163                         $html .= "</div>\n"; 
    164                         $html .= "<div class='admin_section_tools'>\n"; 
    165  
    166                         $html .= "<input type=submit name='edit_submit' value='"._("Edit")."'>\n"; 
    167                         $html .= "</div>\n"; 
    168                         $html .= '</form>'; 
    169                         $html .= "</div>\n"; 
    170                     } 
    171                 } 
     105                                if ($current_user && $current_user->isNobody()) 
     106                                { 
     107                                        $html .= _("You do not have permissions to access any administration functions."); 
     108                                } 
     109                                else 
     110                                { 
     111 
     112                                        if ($current_user && $current_user->isSuperAdmin()) 
     113                                        { 
     114                                                $html .= "<li><a href='user_log.php'>"._("User logs")."</a></li>\n"; 
     115                                                $html .= "<li><a href='online_users.php'>"._("Online Users")."</a></li>\n"; 
     116                                                $html .= "<li><a href='stats.php'>"._("Statistics")."</a></li>\n"; 
     117                                                $html .= "<li><a href='import_user_database.php'>"._("Import NoCat user database")."</a></li>\n"; 
     118                                                $html .= "<li><a href='content_admin.php'>"._("Content manager")."</a></li>\n"; 
     119                                        } 
     120 
     121                                        $html .= "</ul>\n"; 
     122 
     123                                        // If the user is super admin OR owner of at least one hotspot show the menu 
     124                                        if ($current_user && ($current_user->isSuperAdmin() || $current_user->isOwner())) 
     125                                        { 
     126                                                /* Node admin */ 
     127                                                $html .= "<div class='admin_section_container'>\n"; 
     128                                                $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
     129                                                $html .= "<div class='admin_section_title'>"._("Node administration:")." </div>\n"; 
     130 
     131                                                $html .= "<div class='admin_section_data'>\n"; 
     132 
     133                                                if ($current_user->isSuperAdmin()) 
     134                                                        $sql_additional_where = ''; 
     135                                                else 
     136                                                        $sql_additional_where = "AND node_id IN (SELECT node_id from node_stakeholders WHERE is_owner = true AND user_id='".$current_user->getId()."')"; 
     137                                                $html .= "<div id='NodeSelector'>\n"; 
     138                                                $html .= Node :: getSelectNodeUI('object_id', $sql_additional_where); 
     139                                                $html .= "</div>\n"; 
     140                                                $html .= "</div>\n"; 
     141                                                $html .= "<div class='admin_section_tools'>\n"; 
     142 
     143                                                $html .= "<input type='hidden' name='object_class' value='Node'>\n"; 
     144                                                $html .= "<input type='hidden' name='action' value='edit'>\n"; 
     145                                                $html .= "<input type='submit' name='edit_submit' value='"._("Edit")."'>\n"; 
     146 
     147                                                $html .= "</div>\n"; 
     148                                                $html .= '</form>'; 
     149                                                $html .= "<div class='admin_section_tools'>\n"; 
     150                                                $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
     151                                                $html .= "<input type='hidden' name='action' value='new_ui'>\n"; 
     152                                                $html .= "<input type='hidden' name='object_class' value='Node'><br>\n"; 
     153                                                $html .= "<input type=submit name='new_submit' value='"._("Create")."'>\n"; 
     154                                                $html .= "</form>\n"; 
     155                                                $html .= "</div>\n"; 
     156                                                $html .= "</div>\n"; 
     157                                        } 
     158 
     159                                        /* Network admin */ 
     160                                        if ($current_user && $current_user->isSuperAdmin()) 
     161                                        { 
     162                                                $html .= "<div class='admin_section_container'>\n"; 
     163                                                $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
     164                                                $html .= "<div class='admin_section_title'>"._("Network administration:")." </div>\n"; 
     165 
     166                                                $html .= "<div class='admin_section_data'>\n"; 
     167                                                $html .= "<input type='hidden' name='action' value='edit'>\n"; 
     168                                                $html .= "<input type='hidden' name='object_class' value='Network'><br>\n"; 
     169                                                $html .= Network :: getSelectNetworkUI('object_id'); 
     170                                                $html .= "</div>\n"; 
     171                                                $html .= "<div class='admin_section_tools'>\n"; 
     172 
     173                                                $html .= "<input type=submit name='edit_submit' value='"._("Edit")."'>\n"; 
     174                                                $html .= "</div>\n"; 
     175                                                $html .= "</form>\n"; 
     176                                                $html .= "<div class='admin_section_tools'>\n"; 
     177                                                $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
     178                                                $html .= "<input type='hidden' name='action' value='new_ui'>\n"; 
     179                                                $html .= "<input type='hidden' name='object_class' value='Network'><br>\n"; 
     180                                                $html .= "<input type=submit name='new_submit' value='"._("Create")."'>\n"; 
     181                                                $html .= "</form>\n"; 
     182                                                $html .= "</div>\n"; 
     183                                                $html .= "</div>\n"; 
     184                                        } 
     185                                } 
    172186                                break; 
    173187                        default : 
     
    327341 
    328342                $html .= "<body>"."\n"; 
    329                 if(isset($_REQUEST['debug_request'])) 
     343                if (isset ($_REQUEST['debug_request'])) 
    330344                { 
    331345                        $html .= '<pre>'; 
    332                         $html .= print_r($_REQUEST,true); 
     346                        $html .= print_r($_REQUEST, true); 
    333347                        $html .= '</pre>'; 
    334348                } 
    335349                $html .= '<div class="outer_container">'."\n"; 
    336350 
    337                  
    338                 if($this->isToolSectionEnabled()) 
     351                if ($this->isToolSectionEnabled()) 
    339352                { 
    340353                        /**** Tools ******/ 
    341354                        $html .= $this->getToolContent(); 
    342                          
     355 
    343356                        /**** Main section ****/ 
    344357                        $html .= "<div id='main_section'>"."\n"; 
     
    367380        { 
    368381                $html = "<p>$errmsg</p>\n"; 
    369                 $email = Network::getCurrentNetwork()->getTechSupportEmail(); 
    370                 if(!empty($email)) 
    371                 { 
    372                 $html .= "<p>"._("Please get in touch with ")."<a href='{$email}'>{$email}</a></p>"; 
     382                $email = Network :: getCurrentNetwork()->getTechSupportEmail(); 
     383                if (!empty ($email)) 
     384                { 
     385                        $html .= "<p>"._("Please get in touch with ")."<a href='{$email}'>{$email}</a></p>"; 
    373386                } 
    374387                $this->setMainContent($html); 
     
    378391} //End class 
    379392?> 
     393