Эх сурвалжийг харах

Project view in development.

Iñigo Valentin 9 жил өмнө
parent
commit
d77f863600

+ 83 - 0
www/.htaccess

@@ -0,0 +1,83 @@
+#RewriteMap lc int:tolower
+
+ErrorDocument 403     /error/403.php
+ErrorDocument 404     /error/404.php
+ErrorDocument 500     /error/500.php
+
+#AddHandler application/x-httpd-php .xml
+#AddType application/x-httpd-php .xml
+AddType application/x-httpd-php .xml
+AddHandler php5-cgi .xml
+# <FilesMatch "\.php$">
+# Order allow, deny
+# Deny from all
+# </FilesMatch>
+Options +FollowSymlinks
+RewriteEngine on
+CheckSpelling on
+
+
+RewriteRule ^sitemap.xml$ /sitemap.php [NC]
+RewriteRule ^imgmap.xml$ /sitemap-image.php [NC]
+RewriteRule ^rss.xml$ /rss.php [NC]
+
+RewriteRule ^blog/([A-Z\-a-z0-9]{3,}+)[\/]?$ /blog/post.php?permalink=$1 [NC]
+
+RewriteRule ^project/([A-Z\-a-z0-9]{3,}+)[\/]?$ /project/project.php?permalink=$1 [NC]
+
+RewriteRule ^help[\/]?$ /help/index.php [NC]
+
+#Force https
+RewriteCond %{HTTPS} !=on
+RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
+
+# BEGIN Cache-Control Headers
+<IfModule mod_expires.c>
+	ExpiresActive on
+# ExpiresDefault "access plus 1 month"
+	ExpiresByType application/javascript "access plus 6 days"
+	ExpiresByType image/x-ico "access plus 12 days"
+	ExpiresByType image/jpg "access plus 12 days"
+	ExpiresByType image/jpeg "access plus 12 days"
+	ExpiresByType image/gif "access plus 12 days"
+	ExpiresByType image/png "access plus 12 days"
+	ExpiresByType video/mkv "access plus 12 days"
+	ExpiresByType text/css "access plus 6 days"
+	ExpiresByType text/plain "access plus 6 days"
+</IfModule>
+
+# BEGIN Cache-Control Headers
+<ifModule mod_headers.c>
+  <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
+    Header set Cache-Control "max-age=864000, public, must-revalidate"
+  </filesMatch>
+  <filesMatch "\.(css)$">
+    Header set Cache-Control "max-age=864000, public, must-revalidate"
+  </filesMatch>
+  <filesMatch "\.(js)$">
+    Header set Cache-Control "max-age=864000, private, must-revalidate"
+  </filesMatch>
+  <filesMatch "\.(x?html?|php)$">
+    Header set Cache-Control "max-age=86400, private, must-revalidate"
+  </filesMatch>
+</ifModule>
+# END Cache-Control Headers
+
+<ifModule mod_deflate.c>
+	AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain
+	AddOutputFilterByType DEFLATE image/x-icon
+	AddOutputFilterByType DEFLATE image/svg+xml application/xhtml+xml application/xml
+	AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml
+	AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript application/json
+	AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-otf
+	AddOutputFilterByType DEFLATE font/truetype font/opentype
+</ifModule>
+
+# Enable memory caching
+#CacheEnable mem /
+
+# Limit the size of the cache to 1 Megabyte
+#MCacheSize 1024
+
+#CacheFile footer.php header.php img/*/*/*.jpg 
+

+ 0 - 0
www/css/m/project.css


+ 52 - 0
www/css/project.css

@@ -0,0 +1,52 @@
+div#content{
+    display: table;
+}
+
+div#content-row{
+    display: table-row;
+}
+
+div.content_cell{
+    display: table-cell;
+    padding: 1em;
+}
+
+div#content_cell_main{
+    width: 85%;
+}
+
+div#content_cell_right{
+    width: 15%;
+}
+
+div#main_column{
+    padding: 1em;
+}
+
+div#main_column div.iframe_container{
+    width: 100%;
+    text-align: center;
+}
+
+div#main_column iframe.project_embed{
+    background-color: #ffffff;
+    border-radius: 0.8em;
+    border: 0.1em solid #110022;
+    max-width: 90%;
+    max-height: 70em;
+}
+
+div#right_column{
+    padding: 1em;
+}
+
+div#right_column div.url{
+    vertical-align: middle;
+}
+
+div#right_column div.url img{
+    width: 2em;
+    height: 2em;
+    vertical-align: middle;
+}
+

+ 22 - 8
www/css/ui.css

@@ -2,7 +2,7 @@
  * Fonts used across the page     *
  **********************************/
 
