浏览代码

Merge branch 'V3_WEB' into V3

Iñigo Valentin 8 年之前
父节点
当前提交
6e0f07c001
共有 11 个文件被更改,包括 287 次插入402 次删除
  1. 155 144
      www/actividades/actividad.php
  2. 1 1
      www/actividades/index.php
  3. 0 1
      www/css/actividades.css
  4. 0 26
      www/css/m/ui.css
  5. 0 25
      www/css/ui.css
  6. 0 16
      www/footer.php
  7. 9 12
      www/script/actividades.js
  8. 26 7
      www/script/blog.js
  9. 61 142
      www/script/galeria.js
  10. 4 4
      www/script/lablanca.js
  11. 31 24
      www/script/ui.js

+ 155 - 144
www/actividades/actividad.php

@@ -5,13 +5,13 @@
     $con = startdb();
     $proto = getProtocol();
     $server = "$proto$http_host";
-    
+
     //Language
     $lang = selectLanguage();
     include("../lang/lang_$lang.php");
-    
+
     $cur_section = $lng["section_activities"];
-    
+
     // Get current activity id. Redirect if inexistent or invisible
     $perm = mysqli_real_escape_string($con, $_GET["perm"]);
     $q = mysqli_query($con, "SELECT id, permalink, title_$lang AS title, text_$lang AS text, after_$lang AS after, price, inscription, people, max_people, user, date, DATE_FORMAT(date, '%Y-%m-%d %T') AS cdate, DATE_FORMAT(date, '%Y-%m-%d') AS isodate, DATE_FORMAT(date,'%b %d, %Y') as fdate, dtime, comments, city FROM activity WHERE permalink = '$perm' AND visible = 1;");
@@ -21,6 +21,14 @@
     }
     $r = mysqli_fetch_array($q);
     $id = $r["id"];
+
+    //Check if it's a past activity or upcoming activity.
+    $c_date = new Datetime();
+    $a_date = date_create_from_format('Y-m-d H:i:s', $r["cdate"]);
+    $future = false;
+    if (date_format($a_date, 'U') > date_format($c_date, 'U')){
+        $future = true;
+    }
 ?>
 <!DOCTYPE html>
 <html>
@@ -34,7 +42,9 @@
 <?php 
             include("../css/ui.css"); 
             include("../css/actividades.css");
-            include("../css/map.css");
+            if ($future){
+                include("../css/map.css");
+            }
 ?>
         </style>
         <!-- CSS for mobile version -->
@@ -42,7 +52,9 @@
 <?php 
             include("../css/m/ui.css"); 
             include("../css/m/actividades.css");
-            include("../css/m/map.css");
+            if ($future){
+                include("../css/m/map.css");
+            }
 ?>
         </style>
         <!-- Script files -->
@@ -50,26 +62,34 @@
 <?php
             include("../script/ui.js");
             include("../script/actividades.js");
-            include("../script/map.js");
+            if ($future){
+                include("../script/map.js");
+            }
 ?>
         </script>
-        <script src="<?=$server?>/script/OpenLayers/ol.js"></script>
+<?php
+        if ($future){
+?>
+            <script src="<?=$server?>/script/OpenLayers/ol.js"></script>
+<?php
+        }
+?>
         <!-- Meta tags -->
-        <link rel="canonical" href="<?=$server?>/actividades/<?=$r["permalink"]?>"/>
-        <link rel="author" href="<?=$server?>"/>
-        <link rel="publisher" href="<?=$server?>"/>
-        <meta name="description" content="<?=strip_tags($r["text"])?>"/>
-        <meta property="og:title" content="<?=$r["title"]?> - Gasteizko Margolariak"/>
-        <meta property="og:url" content="<?=$server?>/actividades/<?=$r["permalink"]?>"/>
-        <meta property="og:description" content="<?=strip_tags($r["text"])?>?>"/>
-<?php
-        $q_i = mysqli_query($con, "SELECT image FROM activity_image WHERE activity = $id ORDER BY idx;");
-        if (mysqli_num_rows($q_i) == 0){
+        <link rel='canonical' href='<?=$server?>/actividades/<?=$r["permalink"]?>'/>
+        <link rel='author' href='<?=$server?>'/>
+        <link rel='publisher' href='<?=$server?>'/>
+        <meta name='description' content='<?=strip_tags($r["text"])?>'/>
+        <meta property='og:title' content='<?=$r["title"]?> - Gasteizko Margolariak'/>
+        <meta property='og:url' content='<?=$server?>/actividades/<?=$r["permalink"]?>'/>
+        <meta property='og:description' content='<?=strip_tags($r["text"])?>?>'/>
+<?php
+        $q_img = mysqli_query($con, "SELECT image FROM activity_image WHERE activity = $id ORDER BY idx;");
+        if (mysqli_num_rows($q_img) == 0){
             $img = "$server/img/logo/cover.png";
         }
         else{
-            $r_i = mysqli_fetch_array($q_i);
-            $img = "$server/img/actividades/preview/" . $r_i["image"];
+            $r_img = mysqli_fetch_array($q_img);
+            $img = "$server/img/actividades/preview/" . $r_img["image"];
         }
 ?>
         <meta property="og:image" content="<?=$img?>"/>
@@ -77,9 +97,8 @@
         <meta property="og:type" content="article"/>
         <meta property="og:locale" content="<?=$lang?>"/>
         <meta property="article:section" content=""/>
-        <!--     TODO: Review time format     -->
-        <meta property="article:published-time" content="<?=$r["dtime"]?>"/>
-        <meta property="article:modified-time" content="<?=$r["dtime"]?>"/>
+        <meta property="article:published-time" content="<?=$r["isodate"]?>"/>
+        <meta property="article:modified-time" content="<?=$r["isodate"]?>"/>
         <meta property="article:author" content="Gasteizko Margolariak"/>
 <?php
         $res_tag = mysqli_query($con, "SELECT tag FROM activity_tag WHERE activity = $id;");
@@ -101,15 +120,6 @@
         include("../header.php");
 ?>
         <div id="content">
-<?php
-            //Check if it's a past activity or upcoming activity.
-            $c_date = new Datetime();
-            $a_date = date_create_from_format('Y-m-d H:i:s', $r["cdate"]);
-            $future = false;
-            if (date_format($a_date, 'U') > date_format($c_date, 'U')){
-                $future = true;
-            }
-?>
             <div id="middle_column">
                 <div class="section">
                     <h3 class='section_title' id="activity_title"><?=$r["title"]?> - <?=formatDate($r["date"], $lang, false)?></h3>
@@ -131,9 +141,9 @@
 <?php
                         if (mysqli_num_rows($q_i) > 0){
 ?>
-                            <meta itemprop='image' content='</=$server?>/img/actividades/<?=$r_i["image"]?>'/>
+                            <meta itemprop='image' content='<?=$server?>/img/actividades/<?=$r_img["image"]?>'/>
                             <div id='activity_image'>
-                                <img src='<?=$server?>/img/actividades/preview/<?=$r_i["image"]?>'/>
+                                <img src='<?=$server?>/img/actividades/preview/<?=$r_img["image"]?>'/>
                             </div>
 <?php
                         }
@@ -199,155 +209,150 @@
                                 </table> <!-- activity_details -->
                             </div> <!-- activity_details -->
 <?php
-                        
+                        } // if ($future)
 ?>
