Merge pull request #514 from hmeine/master

Cleanups in diabook theme code
This commit is contained in:
Thomas Willingham 2012-10-16 09:05:50 -07:00
commit 2940f25df9
2 changed files with 209 additions and 362 deletions

View file

@ -142,46 +142,8 @@ function diabook_form(&$a, $font_size, $line_height, $resolution, $color, $TSear
'red'=>'red',
'dark'=>'dark',
);
$close_pagesC = array(
'0'=>'show',
'1'=>'hide',
);
$close_mapqueryC = array(
'0'=>'show',
'1'=>'hide',
);
$close_profilesC = array(
'0'=>'show',
'1'=>'hide',
);
$close_helpersC = array(
'0'=>'show',
'1'=>'hide',
);
$close_servicesC = array(
'0'=>'show',
'1'=>'hide',
);
$close_friendsC = array(
'0'=>'show',
'1'=>'hide',
);
$close_twitterC = array(
'0'=>'show',
'1'=>'hide',
);
$close_lastusersC = array(
'0'=>'show',
'1'=>'hide',
);
$close_lastphotosC = array(
'0'=>'show',
'1'=>'hide',
);
$close_lastlikesC = array(
'0'=>'show',
'1'=>'hide',
);
$close_or_not = array('1'=>t("don't show"), '0'=>t("show"),);
@ -198,16 +160,16 @@ function diabook_form(&$a, $font_size, $line_height, $resolution, $color, $TSear
'$ELZoom' => array('diabook_ELZoom', t('Set zoomfactor for Earth Layer'), $ELZoom, '', $ELZoom),
'$ELPosX' => array('diabook_ELPosX', t('Set longitude (X) for Earth Layers'), $ELPosX, '', $ELPosX),
'$ELPosY' => array('diabook_ELPosY', t('Set latitude (Y) for Earth Layers'), $ELPosY, '', $ELPosY),
'$close_pages' => array('diabook_close_pages', t('Community Pages'), $close_pages, '', $close_pagesC),
'$close_mapquery' => array('diabook_close_mapquery', t('Earth Layers'), $close_mapquery, '', $close_mapqueryC),
'$close_profiles' => array('diabook_close_profiles', t('Community Profiles'), $close_profiles, '', $close_profilesC),
'$close_helpers' => array('diabook_close_helpers', t('Help or @NewHere ?'), $close_helpers, '', $close_helpersC),
'$close_services' => array('diabook_close_services', t('Connect Services'), $close_services, '', $close_servicesC),
'$close_friends' => array('diabook_close_friends', t('Find Friends'), $close_friends, '', $close_friendsC),
'$close_twitter' => array('diabook_close_twitter', t('Last tweets'), $close_twitter, '', $close_twitterC),
'$close_lastusers' => array('diabook_close_lastusers', t('Last users'), $close_lastusers, '', $close_lastusersC),
'$close_lastphotos' => array('diabook_close_lastphotos', t('Last photos'), $close_lastphotos, '', $close_lastphotosC),
'$close_lastlikes' => array('diabook_close_lastlikes', t('Last likes'), $close_lastlikes, '', $close_lastlikesC),
'$close_pages' => array('diabook_close_pages', t('Community Pages'), $close_pages, '', $close_or_not),
'$close_mapquery' => array('diabook_close_mapquery', t('Earth Layers'), $close_mapquery, '', $close_or_not),
'$close_profiles' => array('diabook_close_profiles', t('Community Profiles'), $close_profiles, '', $close_or_not),
'$close_helpers' => array('diabook_close_helpers', t('Help or @NewHere ?'), $close_helpers, '', $close_or_not),
'$close_services' => array('diabook_close_services', t('Connect Services'), $close_services, '', $close_or_not),
'$close_friends' => array('diabook_close_friends', t('Find Friends'), $close_friends, '', $close_or_not),
'$close_twitter' => array('diabook_close_twitter', t('Last tweets'), $close_twitter, '', $close_or_not),
'$close_lastusers' => array('diabook_close_lastusers', t('Last users'), $close_lastusers, '', $close_or_not),
'$close_lastphotos' => array('diabook_close_lastphotos', t('Last photos'), $close_lastphotos, '', $close_or_not),
'$close_lastlikes' => array('diabook_close_lastlikes', t('Last likes'), $close_lastlikes, '', $close_or_not),
));
return $o;
}

