Changeset 979

Show
Ignore:
Timestamp:
02/28/06 09:21:36 (7 years ago)
Author:
max-horvath
Message:

"2006-02-28 Max Horvath <max.horvath@…>

  • the content selector for an owner could produce notices
  • the button add existing content in the content manager will only be shown if content is actually available
  • the start button on the portal page won't be shown anymore if a user didn't access it from a WiFiDog hotspot
  • deleted wifidog/templates/message_unknown_hotspot.html as this error message will be displayed using the genecir error message template
  • display of generic error messages will be handled by the MainUI class
  • deleted wifidog/portal/missing_original_url.php as its functions is being handled by wifidog/portal/index.php now
  • deleted wifidog/templates/message_default.html as its functions is being handled by wifidog/gw_message.php now
  • deleted wifidog/templates/message_activate.html as its functions is being handled by wifidog/gw_message.php now
  • account validation hints finally show the real validation grace time (used to display 15 minutes)
  • deleted wifidog/templates/message_denied.html as its functions is being handled by wifidog/gw_message.php now
  • deleted wifidog/templates/message_failed_validation.html as its functions is being handled by wifidog/gw_message.php now
  • deleted wifidog/templates/user_management_menu.html as its not being used anymore
  • deleted wifidog/local_content/default/footer.html as its not being used anymore
  • deleted wifidog/local_content/default/header.html as its not being used anymore
  • deleted wifidog/local_content/default/portal.html as its not being used anymore
  • deleted wifidog/local_content/default/new.css as its wasn't ever used
  • deleted wifidog/local_content/README as its content isn't valid anymore used anymore"
