clean up the webpage list a bit
This commit is contained in:
parent
5c8c555461
commit
31fd284b3c
@ -164,7 +164,7 @@ $(document).ready(function() {
|
||||
<div style="color:#808080;font-weight:bold;font-size:3.0em; margin-bottom:30px;">Dream it. Do it.</div>
|
||||
<div id="word-flasher" style="font-size: 3.0em; font-weight: bold; margin-bottom: 30px;">RedMatrix</div>
|
||||
<div class="tr" style="font-size: 1.6em; color: #666; margin-left: 75px; margin-right: 75px;">
|
||||
The RedMatrix (aka "red") is an open source webapp providing a complete <strong>decentralised</strong> publishing, sharing, and communications system. It provides communications (private messaging, chat and social networking), media management (photos, events, files, web pages) and enough other features to make your head spin.
|
||||
The RedMatrix (aka "red") is an open source webapp providing a complete <strong>decentralised</strong> publishing, sharing, and communications system. It provides communications (private messaging, chat and social networking), media management (photos, events, files, web pages) and enough features to make your head spin.
|
||||
</div>
|
||||
<br />
|
||||
<div class="tr" style="font-size: 1.6em; color: #666; margin-left: 75px; margin-right: 75px;">
|
||||
|
@ -3,37 +3,47 @@
|
||||
// A basic toolbar for observers with write_pages permissions
|
||||
function writepages_widget ($who,$which){
|
||||
return replace_macros(get_markup_template('write_pages.tpl'), array(
|
||||
'$new' => t('New Page'),
|
||||
'$newurl' => "webpages/$who",
|
||||
'$edit' => t('Edit'),
|
||||
'$editurl' => "editwebpage/$who/$which"
|
||||
));
|
||||
'$new' => t('New Page'),
|
||||
'$newurl' => "webpages/$who",
|
||||
'$edit' => t('Edit'),
|
||||
'$editurl' => "editwebpage/$who/$which"
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Chan is channel_id, $who is channel_address - we'll need to pass observer later too.
|
||||
function pagelist_widget ($chan,$who){
|
||||
$r = q("select * from item_id where uid = %d and service = 'WEBPAGE' order by sid asc",
|
||||
intval($chan)
|
||||
// Chan is channel_id, $which is channel_address - we'll need to pass observer later too.
|
||||
function pagelist_widget ($owner,$which){
|
||||
|
||||
$r = q("select * from item_id left join item on item_id.iid = item.id where item_id.uid = %d and service = 'WEBPAGE' order by item.created desc",
|
||||
intval($owner)
|
||||
);
|
||||
$pages = null;
|
||||
// TODO - only list public pages. Doesn't matter for now, since we don't have ACL anyway.
|
||||
|
||||
if($r) {
|
||||
$pages = array();
|
||||
foreach($r as $rr) {
|
||||
$pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid']);
|
||||
}
|
||||
$pages = null;
|
||||
|
||||
if($r) {
|
||||
$pages = array();
|
||||
foreach($r as $rr) {
|
||||
$pages[$rr['iid']][] = array('url' => $rr['iid'],'pagetitle' => $rr['sid'],'title' => $rr['title'],'created' => datetime_convert('UTC',date_default_timezone_get(),$rr['created']),'edited' => datetime_convert('UTC',date_default_timezone_get(),$rr['edited']));
|
||||
}
|
||||
}
|
||||
|
||||
return replace_macros(get_markup_template('webpagelist.tpl'), array(
|
||||
//Build the base URL for edit links
|
||||
$url = z_root() . "/editwebpage/" . $which;
|
||||
// This isn't pretty, but it works. Until I figure out what to do with the UI, it's Good Enough(TM).
|
||||
return $o . replace_macros(get_markup_template("webpagelist.tpl"), array(
|
||||
'$baseurl' => $url,
|
||||
'$edit' => '',
|
||||
'$edit' => t('Edit'),
|
||||
'$pages' => $pages,
|
||||
'$channel' => $who,
|
||||
'$preview' => '',
|
||||
'$widget' => 1,
|
||||
'$channel' => $which,
|
||||
'$view' => t('View'),
|
||||
'$preview' => t('Preview'),
|
||||
'$actions_txt' => t('Actions'),
|
||||
'$pagelink_txt' => t('Page Link'),
|
||||
'$title_txt' => t('Title'),
|
||||
'$created_txt' => t('Created'),
|
||||
'$edited_txt' => t('Edited')
|
||||
|
||||
));
|
||||
|
||||
}
|
||||
|
125
mod/webpages.php
125
mod/webpages.php
@ -15,44 +15,44 @@ function webpages_content(&$a) {
|
||||
|
||||
if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
|
||||
$which = $channel['channel_address'];
|
||||
$profile = argv(1);
|
||||
$profile = argv(1);
|
||||
}
|
||||
|
||||
profile_load($a,$which,$profile);
|
||||
|
||||
|
||||
// Figure out who the page owner is.
|
||||
$r = q("select channel_id from channel where channel_address = '%s'",
|
||||
dbesc($which)
|
||||
);
|
||||
if($r) {
|
||||
$owner = intval($r[0]['channel_id']);
|
||||
// Figure out who the page owner is.
|
||||
$r = q("select channel_id from channel where channel_address = '%s'",
|
||||
dbesc($which)
|
||||
);
|
||||
if($r) {
|
||||
$owner = intval($r[0]['channel_id']);
|
||||
}
|
||||
|
||||
// Get the observer, check their permissions
|
||||
// Get the observer, check their permissions
|
||||
|
||||
$observer = $a->get_observer();
|
||||
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
|
||||
$observer = $a->get_observer();
|
||||
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
|
||||
|
||||
$perms = get_all_perms($owner,$ob_hash);
|
||||
$perms = get_all_perms($owner,$ob_hash);
|
||||
|
||||
if(! $perms['write_pages']) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
if(! $perms['write_pages']) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
// if(local_user() && local_user() == $owner) {
|
||||
// $a->set_widget('design',design_tools());
|
||||
// }
|
||||
|
||||
|
||||
$mimetype = get_config('system','page_mimetype');
|
||||
if(! $mimetype)
|
||||
$mimetype = 'choose';
|
||||
$mimetype = get_config('system','page_mimetype');
|
||||
if(! $mimetype)
|
||||
$mimetype = 'choose';
|
||||
|
||||
$layout = get_config('system','page_layout');
|
||||
if(! $layout)
|
||||
$layout = 'choose';
|
||||
$layout = get_config('system','page_layout');
|
||||
if(! $layout)
|
||||
$layout = 'choose';
|
||||
|
||||
|
||||
// Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
|
||||
@ -61,43 +61,43 @@ function webpages_content(&$a) {
|
||||
require_once('include/acl_selectors.php');
|
||||
|
||||
|
||||
if(local_user() && local_user() == $a->profile_uid) {
|
||||
$channel = $a->get_channel();
|
||||
$channel_acl = array(
|
||||
'allow_cid' => $channel['channel_allow_cid'],
|
||||
'allow_gid' => $channel['channel_allow_gid'],
|
||||
'deny_cid' => $channel['channel_deny_cid'],
|
||||
'deny_gid' => $channel['channel_deny_gid']
|
||||
);
|
||||
}
|
||||
else
|
||||
$channel_acl = array();
|
||||
|
||||
require_once('include/conversation.php');
|
||||
$o = profile_tabs($a,true);
|
||||
|
||||
$o .= '<h2>' . t('Webpages') . '</h2>';
|
||||
|
||||
$x = array(
|
||||
'webpage' => ITEM_WEBPAGE,
|
||||
'is_owner' => true,
|
||||
'nickname' => $a->profile['channel_address'],
|
||||
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
||||
'bang' => (($group || $cid) ? '!' : ''),
|
||||
'acl' => ((local_user() && local_user() == $owner) ? populate_acl($channel_acl) : ''),
|
||||
'visitor' => true,
|
||||
'profile_uid' => intval($owner),
|
||||
'mimetype' => $mimetype,
|
||||
'layout' => $layout,
|
||||
if(local_user() && local_user() == $a->profile_uid) {
|
||||
$channel = $a->get_channel();
|
||||
$channel_acl = array(
|
||||
'allow_cid' => $channel['channel_allow_cid'],
|
||||
'allow_gid' => $channel['channel_allow_gid'],
|
||||
'deny_cid' => $channel['channel_deny_cid'],
|
||||
'deny_gid' => $channel['channel_deny_gid']
|
||||
);
|
||||
}
|
||||
else
|
||||
$channel_acl = array();
|
||||
|
||||
$o .= status_editor($a,$x);
|
||||
require_once('include/conversation.php');
|
||||
$o = profile_tabs($a,true);
|
||||
|
||||
$o .= '<h2>' . t('Webpages') . '</h2>';
|
||||
|
||||
$x = array(
|
||||
'webpage' => ITEM_WEBPAGE,
|
||||
'is_owner' => true,
|
||||
'nickname' => $a->profile['channel_address'],
|
||||
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
||||
'bang' => (($group || $cid) ? '!' : ''),
|
||||
'acl' => ((local_user() && local_user() == $owner) ? populate_acl($channel_acl) : ''),
|
||||
'visitor' => true,
|
||||
'profile_uid' => intval($owner),
|
||||
'mimetype' => $mimetype,
|
||||
'layout' => $layout,
|
||||
);
|
||||
|
||||
$o .= status_editor($a,$x);
|
||||
|
||||
|
||||
//Get a list of webpages. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link.
|
||||
//TODO - this should be replaced with pagelist_widget
|
||||
// Get a list of webpages. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link.
|
||||
//TODO - this should be replaced with pagelist_widget
|
||||
|
||||
$r = q("select item_id.* from item_id left join item on item_id.iid = item.id where item_id.uid = %d and service = 'WEBPAGE' order by item.created desc",
|
||||
$r = q("select * from item_id left join item on item_id.iid = item.id where item_id.uid = %d and service = 'WEBPAGE' order by item.created desc",
|
||||
intval($owner)
|
||||
);
|
||||
|
||||
@ -106,23 +106,28 @@ function webpages_content(&$a) {
|
||||
if($r) {
|
||||
$pages = array();
|
||||
foreach($r as $rr) {
|
||||
$pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid']);
|
||||
}
|
||||
$pages[$rr['iid']][] = array('url' => $rr['iid'],'pagetitle' => $rr['sid'],'title' => $rr['title'],'created' => datetime_convert('UTC',date_default_timezone_get(),$rr['created']),'edited' => datetime_convert('UTC',date_default_timezone_get(),$rr['edited']));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Build the base URL for edit links
|
||||
$url = z_root() . "/editwebpage/" . $which;
|
||||
$url = z_root() . "/editwebpage/" . $which;
|
||||
// This isn't pretty, but it works. Until I figure out what to do with the UI, it's Good Enough(TM).
|
||||
return $o . replace_macros(get_markup_template("webpagelist.tpl"), array(
|
||||
return $o . replace_macros(get_markup_template("webpagelist.tpl"), array(
|
||||
'$baseurl' => $url,
|
||||
'$edit' => t('Edit'),
|
||||
'$pages' => $pages,
|
||||
'$channel' => $which,
|
||||
'$view' => t('View'),
|
||||
'$preview' => t('Preview'),
|
||||
|
||||
));
|
||||
|
||||
'$actions_txt' => t('Actions'),
|
||||
'$pagelink_txt' => t('Page Link'),
|
||||
'$title_txt' => t('Title'),
|
||||
'$created_txt' => t('Created'),
|
||||
'$edited_txt' => t('Edited')
|
||||
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
2014-04-28.659
|
||||
2014-04-29.660
|
||||
|
6
view/css/mod_webpages.css
Normal file
6
view/css/mod_webpages.css
Normal file
@ -0,0 +1,6 @@
|
||||
.webpage-list-table tr {
|
||||
height: 20px;
|
||||
}
|
||||
.webpage-list-table td {
|
||||
padding: 5px;
|
||||
}
|
@ -1715,19 +1715,6 @@ header {
|
||||
.profile-thing-list {
|
||||
list-style-type: none;
|
||||
}
|
||||
/*
|
||||
.profile-thing-list li {
|
||||
float: left;
|
||||
margin-right: 25px;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
div#pagelist-content-wrapper {
|
||||
width: 80%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
div.page-list-item {
|
||||
margin: 20px;
|
||||
|
@ -1,16 +1,35 @@
|
||||
{{if $pages}}
|
||||
|
||||
<div id="pagelist-content-wrapper" class="generic-content-wrapper">
|
||||
<table class="webpage-list-table">
|
||||
<tr><td>{{$actions_txt}}</td><td>{{$pagelink_txt}}</td><td>{{$title_txt}}</td><td>{{$created_txt}}</td><td>{{$edited_txt}}</td></tr>
|
||||
{{foreach $pages as $key => $items}}
|
||||
{{foreach $items as $item}}
|
||||
<div class="page-list-item">
|
||||
{{if $edit}}<a href="{{$baseurl}}/{{$item.url}}" title="{{$edit}}"><i class="icon-pencil design-icons design-edit-icon"></i></a> {{/if}}
|
||||
{{if $view}}<a href="page/{{$channel}}/{{$item.title}}" title="{{$view}}"><i class="icon-external-link design-icons design-view-icon"></i></a> {{/if}}
|
||||
{{if $preview}}<a href="page/{{$channel}}/{{$item.title}}?iframe=true&width=80%&height=80%" title="{{$preview}}" class="webpage-preview" ><i class="icon-eye-open design-icons design-preview-icon"></i></a> {{/if}}
|
||||
<tr>
|
||||
<td>
|
||||
{{if $edit}}<a href="{{$baseurl}}/{{$item.url}}" title="{{$edit}}"><i class="icon-pencil design-icons design-edit-icon btn btn-default"></i></a> {{/if}}
|
||||
{{if $view}}<a href="page/{{$channel}}/{{$item.pagetitle}}" title="{{$view}}"><i class="icon-external-link design-icons design-view-icon btn btn-default"></i></a> {{/if}}
|
||||
{{if $preview}}<a href="page/{{$channel}}/{{$item.pagetitle}}?iframe=true&width=80%&height=80%" title="{{$preview}}" class="webpage-preview" ><i class="icon-eye-open design-icons design-preview-icon btn btn-default"></i></a> {{/if}}
|
||||
</td>
|
||||
<td>
|
||||
{{if $view}}<a href="page/{{$channel}}/{{$item.pagetitle}}" title="{{$view}}">{{$item.pagetitle}}</a>
|
||||
{{else}}{{$item.pagetitle}}
|
||||
{{/if}}
|
||||
</td>
|
||||
<td>
|
||||
{{$item.title}}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{{$item.created}}
|
||||
</td>
|
||||
<td>
|
||||
{{$item.edited}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
{{/foreach}}
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
|
Reference in New Issue
Block a user