aboutsummaryrefslogtreecommitdiffstats
path: root/view/theme/diabook/theme.php
diff options
context:
space:
mode:
Diffstat (limited to 'view/theme/diabook/theme.php')
-rwxr-xr-xview/theme/diabook/theme.php190
1 files changed, 154 insertions, 36 deletions
diff --git a/view/theme/diabook/theme.php b/view/theme/diabook/theme.php
index f8fdeb8b1..a6b58e103 100755
--- a/view/theme/diabook/theme.php
+++ b/view/theme/diabook/theme.php
@@ -3,21 +3,18 @@
/*
* 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.025)
+ * Version: (Version: 1.026)
* Author:
*/
$a = get_app();
-$a->theme_info = array(
- 'family' => 'diabook',
- 'version' => '1.025'
-);
+
function diabook_init(&$a) {
//print diabook-version for debugging
-$diabook_version = "Diabook (Version: 1.025)";
-$a->page['htmlhead'] .= sprintf('<script "%s" ></script>', $diabook_version);
+$diabook_version = "Diabook (Version: 1.026)";
+$a->page['htmlhead'] .= sprintf('<META NAME="theme" CONTENT="%s"/>', $diabook_version);
//change css on network and profilepages
$cssFile = null;
@@ -48,7 +45,7 @@ if ($color=="pink") $color_path = "/diabook-pink/";
if ($color=="green") $color_path = "/diabook-green/";
if ($color=="dark") $color_path = "/diabook-dark/";
-
+
//profile_side at networkpages
if ($a->argv[0] === "network" && local_user()){
@@ -80,9 +77,9 @@ if ($color=="dark") $color_path = "/diabook-dark/";
}
- $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'];
+ $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 != "9") {
+ if($ccCookie != "10") {
// COMMUNITY
diabook_community_info();
@@ -96,7 +93,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
//right_aside at profile pages
if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname']){
- if($ccCookie != "9") {
+ if($ccCookie != "10") {
// COMMUNITY
diabook_community_info();
@@ -117,7 +114,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
$a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $imageresizeJS);
//load jquery.ui.js
- if($ccCookie != "9") {
+ if($ccCookie != "10") {
$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);
}
@@ -128,36 +125,113 @@ if ($color=="dark") $color_path = "/diabook-dark/";
$a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $twitterJS);
}
+ //load jquery.mapquery.js
+
+ 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);
+ $mousewheelJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mousewheel.js";
+ $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mousewheelJS);
+
+ }
+
$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
+
+ if($_COOKIE['close_mapquery'] != "1") {
+ $ELZoom=false;
+ $ELPosX=false;
+ $ELPosy=false;
+ $site_ELZoom = get_config("diabook", "ELZoom" );
+ $site_ELPosX = get_config("diabook", "ELPosX" );
+ $site_ELPosY = get_config("diabook", "ELPosY" );
+ $ELZoom = get_pconfig(local_user(), "diabook", "ELZoom");
+ $ELPosX = get_pconfig(local_user(), "diabook", "ELPosX");
+ $ELPosY = get_pconfig(local_user(), "diabook", "ELPosY");
+ if ($ELZoom===false) $ELZoom=$site_ELZoom;
+ if ($ELPosX===false) $ELPosX=$site_ELPosX;
+ if ($ELPosY===false) $ELPosY=$site_ELPosY;
+ if ($ELZoom===false) $ELZoom="0";
+ if ($ELPosX===false) $ELPosX="0";
+ if ($ELPosY===false) $ELPosY="0";
+ $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:'.$ELZoom.',position:['.$ELPosX.','.$ELPosY.']}),
+ });
+
+ });
+
+ function open_mapcontrol() {
+ $("div#mapcontrol").attr("style","display: block;width:900px;height:600px;");
+ $("#map2").mapQuery({layers:[{type:"osm"}],
+ center:({zoom:'.$ELZoom.',position:['.$ELPosX.','.$ELPosY.']})});
+
+ $("#mouseposition").mqMousePosition({
+ map: "#map2",
+ x:"lon",
+ y:"lat",
+ precision:2
+ });
+
+
+ map = $("#map2").mapQuery().data("mapQuery");
+ textarea = document.getElementById("mapzoom");
+
+
+ $("#map2").bind("mousewheel", function(event, delta) {
+ if (delta > 0 || delta < 0){
+ textarea.value = 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: "friendica",
+ term: "'.$TSearchTerm.'",
animInSpeed: 250,
bird: false,
avatar: false,
colorExterior: "#fff",
- title: "Last Tweets",
timeout: 10000 });
});
+ function open_twittersettings() {
+ $("div#twittersettings").attr("style","display: block;");
+ };
</script>';}
//check if community_home-plugin is activated and change css
@@ -169,6 +243,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
<script>
$(document).ready(function() {
$("div#login-submit-wrapper").attr("style","padding-top: 120px;");
+
});
</script>';
}
@@ -187,6 +262,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
<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: "/" });
@@ -209,7 +285,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
});
</script>';
- if($ccCookie != "9") {
+ if($ccCookie != "10") {
$a->page['htmlhead'] .= '
<script>
$("right_aside").ready(function(){
@@ -219,6 +295,11 @@ if ($color=="dark") $color_path = "/diabook-dark/";
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";
@@ -241,7 +322,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
if($.cookie("close_twitter") == "1")
{
- document.getElementById( "twitter" ).style.display = "none";
+ document.getElementById( "close_twitter" ).style.display = "none";
};
if($.cookie("close_lastusers") == "1")
@@ -265,6 +346,11 @@ if ($color=="dark") $color_path = "/diabook-dark/";
document.getElementById( "close_pages" ).style.display = "none";
$.cookie("close_pages","1", { expires: 365, path: "/" });
};
+
+ function close_mapquery(){
+ document.getElementById( "close_mapquery" ).style.display = "none";
+ $.cookie("close_mapquery","1", { expires: 365, path: "/" });
+ };
function close_profiles(){
document.getElementById( "close_profiles" ).style.display = "none";
@@ -287,7 +373,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
};
function close_twitter(){
- document.getElementById( "twitter" ).style.display = "none";
+ document.getElementById( "close_twitter" ).style.display = "none";
$.cookie("close_twitter","1", { expires: 365, path: "/" });
};
@@ -317,7 +403,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
$a->page['footer'] .= replace_macros($tpl, array());
//
- js_in_foot();
+ js_diabook_footer();
}
@@ -325,7 +411,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
$a = get_app();
// comunity_profiles
if($_COOKIE['close_profiles'] != "1") {
- $aside['$comunity_profilest_title'] = t('Community Profiles');
+ $aside['$comunity_profiles_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");
@@ -478,7 +564,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
if($_COOKIE['close_pages'] != "1") {
if(local_user()) {
$page = '
- <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>
+ <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 id=""><ul style="margin-left: 7px;margin-top: 0px;padding-left: 0px;padding-top: 0px;">';
$pagelist = array();
@@ -509,6 +595,30 @@ if ($color=="dark") $color_path = "/diabook-dark/";
}}
//END Community Page
+ //mapquery
+
+ if($_COOKIE['close_mapquery'] != "1") {
+ $mapquery = array();
+ $mapquery['title'] = Array("", "<a id='mapcontrol-link' href='#mapcontrol' style='text-decoration:none;' onclick='open_mapcontrol(); return false;'>".t('Earth Layers')."</a>", "", "");
+ $aside['$mapquery'] = $mapquery;
+ $ELZoom = get_pconfig(local_user(), 'diabook', 'ELZoom' );
+ $ELPosX = get_pconfig(local_user(), 'diabook', 'ELPosX' );
+ $ELPosY = get_pconfig(local_user(), 'diabook', 'ELPosY' );
+ $aside['$sub'] = t('Submit');
+ $aside['$ELZoom'] = array('diabook_ELZoom', t('Set zoomfactor for Earth Layer'), $ELZoom, '', $ELZoom);
+ $aside['$ELPosX'] = array('diabook_ELPosX', t('Set longitude (X) for Earth Layer'), $ELPosX, '', $ELPosX);
+ $aside['$ELPosY'] = array('diabook_ELPosY', t('Set latitude (Y) for Earth Layer'), $ELPosY, '', $ELPosY);
+ $baseurl = $a->get_baseurl($ssl_state);
+ $aside['$baseurl'] = $baseurl;
+ if (isset($_POST['diabook-settings-map-sub']) && $_POST['diabook-settings-map-sub']!=''){
+ set_pconfig(local_user(), 'diabook', 'ELZoom', $_POST['diabook_ELZoom']);
+ set_pconfig(local_user(), 'diabook', 'ELPosX', $_POST['diabook_ELPosX']);
+ set_pconfig(local_user(), 'diabook', 'ELPosY', $_POST['diabook_ELPosY']);
+ header("Location: network");
+ }
+ }
+ //end mapquery
+
//helpers
if($_COOKIE['close_helpers'] != "1") {
$helpers = array();
@@ -523,6 +633,24 @@ if ($color=="dark") $color_path = "/diabook-dark/";
$aside['$con_services'] = $con_services;
}
//end connectable services
+ //twitter
+ if($_COOKIE['close_twitter'] != "1") {
+ $twitter = array();
+ $twitter['title'] = Array("", "<a id='twittersettings-link' href='#twittersettings' style='text-decoration:none;' onclick='open_twittersettings(); return false;'>".t('Last Tweets')."</a>", "", "");
+ $aside['$twitter'] = $twitter;
+ $TSearchTerm = get_pconfig(local_user(), 'diabook', 'TSearchTerm' );
+ $aside['$sub'] = t('Submit');
+ $aside['$TSearchTerm'] = array('diabook_TSearchTerm', t('Set twitter search term'), $TSearchTerm, '', $TSearchTerm);
+ $baseurl = $a->get_baseurl($ssl_state);
+ $aside['$baseurl'] = $baseurl;
+ if (isset($_POST['diabook-settings-sub']) && $_POST['diabook-settings-sub']!=''){
+ set_pconfig(local_user(), 'diabook', 'TSearchTerm', $_POST['diabook_TSearchTerm']);
+ header("Location: network");
+ }
+ }
+ //end twitter
+ $close = t('Close');
+ $aside['$close'] = $close;
//get_baseurl
$url = $a->get_baseurl($ssl_state);
$aside['$url'] = $url;
@@ -532,7 +660,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
}
- function js_in_foot() {
+ function js_diabook_footer() {
/** @purpose insert stuff in bottom of page
*/
$a = get_app();
@@ -542,14 +670,4 @@ if ($color=="dark") $color_path = "/diabook-dark/";
$a->page['footer'] = $a->page['footer'].replace_macros($tpl, $bottom);
}
-
-
-
-
-
-
-
-
-
-
-
+