HQ dashboard - initial checkin

This commit is contained in:
Mario
2022-07-15 17:50:02 +00:00
parent 40b4636858
commit d6a9a9927c
17 changed files with 149 additions and 147 deletions

View File

@@ -49,16 +49,16 @@ class Hq extends \Zotlabs\Web\Controller {
$sql_extra = '';
if(! $item_hash) {
$r = q("SELECT mid FROM item
WHERE uid = %d $item_normal
AND mid = parent_mid
AND item_private IN (0, 1)
ORDER BY created DESC LIMIT 1",
intval(local_channel())
);
if($r[0]['mid']) {
$item_hash = $r[0]['mid'];
}
//$r = q("SELECT mid FROM item
//WHERE uid = %d $item_normal
//AND mid = parent_mid
//AND item_private IN (0, 1)
//ORDER BY created DESC LIMIT 1",
//intval(local_channel())
//);
//if($r[0]['mid']) {
//$item_hash = $r[0]['mid'];
//}
}
if($item_hash) {

View File

@@ -9,42 +9,42 @@ class Page extends \Zotlabs\Web\Controller {
function init() {
// We need this to make sure the channel theme is always loaded.
$which = argv(1);
$profile = 0;
profile_load($which,$profile);
if(\App::$profile['profile_uid'])
head_set_icon(\App::$profile['thumb']);
// load the item here in the init function because we need to extract
// the page layout and initialise the correct theme.
$observer = \App::get_observer();
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
// perm_is_allowed is denied unconditionally when 'site blocked to unauthenticated members'.
// perm_is_allowed is denied unconditionally when 'site blocked to unauthenticated members'.
// This bypasses that restriction for sys channel (public) content
if((! perm_is_allowed(\App::$profile['profile_uid'],$ob_hash,'view_pages')) && (! is_sys_channel(\App::$profile['profile_uid']))) {
notice( t('Permission denied.') . EOL);
return;
}
if(argc() < 3) {
notice( t('Invalid item.') . EOL);
return;
}
$channel_address = argv(1);
// Always look first for the page name prefixed by the observer language; for instance page/nickname/de/foo
// followed by page/nickname/foo if that is not found.
// If your browser language is de and you want to access the default in this case,
// If your browser language is de and you want to access the default in this case,
// use page/nickname/-/foo to over-ride the language and access only the page with pagelink of 'foo'
$page_name = '';
@@ -63,33 +63,33 @@ class Page extends \Zotlabs\Web\Controller {
// The page link title was stored in a urlencoded format
// php or the browser may/will have decoded it, so re-encode it for our search
$page_id = urlencode($page_name);
$lang_page_id = urlencode(\App::$language . '/' . $page_name);
$u = q("select channel_id from channel where channel_address = '%s' limit 1",
dbesc($channel_address)
);
if(! $u) {
notice( t('Channel not found.') . EOL);
return;
}
if($_REQUEST['rev'])
$revision = " and revision = " . intval($_REQUEST['rev']) . " ";
else
$revision = " order by revision desc ";
require_once('include/security.php');
$sql_options = item_permissions_sql($u[0]['channel_id']);
$r = null;
$r = null;
if(! $ignore_language) {
$r = q("select item.* from item left join iconfig on item.id = iconfig.iid
where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0
and iconfig.k = 'WEBPAGE' and item_type = %d
where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0
and iconfig.k = 'WEBPAGE' and item_type = %d
$sql_options $revision limit 1",
intval($u[0]['channel_id']),
dbesc($lang_page_id),
@@ -98,8 +98,8 @@ class Page extends \Zotlabs\Web\Controller {
}
if(! $r) {
$r = q("select item.* from item left join iconfig on item.id = iconfig.iid
where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0
and iconfig.k = 'WEBPAGE' and item_type = %d
where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0
and iconfig.k = 'WEBPAGE' and item_type = %d
$sql_options $revision limit 1",
intval($u[0]['channel_id']),
dbesc($page_id),
@@ -109,7 +109,7 @@ class Page extends \Zotlabs\Web\Controller {
if(! $r) {
// no webpage by that name, but we do allow you to load/preview a layout using this module. Try that.
$r = q("select item.* from item left join iconfig on item.id = iconfig.iid
where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0
where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0
and iconfig.k = 'PDL' AND item_type = %d $sql_options $revision limit 1",
intval($u[0]['channel_id']),
dbesc($page_id),
@@ -117,17 +117,17 @@ class Page extends \Zotlabs\Web\Controller {
);
}
if(! $r) {
// Check again with no permissions clause to see if it is a permissions issue
$x = q("select item.* from item left join iconfig on item.id = iconfig.iid
where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0
where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0
and iconfig.k = 'WEBPAGE' and item_type = %d $revision limit 1",
intval($u[0]['channel_id']),
dbesc($page_id),
intval(ITEM_TYPE_WEBPAGE)
);
if($x) {
// Yes, it's there. You just aren't allowed to see it.
notice( t('Permission denied.') . EOL);
@@ -140,7 +140,7 @@ class Page extends \Zotlabs\Web\Controller {
if($r[0]['title'])
\App::$page['title'] = escape_tags($r[0]['title']);
if($r[0]['item_type'] == ITEM_TYPE_PDL) {
\App::$comanche = new \Zotlabs\Render\Comanche();
\App::$comanche->parse($r[0]['body']);
@@ -151,40 +151,41 @@ class Page extends \Zotlabs\Web\Controller {
dbesc($r[0]['layout_mid']),
intval($u[0]['channel_id'])
);
if($l) {
\App::$comanche = new \Zotlabs\Render\Comanche();
\App::$comanche->parse($l[0]['body']);
\App::$pdl = $l[0]['body'];
}
}
\App::$data['webpage'] = $r;
}
function get() {
$r = \App::$data['webpage'];
if(! $r)
return;
if($r[0]['item_type'] == ITEM_TYPE_PDL) {
$r[0]['body'] = t('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.');
$r[0]['mimetype'] = 'text/plain';
$r[0]['title'] = '';
}
xchan_query($r);
$r = fetch_post_tags($r,true);
if($r[0]['mimetype'] === 'application/x-pdl')
\App::$page['pdl_content'] = true;
$o .= prepare_page($r[0]);
return $o;
}
}

View File

@@ -19,15 +19,13 @@ class Hq_controls {
if (! local_channel())
return;
$entries = [
'toggle_editor' => [
'label' => t('Toggle post editor'),
'href' => '#',
'class' => 'btn jot-toggle',
'type' => 'button',
'icon' => 'pencil',
'extra' => 'data-toggle="button"'
]
$entries['toggle_editor'] = [
'label' => t('Toggle post editor'),
'href' => '#',
'class' => 'btn jot-toggle',
'type' => 'button',
'icon' => 'pencil',
'extra' => 'data-toggle="button"'
];
if(Apps::system_app_installed(local_channel(), 'Notes')) {
@@ -41,6 +39,15 @@ class Hq_controls {
];
}
$entries['toggle_channel_activities'] = [
'label' => t('Channel activities'),
'href' => '#',
'class' => 'btn channel-activities-toggle d-none',
'type' => 'button',
'icon' => 'user-circle-o',
'extra' => 'data-toggle="button"'
];
return replace_macros(get_markup_template('hq_controls.tpl'),
[
'$entries' => $entries,

View File

@@ -2702,10 +2702,11 @@ function attach_move($channel_id, $resource_id, $new_folder_hash, $newname = '',
}
q("update attach set content = '%s', folder = '%s', filename = '%s' where id = %d",
q("update attach set content = '%s', folder = '%s', filename = '%s', edited = '%s' where id = %d",
dbescbin($newstorepath),
dbesc($new_folder_hash),
dbesc($filename),
dbesc(datetime_convert()),
intval($r[0]['id'])
);

View File

@@ -1719,12 +1719,14 @@ function prepare_page($item) {
}
$body = prepare_body($item, true, [ 'newwin' => false ]);
$edit_link = (($item['uid'] === local_channel()) ? z_root() . '/editwebpage/' . argv(1) . '/' . $item['id'] : '');
if(App::$page['template'] == 'none') {
$tpl = 'page_display_empty.tpl';
return replace_macros(get_markup_template($tpl), array(
'$body' => $body['html']
'$body' => $body['html'],
'$edit_link' => $edit_link
));
}
@@ -1741,6 +1743,7 @@ function prepare_page($item) {
'$body' => $body['html'],
'$preview' => $preview,
'$link' => $link,
'$edit_link' => $edit_link
));
}

View File

@@ -41,20 +41,6 @@ nav .dropdown-menu {
overflow: auto;
}
#navbar-collapse-2 {
flex-basis: 100%;
max-height: 70vh;
}
#navbar-collapse-2.show {
overflow: auto;
}
#navbar-collapse-2.collapsing .dropdown-header,
#navbar-collapse-2.show .dropdown-header {
padding: 0.5rem 0.1rem;
}
.navbar-dark .navbar-toggler {
color: rgba(255,255,255,1);

View File

@@ -316,14 +316,10 @@ a.wall-item-name-link {
}
code {
font-family: Courier, monospace;
font-size: 1em;
padding: 1em 1.5em;
display: block;
}
code.inline-code {
padding: 0.2em;
display: inline;
}

View File

@@ -1,5 +1,5 @@
#ace-editor {
position: relative;
position: relative;
width: 100%;
height: 500px;
border: 1px solid #ccc;
@@ -47,27 +47,3 @@ td > i {
#wikis-index td:nth-last-child(1){
padding-right: 10px;
}
pre code {
background: #F5F5F5;
font-family: Courier, monospace;
font-size: 1em;
padding: 1em 1.5em;
display: block;
white-space: pre-wrap;
word-break: break-all;
}
code {
background: #F5F5F5;
font-family: Courier, monospace;
font-size: 1em;
display: inline;
padding: 0.2em 0.2em;
white-space: pre-wrap;
word-break: break-all;
}
#wiki-content-container code {
background: #F5F5F5;
}

View File

@@ -164,8 +164,8 @@ $(document).ready(function() {
jQuery.timeago.settings.allowFuture = true;
$(document).on('click', '.notification, .message', function(e) {
let b64mid = $(this).data('b64mid');
let notify_id = $(this).data('notify_id');
let b64mid = this.dataset.b64mid;
let notify_id = this.dataset.notify_id;
let path = $(this)[0].pathname.split('/')[1];
let stateObj = { b64mid: b64mid };
let singlethread_modules = ['display', 'hq'];
@@ -882,7 +882,7 @@ function updateInit() {
if($('#live-channel').length) { src = 'channel'; }
if($('#live-pubstream').length) { src = 'pubstream'; }
if($('#live-display').length) { src = 'display'; }
if($('#live-hq').length) { src = 'hq'; }
//if($('#live-hq').length) { src = 'hq'; }
if($('#live-search').length) { src = 'search'; }
// if($('#live-cards').length) { src = 'cards'; }
// if($('#live-articles').length) { src = 'articles'; }

View File

@@ -14,6 +14,11 @@ $(document).ready(function () {
// Per File Tools
// highlight and scroll into view if we got an id via hash
if(window.location.hash) {
$('#cloud-index-' + window.location.hash.substr(1)).addClass('cloud-index-active').get(0).scrollIntoView({block: 'center'});
}
$('.cloud-tool-info-btn').on('click', function (e) {
e.preventDefault();
let id = $(this).data('id');

View File

@@ -1,17 +1,42 @@
$(document).ready(function() {
$(document).on('click', '.jot-toggle', function(e) {
$('.autotime').timeago();
if (bParam_mid) {
src = 'hq';
$('.channel-activities-toggle').removeClass('d-none');
}
else {
$('#channel-activities').removeClass('d-none');
}
$(document).one('click', '.notification, .message', function(e) {
page_load = false;
followUpPageLoad = true;
src = 'hq';
$('#channel-activities').addClass('d-none');
$('.channel-activities-toggle').removeClass('d-none');
});
$(document).on('click', '.channel-activities-toggle', function(e) {
$(window).scrollTop(0);
$(document).trigger('hz:hqControlsClickAction');
$('#channel-activities').toggleClass('d-none');
$(this).toggleClass('active');
});
$(document).on('click', '.jot-toggle', function(e) {
$(document).trigger('hz:hqControlsClickAction');
$('#jot-popup').toggle();
$('#profile-jot-text').focus();
$('#profile-jot-text').focus().get(0).scrollIntoView({block: 'center'});
$(this).toggleClass('active');
});
$(document).on('click', '.notes-toggle', function(e) {
$(window).scrollTop(0);
$(document).trigger('hz:hqControlsClickAction');
$('#personal-notes').toggleClass('d-none');
$('#note-text').focus();
$('#note-text-html').get(0).scrollIntoView({block: 'center'});
$(this).toggleClass('active');
});
});

View File

@@ -6,6 +6,7 @@
[/widget]
[/region]
[region=content]
[widget=channel_activities][/widget]
[widget=notes]
[var=hidden]1[/var]
[var=app]1[/var]

View File

@@ -145,23 +145,6 @@ input[type=text], textarea {
white-space: pre;
}
pre code {
border: none;
padding: 1em 1.5em;
}
code {
background: #ccc;
color: #000;
}
pre {
background: #F5F5F5;
color: #333;
border:1px solid #ccc;
border-radius: $radius;
}
.heart {
color: #FF0000;
}
@@ -209,7 +192,7 @@ nav {
max-height: 50%;
background: $comment_item_colour;
padding: 1rem;
border-bottom: #ccc 1px solid;
border-bottom: #e0e0e0 1px solid;
overflow: auto;
-moz-box-shadow: 0px 3px 3px rgba(0,0,0,0.2);
-webkit-box-shadow: 0px 3px 3px rgba(0,0,0,0.2);
@@ -455,7 +438,7 @@ footer {
.pager-prev,
.pager-next,
.pager_n {
border: 1px solid #ccc;
border: 1px solid #e0e0e0;
background: transparent;
padding: 4px;
}
@@ -706,7 +689,7 @@ nav .acpopup {
*/
.oauthapp {
height: auto; overflow: auto;
border-bottom: 2px solid #cccccc;
border-bottom: 2px solid #e0e0e0;
padding-bottom: 1em;
margin-bottom: 1em;
}
@@ -1086,7 +1069,7 @@ img.mail-conv-sender-photo {
.hide-comments-outer {
background-color: $comment_item_colour;
border-top-color: #ccc;
border-top-color: #e0e0e0;
border-style: solid;
border-top-style: dashed;
border-width: 1px 0px 0px 0px;
@@ -1140,13 +1123,13 @@ img.mail-conv-sender-photo {
.comment-edit-text {
border: 1px solid #ccc;
border: 1px solid #e0e0e0;
border-radius: $radius;
}
.divgrow-showmore {
display: block;
border-top: 1px dashed #ccc;
border-top: 1px dashed #e0e0e0;
text-align: center;
}
@@ -1180,7 +1163,7 @@ img.mail-conv-sender-photo {
}
#datebrowse-sidebar select {
border: 1px solid #ccc;
border: 1px solid #e0e0e0;
border-radius: $radius;
}
@@ -1265,7 +1248,7 @@ img.mail-conv-sender-photo {
}
.generic-content-wrapper {
border: 1px solid rgba(0, 0, 0, .2);
border: 1px solid #e0e0e0;
border-radius: $radius;
margin-bottom: 1.5rem;
}
@@ -1437,7 +1420,7 @@ main.fullscreen .section-content-wrapper-np {
blockquote {
font-size: 1rem;
font-style: italic;
border-left: 3px solid #ccc;
border-left: 3px solid #e0e0e0;
padding: 1em 0px 1em 1.5em;
margin: 0px;
}
@@ -1612,7 +1595,7 @@ dl.bb-dl > dd > li {
.onoffswitch.checkbox > div label {
display: block; overflow: hidden; cursor: pointer;
border: 1px solid #ccc;
border: 1px solid #e0e0e0;
border-radius: 12px;
margin:0px;
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
@@ -1651,13 +1634,13 @@ dl.bb-dl > dd > li {
.onoffswitch-inner:after {
content: attr(data-off);
padding-left: 21px;
background-color: $item_colour; color: #ccc;
background-color: $item_colour; color: #e0e0e0;
text-align: left;
}
.onoffswitch-switch {
display: block; width: 15px; margin:4px;
background: #ccc;
background: #e0e0e0;
border-radius: 10px;
position: absolute; top: 0; bottom: 0; right: 36px;
-moz-transition: all 0.3s ease-in 0s; -webkit-transition: all 0.3s ease-in 0s;
@@ -1801,3 +1784,7 @@ span.default-highlight {
.bootstrap-tagsinput {
width: 100%;
}
.jg-entry img {
border-radius: $radius;
}

View File

@@ -80,13 +80,13 @@ if (! $nav_active_icon_colour)
if (! $link_colour)
$link_colour = '#0d6efd';
if (! $banner_colour)
$banner_colour = '#fff';
$banner_colour = '#efefef';
if (! $bgcolour)
$bgcolour = 'rgb(254,254,254)';
if (! $background_image)
$background_image ='';
if (! $item_colour)
$item_colour = 'rgb(238,238,238)';
$item_colour = '#f6f6f6';
if (! $comment_item_colour)
$comment_item_colour = 'rgb(255,255,255)';
if (! $item_opacity)

View File

@@ -69,7 +69,9 @@
$(document).ready(function () {
$('.messages-timeago').timeago();
$('.message[data-b64mid=\'' + bParam_mid + '\']').addClass('active');
if (bParam_mid) {
$('.message[data-b64mid=\'' + bParam_mid + '\']').addClass('active');
}
});
$('#messages-widget').on('scroll', function() {
@@ -130,7 +132,9 @@
else {
$('#messages-empty').show();
}
$('.message[data-b64mid=\'' + bParam_mid + '\']').addClass('active');
if (bParam_mid) {
$('.message[data-b64mid=\'' + bParam_mid + '\']').addClass('active');
}
$('#messages-loading').hide();
$('.messages-timeago').timeago();

View File

@@ -9,6 +9,11 @@
<div class="page-author"><a class="page-author-link" href="{{$auth_url}}">{{$author}}</a></div>
<div class="page-date">{{$date}}</div>
<div class="page-body">{{$body}}</div>
{{if $edit_link}}
<div class="position-fixed bottom-0 end-0 m-3">
<a href="{{$edit_link}}" class="btn btn-lg btn-primary rounded-circle"><i class="fa fa-pencil"></i></a>
</div>
{{/if}}
</div>
</div>
</div>

View File

@@ -1 +1,6 @@
{{$body}}
{{$body}}
{{if $edit_link}}
<div class="position-fixed bottom-0 end-0 m-3">
<a href="{{$edit_link}}" class="btn btn-lg btn-primary rounded-circle"><i class="fa fa-pencil"></i></a>
</div>
{{/if}}