View file

@ -9,6 +9,19 @@
$a = get_app();
function get_diabook_config($key, $default = false) {
if (local_user()) {
$result = get_pconfig(local_user(), "diabook", $key);
if ($result !== false)
return $result;
}
$result = get_config("diabook", $key);
if ($result !== false)
return $result;
return $default;
}
function diabook_init(&$a) {
@ -24,65 +37,16 @@ load_config("diabook");
load_pconfig(local_user(), "diabook");
//get statuses of boxes at right-hand-column
$close_pages = false;
$site_close_pages = get_config("diabook", "close_pages" );
if (local_user()) {$close_pages = get_pconfig(local_user(), "diabook", "close_pages");}
if ($close_pages===false) $close_pages=$site_close_pages;
if ($close_pages===false) $close_pages="1";
$close_profiles = false;
$site_close_profiles = get_config("diabook", "close_profiles" );
if (local_user()) {$close_profiles = get_pconfig(local_user(), "diabook", "close_profiles");}
if ($close_profiles===false) $close_profiles=$site_close_profiles;
if ($close_profiles===false) $close_profiles="0";
$close_helpers = false;
$site_close_helpers = get_config("diabook", "close_helpers" );
if (local_user()) {$close_helpers = get_pconfig(local_user(), "diabook", "close_helpers");}
if ($close_helpers===false) $close_helpers=$site_close_helpers;
if ($close_helpers===false) $close_helpers="0";
$close_services = false;
$site_close_services = get_config("diabook", "close_services" );
if (local_user()) {$close_services = get_pconfig(local_user(), "diabook", "close_services");}
if ($close_services===false) $close_services=$site_close_services;
if ($close_services===false) $close_services="0";
$close_friends = false;
$site_close_friends = get_config("diabook", "close_friends" );
if (local_user()) {$close_friends = get_pconfig(local_user(), "diabook", "close_friends");}
if ($close_friends===false) $close_friends=$site_close_friends;
if ($close_friends===false) $close_friends="0";
$close_lastusers = false;
$site_close_lastusers = get_config("diabook", "close_lastusers" );
if (local_user()) {$close_lastusers = get_pconfig(local_user(), "diabook", "close_lastusers");}
if ($close_lastusers===false) $close_lastusers=$site_close_lastusers;
if ($close_lastusers===false) $close_lastusers="0";
$close_lastphotos = false;
$site_close_lastphotos = get_config("diabook", "close_lastphotos" );
if (local_user()) {$close_lastphotos = get_pconfig(local_user(), "diabook", "close_lastphotos");}
if ($close_lastphotos===false) $close_lastphotos=$site_close_lastphotos;
if ($close_lastphotos===false) $close_lastphotos="0";
$close_lastlikes = false;
$site_close_lastlikes = get_config("diabook", "close_lastlikes" );
if (local_user()) {$close_lastlikes = get_pconfig(local_user(), "diabook", "close_lastlikes");}
if ($close_lastlikes===false) $close_lastlikes=$site_close_lastlikes;
if ($close_lastlikes===false) $close_lastlikes="0";
$close_twitter = false;
$site_close_twitter = get_config("diabook", "close_twitter" );
if (local_user()) {$close_twitter = get_pconfig(local_user(), "diabook", "close_twitter");}
if ($close_twitter===false) $close_twitter=$site_close_twitter;
if ($close_twitter===false) $close_twitter="1";
$close_mapquery = false;
$site_close_mapquery = get_config("diabook", "close_mapquery" );
if (local_user()) {$close_mapquery = get_pconfig(local_user(), "diabook", "close_mapquery");}
if ($close_mapquery===false) $close_mapquery=$site_close_mapquery;
if ($close_mapquery===false) $close_mapquery="1";
$close_pages = get_diabook_config( "close_pages", 1 );
$close_profiles = get_diabook_config( "close_profiles", 0 );
$close_helpers = get_diabook_config( "close_helpers", 0 );
$close_services = get_diabook_config( "close_services", 0 );
$close_friends = get_diabook_config( "close_friends", 0 );
$close_lastusers = get_diabook_config( "close_lastusers", 0 );
$close_lastphotos = get_diabook_config( "close_lastphotos", 0 );
$close_lastlikes = get_diabook_config( "close_lastlikes", 0 );
$close_twitter = get_diabook_config( "close_twitter", 1 );
$close_mapquery = get_diabook_config( "close_mapquery", 1 );
//get resolution (wide/normal)
$resolution=false;
@ -96,11 +60,7 @@ if ($resolution=="wide") {
$a->page['htmlhead'] .= '<meta name="viewport" content="width=980" />';
}
//get colour-scheme
$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";
$color = get_diabook_config( "color", "diabook" );
if ($color=="diabook") $color_path = "/";
if ($color=="aerith") $color_path = "/diabook-aerith/";
@ -223,21 +183,9 @@ if ($color=="dark") $color_path = "/diabook-dark/";
//check if mapquerybox is active and print
if($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";
$ELZoom = get_diabook_config( "ELZoom", 0 );
$ELPosX = get_diabook_config( "ELPosX", 0);
$ELPosY = get_diabook_config( "ELPosY", 0);
$a->page['htmlhead'] .= '
<script>
@ -288,11 +236,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
}
//check if twitterbox is active and print
if($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";
$TSearchTerm = get_diabook_config( "TSearchTerm", "friendica" );
$a->page['htmlhead'] .= '
<script>
$(function() {
@ -424,66 +368,16 @@ if ($color=="dark") $color_path = "/diabook-dark/";
function diabook_community_info() {
$a = get_app();
$close_pages = false;
$site_close_pages = get_config("diabook", "close_pages" );
if (local_user()) {$close_pages = get_pconfig(local_user(), "diabook", "close_pages");}
if ($close_pages===false) $close_pages=$site_close_pages;
if ($close_pages===false) $close_pages="1";
$close_profiles = false;
$site_close_profiles = get_config("diabook", "close_profiles" );
if (local_user()) {$close_profiles = get_pconfig(local_user(), "diabook", "close_profiles");}
if ($close_profiles===false) $close_profiles=$site_close_profiles;
if ($close_profiles===false) $close_profiles="0";
$close_helpers = false;
$site_close_helpers = get_config("diabook", "close_helpers" );
if (local_user()) {$close_helpers = get_pconfig(local_user(), "diabook", "close_helpers");}
if ($close_helpers===false) $close_helpers=$site_close_helpers;
if ($close_helpers===false) $close_helpers="0";
$close_services = false;
$site_close_services = get_config("diabook", "close_services" );
if (local_user()) {$close_services = get_pconfig(local_user(), "diabook", "close_services");}
if ($close_services===false) $close_services=$site_close_services;
if ($close_services===false) $close_services="0";
$close_friends = false;
$site_close_friends = get_config("diabook", "close_friends" );
if (local_user()) {$close_friends = get_pconfig(local_user(), "diabook", "close_friends");}
if ($close_friends===false) $close_friends=$site_close_friends;
if ($close_friends===false) $close_friends="0";
$close_lastusers = false;
$site_close_lastusers = get_config("diabook", "close_lastusers" );
if (local_user()) {$close_lastusers = get_pconfig(local_user(), "diabook", "close_lastusers");}
if ($close_lastusers===false) $close_lastusers=$site_close_lastusers;
if ($close_lastusers===false) $close_lastusers="0";
$close_lastphotos = false;
$site_close_lastphotos = get_config("diabook", "close_lastphotos" );
if (local_user()) {$close_lastphotos = get_pconfig(local_user(), "diabook", "close_lastphotos");}
if ($close_lastphotos===false) $close_lastphotos=$site_close_lastphotos;
if ($close_lastphotos===false) $close_lastphotos="0";
$close_lastlikes = false;
$site_close_lastlikes = get_config("diabook", "close_lastlikes" );
if (local_user()) {$close_lastlikes = get_pconfig(local_user(), "diabook", "close_lastlikes");}
if ($close_lastlikes===false) $close_lastlikes=$site_close_lastlikes;
if ($close_lastlikes===false) $close_lastlikes="0";
$close_twitter = false;
$site_close_twitter = get_config("diabook", "close_twitter" );
if (local_user()) {$close_twitter = get_pconfig(local_user(), "diabook", "close_twitter");}
if ($close_twitter===false) $close_twitter=$site_close_twitter;
if ($close_twitter===false) $close_twitter="1";
$close_mapquery = false;
$site_close_mapquery = get_config("diabook", "close_mapquery" );
if (local_user()) {$close_mapquery = get_pconfig(local_user(), "diabook", "close_mapquery");}
if ($close_mapquery===false) $close_mapquery=$site_close_mapquery;
if ($close_mapquery===false) $close_mapquery="1";
$close_pages = get_diabook_config( "close_pages", 1 );
$close_profiles = get_diabook_config( "close_profiles", 0 );
$close_helpers = get_diabook_config( "close_helpers", 0 );
$close_services = get_diabook_config( "close_services", 0 );
$close_friends = get_diabook_config( "close_friends", 0 );
$close_lastusers = get_diabook_config( "close_lastusers", 0 );
$close_lastphotos = get_diabook_config( "close_lastphotos", 0 );
$close_lastlikes = get_diabook_config( "close_lastlikes", 0 );
$close_twitter = get_diabook_config( "close_twitter", 1 );
$close_mapquery = get_diabook_config( "close_mapquery", 1 );
// comunity_profiles
if($close_profiles != "1") {
@ -722,38 +616,29 @@ if ($color=="dark") $color_path = "/diabook-dark/";
}
//end twitter
if($ccCookie != "10") {
$close_pages = get_pconfig(local_user(), 'diabook', 'close_pages' );
$close_mapquery = get_pconfig(local_user(), 'diabook', 'close_mapquery' );
$close_profiles = get_pconfig(local_user(), 'diabook', 'close_profiles' );
$close_helpers = get_pconfig(local_user(), 'diabook', 'close_helpers' );
$close_services = get_pconfig(local_user(), 'diabook', 'close_services' );
$close_friends = get_pconfig(local_user(), 'diabook', 'close_friends' );
$close_twitter = get_pconfig(local_user(), 'diabook', 'close_twitter' );
$close_lastusers = get_pconfig(local_user(), 'diabook', 'close_lastusers' );
$close_lastphotos = get_pconfig(local_user(), 'diabook', 'close_lastphotos' );
$close_lastlikes = get_pconfig(local_user(), 'diabook', 'close_lastlikes' );
$close_pagesC = array('1'=>t("don't show"), '0'=>t("show"),);
$close_mapqueryC = array('1'=>t("don't show"), '0'=>t("show"),);
$close_profilesC = array('1'=>t("don't show"), '0'=>t("show"),);
$close_helpersC = array('1'=>t("don't show"), '0'=>t("show"),);
$close_servicesC = array('1'=>t("don't show"), '0'=>t("show"),);
$close_friendsC = array('1'=>t("don't show"), '0'=>t("show"),);
$close_twitterC = array('1'=>t("don't show"), '0'=>t("show"),);
$close_lastusersC = array('1'=>t("don't show"), '0'=>t("show"),);
$close_lastphotosC = array('1'=>t("don't show"), '0'=>t("show"),);
$close_lastlikesC = array('1'=>t("don't show"), '0'=>t("show"),);
$close_pages = get_diabook_config( "close_pages", 1 );
$close_profiles = get_diabook_config( "close_profiles", 0 );
$close_helpers = get_diabook_config( "close_helpers", 0 );
$close_services = get_diabook_config( "close_services", 0 );
$close_friends = get_diabook_config( "close_friends", 0 );
$close_lastusers = get_diabook_config( "close_lastusers", 0 );
$close_lastphotos = get_diabook_config( "close_lastphotos", 0 );
$close_lastlikes = get_diabook_config( "close_lastlikes", 0 );
$close_twitter = get_diabook_config( "close_twitter", 1 );
$close_mapquery = get_diabook_config( "close_mapquery", 1 );
$close_or_not = array('1'=>t("don't show"), '0'=>t("show"),);
$boxsettings['title'] = Array("", t('Show/hide boxes at right-hand column:'), "", "");
$aside['$boxsettings'] = $boxsettings;
$aside['$close_pages'] = array('diabook_close_pages', t('Community Pages'), $close_pages, '', $close_pagesC);
$aside['$close_mapquery'] = array('diabook_close_mapquery', t('Earth Layers'), $close_mapquery, '', $close_mapqueryC);
$aside['$close_profiles'] = array('diabook_close_profiles', t('Community Profiles'), $close_profiles, '', $close_profilesC);
$aside['$close_helpers'] = array('diabook_close_helpers', t('Help or @NewHere ?'), $close_helpers, '', $close_helpersC);
$aside['$close_services'] = array('diabook_close_services', t('Connect Services'), $close_services, '', $close_servicesC);
$aside['$close_friends'] = array('diabook_close_friends', t('Find Friends'), $close_friends, '', $close_friendsC);
$aside['$close_twitter'] = array('diabook_close_twitter', t('Last Tweets'), $close_twitter, '', $close_twitterC);
$aside['$close_lastusers'] = array('diabook_close_lastusers', t('Last users'), $close_lastusers, '', $close_lastusersC);
$aside['$close_lastphotos'] = array('diabook_close_lastphotos', t('Last photos'), $close_lastphotos, '', $close_lastphotosC);
$aside['$close_lastlikes'] = array('diabook_close_lastlikes', t('Last likes'), $close_lastlikes, '', $close_lastlikesC);
$aside['$close_pages'] = array('diabook_close_pages', t('Community Pages'), $close_pages, '', $close_or_not);
$aside['$close_mapquery'] = array('diabook_close_mapquery', t('Earth Layers'), $close_mapquery, '', $close_or_not);
$aside['$close_profiles'] = array('diabook_close_profiles', t('Community Profiles'), $close_profiles, '', $close_or_not);
$aside['$close_helpers'] = array('diabook_close_helpers', t('Help or @NewHere ?'), $close_helpers, '', $close_or_not);
$aside['$close_services'] = array('diabook_close_services', t('Connect Services'), $close_services, '', $close_or_not);
$aside['$close_friends'] = array('diabook_close_friends', t('Find Friends'), $close_friends, '', $close_or_not);
$aside['$close_twitter'] = array('diabook_close_twitter', t('Last Tweets'), $close_twitter, '', $close_or_not);
$aside['$close_lastusers'] = array('diabook_close_lastusers', t('Last users'), $close_lastusers, '', $close_or_not);
$aside['$close_lastphotos'] = array('diabook_close_lastphotos', t('Last photos'), $close_lastphotos, '', $close_or_not);
$aside['$close_lastlikes'] = array('diabook_close_lastlikes', t('Last likes'), $close_lastlikes, '', $close_or_not);
$aside['$sub'] = t('Submit');
$baseurl = $a->get_baseurl($ssl_state);
$aside['$baseurl'] = $baseurl;