-                            </div> <!-- .entry -->
-                            <br/>
-                            <div class='entry'>
+                    </div> <!-- .entry -->
+                    <br/>
 <?php
-                                $q_it = mysqli_query($con, "SELECT activity_itinerary.name_$lang AS name, description_$lang AS description, place.name_$lang AS place_name, place.address_$lang AS place_address, place.lat, place.lon, DATE_FORMAT(start, '%H:%i') AS start, DATE_FORMAT(end, '%H:%i') AS end, DATE_FORMAT(start, '%Y-%m-%d') AS isostart, DATE_FORMAT(end, '%Y-%m-%d') AS isoend, route FROM activity_itinerary, place WHERE place.id = activity_itinerary.place AND activity = $r[id] ORDER BY start;");
-                                if (mysqli_num_rows($q_it) > 0){
+                    if ($future) {
 ?>
-                                    <div id='activity_itinerary'>
-                                        <!-- TODO: Routes -->
-                                        <h3 class='entry_title'><?=$lng["activity_itinerary"]?></h3>
-                                        <table id='activity_itinerary'>
-                                            <tr class='th'>
-                                                <th><?=$lng["activities_when"]?></th>
-                                                <th><?=$lng["activities_what"]?></th>
-                                            </tr>
+                        <div class='entry'>
 <?php
-                                            while ($r_it = mysqli_fetch_array($q_it)){
+                            $q_iti = mysqli_query($con, "SELECT activity_itinerary.name_$lang AS name, description_$lang AS description, place.name_$lang AS place_name, place.address_$lang AS place_address, place.lat, place.lon, DATE_FORMAT(start, '%H:%i') AS start, DATE_FORMAT(end, '%H:%i') AS end, DATE_FORMAT(start, '%Y-%m-%d') AS isostart, DATE_FORMAT(end, '%Y-%m-%d') AS isoend, route FROM activity_itinerary, place WHERE place.id = activity_itinerary.place AND activity = $r[id] ORDER BY start;");
+                            if (mysqli_num_rows($q_iti) > 0){
 ?>
-                                                <tr>
-                                                    <div class='hidden' itemprop='subEvent' itemscope itemtype='http://schema.org/Event'>
-                                                        <meta itemprop='inLanguage' content='<?=$lang?>'/>
-                                                        <meta itemprop='name' content='<?=$r_it["name"]?>'/>
-                                                        <meta itemprop='description' content='<?=$r_it["description"]?>'/>
-                                                        <meta itemprop='startDate' content='<?=$r_it["isostart"]?>'/>
-                                                        <meta itemprop='location' content='<?=$r_it["place_name"]?>'/>
+                                <div id='activity_itinerary'>
+                                    <h3 class='entry_title'><?=$lng["activity_itinerary"]?></h3>
+                                    <table id='activity_itinerary'>
+                                        <tr class='th'>
+                                            <th><?=$lng["activities_when"]?></th>
+                                            <th><?=$lng["activities_what"]?></th>
+                                        </tr>
 <?php
-                                                        if (strlen($r_it["end"]) > 0){
+                                        while ($r_iti = mysqli_fetch_array($q_iti)){
 ?>
-                                                            <meta itemprop='endDate' content='<?=$r_it["place_end"]?>'/>
+                                            <tr>
+                                                <div class='hidden' itemprop='subEvent' itemscope itemtype='http://schema.org/Event'>
+                                                    <meta itemprop='inLanguage' content='<?=$lang?>'/>
+                                                    <meta itemprop='name' content='<?=$r_iti["name"]?>'/>
+                                                    <meta itemprop='description' content='<?=$r_iti["description"]?>'/>
+                                                    <meta itemprop='startDate' content='<?=$r_iti["isostart"]?>'/>
+                                                    <meta itemprop='location' content='<?=$r_iti["place_name"]?>'/>
 <?php
-                                                        }
+                                                    if (strlen($r_iti["end"]) > 0){
 ?>
-                                                    </div>
+                                                        <meta itemprop='endDate' content='<?=$r_iti["place_end"]?>'/>
 <?php
-                                                    if (strlen($r_it["end"]) > 0){
+                                                    }
 ?>
-                                                        <td><?=$r_it["start"]?> - <?=$r_it["end"]?></td>
+                                                </div>
 <?php
-                                                    }
-                                                    else{
+                                                if (strlen($r_iti["end"]) > 0){
 ?>
-                                                        <td class='time'><?=$r_it["start"]?></td>
+                                                    <td><?=$r_iti["start"]?> - <?=$r_iti["end"]?></td>
 <?php
-                                                    }
+                                                }
+                                                else{
 ?>
-                                                    <td>
-                                                        <h5><?=$r_it["name"]?></h5>
-                                                        <p class='description'><?=$r_it["description"]?></p>
-                                                        <br/>
+                                                    <td class='time'><?=$r_iti["start"]?></td>
 <?php
-
-
-
-
-
-                                                        if ($r_it["route"] != null && strlen($r_it["route"]) != 0){
+                                                }
 ?>
-                                                            <!-- TODO: Add center coordinates and zoom -->
-                                                            <span class='fake_a pointer' onClick='showMapRoute(<?=$r_it["route"]?>, "<?=$r_it["name"]?>", <?=$r_it["lat"]?>, <?=$r_it["lon"]?>);'>
-                                                                <img class='pinpoint' alt=' ' src='<?=$server?>/img/misc/pinpoint-route.png'/>
-                                                                <span class='desktop route_start'>
-                                                                    <?=$lng["activities_itinerary_start"]?>
-                                                                </span>
+                                                <td>
+                                                    <h5><?=$r_iti["name"]?></h5>
+                                                    <p class='description'><?=$r_iti["description"]?></p>
+                                                    <br/>
 <?php
-                                                                //If name and address are the same, show only name
-                                                                if ($r_it["place_name"] == $r_it["place_address"]){
+                                                    if ($r_iti["route"] != null && strlen($r_iti["route"]) != 0){
 ?>
-                                                                    <?=$r_it["place_name"]?>
+                                                        <span class='fake_a pointer' onClick='showMapRoute(<?=$r_iti["route"]?>, "<?=$r_iti["name"]?>", <?=$r_iti["lat"]?>, <?=$r_iti["lon"]?>);'>
+                                                            <img class='pinpoint' alt=' ' src='<?=$server?>/img/misc/pinpoint-route.png'/>
+                                                            <span class='desktop route_start'>
+                                                                <?=$lng["activities_itinerary_start"]?>
+                                                            </span>
 <?php
-                                                                }
-                                                                else{
+                                                            //If name and address are the same, show only name
+                                                            if ($r_iti["place_name"] == $r_iti["place_address"]){
 ?>
-                                                                    <?=$r_it["place_name"]?>
-                                                                    <span class='address'>- <?=$r_it["place_address"]?></span>
+                                                                <?=$r_iti["place_name"]?>
 <?php
-                                                                }
+                                                            }
+                                                            else{
 ?>
-                                                            </span>
+                                                                <?=$r_iti["place_name"]?>
+                                                                <span class='address'>- <?=$r_iti["place_address"]?></span>
 <?php
-                                                        }
-                                                        else{
+                                                            }
 ?>
-                                                            <span class='fake_a pointer' onClick='showMapPoint("<?=$r_it["name"]?>>", <?=$r_it["lat"]?>, <?=$r_it["lon"]?>);'>
-                                                                <img class='pinpoint'  alt=' ' src='<?=$server?>/img/misc/pinpoint.png'/>
+                                                        </span>
 <?php
-                                                                //If name and address are the same, show only name
-                                                                if ($r_it["place_name"] == $r_it["place_address"]){
+                                                    }
+                                                    else{
 ?>
-                                                                    <?=$r_it["place_name"]?>
+                                                        <span class='fake_a pointer' onClick='showMapPoint("<?=$r_iti["name"]?>>", <?=$r_iti["lat"]?>, <?=$r_iti["lon"]?>);'>
+                                                            <img class='pinpoint'  alt=' ' src='<?=$server?>/img/misc/pinpoint.png'/>
 <?php
-                                                                }
-                                                                else{
+                                                            //If name and address are the same, show only name
+                                                            if ($r_iti["place_name"] == $r_iti["place_address"]){
 ?>
-                                                                    <?=$r_it["place_name"]?>
-                                                                    <span class='address'>- <?=$r_it["place_address"]?></span>
+                                                                <?=$r_iti["place_name"]?>
 <?php
-                                                                }
+                                                            }
+                                                            else{
 ?>
-                                                            </span>
+                                                                <?=$r_iti["place_name"]?>
+                                                                <span class='address'>- <?=$r_iti["place_address"]?></span>
 <?php
-                                                        }
+                                                            }
 ?>
-                                                    </td>
-                                                </tr>
+                                                        </span>
 <?php
-                                            } // while ($r_it = mysqli_fetch_array($q_it))
+                                                    }
 ?>
-                                        </table> <!-- #activity_itinerary -->
-                                    </div> <!-- #activity_itinerary -->
+                                                </td>
+                                            </tr>
 <?php
-                                } // if (mysqli_num_rows($q_it) > 0)
+                                        } // while ($r_iti = mysqli_fetch_array($q_it))
 ?>
-                            </div> <!-- .entry -->
+                                    </table> <!-- #activity_itinerary -->
+                                </div> <!-- #activity_itinerary -->
 <?php
-                        } //  if ($future)
+                            } // if (mysqli_num_rows($q_it) > 0)
 ?>
