Browse Source

Merge remote-tracking branch 'refs/remotes/origin/develop' into Issue-#2816-2

pull/2836/head
Hypolite Petovan 5 years ago
parent
commit
645fd414d5
20 changed files with 3969 additions and 3776 deletions
  1. +1
    -0
      database.sql
  2. +1
    -1
      include/Contact.php
  3. +16
    -1
      include/Probe.php
  4. +17
    -0
      include/dbstructure.php
  5. +2
    -1
      include/dfrn.php
  6. +23
    -23
      include/pgettext.php
  7. +1
    -2
      include/salmon.php
  8. +1
    -3
      include/security.php
  9. +30
    -14
      include/socgraph.php
  10. +8
    -6
      mod/admin.php
  11. +13
    -2
      mod/poco.php
  12. +1
    -0
      mod/register.php
  13. +1
    -1
      mod/settings.php
  14. +5
    -0
      view/global.css
  15. +3313
    -3258
      view/lang/de/messages.po
  16. +444
    -431
      view/lang/de/strings.php
  17. +0
    -26
      view/templates/pagetypes.tpl
  18. +71
    -0
      view/templates/settings_pagetypes.tpl
  19. +7
    -5
      view/theme/frio/css/style.css
  20. +14
    -2
      view/theme/frio/templates/profile_advanced.tpl

+ 1
- 0
database.sql View File

@ -328,6 +328,7 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
`gender` varchar(32) NOT NULL DEFAULT '',
`birthday` varchar(32) NOT NULL DEFAULT '0000-00-00',
`community` tinyint(1) NOT NULL DEFAULT 0,
`contact-type` tinyint(1) NOT NULL DEFAULT -1,
`hide` tinyint(1) NOT NULL DEFAULT 0,
`nsfw` tinyint(1) NOT NULL DEFAULT 0,
`network` varchar(255) NOT NULL DEFAULT '',


+ 1
- 1
include/Contact.php View File

