+ // USER MENU
+ if(local_user()) {
+
+ $r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
+
+ $userinfo = array(
+ 'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl()."/images/default-profile-mm.jpg"),
+ 'name' => $a->user['username'],
+ );
+ $ps = array('usermenu'=>array());
+ $ps['usermenu']['status'] = Array('profile/' . $a->user['nickname'], t('Home'), "", t('Your posts and conversations'));
+ $ps['usermenu']['profile'] = Array('profile/' . $a->user['nickname']. '?tab=profile', t('Profile'), "", t('Your profile page'));
+ $ps['usermenu']['contacts'] = Array('contacts' , t('Contacts'), "", t('Your contacts'));
+ $ps['usermenu']['photos'] = Array('photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos'));
+ $ps['usermenu']['events'] = Array('events/', t('Events'), "", t('Your events'));
+ $ps['usermenu']['notes'] = Array('notes/', t('Personal notes'), "", t('Your personal photos'));
+ $ps['usermenu']['community'] = Array('community/', t('Community'), "", "");
+ $ps['usermenu']['pgroups'] = Array('http://dir.friendica.com/directory/forum', t('Community Pages'), "", "");
+
+ $tpl = get_markup_template('profile_side.tpl');
+
+ $a->page['aside'] = replace_macros($tpl, array(
+ '$userinfo' => $userinfo,
+ '$ps' => $ps,
+ )).$a->page['aside'];
+
+ }
+
+ $ccCookie = $_COOKIE['close_pages'] + $_COOKIE['close_mapquery'] + $_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 != "10") {
+ // COMMUNITY
+ diabook_community_info();
+
+ // CUSTOM 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";}
+ }
+ }
+
+
+
+ //right_aside at profile pages
+ if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname']){
+ if($ccCookie != "10") {
+ // COMMUNITY
+ diabook_community_info();
+
+ // CUSTOM 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";}
+
+ }
+ }
+
+ //js scripts
+ //load jquery.cookie.js
+ $cookieJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.cookie.js";
+ $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s"></script>', $cookieJS);
+
+ //load jquery.ae.image.resize.js
+ $imageresizeJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.ae.image.resize.js";
+ $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $imageresizeJS);
+
+ //load jquery.ui.js
+ if($ccCookie != "9") {
+ $jqueryuiJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery-ui-1.8.20.custom.min.js";
+ $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $jqueryuiJS);
+ }
+
+ //load jquery.twitter.search.js
+ if($_COOKIE['close_twitter'] != "1") {
+ $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);
+ }
+
+ //load jquery.mapquery.js
+ $_COOKIE['close_mapquery'] = "1";
+ if($_COOKIE['close_mapquery'] != "1") {
+ $mqtmplJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.tmpl.js";
+ $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mqtmplJS);
+ $mapqueryJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mapquery.core.js";
+ $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mapqueryJS);
+ $openlayersJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/OpenLayers.js";
+ $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $openlayersJS);
+ $mqmouseposJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mapquery.mqMousePosition.js";
+ $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mqmouseposJS);
+ $mqzoomsliderJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mapquery.mqZoomSlider.js";
+ $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mqzoomsliderJS);
+
+ }
+
+ $a->page['htmlhead'] .= '
+ <script>
+
+ $(function() {
+ $("a.lightbox").fancybox(); // Select all links with lightbox class
+ $("a.#twittersettings-link").fancybox({onClosed: function() { $("#twittersettings").attr("style","display: none;");}} );
+ $("a.#mapcontrol-link").fancybox({onClosed: function() { $("#mapcontrol").attr("style","display: none;");}} );
+ });
+
+ $(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>';
+ //check if mapquerybox is active and print
+ $_COOKIE['close_mapquery'] = "1";
+ if($_COOKIE['close_mapquery'] != "1") {
+ $a->page['htmlhead'] .= '
+ <script>
+
+ $(document).ready(function() {
+ $("#map").mapQuery({
+ layers:[{ //add layers to your map; you need to define at least one to be able to see anything on the map
+ type:"osm" //add a layer of the type osm (OpenStreetMap)
+ }],
+ center:({zoom:8,position:[11.7,52.2]}),
+ });
+
+ });
+
+ function open_mapcontrol() {
+ $("div#mapcontrol").attr("style","display: block;width:900px;height:600px;");
+ $("#map2").mapQuery({layers:[{type:"osm"}],
+ center:({zoom:8,position:[11.7,52.2]})});
+
+ $("#mouseposition").mqMousePosition({
+ map: "#map2",
+ x:"lon",
+ y:"lat",
+ precision:2
+ });
+
+
+ map = $("#map2").mapQuery().data("mapQuery");
+ alert(map.center().zoom);
+
+
+ };
+ </script>';
+ }
+ //check if twitterbox is active and print
+ if($_COOKIE['close_twitter'] != "1") {
+ $TSearchTerm=false;
+ $site_TSearchTerm = get_config("diabook", "TSearchTerm" );
+ $TSearchTerm = get_pconfig(local_user(), "diabook", "TSearchTerm");
+ if ($TSearchTerm===false) $TSearchTerm=$site_TSearchTerm;
+ if ($TSearchTerm===false) $TSearchTerm="friendica";
+ $a->page['htmlhead'] .= '
+ <script>
+ $(function() {
+ $("#twitter").twitterSearch({
+ term: "'.$TSearchTerm.'",
+ animInSpeed: 250,
+ bird: false,
+ avatar: false,
+ colorExterior: "#fff",
+ timeout: 10000 });
+ });
+ function open_twittersettings() {
+ $("div#twittersettings").attr("style","display: block;");
+ };
+ </script>';}
+
+ //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"){
+ $a->page['htmlhead'] .= '
+ <script>
+ $(function(){
+ $(".comment-edit-form").css("display","table");
+ });
+ </script>';
+ }
+ //restore right hand col at settingspage
+ if($a->argv[0] === "settings" && local_user()) {
+ $a->page['htmlhead'] .= '
+ <script>
+ function restore_boxes(){
+ $.cookie("close_pages","2", { expires: 365, path: "/" });
+ $.cookie("close_mapquery","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: "/" });
+ $.cookie("Boxorder",null, { 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'] .= '
+ <script>
+
+ $(function() {
+ $(".oembed.photo img").aeImageResize({height: 400, width: 400});
+ });
+ </script>';
+
+ if($ccCookie != "9") {
+ $a->page['htmlhead'] .= '
+ <script>
+ $("right_aside").ready(function(){
+
+ if($.cookie("close_pages") == "1")
+ {
+ document.getElementById( "close_pages" ).style.display = "none";
+ };
+
+ if($.cookie("close_mapquery") == "1")
+ {
+ document.getElementById( "close_mapquery" ).style.display = "none";
+ };
+
+ if($.cookie("close_profiles") == "1")
+ {
+ document.getElementById( "close_profiles" ).style.display = "none";
+ };
+
+ if($.cookie("close_helpers") == "1")
+ {
+ document.getElementById( "close_helpers" ).style.display = "none";
+ };
+
+ if($.cookie("close_services") == "1")
+ {
+ document.getElementById( "close_services" ).style.display = "none";
+ };
+
+ if($.cookie("close_friends") == "1")
+ {
+ document.getElementById( "close_friends" ).style.display = "none";
+ };
+
+ if($.cookie("close_twitter") == "1")
+ {
+ document.getElementById( "close_twitter" ).style.display = "none";
+ };
+
+ if($.cookie("close_lastusers") == "1")
+ {
+ document.getElementById( "close_lastusers" ).style.display = "none";
+ };
+
+ if($.cookie("close_lastphotos") == "1")
+ {
+ document.getElementById( "close_lastphotos" ).style.display = "none";
+ };
+
+ if($.cookie("close_lastlikes") == "1")
+ {
+ document.getElementById( "close_lastlikes" ).style.display = "none";
+ };}