-/* Font used for inputs */
+/* Font */
 @font-face {
     font-family: 'Nunito'; 
     src:  url('/fonts/Nunito-Regular.ttf'); 
@@ -27,7 +27,7 @@ a{
 }
 
 /* Elements fith bold font */
-span.bold{
+.bold{
     font-weight: bold;
 }
 
@@ -207,17 +207,31 @@ div#content{
     margin-bottom: 1.875em;
 }
 
-/* .lighted is a style-only class to make contrast against the dark background */
-.lighted{
+div.section{
+    margin: 1em;
     background-color: #898989;
     border: 0.063em solid #77777;
     border-radius: 0.15em;
-  padding: 0.5em;
+    padding: 0.5em;
     box-shadow: 0 0 0.75em #888888;
 }
 
+div.section h3.section_title{
+    font-weight: bold;
+    color: #ccddff;
+    width: 100%;
+    text_align: left;
+    padding: 0.2em 0em 0.1em 0em;
+    margin: 0;
+    text-indent: 0.5em;
+    margin: 0.625em 0 0.438em 0.625em;
+    text-shadow: 0 0 0.4em #000022;
+    font-size: 200%;
+}
+
+
 /* Style only class. Is the title of a .lighted element */
-.section_title{
+div.section h3.section_title_DELETEME{
     font-size: 150%;
     margin: 0.625em 0 0.438em 0.625em;
     text-shadow: 0 0 0.75em #dddddd;
@@ -232,7 +246,7 @@ span.result_counter{
 }
 
 /* .entry is a style only class to show content. Must be allways children os a .lighted element */
-.entry{
+div.section div.entry{
     transition: all .3s ease-in-out;
     margin: 1% 0.438em 0 0.438em;
     background-color: #cccccc;
@@ -242,7 +256,7 @@ span.result_counter{
     box-shadow: 0 0 0.5em #333333;
 }
 
-.entry:hover{
+div.section div.entry:hover{
     background-color: #eeeeee;
 }
 

+ 129 - 14
www/project/project.php

@@ -9,6 +9,18 @@
     $lang = select_language();
     $cur_section = "";
     $cur_entry = "";
+
+    // Get project data
+    $permalink = mysqli_real_escape_string($con, $_GET["permalink"]);
+    $q_project = mysqli_query($con, "SELECT * FROM project WHERE permalink = '$permalink' AND visible = 1;");
+    if (mysqli_num_rows($q_project) == 0){
+        header("Location: $server/project/");
+        exit(-1);
+    }
+    $r_project = mysqli_fetch_array($q_project);
+    $id = $r_project["id"];
+    $title = text($con, $r_project["title"], $lang);
+    $summary = text($con, $r_project["header"], $lang);
 ?>
 <!DOCTYPE html>
 <html>
@@ -16,51 +28,154 @@
         <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
         <meta charset="utf-8"/>
         <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"/>
-        <title>I&ntilde;igo Valentin</title>
-        <link rel="shortcut icon" href="<?=$server?>/img/logo/favicon.ico"/>
+        <title><?=$title?> - I&ntilde;igo Valentin</title>
+<?php
+        if (strlen($r_project["logo"]) > 0){
+?>
+            <link rel="shortcut icon" href="<?=$server?>/img/logo/favicon.ico"/>
+<?php
+        }
+        else{
+?>
+            <link rel="shortcut icon" href="<?=$server?>/img/project/icon/<?=$r_project["logo"]?>"/>
+<?php
+        }
+?>
         <!-- CSS files -->
         <style>
 <?php
             include $doc_root . "css/ui.css";
+            include $doc_root . "css/project.css";
 ?>
         </style>
         <!-- CSS for mobile version -->
         <style media="(max-width : 990px)">
 <?php
             include $doc_root . "css/m/ui.css";
+            include $doc_root . "css/m/project.css";
 ?>
         </style>
         <!-- Script files -->
         <script type="text/javascript">
 <?php
             include $doc_root . "script/ui.js";
+            include $doc_root . "script/project.js";
 ?>
         </script>
         <!-- Meta tags -->
-        <link rel="canonical" href="<?=$server?>"/>
+        <link rel="canonical" href="<?=$server?>/project/<?=$r_project["permalink"]?>"/>
         <link rel="author" href="<?=$server?>"/>
         <link rel="publisher" href="<?=$server?>"/>
-        <meta name="description" content=""/>
-        <meta property="og:title" content="I&ntilde;igo Valentin"/>
-        <meta property="og:url" content="<?=$server?>"/>
-        <meta property="og:description" content=""/>
-        <meta property="og:image" content=""/>
+        <meta name="description" content="<?=$summary?>"/>
+        <meta property="og:title" content="<?=$title?> - I&ntilde;igo Valentin"/>
+        <meta property="og:url" content="<?=$server?>/project/<?=$r_project["permalink"]?>"/>
+        <meta property="og:description" content="<?=$summary?>"/>
+<?php
+        if (strlen($r_project["logo"]) > 0){
+?>
+            <meta property="og:image" content="<?=$server?>/img/logo/favicon.ico"/>
+<?php
+        }
+        else{
+?>
+            <meta property="og:image" content="<?=$server?>/img/project/icon/<?=$r_project["logo"]?>"/>
+<?php
+        }
+?>
         <meta property="og:site_name" content="I&ntilde;igo Valentin"/>
         <meta property="og:type" content="website"/>
         <meta property="og:locale" content="<?=$lang?>"/>
         <meta name="twitter:card" content="summary"/>
-        <meta name="twitter:title" content="I&ntilde;igo Valentin"/>
-        <meta name="twitter:description" content=""/>
-        <meta name="twitter:image" content=""/>
-        <meta name="twitter:url" content="<?=$server?>"/>
+        <meta name="twitter:title" content="<?=$title?> - I&ntilde;igo Valentin"/>
+        <meta name="twitter:description" content="<?=$summary?>"/>
+<?php
+        if (strlen($r_project["logo"]) > 0){
+?>
+            <meta name="twitter:image" content="<?=$server?>/img/logo/favicon.ico"/>
+<?php
+        }
+        else{
+?>
+            <meta name="twitter:image" content="<?=$server?>/img/project/icon/<?=$r_project["logo"]?>"/>
+<?php
+        }
+?>
+        <meta name="twitter:url" content="<?=$server?>/project/<?=$r_project["permalink"]?>"/>
         <meta name="robots" content="index follow"/>
     </head>
     <body>
 <?php
         include $doc_root . "header.php";
 ?>
-        <div id="content">
-
+        <div id='content'>
+            <div id='content_row'>
+                <div class='content_cell' id='content_cell_main'>
+                    <div class='section' id='main_column'>
+                        <h3 class='section_title'><?=$title?></h3>
+                        <div class='entry'>
+                            <h4><?=$summary?></h4>
+<?php
+                            error_log("SELECT * FROM project_url WHERE type = 'E' AND project = $id;");
+                            $q_embed = mysqli_query($con, "SELECT * FROM project_url WHERE type = 'E' AND project = $id;");
+                            while ($r_embed = mysqli_fetch_array($q_embed)){
+?>
+                                <br/><br/>
+                                <div class='iframe_container'>
+                                    <iframe class='project_embed' onload='resizeIframe(this);' src='<?=$server?><?=$r_embed["url"]?>'></iframe>
+                                </div>
+<?php
+                            }
+?>
+                        </div> <!-- .entry -->
+                    </div> <!-- #middle_column -->
+                </div> <!-- #content_cell_main -->
+                <div class='content_cell'  id='content_cell_right'>
+                    <div class='section' id='right_column'>
+                        <div class='entry'>
+<?php
+                            $q_url = mysqli_query($con, "SELECT url, title, summary, logo FROM project_url, project_url_type WHERE project_url_type.id = project_url.type AND project = $id AND type <> 'E';");
+                            while ($r_url = mysqli_fetch_array($q_url)){
+?>
+                                <div class='url'>
+                                    <a target='_blank' title='<?=text($con, $r_url["summary"], $lang);?>' href='<?=text($con, $r_url["url"], $lang);?>'>
+<?php
+                                        if (strlen($r_url["logo"]) > 0){
+?>
+                                            <img title='<?=text($con, $r_url["summary"], $lang);?>' src='<?=$server?>/img/url/<?=$r_url["logo"]?>'/>
+<?php
+                                        }
+?>
+                                        <?=text($con, $r_url["title"], $lang);?>
+                                    </a>
+                                </div> <!-- .url -->
+<?php
+                            }
+?>
+                        </div> <!-- .entry -->
+                        <div class='entry'>
+<?php
+                            $q_license = mysqli_query($con, "SELECT * FROM license WHERE id = $r_project[license];");
+                            $r_license = mysqli_fetch_array($q_license);
+?>
+                            <span class='hidden' id='license_id'><?=$r_license["id"]?></span>
+                            <span class='hidden' id='license_text'><?=$r_license["summary"]?></span>
+                            <span class='fakelink pointer' onClick='showLicense();'>
+                                <img title='<?=$r_license["id"]?>' src='<?=$server?>/img/license/icon/<?=$r_license["logo"]?>' />
+                            <span>
+                            <br/>
+                            <br/>
+<?php
+                            $q_version = mysqli_query($con, "SELECT version_name, project_version.summary AS summary, dtime, title, project_version_type.summary AS vsummary, color FROM project_version, project_version_type WHERE type = id AND visible = 1 AND project = $id ORDER BY dtime DESC LIMIT 1;");
+                            $r_version = mysqli_fetch_array($q_version);
+?>
+                            TR#Version: <?=$r_version["version_name"]?>
+                            <span class='version_type' style='background-color: <?=$r_version["color"]?>'>
+                                <?=text($con, $r_version["title"], $lang)?>
+                            </span>
+                        </div>
+                    </div> <!-- #right_column -->
+                </div> <!-- #content_cell_right -->
+            </div> <!-- #content_row -->
         </div> <!-- #content -->
 <?php
 

+ 9 - 0
www/script/project.js

@@ -0,0 +1,9 @@
+/**
+ * Used to resize the iframe for embebbed projects.
+ *
+ * @param obj The iframe.
+ */
+function resizeIframe(obj) {
+    obj.style.height = (obj.contentWindow.document.body.scrollHeight + 100) + 'px';
+    obj.style.width = (obj.contentWindow.document.body.scrollWidth + 100) + 'px';
+}