aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--assets/home.html2
-rw-r--r--include/page_widgets.php54
-rw-r--r--mod/webpages.php125
-rw-r--r--version.inc2
-rw-r--r--view/css/mod_webpages.css6
-rw-r--r--view/theme/redbasic/css/style.css13
-rw-r--r--view/tpl/webpagelist.tpl29
7 files changed, 129 insertions, 102 deletions
diff --git a/assets/home.html b/assets/home.html
index be270dbb8..d0c242f16 100644
--- a/assets/home.html
+++ b/assets/home.html
@@ -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;">
diff --git a/include/page_widgets.php b/include/page_widgets.php
index d70281afc..49d1439be 100644
--- a/include/page_widgets.php
+++ b/include/page_widgets.php
@@ -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')
+
));
}
diff --git a/mod/webpages.php b/mod/webpages.php
index 6328454a6..dea034357 100644
--- a/mod/webpages.php
+++ b/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();
+
+ 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);
+ $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')
+
+));
+
}
diff --git a/version.inc b/version.inc
index 6bc57efd0..de307641d 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2014-04-28.659
+2014-04-29.660
diff --git a/view/css/mod_webpages.css b/view/css/mod_webpages.css
new file mode 100644
index 000000000..1b5a798cd
--- /dev/null
+++ b/view/css/mod_webpages.css
@@ -0,0 +1,6 @@
+.webpage-list-table tr {
+ height: 20px;
+}
+.webpage-list-table td {
+ padding: 5px;
+}
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index 881377e00..26ac639ee 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -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;
diff --git a/view/tpl/webpagelist.tpl b/view/tpl/webpagelist.tpl
index c19836a28..4ae153423 100644
--- a/view/tpl/webpagelist.tpl
+++ b/view/tpl/webpagelist.tpl
@@ -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>