]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/diabook/theme.php
diabook-theme: fix footer/impressum
[friendica.git] / view / theme / diabook / theme.php
index 3ce0cc39d0b092e8a07c952d429a41f6bb3ec63e..f9be99759e61da1e88a888840f6a84f110e72d1f 100755 (executable)
@@ -3,21 +3,37 @@
 /*
  * Name: Diabook
  * Description: Diabook: report bugs and request here: http://pad.toktan.org/p/diabook or contact me : thomas_bierey@friendica.eu
- * Version: (Version: 1.020)
+ * Version: (Version: 1.024)
  * Author: 
  */
 
 
 //print diabook-version for debugging
-$diabook_version = "Diabook (Version: 1.020)";
+$diabook_version = "Diabook (Version: 1.024)";
 $a->page['htmlhead'] .= sprintf('<script "%s" ></script>', $diabook_version);
 
 //change css on network and profilepages
 $cssFile = null;
+
 $resolution=false;
 $resolution = get_pconfig(local_user(), "diabook", "resolution");
 if ($resolution===false) $resolution="normal";
 
+$color = false;
+$site_color = get_config("diabook", "color" );
+if (local_user()) {$color = get_pconfig(local_user(), "diabook", "color");}
+if ($color===false) $color=$site_color;
+if ($color===false) $color="diabook";
+
+if ($color=="diabook") $color_path = "/";
+if ($color=="aerith") $color_path = "/diabook-aerith/";
+if ($color=="blue") $color_path = "/diabook-blue/";
+if ($color=="red") $color_path = "/diabook-red/";
+if ($color=="pink") $color_path = "/diabook-pink/";
+if ($color=="green") $color_path = "/diabook-green/";
+if ($color=="dark") $color_path = "/diabook-dark/";
+
+
 /**
  * prints last community activity
  */