Location:
trunk/wifidog-auth
Files:
1 added
12 removed
12 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/CHANGELOG

    r978 r979  
     12006-02-28 Max Horváth <max.horvath@maxspot.de> 
     2        * the content selector for an owner could produce notices 
     3        * the button add existing content in the content manager will only be shown 
     4          if content is actually available 
     5        * the start button on the portal page won't be shown anymore if a user 
     6          didn't access it from a WiFiDog hotspot 
     7        * deleted wifidog/templates/message_unknown_hotspot.html as this error 
     8          message will be displayed using the genecir error message template 
     9        * display of generic error messages will be handled by the MainUI class 
     10        * deleted wifidog/portal/missing_original_url.php as its functions is being 
     11          handled by wifidog/portal/index.php now 
     12        * deleted wifidog/templates/message_default.html as its functions is being 
     13          handled by wifidog/gw_message.php now 
     14        * deleted wifidog/templates/message_activate.html as its functions is being 
     15          handled by wifidog/gw_message.php now 
     16        * account validation hints finally show the real validation grace time 
     17          (used to display 15 minutes) 
     18        * deleted wifidog/templates/message_denied.html as its functions is being 
     19          handled by wifidog/gw_message.php now 
     20        * deleted wifidog/templates/message_failed_validation.html as its functions 
     21          is being handled by wifidog/gw_message.php now 
     22        * deleted wifidog/templates/user_management_menu.html as its not being 
     23          used anymore 
     24        * deleted wifidog/local_content/default/footer.html as its not being 
     25          used anymore 
     26        * deleted wifidog/local_content/default/header.html as its not being 
     27          used anymore 
     28        * deleted wifidog/local_content/default/portal.html as its not being 
     29          used anymore 
     30        * deleted wifidog/local_content/default/new.css as its wasn't ever used 
     31        * deleted wifidog/local_content/README as its content isn't valid anymore 
     32          used anymore 
     33 
    1342006-02-26 Max Horváth <max.horvath@maxspot.de> 
    235        * Hotspots map page now uses a direct Javascript call for the link 
  • trunk/wifidog-auth/wifidog/admin/hotspot_location_map.php

    r974 r979  
    5151 
    5252require_once('classes/Node.php'); 
     53require_once('classes/Network.php'); 
    5354require_once('classes/AbstractGeocoder.php'); 
    5455require_once('classes/MainUI.php'); 
     56require_once('classes/Server.php'); 
    5557 
    5658$ui = new MainUI(); 
     
    6264 
    6365    // Add Google Maps JavaScript ( must set config values ) 
    64     $html_headers = "<script src=\"http://maps.google.com/maps?file=api&v=1&key=".GMAPS_PUBLIC_API_KEY."\" type=\"text/javascript\"></script>"; 
     66    $html_headers = "<script src=\"http://maps.google.com/maps?file=api&v=1&key=" . Server::getCurrentServer()->getGoogleAPIKey() . "\" type=\"text/javascript\"></script>"; 
    6567    $ui->setHtmlHeader($html_headers); 
    6668 
     
    8789    $script .= "map.addControl(new GLargeMapControl());\n"; 
    8890    $script .= "map.addControl(new GMapTypeControl());\n"; 
     91    $script .= "map.setMapType(" . $node->getNetwork()->getGisMapType() . ");\n"; 
    8992    $script .= "map.centerAndZoom(new GPoint($long, $lat), 1);\n"; 
    9093    $script .= "var current_marker_point = new GPoint($long, $lat);\n"; 
  • trunk/wifidog-auth/wifidog/classes/Content.php

    r974 r979  
    556556        $html .= "<li class='admin_section_list_item'>\n"; 
    557557        $name = "{$user_prefix}_new_existing"; 
    558         $html .= Content :: getSelectContentUI($name, "AND content_id NOT IN (SELECT content_id FROM $link_table WHERE $link_table_obj_key_col='$link_table_obj_key')"); 
     558        $_contentSelector = Content::getSelectContentUI($name, "AND content_id NOT IN (SELECT content_id FROM $link_table WHERE $link_table_obj_key_col='$link_table_obj_key')"); 
     559        $html .= $_contentSelector; 
    559560        $name = "{$user_prefix}_new_display_location"; 
    560561 
    561562        $html .= "<input type='hidden' name='{$name}' value='{$display_location}'>\n"; 
    562563        $name = "{$user_prefix}_new_existing_submit"; 
    563         $html .= "<input type='submit' name='$name' value='"._("Add")."'>"; 
     564 
     565        if (strpos($_contentSelector, _("Sorry, no content available in the database")) === false) { 
     566            $html .= "<input type='submit' name='$name' value='"._("Add")."'>"; 
     567        } 
     568 
    564569        $html .= "</li>\n"; 
    565570        $html .= "<li class='admin_section_list_item'>\n"; 
     
    721726 
    722727            if ($type_interface != "table") { 
    723                 $_html .= FormSelectGenerator::generateFromArray($_tab, null, $_name, null, false); 
     728                if (isset($_tab)) { 
     729                    $_html .= FormSelectGenerator::generateFromArray($_tab, null, $_name, null, false); 
     730                } else { 
     731                    $_html .= "<div class='warningmsg'>" . _("Sorry, no content available in the database") . "</div>\n"; 
     732                } 
    724733            } else { 
    725734                $_html .= "</table>\n"; 
  • trunk/wifidog-auth/wifidog/classes/MainUI.php

    r938 r979  
    538538    } 
    539539 
    540     function displayError($errmsg) 
     540    /** 
     541     * Display a generic error message 
     542     * 
     543     * @param string $errmsg                  The error message to be displayed 
     544     * @param bool   $show_tech_support_email Defines wether to show the link of 
     545     *                                        the tech-support 
     546     * 
     547     * @return void 
     548     * 
     549     * @access public 
     550     */ 
     551    function displayError($errmsg, $show_tech_support_email = true) 
    541552    { 
    542553        // Init ALL smarty values 
    543554        $this->smarty->assign("error", ""); 
     555        $this->smarty->assign("show_tech_support_email", false); 
    544556        $this->smarty->assign("tech_support_email", ""); 
    545557 
    546558        // Define needed error content 
    547559        $this->smarty->assign("error", $errmsg); 
    548         $this->smarty->assign("tech_support_email", Network::getCurrentNetwork()->getTechSupportEmail()); 
     560 
     561        if ($show_tech_support_email) { 
     562            $this->smarty->assign("show_tech_support_email", true); 
     563            $this->smarty->assign("tech_support_email", Network::getCurrentNetwork()->getTechSupportEmail()); 
     564        } 
    549565 
    550566        /* 
    551567         * Output the error message 
    552568         */ 
    553         $_html = $this->smarty->fetch("templates/generic_error.html"); 
     569        $_html = $this->smarty->fetch("templates/sites/error.tpl"); 
    554570 
    555571        $this->setMainContent($_html); 
  • trunk/wifidog-auth/wifidog/classes/SmartyWifidog.php

    r938 r979  
    9494    $this->assign('request_uri', $_SERVER["REQUEST_URI"]); 
    9595 
    96     if(is_file(NODE_CONTENT_PHP_RELATIVE_PATH.PAGE_HEADER_NAME)) 
    97       { 
    98         $this->assign('header_file',NODE_CONTENT_SMARTY_PATH.PAGE_HEADER_NAME); 
    99       } 
    100     else 
    101       { 
    102         $this->assign('header_file',DEFAULT_CONTENT_SMARTY_PATH.PAGE_HEADER_NAME); 
    103       } 
    104  
    105     if (is_file(NODE_CONTENT_PHP_RELATIVE_PATH.PORTAL_PAGE_NAME)) { 
    106         $this->assign('portal_page', NODE_CONTENT_SMARTY_PATH.PORTAL_PAGE_NAME); 
    107     } else { 
    108         $this->assign('portal_page', DEFAULT_CONTENT_SMARTY_PATH.PORTAL_PAGE_NAME); 
    109     } 
    110  
    111     if (is_file(NODE_CONTENT_PHP_RELATIVE_PATH.PORTAL_PAGE_NAME)) { 
     96    if (is_file(NODE_CONTENT_PHP_RELATIVE_PATH.LOGIN_PAGE_NAME)) { 
    11297        $this->assign('login_page', NODE_CONTENT_SMARTY_PATH.LOGIN_PAGE_NAME); 
    11398    } else { 
    11499        $this->assign('login_page', DEFAULT_CONTENT_SMARTY_PATH.LOGIN_PAGE_NAME); 
    115100    } 
    116  
    117     if (is_file(NODE_CONTENT_PHP_RELATIVE_PATH.PAGE_FOOTER_NAME)) 
    118       { 
    119         $this->assign('footer_file',NODE_CONTENT_SMARTY_PATH.PAGE_FOOTER_NAME); 
    120       } 
    121     else 
    122       { 
    123         $this->assign('footer_file',DEFAULT_CONTENT_SMARTY_PATH.PAGE_FOOTER_NAME); 
    124       } 
    125101 
    126102    if (is_file(NODE_CONTENT_PHP_RELATIVE_PATH.STYLESHEET_NAME)) 
  • trunk/wifidog-auth/wifidog/classes/Style.php

    r915 r979  
    8989    $smarty = new SmartyWifidog; 
    9090    $smarty->assign('title',$title); 
    91     $retval = $smarty->fetch(DEFAULT_CONTENT_SMARTY_PATH.PAGE_HEADER_NAME); 
     91    //$retval = $smarty->fetch(DEFAULT_CONTENT_SMARTY_PATH.PAGE_HEADER_NAME); 
    9292    global $starttime; 
    9393    $starttime = microtime(); 
  • trunk/wifidog-auth/wifidog/config.php

    r974 r979  
    321321define('DEFAULT_NODE_ID', 'default'); 
    322322 
    323 /********************************************************************\ 
    324  * DEPRECATED VALUES                                                * 
    325 \********************************************************************/ 
    326  
    327 /** 
    328  * @deprecated since 2005-04-19 
    329  */ 
    330 define('PAGE_HEADER_NODE', 'header.html'); 
    331  
    332 /** 
    333  * @deprecated since 2005-04-19 
    334  */ 
    335 define('PAGE_HEADER_NAME', 'header.html'); 
    336  
    337 /** 
    338  * @deprecated since 2005-04-19 
    339  */ 
    340 define('PAGE_FOOTER_NODE', 'footer.html'); 
    341  
    342 /** 
    343  * @deprecated since 2005-04-19 
    344  */ 
    345 define('PAGE_FOOTER_NAME', 'footer.html'); 
    346  
    347 /** 
    348  * @deprecated since 2005-04-19 
    349  */ 
    350 define('PORTAL_PAGE_NAME', 'portal.html'); 
    351  
    352323/** 
    353324 * In case this is the local.config.php you should remove the next lines. 
  • trunk/wifidog-auth/wifidog/content/index.php

    r933 r979  
    6262    $node = Node :: getObject($_REQUEST['gw_id']); 
    6363 
    64 if ($node == null) 
    65 { 
    66     $smarty->assign("tech_support_email", Network::getCurrentNetwork()->getTechSupportEmail()); 
    67     $smarty->display("templates/message_unknown_hotspot.html"); 
     64if ($node == null) { 
     65    $ui = new MainUI(); 
     66    $ui->displayError(_("No Hotspot specified!")); 
    6867    exit; 
    6968} 
  • trunk/wifidog-auth/wifidog/gw_message.php

    r916 r979  
    5050 
    5151require_once('include/common_interface.php'); 
     52require_once('classes/User.php'); 
     53require_once('classes/Network.php'); 
     54require_once('classes/MainUI.php'); 
     55 
     56$ui = new MainUI(); 
     57$errmsg = ""; 
    5258 
    5359if (isset($_REQUEST["message"])) { 
    5460    switch ($_REQUEST["message"]) { 
    55         case "failed_validation": 
    56             $smarty->display("templates/message_failed_validation.html"); 
    57             break; 
    58         case "denied": 
    59             $smarty->display("templates/message_denied.html"); 
    60             break; 
    61         case "activate": 
    62             $smarty->display("templates/message_activate.html"); 
    63             break; 
    64         default: 
    65             $smarty->display("templates/message_default.html"); 
    66             break; 
     61    case "failed_validation": 
     62        $errmsg .= "<p>" . sprintf(_("You have failed to validate your account in %d minutes."), (User::getCurrentUser()->getNetwork()->getValidationGraceTime() / 60)) . "</p>"; 
     63        $errmsg .= "<p>" . _("Please validate your account from somewhere else or create a new one.") . "</p>"; 
     64        $ui->displayError($errmsg); 
     65        break; 
     66 
     67    case "denied": 
     68        $errmsg .= _("Access denied!"); 
     69        $ui->displayError($errmsg); 
     70        break; 
     71 
     72    case "activate": 
     73        $errmsg .= "<p>" . sprintf(_("You have now been granted %d minutes of Internet access without being validated to go and activate your account."), (User::getCurrentUser()->getNetwork()->getValidationGraceTime() / 60)) . "</p>"; 
     74        $errmsg .= "<p>" . _("If you fail to validate your account in 15 minutes, you will have to validate it from somewhere else.") . "</p>"; 
     75        $errmsg .= "<p>" . _("If you do not receive an email from our validation server in the next minute, perhaps you have made a typo in your email address, you might have to create another account.") . "</p>"; 
     76        $ui->displayError($errmsg); 
     77        break; 
     78 
     79    default: 
     80        $errmsg .= _("No message has been specified! (this is probably an error)"); 
     81        $ui->displayError($errmsg); 
     82        break; 
    6783    } 
    6884} else { 
    69     $smarty->display("templates/message_default.html"); 
     85    $errmsg .= _("No message has been specified! (this is probably an error)"); 
     86    $ui->displayError($errmsg); 
    7087} 
    7188 
  • trunk/wifidog-auth/wifidog/login/index.php

    r952 r979  
    130130 
    131131    catch (Exception $e) { 
    132         $smarty->assign("error", $e->getMessage()); 
    133         $smarty->assign("tech_support_email", Network::getCurrentNetwork()->getTechSupportEmail()); 
    134         $smarty->display("templates/generic_error.html"); 
     132        $ui = new MainUI(); 
     133        $ui->displayError($e->getMessage()); 
    135134        exit; 
    136135    } 
  • trunk/wifidog-auth/wifidog/portal/index.php

    r974 r979  
    4040 * @author     Philippe April 
    4141 * @author     Benoit Gregoire <bock@step.polymtl.ca> 
     42 * @author     Max Horvath <max.horvath@maxspot.de> 
    4243 * @copyright  2004-2006 Philippe April 
    4344 * @copyright  2004-2006 Benoit Gregoire, Technologies Coeus inc. 
     45 * @copyright  2006 Max Horvath, maxspot GmbH 
    4446 * @version    Subversion $Id$ 
    4547 * @link       http://www.wifidog.org/ 
     
    5658require_once('classes/Session.php'); 
    5759 
    58 /** 
    59  * Define width of toolbar 
    60  * 
    61  * Must match the stylesheet for the tool section width 
    62  */ 
    63 define('TOOLBAR_WIDTH', '250'); 
     60/* 
     61 * Check for missing URL switch 
     62 */ 
     63if (isset($_REQUEST['missing']) && $_REQUEST['missing'] == "url") { 
     64    $ui = new MainUI(); 
     65    $ui->displayError(_('For some reason, we were unable to determine the web site you initially wanted to see.  You should now enter a web address in your URL bar.'), false); 
     66    exit; 
     67} 
    6468 
    6569// Init values 
     
    7377$current_user = User::getCurrentUser(); 
    7478 
    75 if (!empty ($_REQUEST['gw_id'])) { 
    76     $node = Node :: getObject($_REQUEST['gw_id']); 
    77 } 
    78  
    79 if ($node == null) { 
    80     $smarty->display("templates/message_unknown_hotspot.html"); 
     79/* 
     80 * Start general request parameter processing section 
     81 */ 
     82if (!empty($_REQUEST['gw_id'])) { 
     83    try { 
     84        $node = Node::getObject($_REQUEST['gw_id']); 
     85        $network = $node->getNetwork(); 
     86    } 
     87 
     88    catch (Exception $e) { 
     89        $ui = new MainUI(); 
     90        $ui->displayError($e->getMessage()); 
     91        exit; 
     92    } 
     93} else { 
     94    $ui = new MainUI(); 
     95    $ui->displayError(_("No Hotspot specified!")); 
    8196    exit; 
    8297} 
    83  
    84 // Get information about current network 
    85 $network = $node->getNetwork(); 
    8698 
    8799/* 
     
    90102 */ 
    91103$custom_portal_url = $node->getCustomPortalRedirectUrl(); 
     104 
    92105if (!empty($custom_portal_url) && $network->getCustomPortalRedirectAllowed()) { 
    93106    header("Location: {$custom_portal_url}"); 
     
    96109$node_id = $node->getId(); 
    97110$portal_template = $node_id.".html"; 
    98 Node :: setCurrentNode($node); 
    99  
    100 $ui = new MainUI(); 
    101 if (isset ($session)) 
    102 { 
    103     if(!empty($_REQUEST['gw_id'])) 
     111Node::setCurrentNode($node); 
     112 
     113if (isset($session)) { 
     114    if (!empty($_REQUEST['gw_id'])) { 
    104115        $session->set(SESS_GW_ID_VAR, $_REQUEST['gw_id']); 
    105  
    106 } 
    107  
    108 $tool_html = ''; 
    109  
    110 $tool_html .= "<h1>"._("Online users")."</h1>"."\n"; 
    111 $tool_html .= '<p class="indent">'."\n"; 
    112 $current_node = Node :: getCurrentNode(); 
    113 if ($current_node != null) 
    114 { 
    115     $current_node_id = $current_node->getId(); 
    116     $online_users = $current_node->getOnlineUsers(); 
    117     $num_online_users = count($online_users); 
    118     if ($num_online_users > 0) 
    119     { 
    120         //$tool_html .= $num_online_users.' '._("other users online at this hotspot..."); 
    121         $tool_html .= "<ul class='users_list'>\n"; 
    122         foreach($online_users as $online_user) { 
    123             $tool_html .= "<li>"; 
    124             $tool_html .= $online_user->getUsername(); 
    125             $roles = array(); 
    126             if ($current_node->isOwner($online_user)) 
    127                 $roles[] = _("owner"); 
    128             if ($current_node->isTechnicalOfficer($online_user)) 
    129                 $roles[] = _("technical officer"); 
    130             if ($roles) 
    131                 $tool_html .= " <span class='roles'>(" . join($roles, ",") . ")</span>"; 
    132             $tool_html .= "</li>\n"; 
    133         } 
    134         $tool_html .= "</ul>\n"; 
    135     } 
    136     else 
    137     { 
    138         $tool_html .= _("Nobody is online at this hotspot..."); 
    139     } 
    140 } 
    141 else 
    142 { 
    143     $network = Network::getCurrentNetwork(); 
    144     $current_node_id = null; 
    145     $tool_html .= _("You are not currently at a hotspot..."); 
    146 } 
    147 $tool_html .= "</p>"."\n"; 
    148  
    149 $tool_html .= '<script type="text/javascript"> 
    150 function getElementById(id) { 
    151     if (document.all) { 
    152     return document.getElementById(id); 
    153     } 
    154     for (i=0;i<document.forms.length;i++) { 
    155     if (document.forms[i].elements[id]) {return document.forms[i].elements[id]; } 
    156     } 
    157 } 
    158  
    159 function getWindowSize(window) { 
    160 var size_array = new Array(2); 
    161   var myWidth = 0, myHeight = 0; 
    162   if( typeof( window.innerWidth ) == "number" ) { 
    163     //Non-IE 
    164     myWidth = window.innerWidth; 
    165     myHeight = window.innerHeight; 
    166   } else if( document.documentElement && 
    167       ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { 
    168     //IE 6+ in "standards compliant mode" 
    169     myWidth = document.documentElement.clientWidth; 
    170     myHeight = document.documentElement.clientHeight; 
    171   } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { 
    172     //IE 4 compatible 
    173     myWidth = document.body.clientWidth; 
    174     myHeight = document.body.clientHeight; 
    175   } 
    176   size_array[0] = myWidth; 
    177   size_array[1] = myHeight; 
    178 //  window.alert( "Width = " + myWidth ); 
    179 //  window.alert( "Height = " + myHeight ); 
    180 return size_array; 
    181 } 
    182  
    183  
    184 </script>'; 
    185  
    186  
    187 $tool_html .= '<p class="indent">'."\n"; 
    188 $tool_html .= "<a  id='wifidog_portal_expand' onclick=\" 
    189 var wifidog_portal_expand = getElementById('wifidog_portal_expand'); 
    190 var wifidog_portal_collapse = getElementById('wifidog_portal_collapse'); 
    191  
    192 wifidog_portal_expand.style.display = 'none'; 
    193 wifidog_portal_collapse.style.display = 'inline'; 
    194 var size_array = getWindowSize(window.opener); 
    195 window.resizeTo(size_array[0],size_array[1]); 
    196 \">"._("Expand portal")."</a>"."\n"; 
    197  
    198 $tool_html .= "<a id='wifidog_portal_collapse' onclick=\" 
    199 var wifidog_portal_expand = getElementById('wifidog_portal_expand'); 
    200 var wifidog_portal_collapse = getElementById('wifidog_portal_collapse'); 
    201  
    202 wifidog_portal_expand.style.display = 'inline'; 
    203 wifidog_portal_collapse.style.display = 'none'; 
    204 var size_array = getWindowSize(window.opener); 
    205 window.resizeTo('".TOOLBAR_WIDTH."',size_array[1]); 
    206  
    207 \">"._("Collapse portal")."</a>"."\n"; 
    208 $tool_html .= "</p>"."\n"; 
    209  
    210  
    211  
    212  
    213     $original_url_requested=$session->get(SESS_ORIGINAL_URL_VAR); 
    214     if(empty($original_url_requested)) 
    215     { 
    216         $url="missing_original_url.php"; 
    217     } 
    218     else 
    219     { 
    220         $url=$original_url_requested; 
    221     } 
    222 $tool_html .= '<p class="indent">'."\n"; 
    223 $tool_html .= "<a id='wifidog_use_internet' href='$url' onclick=\" 
    224 var size_array = getWindowSize(window); 
    225 var original_location=window.location.href; 
    226 //this.target='_blank'; 
    227 var old_window = window; 
    228 var new_window = window.open('".CURRENT_REQUEST_URL."','wifidog_portal'); 
    229 new_window.blur(); 
    230 old_window.focus(); 
    231 new_window.resizeTo('".TOOLBAR_WIDTH."',size_array[1]); 
    232  
    233 //old_window.location.href='test'; 
    234 //window.moveBy(300, 300); 
    235 /*if(window.open){alert('window.open enabled');} 
    236 else{alert('window.open DISABLED');}*/ 
    237  
    238 \"><img src='" . BASE_SSL_PATH . "images/start.gif'></a>\n"; 
    239 $tool_html .= "</p>"."\n"; 
    240  
    241 $tool_html .= '<script type="text/javascript"> 
    242 //Set up if expand/collapse functionnality is to be enabled by checking if we were called from another portal window. 
    243  
    244 window.is_wifidog_portal=true; //This assignement may be read by another window 
    245  
    246 var wifidog_portal_expand = document.getElementById("wifidog_portal_expand"); 
    247 var wifidog_portal_collapse = document.getElementById("wifidog_portal_collapse"); 
    248 var wifidog_use_internet = document.getElementById("wifidog_use_internet"); 
    249 if(window.opener && window.opener.is_wifidog_portal==true) 
    250 { 
    251 wifidog_portal_expand.style.display = "inline"; 
    252 wifidog_portal_collapse.style.display = "none"; 
    253 wifidog_use_internet.style.display = "none"; 
    254 } 
    255 else 
    256 { 
    257 wifidog_portal_expand.style.display = "none"; 
    258 wifidog_portal_collapse.style.display = "none"; 
    259 } 
    260 </script>'; 
    261  
    262 $ui->setToolContent($tool_html); 
    263  
    264 $hotspot_network_name = $network->getName(); 
    265 $hotspot_network_url = $network->getHomepageURL(); 
    266 $network_logo_url = COMMON_CONTENT_URL.NETWORK_LOGO_NAME; 
    267 $network_logo_banner_url = COMMON_CONTENT_URL.NETWORK_LOGO_BANNER_NAME; 
    268  
    269 $html = ''; 
     116    } 
     117} 
     118 
     119$current_node = Node::getCurrentNode(); 
     120$current_node_id = $current_node->getId(); 
     121 
     122// Init ALL smarty SWITCH values 
     123$smarty->assign('sectionTOOLCONTENT', false); 
     124$smarty->assign('sectionMAINCONTENT', false); 
     125 
     126// Init ALL smarty values 
     127$smarty->assign('currentNode', null); 
     128$smarty->assign('numOnlineUsers', 0); 
     129$smarty->assign('onlineUsers', array()); 
     130$smarty->assign('userIsAtHotspot', false); 
     131$smarty->assign('noUrl', true); 
     132$smarty->assign('url', ""); 
     133$smarty->assign('accountValidation', false); 
     134$smarty->assign('validationTime', 20); 
     135$smarty->assign('hotspotNetworkUrl', ""); 
     136$smarty->assign('hotspotNetworkName', ""); 
     137$smarty->assign('networkLogoBannerUrl', ""); 
     138$smarty->assign('networkContents', false); 
     139$smarty->assign('networkContentArray', array()); 
     140$smarty->assign('nodeHomepage', false); 
     141$smarty->assign('nodeURL', ""); 
     142$smarty->assign('nodeName', ""); 
     143$smarty->assign('nodeContents', false); 
     144$smarty->assign('nodeContentArray', array()); 
     145$smarty->assign('userContents', false); 
     146$smarty->assign('userContentArray', array()); 
     147 
     148/* 
     149 * Tool content 
     150 */ 
     151 
     152// Set section of Smarty template 
     153$smarty->assign('sectionTOOLCONTENT', true); 
     154 
     155// Set details about node 
     156$smarty->assign('currentNode', $current_node); 
     157 
     158// Set details about onlineusers 
     159$online_users = $current_node->getOnlineUsers(); 
     160$num_online_users = count($online_users); 
     161 
     162foreach ($online_users as $online_user) { 
     163    $roles = array(); 
     164 
     165    if ($current_node->isOwner($online_user)) { 
     166        $roles[] = _("owner"); 
     167    } 
     168 
     169    if ($current_node->isTechnicalOfficer($online_user)) { 
     170        $roles[] = _("technical officer"); 
     171    } 
     172 
     173    if ($roles) { 
     174        $rolenames = join($roles, ","); 
     175    } 
     176 
     177    $online_user_array[] = array('Username' => $online_user->getUsername(), 'showRoles' => count($roles) > 0, 'roles' => $rolenames); 
     178} 
     179 
     180$smarty->assign('numOnlineUsers', $num_online_users); 
     181 
     182if ($num_online_users > 0) { 
     183    $smarty->assign('onlineUsers', $online_user_array); 
     184} 
     185 
     186// Check for requested URL and if user is at a hotspot 
     187$original_url_requested = $session->get(SESS_ORIGINAL_URL_VAR); 
     188 
     189$smarty->assign('userIsAtHotspot', Node::getCurrentRealNode() != null ? true : false); 
     190 
     191if (empty($original_url_requested)) { 
     192    $smarty->assign('noUrl', true); 
     193    $smarty->assign('url', "?missing=url"); 
     194} else { 
     195    $smarty->assign('noUrl', true); 
     196    $smarty->assign('url', $original_url_requested); 
     197} 
     198 
     199// Compile HTML code 
     200$tool_html = $smarty->fetch("templates/sites/portal.tpl"); 
     201 
     202/* 
     203 * Main content 
     204 */ 
     205 
     206// Reset ALL smarty SWITCH values 
     207$smarty->assign('sectionTOOLCONTENT', false); 
     208$smarty->assign('sectionMAINCONTENT', false); 
     209 
     210// Set section of Smarty template 
     211$smarty->assign('sectionMAINCONTENT', true); 
    270212 
    271213// While in validation period, alert user that he should validate his account ASAP 
    272 if($current_user && $current_user->getAccountStatus() == ACCOUNT_STATUS_VALIDATION) 
    273     $html .= "<div id='warning_message_area'>"._('An email with confirmation instructions was sent to your email address.  Your account has been granted 15 minutes of access to retrieve your email and validate your account.')."</div>"; 
    274  
    275 $html .= "<div id='portal_container'>\n"; 
    276  
    277  
    278 /* Network section */ 
    279  
    280 $html .= "<div class='portal_network_section'>\n"; 
    281 $html .= "<a href='{$hotspot_network_url}'><img class='portal_section_logo' alt='{$hotspot_network_name} logo' src='{$network_logo_banner_url}' border='0'></a>\n"; 
     214if ($current_user && $current_user->getAccountStatus() == ACCOUNT_STATUS_VALIDATION) { 
     215    $smarty->assign('accountValidation', true); 
     216    $smarty->assign('validationTime', ($current_user->getNetwork()->getValidationGraceTime() / 60)); 
     217} 
     218 
     219/* 
     220 * Network section 
     221 */ 
     222 
     223// Set network details 
     224$smarty->assign('hotspotNetworkUrl', $network->getHomepageURL()); 
     225$smarty->assign('hotspotNetworkName', $network->getName()); 
     226$smarty->assign('networkLogoBannerUrl', COMMON_CONTENT_URL . NETWORK_LOGO_BANNER_NAME); 
     227 
    282228// Get all network content and EXCLUDE user subscribed content 
    283 if($current_user) 
    284     $contents = Network :: getCurrentNetwork()->getAllContent(true, $current_user); 
    285 else 
    286     $contents = Network :: getCurrentNetwork()->getAllContent(); 
    287 if ($contents) 
    288 { 
    289     foreach ($contents as $content) 
    290     { 
    291         if ($content->isDisplayableAt($node)) 
    292         { 
    293             $html .= "<div class='portal_content'>\n"; 
    294             $html .= $content->getUserUI(); 
    295             $html .= "</div>\n"; 
    296         } 
    297     } 
    298 } 
    299 $html .= "</div>\n"; 
    300  
    301 /* Node section */ 
     229if ($current_user) { 
     230    $contents = Network::getCurrentNetwork()->getAllContent(true, $current_user); 
     231} else { 
     232    $contents = Network::getCurrentNetwork()->getAllContent(); 
     233} 
     234 
     235if ($contents) { 
     236    foreach ($contents as $content) { 
     237        $contentArray[] = array('isDisplayableAt' => $content->isDisplayableAt($node), 'userUI' => $content->getUserUI()); 
     238    } 
     239 
     240    // Set all content of current node 
     241    $smarty->assign('networkContents', true); 
     242    $smarty->assign('networkContentArray', $contentArray); 
     243} 
     244 
     245/* 
     246 * Node section 
     247 */ 
     248 
    302249// Get all node content and EXCLUDE user subscribed content 
    303 if($current_user) 
     250if ($current_user) { 
    304251    $contents = $node->getAllContent(true, $current_user); 
    305 else 
     252} else { 
    306253    $contents = $node->getAllContent(); 
    307  
    308 if(!empty($contents)) 
    309 { 
    310     $html .= "<div class='portal_node_section'>\n"; 
    311     $html .= "<span class='portal_section_title'>"._("Content from:")." "; 
    312     $node_homepage = $node->getHomePageURL(); 
    313     if (!empty ($node_homepage)) 
    314     { 
    315         $html .= "<a href='$node_homepage'>"; 
    316     } 
    317     $html .= $node->getName(); 
    318     if (!empty ($node_homepage)) 
    319     { 
    320         $html .= "</a>\n"; 
    321     } 
    322     $html .= "</span>"; 
    323     foreach ($contents as $content) 
    324     { 
     254} 
     255 
     256// Set homepage details of node 
     257$node_homepage = $node->getHomePageURL(); 
     258if (!empty($node_homepage)) { 
     259    $smarty->assign('nodeHomepage', true); 
     260    $smarty->assign('nodeURL', $node_homepage); 
     261    $smarty->assign('nodeName', $node->getName()); 
     262} 
     263 
     264if ($contents) { 
     265    foreach ($contents as $content) { 
    325266        // Check for content requirements to show the "Show all contents" link 
    326267        if (!$show_more_link) { 
     
    334275        } 
    335276 
    336         if ($content->isDisplayableAt($node)) { 
    337             $html .= "<div class='portal_content'>\n"; 
    338             $html .= $content->getUserUI(); 
    339             $html .= "</div>\n"; 
     277        $contentArray[] = array('isDisplayableAt' => $content->isDisplayableAt($node), 'userUI' => $content->getUserUI()); 
     278    } 
     279 
     280    // Set all content of current node 
     281    $smarty->assign('nodeContents', true); 
     282    $smarty->assign('nodeContentArray', $contentArray); 
     283} 
     284 
     285/* 
     286 * User section 
     287 */ 
     288 
     289if ($current_user) { 
     290    $contents = User::getCurrentUser()->getAllContent(); 
     291 
     292    if ($contents) { 
     293        foreach ($contents as $content) { 
     294            $contentArray[] = array('userUI' => $content->getUserUI()); 
    340295        } 
    341     } 
    342     $html .= "</div>\n"; 
    343 } 
    344  
    345 /* User section */ 
    346 if($current_user) 
    347 { 
    348     $contents = User :: getCurrentUser()->getAllContent(); 
    349     if($contents) 
    350     { 
    351         $html .= "<div class='portal_user_section'>\n"; 
    352         $html .= "<h1>"._("My content")."</h1>\n"; 
    353         foreach ($contents as $content) 
    354         { 
    355             $html .= "<div class='portal_content'>\n"; 
    356             $html .= $content->getUserUI(); 
    357             $html .= "</div>\n"; 
    358         } 
    359         $html .= "</div>\n"; 
     296 
     297        // Set all content of current node 
     298        $smarty->assign('userContents', true); 
     299        $smarty->assign('userContentArray', $contentArray); 
    360300    } 
    361301} 
     
    363303// Hyperlinks to full content display page 
    364304if ($show_more_link) { 
    365     $html .= "<a href='" . BASE_SSL_PATH . "content/?gw_id={$current_node_id}'>"._("Show all available contents for this hotspot")."</a>"."\n"; 
    366 } 
    367  
    368 $html .= "<div style='clear:both;'></div>"; 
    369 $html .= "</div>\n"; 
    370  
    371 $ui->setMainContent($html); 
     305    $smarty->assign('showMoreLink', true); 
     306    $smarty->assign('currentNodeId', $current_node_id); 
     307} 
     308 
     309// Compile HTML code 
     310$html_body = $smarty->fetch("templates/sites/portal.tpl"); 
     311 
     312/* 
     313 * Render output 
     314 */ 
     315 
     316$ui = new MainUI(); 
     317$ui->setToolContent($tool_html); 
     318$ui->setMainContent($html_body); 
    372319$ui->display(); 
    373320 
  • trunk/wifidog-auth/wifidog/templates/generic_error.html

    r933 r979  
    1 <p> 
    2 {$error} 
    3 </p> 
     1<div id="warning_message_area">{$error}</div> 
    42 
    5 <p> 
    6 {"Please get in touch with "|_} <a href="mailto:{$tech_support_email}">{$tech_support_email}</a>. 
    7 </p> 
     3{if $show_tech_support_email} 
     4    <p>{"Please get in touch with "|_} <a href="mailto:{$tech_support_email}">{$tech_support_email}</a>.</p> 
     5{/if}