@ -223,7 +223,7 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
// Fetch the data from the gcontact table
if (!$r)
$r = q("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`,
`keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, `community` AS `forum`, 0 AS `prv`, `community`, 0 AS `contact-type`, `birthday`, 0 AS `self`
`keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, `community` AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self`
FROM `gcontact` WHERE `nurl` = '%s'",
dbesc(normalise_link($url)));


+ 16
- 1
include/Probe.php View File

@ -180,6 +180,11 @@ class Probe {
$path = str_replace('{uri}', urlencode($uri), $link);
$webfinger = self::webfinger($path);
if (!$webfinger AND (strstr($uri, "@"))) {
$path = str_replace('{uri}', urlencode("acct:".$uri), $link);
$webfinger = self::webfinger($path);
}
}
if (!is_array($webfinger["links"]))
@ -310,6 +315,7 @@ class Probe {
return array("network" => NETWORK_TWITTER);
$lrdd = self::xrd($host);
if (!$lrdd)
return self::mail($uri, $uid);
@ -356,6 +362,12 @@ class Probe {
$path = str_replace('{uri}', urlencode($addr), $link);
$webfinger = self::webfinger($path);
// Mastodon needs to have it with "acct:"
if (!$webfinger) {
$path = str_replace('{uri}', urlencode("acct:".$addr), $link);
$webfinger = self::webfinger($path);
}
// If webfinger wasn't successful then try it with the URL - possibly in the format https://...
if (!$webfinger AND ($uri != $addr)) {
$path = str_replace('{uri}', urlencode($uri), $link);
@ -815,6 +827,9 @@ class Probe {
if (strstr($alias, "@"))
$data["addr"] = str_replace('acct:', '', $alias);
if (is_string($webfinger["subject"]) AND strstr($webfinger["subject"], "@"))
$data["addr"] = str_replace('acct:', '', $webfinger["subject"]);
$pubkey = "";
foreach ($webfinger["links"] AS $link) {
if (($link["rel"] == "http://webfinger.net/rel/profile-page") AND
@ -832,7 +847,7 @@ class Probe {
$pubkey = substr($pubkey, strpos($pubkey, ',') + 1);
else
$pubkey = substr($pubkey, 5);
} else
} elseif (normalise_link($pubkey) == 'http://')
$pubkey = fetch_url($pubkey);
$key = explode(".", $pubkey);


+ 17
- 0
include/dbstructure.php View File

@ -708,6 +708,7 @@ function db_definition($charset) {
"gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
"birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
"community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
"hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
@ -1517,6 +1518,22 @@ function dbstructure_run(&$argv, &$argc) {
return;
case "update":
update_structure(true, true);
$build = get_config('system','build');
if (!x($build)) {
set_config('system','build',DB_UPDATE_VERSION);
$build = DB_UPDATE_VERSION;
}
$stored = intval($build);
$current = intval(DB_UPDATE_VERSION);
// run any left update_nnnn functions in update.php
for($x = $stored; $x < $current; $x ++) {
$r = run_update_function($x);
if (!$r) break;
}
set_config('system','build',DB_UPDATE_VERSION);
return;
case "dumpsql":


+ 2
- 1
include/dfrn.php View File

@ -1147,7 +1147,7 @@ class dfrn {
$author["link"] = $xpath->evaluate($element."/atom:uri/text()", $context)->item(0)->nodeValue;
$r = q("SELECT `id`, `uid`, `url`, `network`, `avatar-date`, `name-date`, `uri-date`, `addr`,
`name`, `nick`, `about`, `location`, `keywords`, `xmpp`, `bdyear`, `bd`, `hidden`
`name`, `nick`, `about`, `location`, `keywords`, `xmpp`, `bdyear`, `bd`, `hidden`, `contact-type`
FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `network` != '%s'",
intval($importer["uid"]), dbesc(normalise_link($author["link"])), dbesc(NETWORK_STATUSNET));
if ($r) {
@ -1336,6 +1336,7 @@ class dfrn {
$poco["generation"] = 2;
$poco["photo"] = $author["avatar"];
$poco["hide"] = $hide;
$poco["contact-type"] = $contact["contact-type"];
update_gcontact($poco);
}


+ 23
- 23
include/pgettext.php View File

@ -1,13 +1,7 @@
<?php
require_once("include/dba.php");
/**
* translation support
*/
/**
* @brief translation support
*
* Get the language setting directly from system variables, bypassing get_config()
* as database may not yet be configured.
@ -16,8 +10,12 @@ require_once("include/dba.php");
*
*/
require_once("include/dba.php");
if(! function_exists('get_browser_language')) {
/**
* @brief get the prefered language from the HTTP_ACCEPT_LANGUAGE header
*/
function get_browser_language() {
if (x($_SERVER,'HTTP_ACCEPT_LANGUAGE')) {
@ -25,32 +23,34 @@ function get_browser_language() {
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i',
$_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
$lang_list = [];
if (count($lang_parse[1])) {
// create a list like "en" => 0.8
$langs = array_combine($lang_parse[1], $lang_parse[4]);
// set default to 1 for any without q factor
foreach ($langs as $lang => $val) {
if ($val === '') $langs[$lang] = 1;
// go through the list of prefered languages and add a generic language
// for sub-linguas (e.g. de-ch will add de) if not already in array
for ($i=0; $i<count($lang_parse[1]); $i++) {
$lang_list[] = strtolower($lang_parse[1][$i]);
if ( strlen($lang_parse[1][$i])>3 ) {
$dashpos = strpos($lang_parse[1][$i], '-');
if (! in_array(substr($lang_parse[1][$i], 0, $dashpos), $lang_list ) ) {
$lang_list[] = strtolower(substr($lang_parse[1][$i], 0, $dashpos));
}
}
}
// sort list based on value
arsort($langs, SORT_NUMERIC);
}
}
if(isset($langs) && count($langs)) {
foreach ($langs as $lang => $v) {
if(file_exists("view/lang/$lang") && is_dir("view/lang/$lang")) {
$preferred = $lang;
break;
}
// check if we have translations for the preferred languages and pick the 1st that has
for ($i=0; $i<count($lang_list); $i++) {
$lang = $lang_list[$i];
if(file_exists("view/lang/$lang") && is_dir("view/lang/$lang")) {
$preferred = $lang;
break;
}
}
if(isset($preferred))
return $preferred;
// in case none matches, get the system wide configured language, or fall back to English
$a = get_app();
return ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en');
}}


+ 1
- 2
include/salmon.php View File

@ -31,8 +31,7 @@ function get_salmon_key($uri,$keyhash) {
$ret[$x] = substr($ret[$x],strpos($ret[$x],',')+1);
else
$ret[$x] = substr($ret[$x],5);
}
else
} elseif (normalise_link($ret[$x]) == 'http://')
$ret[$x] = fetch_url($ret[$x]);
}
}


+ 1
- 3
include/security.php View File

@ -79,11 +79,9 @@ function authenticate_success($user_record, $login_initial = false, $interactive
header('X-Account-Management-Status: active; name="' . $a->user['username'] . '"; id="' . $a->user['nickname'] .'"');
if($login_initial || $login_refresh) {
$l = get_browser_language();
q("UPDATE `user` SET `login_date` = '%s', `language` = '%s' WHERE `uid` = %d",
q("UPDATE `user` SET `login_date` = '%s' WHERE `uid` = %d",
dbesc(datetime_convert()),
dbesc($l),
intval($_SESSION['uid'])
);


+ 30
- 14
include/socgraph.php View File

@ -52,7 +52,7 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
if(! $url)
return;
$url = $url . (($uid) ? '/@me/@all?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,generation' : '?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,generation') ;
$url = $url . (($uid) ? '/@me/@all?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation' : '?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation') ;
logger('poco_load: ' . $url, LOGGER_DEBUG);
@ -86,6 +86,7 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
$about = '';
$keywords = '';
$gender = '';
$contact_type = -1;
$generation = 0;
$name = $entry->displayName;
@ -133,6 +134,9 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
foreach($entry->tags as $tag)
$keywords = implode(", ", $tag);
if(isset($entry->contactType) AND ($entry->contactType >= 0))
$contact_type = $entry->contactType;
// If you query a Friendica server for its profiles, the network has to be Friendica
/// TODO It could also be a Redmatrix server
//if ($uid == 0)
@ -140,6 +144,9 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $generation, $cid, $uid, $zcid);
$gcontact = array("url" => $profile_url, "contact-type" => $contact_type, "generation" => $generation);
update_gcontact($gcontact);
// Update the Friendica contacts. Diaspora is doing it via a message. (See include/diaspora.php)
// Deactivated because we now update Friendica contacts in dfrn.php
//if (($location != "") OR ($about != "") OR ($keywords != "") OR ($gender != ""))
@ -1236,7 +1243,7 @@ function poco_discover($complete = false) {
}
// Fetch all users from the other server
$url = $server["poco"]."/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,generation";
$url = $server["poco"]."/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation";
logger("Fetch all users from the server ".$server["nurl"], LOGGER_DEBUG);
@ -1255,7 +1262,7 @@ function poco_discover($complete = false) {
$updatedSince = date("Y-m-d H:i:s", time() - $timeframe * 86400);
// Fetch all global contacts from the other server (Not working with Redmatrix and Friendica versions before 3.3)
$url = $server["poco"]."/@global?updatedSince=".$updatedSince."&fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,generation";
$url = $server["poco"]."/@global?updatedSince=".$updatedSince."&fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation";
$success = false;
@ -1303,7 +1310,7 @@ function poco_discover_server_users($data, $server) {
logger("Fetch contacts for the user ".$username." from the server ".$server["nurl"], LOGGER_DEBUG);
// Fetch all contacts from a given user from the other server
$url = $server["poco"]."/".$username."/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,generation";
$url = $server["poco"]."/".$username."/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation";
$retdata = z_fetch_url($url);
if ($retdata["success"])
@ -1330,6 +1337,7 @@ function poco_discover_server($data, $default_generation = 0) {
$about = '';
$keywords = '';
$gender = '';
$contact_type = -1;
$generation = $default_generation;
$name = $entry->displayName;
@ -1374,6 +1382,9 @@ function poco_discover_server($data, $default_generation = 0) {
if(isset($entry->generation) AND ($entry->generation > 0))
$generation = ++$entry->generation;
if(isset($entry->contactType) AND ($entry->contactType >= 0))
$contact_type = $entry->contactType;
if(isset($entry->tags))
foreach($entry->tags as $tag)
$keywords = implode(", ", $tag);
@ -1383,6 +1394,10 @@ function poco_discover_server($data, $default_generation = 0) {
logger("Store profile ".$profile_url, LOGGER_DEBUG);
poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $generation, 0, 0, 0);
$gcontact = array("url" => $profile_url, "contact-type" => $contact_type, "generation" => $generation);
update_gcontact($gcontact);
logger("Done for profile ".$profile_url, LOGGER_DEBUG);
}
}
@ -1534,7 +1549,7 @@ function update_gcontact($contact) {
return false;
$r = q("SELECT `name`, `nick`, `photo`, `location`, `about`, `addr`, `generation`, `birthday`, `gender`, `keywords`,
`hide`, `nsfw`, `network`, `alias`, `notify`, `server_url`, `connect`, `updated`, `url`
`contact-type`, `hide`, `nsfw`, `network`, `alias`, `notify`, `server_url`, `connect`, `updated`, `url`
FROM `gcontact` WHERE `id` = %d LIMIT 1",
intval($gcontact_id));
@ -1614,20 +1629,20 @@ function update_gcontact($contact) {
}
if ($update) {
logger("Update gcontact for ".$contact["url"]." Callstack: ".App::callstack(), LOGGER_DEBUG);
logger("Update gcontact for ".$contact["url"], LOGGER_DEBUG);
q("UPDATE `gcontact` SET `photo` = '%s', `name` = '%s', `nick` = '%s', `addr` = '%s', `network` = '%s',
`birthday` = '%s', `gender` = '%s', `keywords` = '%s', `hide` = %d, `nsfw` = %d,
`alias` = '%s', `notify` = '%s', `url` = '%s',
`contact-type` = %d, `alias` = '%s', `notify` = '%s', `url` = '%s',
`location` = '%s', `about` = '%s', `generation` = %d, `updated` = '%s',
`server_url` = '%s', `connect` = '%s'
WHERE `nurl` = '%s' AND (`generation` = 0 OR `generation` >= %d)",
dbesc($contact["photo"]), dbesc($contact["name"]), dbesc($contact["nick"]),
dbesc($contact["addr"]), dbesc($contact["network"]), dbesc($contact["birthday"]),
dbesc($contact["gender"]), dbesc($contact["keywords"]), intval($contact["hide"]),
intval($contact["nsfw"]), dbesc($contact["alias"]), dbesc($contact["notify"]),
dbesc($contact["url"]), dbesc($contact["location"]), dbesc($contact["about"]),
intval($contact["generation"]), dbesc($contact["updated"]),
intval($contact["nsfw"]), intval($contact["contact-type"]), dbesc($contact["alias"]),
dbesc($contact["notify"]), dbesc($contact["url"]), dbesc($contact["location"]),
dbesc($contact["about"]), intval($contact["generation"]), dbesc($contact["updated"]),
dbesc($contact["server_url"]), dbesc($contact["connect"]),
dbesc(normalise_link($contact["url"])), intval($contact["generation"]));
@ -1644,13 +1659,14 @@ function update_gcontact($contact) {
q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `addr` = '%s',
`network` = '%s', `bd` = '%s', `gender` = '%s',
`keywords` = '%s', `alias` = '%s', `url` = '%s',
`location` = '%s', `about` = '%s'
`keywords` = '%s', `alias` = '%s', `contact-type` = %d,
`url` = '%s', `location` = '%s', `about` = '%s'
WHERE `id` = %d",
dbesc($contact["name"]), dbesc($contact["nick"]), dbesc($contact["addr"]),
dbesc($contact["network"]), dbesc($contact["birthday"]), dbesc($contact["gender"]),
dbesc($contact["keywords"]), dbesc($contact["alias"]), dbesc($contact["url"]),
dbesc($contact["location"]), dbesc($contact["about"]), intval($r[0]["id"]));
dbesc($contact["keywords"]), dbesc($contact["alias"]), intval($contact["contact-type"]),
dbesc($contact["url"]), dbesc($contact["location"]), dbesc($contact["about"]),
intval($r[0]["id"]));
}
}


+ 8
- 6
mod/admin.php View File

@ -1127,18 +1127,20 @@ function admin_page_dbsync(&$a) {
* @param App $a
*/
function admin_page_users_post(&$a){
$pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
$users = (x($_POST, 'user') ? $_POST['user'] : array());
$nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
$nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
$nu_email = (x($_POST, 'new_user_email') ? $_POST['new_user_email'] : '');
$pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
$users = (x($_POST, 'user') ? $_POST['user'] : array());
$nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
$nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
$nu_email = (x($_POST, 'new_user_email') ? $_POST['new_user_email'] : '');
$nu_language = get_config('system', 'language');
check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
if(!($nu_name==="") && !($nu_email==="") && !($nu_nickname==="")) {
require_once('include/user.php');
$result = create_user(array('username'=>$nu_name, 'email'=>$nu_email, 'nickname'=>$nu_nickname, 'verified'=>1));
$result = create_user(array('username'=>$nu_name, 'email'=>$nu_email,
'nickname'=>$nu_nickname, 'verified'=>1, 'language'=>$nu_language));
if(! $result['success']) {
notice($result['message']);
return;


+ 13
- 2
mod/poco.php View File

@ -1,4 +1,6 @@
<?php
// See here for a documentation for portable contacts:
// https://web.archive.org/web/20160405005550/http://portablecontacts.net/draft-spec.html
function poco_init(&$a) {
require_once("include/bbcode.php");
@ -104,9 +106,11 @@ function poco_init(&$a) {
);
} elseif($system_mode) {
logger("Start system mode query", LOGGER_DEBUG);
$r = q("SELECT `contact`.*, `profile`.`about` AS `pabout`, `profile`.`locality` AS `plocation`, `profile`.`pub_keywords`, `profile`.`gender` AS `pgender`,
`profile`.`address` AS `paddress`, `profile`.`region` AS `pregion`, `profile`.`postal-code` AS `ppostalcode`, `profile`.`country-name` AS `pcountry`
$r = q("SELECT `contact`.*, `profile`.`about` AS `pabout`, `profile`.`locality` AS `plocation`, `profile`.`pub_keywords`,
`profile`.`gender` AS `pgender`, `profile`.`address` AS `paddress`, `profile`.`region` AS `pregion`,
`profile`.`postal-code` AS `ppostalcode`, `profile`.`country-name` AS `pcountry`, `user`.`account-type`
FROM `contact` INNER JOIN `profile` ON `profile`.`uid` = `contact`.`uid`
INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
WHERE `self` = 1 AND `profile`.`is-default`
AND `contact`.`uid` IN (SELECT `uid` FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1) LIMIT %d, %d",
intval($startIndex),
@ -155,6 +159,7 @@ function poco_init(&$a) {
'gender' => false,
'tags' => false,
'address' => false,
'contactType' => false,
'generation' => false
);
@ -207,6 +212,9 @@ function poco_init(&$a) {
if (($rr['keywords'] == "") AND isset($rr['pub_keywords']))
$rr['keywords'] = $rr['pub_keywords'];
if (isset($rr['account-type']))
$rr['contact-type'] = $rr['account-type'];
$about = Cache::get("about:".$rr['updated'].":".$rr['nurl']);
if (is_null($about)) {
$about = bbcode($rr['about'], false, false);
@ -300,6 +308,9 @@ function poco_init(&$a) {
$entry['address']['country'] = $rr['pcountry'];
}
if($fields_ret['contactType'])
$entry['contactType'] = intval($rr['contact-type']);
$ret['entry'][] = $entry;
}
}


+ 1
- 0
mod/register.php View File

@ -52,6 +52,7 @@ function register_post(&$a) {
$arr['blocked'] = $blocked;
$arr['verified'] = $verified;
$arr['language'] = get_browser_language();
$result = create_user($arr);


+ 1
- 1
mod/settings.php View File

@ -1083,7 +1083,7 @@ function settings_content(&$a) {
($a->user['account-type'] != ACCOUNT_TYPE_COMMUNITY))
$a->user['account-type'] = ACCOUNT_TYPE_COMMUNITY;
$pageset_tpl = get_markup_template('pagetypes.tpl');
$pageset_tpl = get_markup_template('settings_pagetypes.tpl');
$pagetype = replace_macros($pageset_tpl, array(
'$account_types' => t("Account Types"),


+ 5
- 0
view/global.css View File

@ -455,3 +455,8 @@ td.federation-data {
display: none;
margin: 10px 0;
}
/* settings page */
#settings-form .pageflags {
margin: 0 0 20px 30px;
}

+ 3313
- 3258
view/lang/de/messages.po
File diff suppressed because it is too large
View File


+ 444
- 431
view/lang/de/strings.php
File diff suppressed because it is too large
View File


+ 0
- 26
view/templates/pagetypes.tpl View File

@ -1,26 +0,0 @@
<h4>{{$account_types}}</h4>
{{include file="field_radio.tpl" field=$account_person}}
{{include file="field_radio.tpl" field=$account_organisation}}
{{include file="field_radio.tpl" field=$account_news}}
{{include file="field_radio.tpl" field=$account_community}}
{{if $account_type == $type_person}}
<h5>{{$user}}</h5>
{{include file="field_radio.tpl" field=$page_normal}}
{{include file="field_radio.tpl" field=$page_soapbox}}
{{include file="field_radio.tpl" field=$page_freelove}}
{{/if}}
{{if $account_type == $type_organisation}}
<input type='hidden' name='page-flags' value='1'>
{{/if}}
{{if $account_type == $type_news}}
<input type='hidden' name='page-flags' value='1'>
{{/if}}
{{if $account_type == $type_community}}
<h5>{{$community}}</h5>
{{include file="field_radio.tpl" field=$page_community}}
{{include file="field_radio.tpl" field=$page_prvgroup}}
{{/if}}

+ 71
- 0
view/templates/settings_pagetypes.tpl View File

@ -0,0 +1,71 @@
<h4>{{$account_types}}</h4>
{{include file="field_radio.tpl" field=$account_person}}
<div id="account-type-sub-0" class="pageflags">
<h5>{{$user}}</h5>
{{include file="field_radio.tpl" field=$page_normal}}
{{include file="field_radio.tpl" field=$page_soapbox}}
{{include file="field_radio.tpl" field=$page_freelove}}
</div>
{{include file="field_radio.tpl" field=$account_organisation}}
{{include file="field_radio.tpl" field=$account_news}}
{{include file="field_radio.tpl" field=$account_community}}
<div id="account-type-sub-3" class="pageflags">
<h5>{{$community}}</h5>
{{include file="field_radio.tpl" field=$page_community}}
{{include file="field_radio.tpl" field=$page_prvgroup}}
</div>
<script language="javascript" type="text/javascript">
// This js part changes the state of page-flags radio buttons according
// to the selected account type. For a translation of the different
// account-types and page-flags have a look in the define section in boot.php
var accountType = {{$account_type}};
$(document).ready(function(){
// Hide all DIV for page-flags expet the one which belongs to the present
// account-type
showPageFlags(accountType);
// Save the ID of the active page-flage
var activeFlag = $('[id^=id_page-flags_]:checked');
$("[id^=id_account-type_]").change(function(){
// Since the ID of the radio buttons containing the type of
// the account-type we catch the last character of the ID to
// know for what account-type the radio button stands for.
var type = this.id.substr(this.id.length - 1);
// Hide all DIV with page-flags and show only the one which belongs
// to the selected radio button
showPageFlags(type);
// Uncheck all page-flags radio buttons
$('input:radio[name="page-flags"]').prop("checked", false);
// If the selected account type is the active one mark the page-flag
// radio button as checked which is already by database state
if (accountType == type) {
$(activeFlag).prop("checked", true);
} else if (type == 1 || type == 2) {
// For account-type 1 or 2 the page-flags are always set to 1
$('#id_page-flags_1').prop("checked", true);
} else {
// Mark the first available page-flags radio button of the selected
// account-type as checked
$('#account-type-sub-' + type + ' input:radio[name="page-flags"]').first().prop("checked", true);
}
});
});
// Show/Hide the page-flags according to the selected account-type
function showPageFlags(type) {
$(".pageflags").hide();
if (type == 0 || type == 3) {
$("#account-type-sub-" + type).show();
}
}
</script>

+ 7
- 5
view/theme/frio/css/style.css View File

@ -835,17 +835,19 @@ nav.navbar a {
/*border-left: 3px solid #6fdbe8;*/
border-left: 3px solid $link_color;
color: #fff!important;
background-color: $menu_background_hover_color !important
background-color: $menu_background_hover_color !important;
}
.nav-pills.preferences .dropdown .dropdown-toggle {
color: #bebebe
.nav-pills.preferences .dropdown .dropdown-toggle,
.nav-pills.preferences > li > .btn {
color: #bebebe;
}
.nav-pills.preferences .dropdown.open .dropdown-toggle,
.nav-pills.preferences .dropdown.open .dropdown-toggle:hover {
background-color: $nav_bg
background-color: $nav_bg;
}
.nav-pills.preferences .dropdown .dropdown-toggle {
.nav-pills.preferences .dropdown .dropdown-toggle,
.nav-pills.preferences > li > .btn {
padding: 2px 10px;
}


+ 14
- 2
view/theme/frio/templates/profile_advanced.tpl View File

@ -1,5 +1,5 @@
<script>
<script language="javascript" type="text/javascript">
// the following functions show/hide the specific profile page content
// in dependence of the selected nav
function profileStandardActive() {
@ -21,6 +21,19 @@
<div id="profile-page" class="generic-page-wrapper">
<h3 class="">{{$title}}</h3>
{{* The link to edit the profile*}}
{{if $profile.edit}}
<ul class="nav nav-pills preferences">
<li class="pull-right">
<a class="btn btn-link btn-sm" type="button" id="profile-edit-link" href="{{$profile.edit.0}}" title="{{$profile.edit.3}}">
<i class="fa fa-pencil-square-o" aria-hidden="true"></i>&nbsp;{{$profile.edit.1}}
</a>
</li>
</ul>
<div class="clear"></div>
{{/if}}
{{* Frio does split the profile information in "standard" and "advanced". This is the tab menu for swithching between this modes *}}
<ul id="profile-menu" class="nav nav-tabs" role="menubar" data-tabs="tabs">
<li class="active" role="menuitem"><a id="profile-tab-standard-link" onclick="profileStandardActive(); return false;">{{$basic}}</a></li>
<li role="menuitem"><a id="profile-tab-advanced-link" onclick="profileAdvancedActive(); return false;">{{$advanced}}</a></li>
@ -226,4 +239,3 @@
{{/if}}
</div>
</div>

Loading…
Cancel
Save