@@ -28,6 +44,26 @@ function diabook_community_info(){
        $a = get_app();
 
 
+       // comunity_profiles
+       $aside['$comunity_profilest_title'] = t('Community Profiles');
+       $aside['$comunity_profiles_items'] = array();
+       $r = q("select gcontact.* from gcontact left join glink on glink.gcid = gcontact.id 
+                         where glink.cid = 0 and glink.uid = 0 order by rand() limit 9");
+       $tpl = file_get_contents( dirname(__file__).'/ch_directory_item.tpl');
+       if(count($r)) {
+               $photo = 'photo';
+               foreach($r as $rr) {
+                       $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
+                       $entry = replace_macros($tpl,array(
+                               '$id' => $rr['id'],
+                               '$profile-link' => zrl($rr['url']),
+                               '$photo' => $rr[$photo],
+                               '$alt-text' => $rr['name'],
+                       ));
+                       $aside['$comunity_profiles_items'][] = $entry;
+               }
+       }
+
        // last 12 users
        $aside['$lastusers_title'] = t('Last users');
        $aside['$lastusers_items'] = array();
@@ -136,7 +172,6 @@ function diabook_community_info(){
                }
        }
        
-       
    
    //right_aside FIND FRIENDS
        if(local_user()) {
@@ -160,10 +195,9 @@ function diabook_community_info(){
    
    //Community Page
    if(local_user()) {
-   $page = '<div id="page-sidebar-right_aside" class="widget">
-                       <div class="title tool">
-                       <h3>'.t("Community Pages").'<a id="close_pages_icon"  onClick="close_pages()" class="icon close_box" title="close"></a></h3></div>
-                       <div id="sidebar-page-list"><ul>';
+   $page = '<div id="" >
+                       <h3 style="margin-top:0px;">'.t("Community Pages").'<a id="close_pages_icon"  onClick="close_pages()" class="icon close_box" title="close"></a></h3></div>
+                       <div id=""><ul style="margin-left: 7px;margin-top: 0px;padding-left: 0px;padding-top: 0px;">';
 
        $pagelist = array();
 
@@ -184,7 +218,7 @@ function diabook_community_info(){
        $contacts = $pageD;
 
        foreach($contacts as $contact) {
-               $page .= '<li style="list-style-type: none;" class="tool"><img height="20" width="20" style="float: left; margin-right: 3px;" src="' . $contact['micro'] .'" alt="' . $contact['url'] . '" /> <a href="'.$a->get_baseurl().'/redir/'.$contact["id"].'" style="margin-top: 2px;" title="' . $contact['url'] . '" class="label" target="external-link">'.
+               $page .= '<li style="list-style-type: none;" class="tool"><img height="20" width="20" style="float: left; margin-right: 3px;" src="' . $contact['micro'] .'" alt="' . $contact['url'] . '" /> <a href="'.$a->get_baseurl().'/redir/'.$contact["id"].'" style="margin-top: 2px; word-wrap: break-word; width: 132px;" title="' . $contact['url'] . '" class="label" target="external-link">'.
                                $contact["name"]."</a></li>";
        }
        $page .= '</ul></div></div>';
@@ -251,15 +285,15 @@ if ($a->argv[0] === "network" && local_user()){
 
        }
        
-       $ccCookie = $_COOKIE['close_pages'] + $_COOKIE['close_helpers'] + $_COOKIE['close_services'] + $_COOKIE['close_friends'] + $_COOKIE['close_lastusers'] + $_COOKIE['close_lastphotos'] + $_COOKIE['close_lastlikes'];
+       $ccCookie = $_COOKIE['close_pages'] + $_COOKIE['close_profiles'] + $_COOKIE['close_helpers'] + $_COOKIE['close_services'] + $_COOKIE['close_friends'] + $_COOKIE['close_twitter'] + $_COOKIE['close_lastusers'] + $_COOKIE['close_lastphotos'] + $_COOKIE['close_lastlikes'];
        
-       if($ccCookie != "7") {
+       if($ccCookie != "9") {
        // COMMUNITY
        diabook_community_info();
 
        // CUSTOM CSS
-       if($resolution == "normal") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook/style-network.css";}
-       if($resolution == "wide") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook/style-network-wide.css";}
+       if($resolution == "normal") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-network.css";}
+       if($resolution == "wide") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-network-wide.css";}
        }
 }
 
@@ -267,13 +301,13 @@ if ($a->argv[0] === "network" && local_user()){
 
 //right_aside at profile pages
 if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname']){
-       if($ccCookie != "7") {
+       if($ccCookie != "9") {
        // COMMUNITY
        diabook_community_info();
        
        // CUSTOM CSS
-       if($resolution == "normal") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook/style-profile.css";}
-       if($resolution == "wide") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook/style-profile-wide.css";}
+       if($resolution == "normal") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-profile.css";}
+       if($resolution == "wide") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-profile-wide.css";}
        
        }
 }
@@ -281,7 +315,9 @@ if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname']){
 // custom css
 if (!is_null($cssFile)) $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
 
-
+//footer
+$tpl = get_markup_template('footer.tpl');
+$a->page['footer'] .= replace_macros($tpl, array());
 
 //load jquery.cookie.js
 $cookieJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.cookie.js";
@@ -295,7 +331,25 @@ $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></scrip
 $autogrowJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.autogrow.textarea.js";
 $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $autogrowJS);
 
+//load jquery.twitter.search.js
+$twitterJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.twitter.search.js";
+$a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $twitterJS);
+
 //js scripts
+
+//check if community_home-plugin is activated and change css
+$nametocheck = "communityhome";
+$r = q("select id from addon where name = '%s' and installed = 1", dbesc($nametocheck));
+if(count($r) == "1") {
+       
+$a->page['htmlhead'] .= '
+<script>
+$(document).ready(function() {
+       $("div#login-submit-wrapper").attr("style","padding-top: 120px;");
+       });
+</script>';    
+}
+
 //comment-edit-wrapper on photo_view
 if ($a->argv[0].$a->argv[2] === "photos"."image"){
 
@@ -307,18 +361,31 @@ $a->page['htmlhead'] .= '
                        
                        });
     </script>';
-       
 }
 
 $a->page['htmlhead'] .= '
 
 <script>
+
  $(function() {
        $("a.lightbox").fancybox(); // Select all links with lightbox class
+       $("#twitter").twitterSearch({               
+       term: "friendica",
+       animInSpeed: 250,
+       bird:    false, 
+       avatar:  false, 
+       colorExterior: "#fff",
+       title: "Last Tweets",
+       timeout: 10000          });
  });
    
+$(window).load(function() {
+       var footer_top = $(document).height() - 30;
+       $("div#footerbox").attr("style", "border-top: 1px solid #D2D2D2; width: 70%;right: 15%;position: absolute;top:"+footer_top+"px;");
+ });
  </script>';
  
 $a->page['htmlhead'] .= '
 
 <script type="text/javascript">
@@ -343,22 +410,71 @@ $(document).ready(function() {
             $(this).attr("src",newString+"?"+wmode+"&"+oldString);
         }
         else $(this).attr("src",ifr_source+"?"+wmode);
+       
     });
       
-
 });
 
 function yt_iframe() {
-       
+
        $("iframe").load(function() { 
        var ifr_src = $(this).contents().find("body iframe").attr("src");
        $("iframe").contents().find("body iframe").attr("src", ifr_src+"&wmode=transparent");
     });
 
        };
