aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-01-12 21:08:29 +0000
committerMario <mario@mariovavti.com>2022-01-12 21:08:29 +0000
commitabe3039926dd388108e620148868880cb1da3fa3 (patch)
tree5df8a062da5e7829d23045fc7e197392a9655baa
parent82a1117e917a0c97de961f31f4d4aea7affa069f (diff)
downloadvolse-hubzilla-abe3039926dd388108e620148868880cb1da3fa3.tar.gz
volse-hubzilla-abe3039926dd388108e620148868880cb1da3fa3.tar.bz2
volse-hubzilla-abe3039926dd388108e620148868880cb1da3fa3.zip
ux improvements
-rw-r--r--Zotlabs/Module/Connections.php8
-rw-r--r--Zotlabs/Module/Profile_photo.php30
-rw-r--r--Zotlabs/Module/Profiles.php38
-rw-r--r--Zotlabs/Module/Settings/Profiles.php8
-rw-r--r--include/selectors.php8
-rw-r--r--view/tpl/connection_template.tpl9
-rw-r--r--view/tpl/profile_edit.tpl2
7 files changed, 43 insertions, 60 deletions
diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php
index b77e5d06d..0f674965d 100644
--- a/Zotlabs/Module/Connections.php
+++ b/Zotlabs/Module/Connections.php
@@ -332,9 +332,6 @@ class Connections extends \Zotlabs\Web\Controller {
'thumb' => $rr['xchan_photo_m'],
'name' => $rr['xchan_name'],
'classes' => ((intval($rr['abook_archived']) || intval($rr['abook_not_here'])) ? 'archived' : ''),
- 'link' => z_root() . '/connedit/' . $rr['abook_id'],
- 'deletelink' => z_root() . '/connedit/' . intval($rr['abook_id']) . '/drop',
- 'delete' => t('Delete'),
'url' => chanlink_hash($rr['xchan_hash']),
'webbie_label' => t('Channel address'),
'webbie' => $rr['xchan_addr'],
@@ -345,6 +342,7 @@ class Connections extends \Zotlabs\Web\Controller {
'phone' => $phone,
'status_label' => t('Status'),
'status' => $status_str,
+ 'states' => $status,
'connected_label' => t('Connected'),
'connected' => datetime_convert('UTC',date_default_timezone_get(),$rr['abook_created'], 'c'),
'approve_hover' => t('Approve connection'),
@@ -358,7 +356,8 @@ class Connections extends \Zotlabs\Web\Controller {
'connect' => (intval($rr['abook_not_here']) ? t('Connect') : ''),
'follow' => z_root() . '/follow/?f=&url=' . urlencode($rr['xchan_hash']) . '&interactive=0',
'connect_hover' => t('Connect at this location'),
- 'role' => $roles_dict[$rr['abook_role']]
+ 'role' => $roles_dict[$rr['abook_role']],
+ 'pending' => intval($rr['abook_pending'])
);
}
}
@@ -398,6 +397,7 @@ class Connections extends \Zotlabs\Web\Controller {
'$finding' => (($searching) ? t('Contact search') . ": '" . $search . "'" : ""),
'$submit' => t('Find'),
'$edit' => t('Edit'),
+ '$approve' => t('Approve'),
'$cmd' => App::$cmd,
'$contacts' => $contacts,
'$paginate' => paginate($a),
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php
index 57b491801..661694d18 100644
--- a/Zotlabs/Module/Profile_photo.php
+++ b/Zotlabs/Module/Profile_photo.php
@@ -56,7 +56,6 @@ class Profile_photo extends Controller {
check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
-
$r = q("select id, profile_guid, is_default, gender from profile where uid = %d",
intval(local_channel())
);
@@ -99,7 +98,6 @@ class Profile_photo extends Controller {
dbesc(z_root() . '/photo/profile/m/' . local_channel()),
intval(local_channel())
);
-
}
}
else {
@@ -211,14 +209,12 @@ class Profile_photo extends Controller {
// If setting for the default profile, unset the profile photo flag from any other photos I own
if ($is_default_profile) {
-
q("update profile set photo = '%s', thumb = '%s' where is_default = 1 and uid = %d",
dbesc(z_root() . '/photo/profile/l/' . local_channel()),
dbesc(z_root() . '/photo/profile/m/' . local_channel()),
intval(local_channel())
);
-
q("UPDATE photo SET photo_usage = %d WHERE photo_usage = %d
AND resource_id != '%s' AND uid = %d",
intval(PHOTO_NORMAL),
@@ -227,9 +223,7 @@ class Profile_photo extends Controller {
intval(local_channel())
);
-
send_profile_photo_activity($channel, $base_image, $profile);
-
}
else {
q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
@@ -288,12 +282,10 @@ class Profile_photo extends Controller {
// A new photo was uploaded. Store it and save some important details
// in App::$data for use in the cropping function
-
$hash = photo_new_resource();
$importing = false;
$smallest = 0;
-
if ($_REQUEST['importfile']) {
$hash = $_REQUEST['importfile'];
$importing = true;
@@ -358,6 +350,7 @@ class Profile_photo extends Controller {
notice(t('Image upload failed.') . EOL);
return;
}
+
$os_storage = false;
foreach ($i as $ii) {
@@ -501,14 +494,16 @@ class Profile_photo extends Controller {
return;
}
- if (intval($r[0]['os_storage']))
+ if (intval($r[0]['os_storage'])) {
$data = @file_get_contents($r[0]['content']);
- else
+ }
+ else {
$data = dbunescbin($r[0]['content']);
-
+ }
$ph = photo_factory($data, $r[0]['mimetype']);
$smallest = 0;
+
if ($ph->is_valid()) {
// go ahead as if we have just uploaded a new photo to crop
@@ -573,7 +568,8 @@ class Profile_photo extends Controller {
$filename = App::$data['imagecrop'] . '-' . App::$data['imagecrop_resolution'];
$tpl = get_markup_template("cropbody.tpl");
- $o = replace_macros($tpl, [
+
+ $o = replace_macros($tpl, [
'$filename' => $filename,
'$profile' => $profile_id,
'$resource' => App::$data['imagecrop'] . '-' . App::$data['imagecrop_resolution'],
@@ -583,6 +579,7 @@ class Profile_photo extends Controller {
'$form_security_token' => get_form_security_token("profile_photo"),
'$done' => t('Done editing')
]);
+
return $o;
}
@@ -601,10 +598,13 @@ class Profile_photo extends Controller {
function profile_photo_crop_ui_head($ph, $hash, $smallest) {
$max_length = get_config('system', 'max_image_length');
- if (!$max_length)
+
+ if (!$max_length) {
$max_length = MAX_IMAGE_LENGTH;
- if ($max_length > 0)
+ }
+ if ($max_length > 0) {
$ph->scaleImage($max_length);
+ }
App::$data['width'] = $ph->getWidth();
App::$data['height'] = $ph->getHeight();
@@ -615,10 +615,10 @@ class Profile_photo extends Controller {
App::$data['height'] = $ph->getHeight();
}
-
App::$data['imagecrop'] = $hash;
App::$data['imagecrop_resolution'] = $smallest;
App::$page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), []);
+
return;
}
diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php
index ca0ca4f1a..70f6b1125 100644
--- a/Zotlabs/Module/Profiles.php
+++ b/Zotlabs/Module/Profiles.php
@@ -163,34 +163,6 @@ class Profiles extends \Zotlabs\Web\Controller {
killme();
}
-
-
-
- // Run profile_load() here to make sure the theme is set before
- // we start loading content
- if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_channel(),'multi_profiles')) {
- if(feature_enabled(local_channel(),'multi_profiles'))
- $id = \App::$argv[1];
- else {
- $x = q("select id from profile where uid = %d and is_default = 1",
- intval(local_channel())
- );
- if($x)
- $id = $x[0]['id'];
- }
- $r = q("SELECT * FROM profile WHERE id = %d AND uid = %d LIMIT 1",
- intval($id),
- intval(local_channel())
- );
- if(! count($r)) {
- notice( t('Profile not found.') . EOL);
- \App::$error = 404;
- return;
- }
-
- $chan = \App::get_channel();
- profile_load($chan['channel_address'],$r[0]['id']);
- }
}
function post() {
@@ -628,8 +600,6 @@ class Profiles extends \Zotlabs\Web\Controller {
}
if($is_default) {
- // reload the info for the sidebar widget
- profile_load($channel['channel_address']);
\Zotlabs\Daemon\Master::Summon(array('Directory',local_channel()));
}
}
@@ -640,13 +610,13 @@ class Profiles extends \Zotlabs\Web\Controller {
$o = '';
- $channel = \App::get_channel();
-
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
+ $channel = \App::get_channel();
+
require_once('include/channel.php');
$profile_fields_basic = get_profile_fields_basic();
@@ -662,6 +632,7 @@ class Profiles extends \Zotlabs\Web\Controller {
if($x)
$id = $x[0]['id'];
}
+
$r = q("SELECT * FROM profile WHERE id = %d AND uid = %d LIMIT 1",
intval($id),
intval(local_channel())
@@ -672,6 +643,9 @@ class Profiles extends \Zotlabs\Web\Controller {
return;
}
+ // make sure we got uptodate data
+ profile_load($channel['channel_address'], $id);
+
$editselect = 'none';
\App::$page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
diff --git a/Zotlabs/Module/Settings/Profiles.php b/Zotlabs/Module/Settings/Profiles.php
index 67b03e04f..a1a1b8d96 100644
--- a/Zotlabs/Module/Settings/Profiles.php
+++ b/Zotlabs/Module/Settings/Profiles.php
@@ -13,14 +13,14 @@ class Profiles {
$module = substr(strrchr(strtolower(static::class), '\\'), 1);
check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
-
+
$features = get_module_features($module);
process_module_features_post(local_channel(), $features, $_POST);
$profile_assign = ((x($_POST,'profile_assign')) ? notags(trim($_POST['profile_assign'])) : '');
set_pconfig(local_channel(),'system','profile_assign',$profile_assign);
-
+
Libsync::build_sync_packet();
if($_POST['rpath'])
@@ -38,7 +38,7 @@ class Profiles {
$extra_settings_html = '';
if(feature_enabled(local_channel(),'multi_profiles'))
- $extra_settings_html = contact_profile_assign(get_pconfig(local_channel(),'system','profile_assign',''));
+ $extra_settings_html = contact_profile_assign(get_pconfig(local_channel(),'system','profile_assign',''), t('Default profile for new contacts'));
$tpl = get_markup_template("settings_module.tpl");
@@ -51,7 +51,7 @@ class Profiles {
'$extra_settings_html' => $extra_settings_html,
'$submit' => t('Submit')
));
-
+
return $o;
}
diff --git a/include/selectors.php b/include/selectors.php
index d58ef1085..57a9db480 100644
--- a/include/selectors.php
+++ b/include/selectors.php
@@ -1,7 +1,7 @@
<?php /** @file */
-function contact_profile_assign($current) {
+function contact_profile_assign($current, $label = '') {
$r = q("SELECT profile_guid, profile_name FROM profile WHERE uid = %d",
intval($_SESSION['uid'])
@@ -13,9 +13,13 @@ function contact_profile_assign($current) {
}
}
+ if (!$label) {
+ $label = t('Select a profile to assign to this contact');
+ }
+
$select = [
'profile_assign',
- t('Select a profile to assign to this contact'),
+ $label,
$current,
'',
$options
diff --git a/view/tpl/connection_template.tpl b/view/tpl/connection_template.tpl
index 5c1542111..090899cd6 100644
--- a/view/tpl/connection_template.tpl
+++ b/view/tpl/connection_template.tpl
@@ -1,6 +1,11 @@
<div id="contact-entry-wrapper-{{$contact.id}}">
<div class="section-subtitle-wrapper clearfix">
<div class="float-end">
+ {{if $contact.status}}
+ {{foreach $contact.states as $state}}
+ <span class="badge rounded-pill bg-danger text-white me-1" title="">{{$state}}</span>
+ {{/foreach}}
+ {{/if}}
<span id="contact-role-{{$contact.id}}" class="badge rounded-pill bg-warning text-dark me-1" title="{{$role_label}}">{{$contact.role}}</span>
<button type="button" class="btn btn-outline-secondary btn-sm contact-edit" title="{{$contact.edit_hover}}" data-id="{{$contact.id}}">
<i class="fa fa-pencil"></i> {{$contact.edit}}
@@ -16,11 +21,11 @@
{{include "connstatus.tpl" perminfo=$contact.perminfo}}
</div>
<div class="contact-info">
- {{if $contact.status}}
+ {{** if $contact.status}}
<div class="contact-info-element">
<span class="contact-info-label">{{$contact.status_label}}:</span> {{$contact.status}}
</div>
- {{/if}}
+ {{/if **}}
{{if $contact.connected}}
<div class="contact-info-element">
<span class="contact-info-label">{{$contact.connected_label}}:</span> <span class="autotime" title="{{$contact.connected}}"></span>
diff --git a/view/tpl/profile_edit.tpl b/view/tpl/profile_edit.tpl
index 7361411b9..c55ce0183 100644
--- a/view/tpl/profile_edit.tpl
+++ b/view/tpl/profile_edit.tpl
@@ -30,7 +30,7 @@
{{/if}}
</div>
</div>
- <h2>{{$banner}}</h2>
+ <h2>{{$banner}}{{if $multi_profiles}}: {{$profile_name.2}}{{/if}}</h2>
<div class="clear"></div>
</div>
<div class="section-content-tools-wrapper" id="profile-upload-form">