Sfoglia il codice sorgente

Several improvements to the main and blog sections.

Iñigo Valentin 8 anni fa
parent
commit
b72f25e229

+ 13 - 6
www-admin/blog/edit.php

@@ -131,16 +131,23 @@
                         $q_image = mysqli_query($con, "SELECT id, image FROM post_image WHERE post = $id;");
                         while ($r_image = mysqli_fetch_array($q_image)){
 ?>
-                            <span id='post_image_<?=$r_image["id"]?>'>
-                                <img alt='<?=$title?>' title='<?=$title?>' src='<?=$pserver?>/imgblog/x3/<?=$r_image["image"]?>' />
-                                <img class='pointer' onClick='deleteImage(<?=$r_image["id"]?>)' alt='Delete image' title='Delete image' src='<?=$server?>/img/icon/cancel.png' />
-                            </span>
+                            <div class='post_image' id='post_image_<?=$r_image["id"]?>'>
+                                <img alt='<?=$title?>' title='<?=$title?>' src='<?=$pserver?>/img/blog/x4/<?=$r_image["image"]?>' />
+                                <br/>
+                                <label class="image_control image_upload">
+                                    <input id="image" onchange="preview_image();" type="file" name="image" accept="image/x-png, image/gif, image/jpeg"/>
+                                    @
+                                </label>
+                                <input class='image_control' type='button' onClick='deleteImage(<?=$r_image["id"]?>)' value='X' />
+                            </div>
 <?php
                         }
 ?>
-                        <span id='post_image_add'>
+                        <div class='post_image' id='post_image_add'>
                             <img onClick='addImage(<?=$id?>)' alt='Add image' title='Add image' src='<?=$server?>/img/icon/addimage.png' />
-                        </span> <!-- #image_reel -->
+                            <input type='file' id='header_img_selector' onChange='uploadHeaderImage(event, <?=$r["id"]?>);'/>
+                            <img id="image_preview" src="<?php echo $img; ?>"/><br/><br/>
+                        </div>
                     </div>
                     <hr class='separator'/>
                     <h4>Tags</h4>

+ 18 - 3
www-admin/css/blog.css

@@ -72,16 +72,31 @@ div#post_edit div#image_reel{
     padding: 0.5em;
 }
 
-div#post_edit div#image_reel img{
+div#post_edit div#image_reel div.post_image{
+    display: inline-block;
+    vertical-align: top;
+    margin: 0.5em 0.25em 0.5em 0.25em;
+}
+
+div#post_edit div#image_reel div.post_image img{
     vertical-align: middle;
-    max-height: 5em;
-    max-width: 7em;
+    max-height: 7em;
+    max-width: 9em;
     border: 0.2em solid #003400;
     border-radius: 0.1em;
     margin: 0.5em;
     background-color: #ffffff;
 }
 
+div#post_edit div#image_reel div.post_image .image_control{
+    display: inline-block;
+    font-size: 100%;
+    width: 40%;
+    height: 2em;
+    text-align: center;
+    vertical-align: top;
+}
+
 div#post_edit table#comments{
     border-collapse: collapse;
     width: 100%;

+ 29 - 3
www-admin/css/ui.css

@@ -17,6 +17,7 @@
 /* Styles for the body of the page */
 body{
     background-color: #111111;
+    padding: 0;
 }
 
 /* Style for all links */
@@ -102,12 +103,12 @@ div#header{
     background-color: #000000;
     margin: 0;
     width: 100%;
-    height: 2em;
+    height: 2.6em;
     padding: 0;
 }
 
 div#header img{
-    height: 1.6em;
+    height: 1.8em;
     vertical-align: center;
 }
 
@@ -146,7 +147,7 @@ div.secondary_header{
     margin: 0;
     display: none;
     width: 100%;
-    height: 2em;
+    height: 2.6em;
 }
 
 div.secondary_header table{
@@ -346,6 +347,31 @@ select{
     text-shadow: 0 0 0.5em #ffffff;
 }
 
+/* Styles so the input field to upload an image with the comment looks like a button */
+label.image_upload {
+    font-family: 'Nunito';
+    font-weight: bold;
+    color: #cccccc;
+    background-color: #555555;
+    border: 0.143em solid #bbbbbb;
+    border-radius: 0.429em;
+    padding: 0.5em;
+    text-shadow: 0 0 0.75em #000000;
+    cursor: pointer;
+}
+
+label.image_upload input {
+    width: 0 !important;
+    opacity: 0 !important;
+    overflow: hidden !important;
+}
+
+/* Previsualization for the upload image in a comment */
+img#new_comment_image_preview{
+        max-height: 7.692em;
+        max-width: 11.538em;
+}
+
 /* Style for placeholders in input fields */
 ::-webkit-input-placeholder { /* WebKit browsers */
     color: #777777;

+ 1 - 1
www-admin/functions.php

@@ -262,7 +262,7 @@
             return true;
         }
         else{
-            error_log("Invalid login. username = $user, id = $r[id];");
+            error_log("Invalid login. username = $user.");
             return false;
         }
     }

+ 1 - 1
www-admin/index.php

@@ -51,7 +51,7 @@
                             <h3 class='section_title'>Blog</h3>
                             <div class='entry'>
                                 <ul>
-                                    <li><a href='<?=$server?>/blog/add/'>New post</a></li>
+                                    <li><a href='<?=$server?>/blog/new.php/'>New post</a></li>
                                     <li><a href='<?=$server?>/blog/'>Manage posts</a></li>
                                 </ul>
                             </div>

+ 5 - 0
www-admin/script/blog.js

@@ -67,3 +67,8 @@ function visiblePost(id, title, visible){
     xmlhttp.open("GET","/post/visible.php?p=" + id + "&v=" + visible, true);
     xmlhttp.send();
 }
+
+
+function addImage(){
+    
+}

+ 3 - 0
www-admin/stats/index.php

@@ -42,6 +42,9 @@
         </script>
     </head>
     <body>
+<?php
+        include $doc_root . "header.php";
+?>
         <div id='content'>
             <div class='section' id='post_edit'>
                 <h3 class='section_title'>Visits</h3>