+
+function scrolldown(){
+                       $("html, body").animate({scrollTop:$(document).height()}, "slow");
+                       return false;
+               };
+               
+function scrolltop(){
+                       $("html, body").animate({scrollTop:0}, "slow");
+                       return false;
+               };
+               
+$(window).scroll(function () { 
+               
+               var footer_top = $(document).height() - 30;
+               $("div#footerbox").css("top", footer_top);
+       
+               var scrollInfo = $(window).scrollTop();      
+               
+               if (scrollInfo <= "900"){
+      $("a#top").attr("id","down");
+      $("a#down").attr("onclick","scrolldown()");
+               $("img#scroll_top_bottom").attr("src","view/theme/diabook/icons/scroll_bottom.png");
+               } 
+                   
+      if (scrollInfo > "900"){
+      $("a#down").attr("id","top");
+      $("a#top").attr("onclick","scrolltop()");
+               $("img#scroll_top_bottom").attr("src","view/theme/diabook/icons/scroll_top.png");
+               }
+               
+    });
   
  </script>';
  
+if($a->argv[0] === "settings" && local_user()) {
+$a->page['htmlhead'] .= ' 
+<script>
+function restore_boxes(){
+       $.cookie("close_pages","2", { expires: 365, path: "/" });
+       $.cookie("close_helpers","2", { expires: 365, path: "/" });
+       $.cookie("close_profiles","2", { expires: 365, path: "/" });
+       $.cookie("close_services","2", { expires: 365, path: "/" });
+       $.cookie("close_friends","2", { expires: 365, path: "/" });
+       $.cookie("close_twitter","2", { expires: 365, path: "/" });
+       $.cookie("close_lastusers","2", { expires: 365, path: "/" });
+       $.cookie("close_lastphotos","2", { expires: 365, path: "/" });
+       $.cookie("close_lastlikes","2", { expires: 365, path: "/" });
+       alert("Right-hand column was restored. Please refresh your browser");
+  }
+</script>';}
+
+
 
 if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname'] or $a->argv[0] === "network" && local_user()){
 $a->page['htmlhead'] .= '
@@ -370,7 +486,7 @@ $a->page['htmlhead'] .= '
 </script>';
 
 
-       if($ccCookie != "7") {
+       if($ccCookie != "9") {
 $a->page['htmlhead'] .= '
 <script>
 $("right_aside").ready(function(){
@@ -379,6 +495,11 @@ $("right_aside").ready(function(){
                {
                document.getElementById( "close_pages" ).style.display = "none";
                        };
+                       
+       if($.cookie("close_profiles") == "1") 
+               {
+               document.getElementById( "close_profiles" ).style.display = "none";
+                       };
        
        if($.cookie("close_helpers") == "1") 
                {
@@ -395,6 +516,10 @@ $("right_aside").ready(function(){
                document.getElementById( "close_friends" ).style.display = "none";
                        };
        
+       if($.cookie("close_twitter") == "1") 
+               {
+               document.getElementById( "twitter" ).style.display = "none";
+                       };      
                        
        if($.cookie("close_lastusers") == "1") 
                {
@@ -418,6 +543,11 @@ function close_pages(){
  $.cookie("close_pages","1", { expires: 365, path: "/" });
  };
  
+function close_profiles(){
+ document.getElementById( "close_profiles" ).style.display = "none";
+ $.cookie("close_profiles","1", { expires: 365, path: "/" });
+ };
 function close_helpers(){
  document.getElementById( "close_helpers" ).style.display = "none";
   $.cookie("close_helpers","1", { expires: 365, path: "/" });
@@ -432,7 +562,11 @@ function close_friends(){
  document.getElementById( "close_friends" ).style.display = "none";
  $.cookie("close_friends","1", { expires: 365, path: "/" });
  };
-
+function close_twitter(){
+ document.getElementById( "twitter" ).style.display = "none";
+ $.cookie("close_twitter","1", { expires: 365, path: "/" });
+ };
  
 function close_lastusers(){
  document.getElementById( "close_lastusers" ).style.display = "none";
@@ -448,22 +582,7 @@ function close_lastlikes(){
  document.getElementById( "close_lastlikes" ).style.display = "none";
  $.cookie("close_lastlikes","1", { expires: 365, path: "/" });
  };
-</script>';}
-
-$a->page['htmlhead'] .= ' 
-<script>
-function restore_boxes(){
-       $.cookie("close_pages","2", { expires: 365, path: "/" });
-       $.cookie("close_helpers","2", { expires: 365, path: "/" });
-       $.cookie("close_services","2", { expires: 365, path: "/" });
-       $.cookie("close_friends","2", { expires: 365, path: "/" });
-       $.cookie("close_lastusers","2", { expires: 365, path: "/" });
-       $.cookie("close_lastphotos","2", { expires: 365, path: "/" });
-       $.cookie("close_lastlikes","2", { expires: 365, path: "/" });
-       alert("Right-hand column was restored. Please refresh your browser");
-  }
-</script>';}
-
+</script>';}}
 
 $a->page['htmlhead'] .= ' 
 
@@ -496,4 +615,12 @@ function insertFormatting(comment,BBcode,id) {
        }
        return true;
 }
+
+function cmtBbOpen(id) {
+       $(".comment-edit-bb-" + id).show();
+}
+function cmtBbClose(id) {
+       $(".comment-edit-bb-" + id).hide();
+}
+
 </script> ';
\ No newline at end of file