-                    </div> <!-- .section -->
-                </div> <!-- .entry -->
+                        </div> <!-- .entry -->
+<?php
+                    } //  if ($future)
+?>
+                </div> <!-- .section -->
             </div> <!-- #middle_column -->
             <div id="right_column">
                 <div id="archive" class="section desktop">
                     <h3 class="section_title"><?=$lng["activities_archive"] ?></h3>
                     <div class='entry'>
 <?php
-                        $res_year = mysqli_query($con, "SELECT year(date) AS year FROM activity WHERE visible = 1 GROUP BY year(date) ORDER BY year DESC;");
-                        while($row_year = mysqli_fetch_array($res_year)){
+                        $q_year = mysqli_query($con, "SELECT year(date) AS year FROM activity WHERE visible = 1 GROUP BY year(date) ORDER BY year DESC;");
+                        while($r_year = mysqli_fetch_array($q_year)){
 ?>
-                            <div class='year pointer' onClick='toggleElement("year_<?=$row_year["year"]?>");'>
-                                <img class='slid' id='slid_year_<?=$row_year["year"]?>' src='<?=$server?>/img/misc/slid-right.png' alt='<?=$row_year["year"]?>'/>
-                                <span class='fake_a'><?=$row_year["year"]?></span>
+                            <div class='year pointer' onClick='toggleElement("year_<?=$r_year["year"]?>");'>
+                                <img class='slid' id='slid_year_<?=$r_year["year"]?>' src='<?=$server?>/img/misc/slid-right.png' alt='<?=$r_year["year"]?>'/>
+                                <span class='fake_a'><?=$r_year["year"]?></span>
                             </div>
-                            <div class='list_year pointer' id='list_year_<?=$row_year["year"]?>'>
-<?php
-                                $res_month = mysqli_query($con, "SELECT month(date) AS month FROM activity WHERE visible = 1 AND year(date) = $row_year[year] GROUP BY month(date) ORDER BY month DESC;");
-                                while($row_month = mysqli_fetch_array($res_month)){
-?>                                
-                                    <div class='month pointer' onClick='toggleElement("month_<?=$row_year["year"]?>_<?=$row_month["month"]?>");'>
-                                        <img class='slid' id='slid_month_<?=$row_year["year"]?>_<?=$row_month["month"]?>' src='<?=$server?>/img/misc/slid-right.png' alt='<?=$row_year["year"]?>_<?=$row_month["month"]?>'/>
-                                        <span class='fake_a'><?=$lng["months"][$row_month["month"] - 1]?></span>
+                            <div class='list_year pointer' id='list_year_<?=$r_year["year"]?>'>
+<?php
+                                $q_month = mysqli_query($con, "SELECT month(date) AS month FROM activity WHERE visible = 1 AND year(date) = $r_year[year] GROUP BY month(date) ORDER BY month DESC;");
+                                while($r_month = mysqli_fetch_array($q_month)){
+?>
+                                    <div class='month pointer' onClick='toggleElement("month_<?=$r_year["year"]?>_<?=$r_month["month"]?>");'>
+                                        <img class='slid' id='slid_month_<?=$r_year["year"]?>_<?=$r_month["month"]?>' src='<?=$server?>/img/misc/slid-right.png' alt='<?=$r_year["year"]?>_<?=$r_month["month"]?>'/>
+                                        <span class='fake_a'><?=$lng["months"][$r_month["month"] - 1]?></span>
                                     </div>
-                                    <ul id='list_month_<?=$row_year["year"]?>_<?=$row_month["month"]?>' class='activity_list'>
+                                    <ul id='list_month_<?=$r_year["year"]?>_<?=$r_month["month"]?>' class='activity_list'>
 <?php
-                                    $res_title = mysqli_query($con, "SELECT id, permalink, title_$lang AS title FROM activity WHERE visible = 1 AND year(date) = $row_year[year] AND month(date) = '$row_month[month]' ORDER BY date DESC;");
-                                    while($row_title = mysqli_fetch_array($res_title)){
+                                    $q_title = mysqli_query($con, "SELECT id, permalink, title_$lang AS title FROM activity WHERE visible = 1 AND year(date) = $r_year[year] AND month(date) = '$r_month[month]' ORDER BY date DESC;");
+                                    while($r_title = mysqli_fetch_array($q_title)){
 ?>
                                         <li>
-                                            <a href='<?=$server?>/actividades/<?=$row_title["permalink"]?>'><?=$row_title["title"]?></a>
+                                            <a href='<?=$server?>/actividades/<?=$r_title["permalink"]?>'><?=$r_title["title"]?></a>
                                         </li>
 <?php
                                     }
@@ -356,25 +361,31 @@
 <?php
                                 }
 ?>
-                            </div> <!-- #list_year_<?=$row_year["year"]?> -->
+                            </div> <!-- #list_year_<?=$r_year["year"]?> -->
 <?php
                         }
 ?>
                     </div> <!-- .entry -->
                 </div> <!-- #archive -->
             </div> <!-- #right_column -->
-            <div id='map_container'>
-                <div class='section'>
-                    <h3 class='section_title'>
-                        <span id='map_title'>MAP</span>
-                        <div id='map_close_container'>
-                            <img id='map_close' class='pointer' alt=' ' src='<?=$server?>/img/misc/close.png' onClick='hideMap();'/>
-                        </div>
-                    </h3>
-                    <div id='map' class='entry'>
-                    </div> <!-- map -->
-                </div> <!-- .section -->
-            </div> <!-- .map_container -->
+<?php
+            if ($future){
+?>
+                <div id='map_container'>
+                    <div class='section'>
+                        <h3 class='section_title'>
+                            <span id='map_title'>MAP</span>
+                            <div id='map_close_container'>
+                                <img id='map_close' class='pointer' alt=' ' src='<?=$server?>/img/misc/close.png' onClick='hideMap();'/>
+                            </div>
+                        </h3>
+                        <div id='map' class='entry'>
+                        </div> <!-- map -->
+                    </div> <!-- .section -->
+                </div> <!-- .map_container -->
+<?php
+            } // if ($future)
+?>
         </div> <!-- #content -->
 <?php
         include("../footer.php");

+ 1 - 1
www/actividades/index.php

@@ -92,7 +92,7 @@
                             </div>
                             <div id='upcoming_text'>
                                 <h3 class='entry_title'>
-                                    <a itemprop='url' href=<?=$server?>/actividades/<?=$r_activity["permalink"]?>'><?=$r_activity["title"]?></a>
+                                    <a itemprop='url' href='<?=$server?>/actividades/<?=$r_activity["permalink"]?>'><?=$r_activity["title"]?></a>
                                     <span class='title_date'> - <?=formatDate($r_activity["date"], $lang, false)?></span>
                                 </h3>
                                 <table class='future_details'>

+ 0 - 1
www/css/actividades.css

@@ -37,7 +37,6 @@ div.list_year{
 ul.activity_list{
     margin-top:        0em;
     margin-bottom:    0em;
-    /*     display:        none; */
     max-height:        0em;
     overflow-y:        hidden;
     transition:    max-height 0.6s ease-in-out;

+ 0 - 26
www/css/m/ui.css

@@ -212,29 +212,3 @@ div#ad div.entry div#ad_image_container{
 div#ad div.entry a{
     font-size:        100%;
 }
-
-/******************************************
-* Styles for the annoying cookie popup.   *
-******************************************/
-div#cookie_popup{
-    font-size:                    80%;
-    color:                        #dddddd;
-    text-align:                    center;
-    position:                    fixed;
-    background-color:            #4c9ed8;
-    border:                        0.5em solid #265774;
-    padding:                    1em 4em 1em 4em;
-    left:                        0em;
-    right:                        0em;
-    bottom:                        0em;
-    -ms-transform:                rotate(0deg); /* IE 9 */
-    -ms-transform-origin:        0% 0%; /* IE 9 */
-    -webkit-transform:            rotate(00deg); /* Chrome, Safari, Opera */
-    -webkit-transform-origin:    0% 0%; /* Chrome, Safari, Opera */
-    -moz-transform:                rotate(00deg); 
-    -moz-transform-origin:        0% 0%; /* Chrome, Safari, Opera */
-    transform:                    rotate(00deg);
-    transform-origin:            0% 0%;
-    box-shadow:                    0 0 3em #265774;
-    transition:                    bottom .5s ease-in-out;
-}

+ 0 - 25
www/css/ui.css

@@ -349,31 +349,6 @@ img.footer_social_icon:hover{
     filter:            drop-shadow(0 0 0.6em #111);
 }
 
-/******************************************
-* Styles for the annoying cookie popup.   *
-******************************************/
-div#cookie_popup{
-    font-size:                    80%;
-    color:                        #dddddd;
-    text-align:                    center;
-    position:                    fixed;
-    background-color:            #4c9ed8;
-    border:                        0.5em solid #265774;
-    padding:                    1em 10em 1em 10em;
-    left:                        -9em;
-    bottom:                        9em;
-    -ms-transform:                rotate(30deg); /* IE 9 */
-    -ms-transform-origin:        20% 40%; /* IE 9 */
-    -webkit-transform:            rotate(30deg); /* Chrome, Safari, Opera */
-    -webkit-transform-origin:    20% 40%; /* Chrome, Safari, Opera */
-    -moz-transform:                rotate(30deg); 
-    -moz-transform-origin:        20% 40%; /* Chrome, Safari, Opera */
-    transform:                    rotate(30deg);
-    transform-origin:            20% 40%;
-    box-shadow:                    0 0 3em #265774;
-    transition:                    bottom .5s ease-in-out;
-}
-
 div.button{
     border: 0.2em solid #133442;
     border-radius: 0.2em;

+ 0 - 16
www/footer.php

@@ -64,19 +64,3 @@
         </div> <!-- .tr -->
     </div> <!-- #footer_table -->
 </div> <!-- footer -->
-<?php
-
-if (isSet($_COOKIE["cookie"]) == false){
-?>
-    <div id='cookie_popup'>
-        <span id='message'><?=$lng["cookie_message"]?></span><br/><br/>
-        <span class='button pointer' style="cursor:pointer" id='button_ok'>
-            <a onClick="dismissCookiePopUp('<?=$server?>', false);" ><?=$lng["cookie_ok"]?></a>
-        </span>
-        <span class='button pointer' style="cursor:pointer" id='button_more'>
-            <a onClick="dismissCookiePopUp('<?=$server?>', true);" ><?=$lng["cookie_more"]?></a>
-        </span>
-    </div>
-<?php
-}
-?>

+ 9 - 12
www/script/actividades.js

@@ -1,5 +1,8 @@
- function showPastActivity(id){
-    console.log("Current max-height: " + document.getElementById("past_activity_details_" + id).clientHeight);
+/**
+ * Expands or contracts a past activity.
+ * @param id Activity ID.
+ */
+function showPastActivity(id){
     if (document.getElementById("past_activity_details_" + id).clientHeight > 0){
         document.getElementById("past_activity_details_" + id).style.maxHeight = '0em';
         setTimeout(function(){document.getElementById('slid_past_activity_' + id).src = '/img/misc/slid-right.png';}, 500);
@@ -12,7 +15,10 @@
     setTimeout(function(){document.getElementById('slid_past_activity_' + id).style.opacity = '1';}, 500);
 }
 
-//Archive
+/**
+ * Toggles a drop-down list.
+ * @param name. Element name, same as the id without the 'list_'.
+ */
 function toggleElement(name){
     if (document.getElementById("list_" + name).clientHeight > 0){
         document.getElementById("list_" + name).style.maxHeight = '0em';
@@ -24,13 +30,4 @@ function toggleElement(name){
     }
     document.getElementById('slid_' + name).style.opacity = '0';
     setTimeout(function(){document.getElementById('slid_' + name).style.opacity = '1';}, 500);
-    
-    /*if (document.getElementById("list_" + name).style.display == 'block'){
-        document.getElementById("list_" + name).style.display = 'none';
-        document.getElementById("slid_" + name).src = '/img/misc/slid-right.png';
-    }
-    else{
-        document.getElementById("list_" + name).style.display = 'block';
-        document.getElementById("slid_" + name).src = '/img/misc/slid-down.png';
-    }*/
 }

+ 26 - 7
www/script/blog.js

@@ -1,3 +1,7 @@
+/**
+ * Toggles a drop-down list.
+ * @param name. Element name, same as the id without the 'list_'.
+ */
 function toggleElement(name){
     if (document.getElementById("list_" + name).clientHeight > 0){
         document.getElementById("list_" + name).style.maxHeight = '0em';
@@ -11,24 +15,39 @@ function toggleElement(name){
     setTimeout(function(){document.getElementById('slid_' + name).style.opacity = '1';}, 500);
 }
 
+/**
+ * Redirects to the search page.
+ * @param where Only valid value: 'todo'.
+ */
 function launchSearch(where){
-    //Get search terms
     text = document.getElementById("search_panel_input").value;
     if (text.length > 0)
         window.location.href = "/blog/buscar/" + where + "/" + text;
 }
 
-//WARNING: If changed in css, change here.
+/**
+ * Returns an input element to it's default borders once an error
+ * has been corrected.
+ * WARNING: If changed in css, change here.
+ * @param id The element whose border must be altered.
+ */
 function defaultInputBorder(id){
     id.style.border = '0.2em solid #0078ff'
 }
 
+/**
+ * Posts a comment in the blog. Checks required fields and
+ * makes an AJAX request. Also it inserts the comment in 
+ * the page without needingo to reload.
+ * @param post Post ID.
+ * @param lang User language.
+ */
 function postComment(post, lang){
-        
+
     //Get field values
     var text = document.getElementById('new_comment_text').value;
     var user = document.getElementById('new_comment_user').value;
-    
+
     //Check fields
     if (text.length == 0){
         defaultBorderStyle = document.getElementById('new_comment_text').style.border;
@@ -41,12 +60,12 @@ function postComment(post, lang){
         document.getElementById('new_comment_user').focus();
         return false;
     }
-        
+
     //Load page
     if(XMLHttpRequest){
         var x = new XMLHttpRequest();
     }
-    else {
+    else { // IE v<7
         var x = new ActiveXObject("Microsoft.XMLHTTP");
     }
     x.open("POST", "/blog/comment.php", true);
@@ -55,7 +74,7 @@ function postComment(post, lang){
     x.onreadystatechange = function(){
         if(x.readyState == 4){
             if(x.status == 200){
-                document.getElementById("comment_list").innerHTML = x.responseText;
+                document.getElementById('comment_list').innerHTML = x.responseText;
                 document.getElementById('new_comment_text').value = '';
                 document.getElementById('new_comment_user').value = '';
             }

+ 61 - 142
www/script/galeria.js

@@ -1,25 +1,44 @@
+/**
+ * Array with al the photos in the currently opened album.
+ * It is populated in {@link populatePhotos()} and read
+ * in {@link showPhotoByPath(path)}, {@link scrollPhoto(inc)}
+ * and {@link keyDown(ev)}.
+ */
 var photo = [];
-var maxId;
-var cid;    //Current photo ID;
 
+/**
+ * ID of the photo currently being viewed.
+ * Set and read from {@link showPhotoByPath(path)},
+ * {@link scrollPhoto(inc)} and {@link keyDown(ev)}.
+ */
+var cid;
+
+/**
+ * Populates the photo array {@link photo} with the IDs of the photos
+ * of the current album.
+ */
 function populatePhotos(){
     var photos = document.getElementsByClassName('photo_img');
     for (var i = 0; i < photos.length; i ++){
         var path = photos.item(i).src.substring(photos.item(i).src.lastIndexOf('/') + 1);
         photo.push(path);
     }
-    maxId = photos.length;
-    console.log("photo 0: " + photo[0]);
 }
 
-
+/**
+ * Displays the photo viewer and loads a photo from it's URL.
+ * It also sets {@link cid} to be able to use the next/previous features.
+ * TODO Show a spinning wheel or something before real content is loaded.
+ * @param path Photo URL.
+ */
 function showPhotoByPath(path){
-    //TODO Change content to a spinning wheel or something before real content is loaded
     // Load content
-    if(XMLHttpRequest)
+    if(XMLHttpRequest){
         var x = new XMLHttpRequest();
-    else 
+    }
+    else{ //IE v<7
         var x = new ActiveXObject("Microsoft.XMLHTTP");
+    }
     x.open("GET", "/galeria/load_photo.php?path=" + path, true);
     x.send();
     x.onreadystatechange = function(){
@@ -30,13 +49,13 @@ function showPhotoByPath(path){
         else
             document.getElementById('photo_viewer').innerHTML = "";
     }
-    
+
     //Show
     document.getElementById('screen_cover').style.display = 'block';
     document.getElementById('screen_cover').style.opacity = 0.7;
     document.getElementById('photo_viewer').style.display = 'block';
     document.getElementById('photo_viewer').style.opacity = 1;
-    
+
     //Searh for path in photo array and set cid
     for (var i = 0; i < photo.length; i ++){
         if (photo[i] == path){
@@ -45,6 +64,9 @@ function showPhotoByPath(path){
     }
 }
 
+/**
+ * Closes the photo viewer.
+ */
 function closeViewer(){
     document.getElementById('screen_cover').style.display = 'none';
     document.getElementById('screen_cover').style.opacity = 0;
@@ -53,8 +75,14 @@ function closeViewer(){
     document.getElementById('photo_viewer').innerHTML = "";
 }
 
+/**
+ * Reads a keypress and acts accordingly if the viewer is shown:
+ *   ESC: Closes the viewer calling {@link closeViewer()}
+ *   LEFT/RIGHT ARROW: Shows previous/next photo
+ * @param ev Key event.
+ */
 function keyDown(ev){
-    var code = ev.keyCode; //('charCode' in event) ? event.charCode : event.keyCode;
+    var code = ev.keyCode;
     switch (code){
         case 27:    //ESC
             closeViewer();
@@ -82,6 +110,11 @@ function keyDown(ev){
     }
 }
 
+/**
+ * Shows the previous or next photo in the viewer.
+ * Does nothing if there are no more photos.
+ * @param inc -1 for the previous photo, 1 for the next one.
+ */
 function scrollPhoto(inc){
     switch(inc){
         case -1: //Previous
@@ -107,17 +140,29 @@ function scrollPhoto(inc){
     }
 }
 
-//WARNING: If changed in css, change here.
+/**
+ * Returns an input element to it's default borders once an error
+ * has been corrected.
+ * WARNING: If changed in css, change here.
+ * @param id The element whose border must be altered.
+ */
 function defaultInputBorder(id){
     id.style.border = '0.2em solid #0078ff'
 }
 
+/**
+ * Posts a comment in a photo. Checks required fields and
+ * makes an AJAX request. Also it inserts the comment in 
+ * the page without needingo to reload.
+ * @param photo Photo ID.
+ * @param lang User language.
+ */
 function postComment(photo, lang){
-        
+
     //Get field values
     var text = document.getElementById('new_comment_text').value;
     var user = document.getElementById('new_comment_user').value;
-    
+
     //Check fields
     if (text.length == 0){
         defaultBorderStyle = document.getElementById('new_comment_text').style.border;
@@ -130,12 +175,12 @@ function postComment(photo, lang){
         document.getElementById('new_comment_user').focus();
         return false;
     }
-        
+
     //Load page
     if(XMLHttpRequest){
         var x = new XMLHttpRequest();
     }
-    else {
+    else{ //IE v<7
         var x = new ActiveXObject("Microsoft.XMLHTTP");
     }
     x.open("POST", "/galeria/comment.php", true);
@@ -153,129 +198,3 @@ function postComment(photo, lang){
     x.send(params);
     return false;
 }
-
-//Upload functions
-
-function dropFile(ev, title, description){
-    ev.preventDefault();
-    var totalFiles = ev.dataTransfer.files.length;
-    var entry = "";
-    var reader;
-    for (var i = 0; i < totalFiles; i++) {
-        console.log(ev.dataTransfer.files[i]);
-        if (ev.dataTransfer.files[i].type.substring(0, 5) == 'image'){
-            reader = new FileReader();
-            reader.onload = function(event) {
-                //imgtag.src = event.target.result;
-                entry = "<div class='form_photo entry'>";
-                entry = entry + "<img src='" + event.target.result + "'/><br/>"; 
-                entry = entry + "<input type='text' placeholder='" + title + "'/><br/>";
-                entry = entry + "<textarea placeholder='" + description + "'></textarea><br/>";
-                entry = entry + "</div>";
-                document.getElementById("file_list").innerHTML = document.getElementById("file_list").innerHTML + entry;
-            }
-            reader.readAsDataURL(ev.dataTransfer.files[i]);
-        }
-    }
-    //Show submit button
-    document.getElementById('photo_submit').style.display = 'initial';
-}
-
-function selectFile(ev, inp, title, description){
-    var totalFiles = inp.files.length;
-    var entry = "";
-    var reader;
-    for (var i = 0; i < inp.files.length; ++i) {
-        //console.log(inp.files[i]);
-        if (inp.files[i].type.substring(0, 5) == 'image'){
-            reader = new FileReader();
-            reader.onload = function(event) {
-                //imgtag.src = event.target.result;
-                entry = "<div class='form_photo entry'>";
-                entry = entry + "<img src='" + event.target.result + "'/><br/>"; 
-                entry = entry + "<input type='text' placeholder='" + title + "'/><br/>";
-                entry = entry + "<textarea placeholder='" + description + "'></textarea><br/>";
-                entry = entry + "</div>";
-                document.getElementById("file_list").innerHTML = document.getElementById("file_list").innerHTML + entry;
-            }
-            reader.readAsDataURL(inp.files[i]);
-        }
-    }
-    //Show submit button
-    document.getElementById('photo_submit').style.display = 'initial';
-}
-
-function isInteger(n) {
-    return n % 1 === 0;
-}
-
-function submitPhotos(){
-    var photoList = [];
-    var photoData;
-    var path;
-    var img;
-    var album;
-    var username;
-    
-    //Check that there is an album selected
-    album = document.getElementById('album').value;
-    if (album == -1 || isInteger(album) == false){
-        //TODO: Notify
-        console.log('album');
-        return;
-    }
-    
-    //Check that username is filled
-    username = document.getElementById('username').value;
-    if (username.length <= 0){
-        //TODO: Notify
-        console.log('user');
-        return;
-    }
-    
-    //var url;
-    var title;
-    var description;
-    //Loop section with class form_photo, getting data
-    var ph = document.getElementsByClassName('form_photo');
-    for (var i = 0; i < ph.length; i ++){
-        //Get image
-        path = ph.item(i).getElementsByTagName('img')[0].src;
-        //url = ph.item(i).getAsDataURL();
-        title = ph.item(i).getElementsByTagName('input')[0].value;
-        description = ph.item(i).getElementsByTagName('textarea')[0].value;
-        //path = ph.item(i).src.substring(ph.item(i).src.lastIndexOf('/') + 1);
-        photoList.push([encodeURIComponent(path), encodeURIComponent(title), encodeURIComponent(description)]);
-        //console.log(photoList[i]);
-    }
-    
-    //Load page
-    if(XMLHttpRequest){
-        var x = new XMLHttpRequest();
-    }
-    else {
-        var x = new ActiveXObject("Microsoft.XMLHTTP");
-    }
-    x.open("POST", "/galeria/save.php", true);
-    //Set paramas
-    //TODO: paramas, add user and album
-    var params = "username=" + username + "&album=" + album;
-    for (var i = 0; i < photoList.length; i ++){
-        var params = params + "&file_" + i + "=" + photoList[i][0] + "&title_" + i + "=" + photoList[i][1] + "&description_" + i + "=" + photoList[i][2]; 
-    }
-    console.log(params);
-    x.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
-    x.onreadystatechange = function(){
-        if(x.readyState == 4){
-            if(x.status == 200){
-                console.log("RESPONSE: " + x.responseText);
-                window.location = "/galeria/";
-            }
-        }
-    }
-    x.send(params);
-}
-
-function launchFileSelector(){
-    document.getElementById("file_selector").click();
-}

+ 4 - 4
www/script/lablanca.js

@@ -1,7 +1,7 @@
-function expand(year){
-    console.log('Expanding ' + year);
-}
-
+/**
+ * Expands a day in the Festival Schedule page.
+ * @param id Day identifier, as it is in the DOM.
+ */
 function expandDay(id){
     if (document.getElementById('day_schedule_' + id).style.maxHeight != '' && document.getElementById('day_schedule_' + id).style.maxHeight != '0em'){
         document.getElementById('day_schedule_' + id).style.maxHeight = '0em';

+ 31 - 24
www/script/ui.js

@@ -1,3 +1,8 @@
+/**
+ * Changes the site language.
+ * @param code Two-letter language code ("es", "en" or "eu").
+ * @param host Hostname.
+ */
 function changeLanguage(code, host){
     var days = 100;
     if (code == 'es' || code == 'en' || code == 'eu'){
@@ -9,25 +14,34 @@ function changeLanguage(code, host){
     }
 }
 
+/**
+ * Keeps track of the menu state in the mobile version.
+ * Used by {@link toggleMobileMenu()}.
+ */
 var mobileMenuState = false;
 
+/**
+ * Opens the main menu in the mobile version.
+ * Called from {@link toggleMobileMenu()}.
+ */
 function openMobileMenu(){
     //Hide title, show entries
-    //document.getElementById('header_m_title').style.display = 'none';
     document.getElementById('header_m_title').style.maxHeight = '0em';
-    //document.getElementById('header_m_slider').style.display = 'block';
     var entries = document.getElementsByClassName('header_m_link');
     for (var i = 0; i < entries.length; i ++){
-        //entries.item(i).style.display = 'block';
         entries.item(i).style.maxHeight = '2em';
         entries.item(i).style.padding = '0.5em 0 0 0';
         entries.item(i).style.borderBottom = '0.1em solid black';
     }
     mobileMenuState = true;
 }
+
+/**
+ * Closes the main menu in the mobile version.
+ * Called from {@link toggleMobileMenu()}.
+ */
 function closeMobileMenu(){
-    //Hide title, show entries
-    //document.getElementById('header_m_title').style.display = 'block';
+    //Hide entries, show title
     document.getElementById('header_m_title').style.maxHeight = '3.5em';
     document.getElementById('header_m_slider').style.display = 'none';
     var entries = document.getElementsByClassName('header_m_link');
@@ -39,6 +53,12 @@ function closeMobileMenu(){
     }
     mobileMenuState = false;
 }
+
+/**
+ * Toggles the main menu in the mobile version.
+ * Calls {@link closeMobileMenu()} or {@link closeMobileMenu()},
+ * depending on {@link mobileMenuState}.
+ */
 function toggleMobileMenu(){
     if (mobileMenuState){
         closeMobileMenu();
@@ -48,29 +68,16 @@ function toggleMobileMenu(){
     }
 }
 
-function dismissCookiePopUp(host, open){
-    //Set cookie
-    var date = new Date();
-    date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000));
-    expires = '; expires=' + date.toGMTString();
-    document.cookie = 'cookie=1' + expires + ';domain=.' + host + ';path=/';
-    //Hide message
-    document.getElementById('cookie_popup').style.bottom = '-20em';
-    // Open the help window if required
-    if (open){
-        var win = window.open('http://' + host + '/ayuda/#section_cookie', '_blank');
-        win.focus();
-    }
-    return false;
-    return true;
-}
-
+/**
+ * Shows the advertisment window.
+ */
 function showAd(){
-    console.log("SHOW");
     setTimeout(function(){document.getElementById('ad').style.bottom = '0';}, 3000);
 }
 
+/**
+ * Closes the advertisment window.
+ */
 function closeAd(){
-    console.log("CLOSE");
     document.getElementById('ad').style.bottom = '-25em';
 }