diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-06-11 17:56:56 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-06-11 17:56:56 -0700 |
commit | 5733491ac853b4af5d4829d68e870f3d82ced3c8 (patch) | |
tree | e90b5ee0f46e37e239cf9df51e6e45adf7b7d454 | |
parent | 8812f183a288fa3da960c5b91107315080ecec1e (diff) | |
parent | bc8840eab5298aef6902ac0751adf91df5232188 (diff) | |
download | volse-hubzilla-5733491ac853b4af5d4829d68e870f3d82ced3c8.tar.gz volse-hubzilla-5733491ac853b4af5d4829d68e870f3d82ced3c8.tar.bz2 volse-hubzilla-5733491ac853b4af5d4829d68e870f3d82ced3c8.zip |
more work on items
and
Merge branch 'master' of https://github.com/redmatrix/redmatrix
Conflicts:
include/items.php
view/it/messages.po
view/it/strings.php
-rw-r--r-- | doc/Plugins.md | 4 | ||||
-rw-r--r-- | doc/plugins.bb | 4 | ||||
-rw-r--r-- | include/contact_widgets.php | 4 | ||||
-rwxr-xr-x | include/items.php | 105 | ||||
-rw-r--r-- | mod/impel.php | 2 | ||||
-rw-r--r-- | mod/item.php | 53 | ||||
-rw-r--r-- | mod/photos.php | 3 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rw-r--r-- | view/css/default.css | 3 | ||||
-rw-r--r-- | view/theme/redbasic/css/converse_center.css | 6 | ||||
-rw-r--r-- | view/theme/redbasic/css/style.css | 2 | ||||
-rw-r--r-- | view/theme/redbasic/php/style.php | 11 | ||||
-rwxr-xr-x | view/tpl/main_slider.tpl | 3 |
13 files changed, 164 insertions, 38 deletions
diff --git a/doc/Plugins.md b/doc/Plugins.md index 7d802fc5c..90ff0fb7d 100644 --- a/doc/Plugins.md +++ b/doc/Plugins.md @@ -101,8 +101,8 @@ Let's go ahead and add some code to implement our post_local hook handler. if(local_channel() != $item['uid']) /* Does this person own the post? */ return; - if(($item['parent']) || ($item['item_restrict'])) { - /* If the item has a parent, or item_restrict is non-zero, this is a comment or something else, not a status post. */ + if(($item['parent']) || (! is_item_normal($item))) { + /* If the item has a parent, or isn't "normal", this is a comment or something else, not a status post. */ return; } diff --git a/doc/plugins.bb b/doc/plugins.bb index fdabbb7ab..f74276038 100644 --- a/doc/plugins.bb +++ b/doc/plugins.bb @@ -97,8 +97,8 @@ Let's go ahead and add some code to implement our post_local hook handler. if(local_channel() != $item['uid']) /* Does this person own the post? */
return;
- if(($item['parent']) || ($item['item_restrict'])) {
- /* If the item has a parent, or item_restrict is non-zero, this is a comment or something else, not a status post. */
+ if(($item['parent']) || (! is_item_normal($item))) {
+ /* If the item has a parent, or is not "normal", this is a comment or something else, not a status post. */
return;
}
diff --git a/include/contact_widgets.php b/include/contact_widgets.php index a02fea523..2c41ea92e 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -71,6 +71,8 @@ function categories_widget($baseurl,$selected = '') { if(! feature_enabled($a->profile['profile_uid'],'categories')) return ''; + $item_normal = item_normal(); + $terms = array(); $r = q("select distinct(term.term) from term join item on term.oid = item.id @@ -78,7 +80,7 @@ function categories_widget($baseurl,$selected = '') { and term.uid = item.uid and term.type = %d and item.author_xchan = '%s' - and item.item_restrict = 0 + $item_normal order by term.term asc", intval($a->profile['profile_uid']), intval(TERM_CATEGORY), diff --git a/include/items.php b/include/items.php index 4532bf8d8..23561ef46 100755 --- a/include/items.php +++ b/include/items.php @@ -198,20 +198,25 @@ function item_normal() { and item.item_blocked = 0 "; } +/** + * @brief + * + * This is a compatibility function primarily for plugins, because + * in earlier DB schemas this was a much simpler single integer compare + * + */ + function is_item_normal($item) { - if(intval($item['item_hidden')) || intval($item['item_type')) || intval($item['item_deleted')) - || intval($item['item_unpublished')) || intval($item['item_delayed')) || intval($item['item_pending_remove'])) - || intval($item['item_blocked'))) + if(intval($item['item_hidden']) || intval($item['item_type']) || intval($item['item_deleted']) + || intval($item['item_unpublished']) || intval($item['item_delayed']) || intval($item['item_pending_remove']) + || intval($item['item_blocked'])) return false; return true; } - - - /** * @brief * @@ -914,6 +919,7 @@ function get_item_elements($x) { } if(array_key_exists('revision',$x)) { + // extended export encoding $arr['revision'] = $x['revision']; @@ -925,9 +931,30 @@ function get_item_elements($x) { $arr['postopts'] = $x['postopts']; $arr['resource_id'] = $x['resource_id']; $arr['resource_type'] = $x['resource_type']; - $arr['item_restrict'] = $x['item_restrict']; - $arr['item_flags'] = $x['item_flags']; $arr['attach'] = $x['attach']; + $arr['item_origin'] = $x['item_origin']; + $arr['item_unseen'] = $x['item_unseen']; + $arr['item_starred'] = $x['item_starred']; + $arr['item_uplink'] = $x['item_uplink']; + $arr['item_consensus'] = $x['item_consensus']; + $arr['item_wall'] = $x['item_wall']; + $arr['item_thread_top'] = $x['item_thread_top']; + $arr['item_notshown'] = $x['item_notshown']; + $arr['item_nsfw'] = $x['item_nsfw']; + $arr['item_relay'] = $x['item_relay']; + $arr['item_mentionsme'] = $x['item_mentionsme']; + $arr['item_nocomment'] = $x['item_nocomment']; + $arr['item_obscured'] = $x['item_obscured']; + $arr['item_verified'] = $x['item_verified']; + $arr['item_retained'] = $x['item_retained']; + $arr['item_rss'] = $x['item_rss']; + $arr['item_deleted'] = $x['item_deleted']; + $arr['item_type'] = $x['item_type']; + $arr['item_hidden'] = $x['item_hidden']; + $arr['item_unpublished'] = $x['item_unpublished']; + $arr['item_delayed'] = $x['item_delayed']; + $arr['item_pending_remove'] = $x['item_pending_remove']; + $arr['item_blocked'] = $x['item_blocked']; } return $arr; @@ -1133,9 +1160,31 @@ function encode_item($item,$mirror = false) { $x['postopts'] = $item['postopts']; $x['resource_id'] = $item['resource_id']; $x['resource_type'] = $item['resource_type']; - $x['item_restrict'] = $item['item_restrict']; - $x['item_flags'] = $item['item_flags']; $x['attach'] = $item['attach']; + $x['item_origin'] = $item['item_origin']; + $x['item_unseen'] = $item['item_unseen']; + $x['item_starred'] = $item['item_starred']; + $x['item_uplink'] = $item['item_uplink']; + $x['item_consensus'] = $item['item_consensus']; + $x['item_wall'] = $item['item_wall']; + $x['item_thread_top'] = $item['item_thread_top']; + $x['item_notshown'] = $item['item_notshown']; + $x['item_nsfw'] = $item['item_nsfw']; + $x['item_relay'] = $item['item_relay']; + $x['item_mentionsme'] = $item['item_mentionsme']; + $x['item_nocomment'] = $item['item_nocomment']; + $x['item_obscured'] = $item['item_obscured']; + $x['item_verified'] = $item['item_verified']; + $x['item_retained'] = $item['item_retained']; + $x['item_rss'] = $item['item_rss']; + $x['item_deleted'] = $item['item_deleted']; + $x['item_type'] = $item['item_type']; + $x['item_hidden'] = $item['item_hidden']; + $x['item_unpublished'] = $item['item_unpublished']; + $x['item_delayed'] = $item['item_delayed']; + $x['item_pending_remove'] = $item['item_pending_remove']; + $x['item_blocked'] = $item['item_blocked']; + } @@ -2045,8 +2094,8 @@ function item_store($arr, $allow_exec = false) { $arr['deny_cid'] = ((x($arr,'deny_cid')) ? trim($arr['deny_cid']) : ''); $arr['deny_gid'] = ((x($arr,'deny_gid')) ? trim($arr['deny_gid']) : ''); $arr['item_private'] = ((x($arr,'item_private')) ? intval($arr['item_private']) : 0 ); - $arr['item_flags'] = ((x($arr,'item_flags')) ? intval($arr['item_flags']) : 0 ); $arr['item_wall'] = ((x($arr,'item_wall')) ? intval($arr['item_wall']) : 0 ); + $arr['item_type'] = ((x($arr,'item_type')) ? intval($arr['item_type']) : 0 ); // only detect language if we have text content, and if the post is private but not yet // obscured, make it so. @@ -2118,7 +2167,6 @@ function item_store($arr, $allow_exec = false) { $arr['plink'] = ((x($arr,'plink')) ? notags(trim($arr['plink'])) : ''); $arr['attach'] = ((x($arr,'attach')) ? notags(trim($arr['attach'])) : ''); $arr['app'] = ((x($arr,'app')) ? notags(trim($arr['app'])) : ''); - $arr['item_restrict'] = ((x($arr,'item_restrict')) ? intval($arr['item_restrict']) : 0 ); $arr['public_policy'] = ((x($arr,'public_policy')) ? notags(trim($arr['public_policy'])) : '' ); @@ -2419,8 +2467,6 @@ function item_store_update($arr,$allow_exec = false) { $arr['item_unseen'] = $orig[0]['item_unseen']; - $arr['item_flags'] = intval($arr['item_flags']) | $orig[0]['item_flags']; - $arr['item_restrict'] = intval($arr['item_restrict']) | $orig[0]['item_restrict']; if(array_key_exists('edit',$arr)) unset($arr['edit']); @@ -2520,10 +2566,33 @@ function item_store_update($arr,$allow_exec = false) { $arr['body'] = ((array_key_exists('body',$arr) && strlen($arr['body'])) ? trim($arr['body']) : ''); $arr['html'] = ((array_key_exists('html',$arr) && strlen($arr['html'])) ? trim($arr['html']) : ''); - $arr['attach'] = ((x($arr,'attach')) ? notags(trim($arr['attach'])) : $orig[0]['attach']); - $arr['app'] = ((x($arr,'app')) ? notags(trim($arr['app'])) : $orig[0]['app']); -// $arr['item_restrict'] = ((x($arr,'item_restrict')) ? intval($arr['item_restrict']) : $orig[0]['item_restrict'] ); -// $arr['item_flags'] = ((x($arr,'item_flags')) ? intval($arr['item_flags']) : $orig[0]['item_flags'] ); + $arr['attach'] = ((array_key_exists('attach',$arr)) ? notags(trim($arr['attach'])) : $orig[0]['attach']); + $arr['app'] = ((array_key_exists('app',$arr)) ? notags(trim($arr['app'])) : $orig[0]['app']); + + $arr['item_origin'] = ((array_key_exists('item_origin',$arr)) ? intval($arr['item_origin']) : $orig[0]['item_origin'] ); + $arr['item_unseen'] = ((array_key_exists('item_unseen',$arr)) ? intval($arr['item_unseen']) : $orig[0]['item_unseen'] ); + $arr['item_starred'] = ((array_key_exists('item_starred',$arr)) ? intval($arr['item_starred']) : $orig[0]['item_starred'] ); + $arr['item_uplink'] = ((array_key_exists('item_uplink',$arr)) ? intval($arr['item_uplink']) : $orig[0]['item_uplink'] ); + $arr['item_consensus'] = ((array_key_exists('item_consensus',$arr)) ? intval($arr['item_consensus']) : $orig[0]['item_consensus'] ); + $arr['item_wall'] = ((array_key_exists('item_wall',$arr)) ? intval($arr['item_wall']) : $orig[0]['item_wall'] ); + $arr['item_thread_top'] = ((array_key_exists('item_thread_top',$arr)) ? intval($arr['item_thread_top']) : $orig[0]['item_thread_top'] ); + $arr['item_notshown'] = ((array_key_exists('item_notshown',$arr)) ? intval($arr['item_notshown']) : $orig[0]['item_notshown'] ); + $arr['item_nsfw'] = ((array_key_exists('item_nsfw',$arr)) ? intval($arr['item_nsfw']) : $orig[0]['item_nsfw'] ); + $arr['item_relay'] = ((array_key_exists('item_relay',$arr)) ? intval($arr['item_relay']) : $orig[0]['item_relay'] ); + $arr['item_mentionsme'] = ((array_key_exists('item_mentionsme',$arr)) ? intval($arr['item_mentionsme']) : $orig[0]['item_mentionsme'] ); + $arr['item_nocomment'] = ((array_key_exists('item_nocomment',$arr)) ? intval($arr['item_nocomment']) : $orig[0]['item_nocomment'] ); + $arr['item_obscured'] = ((array_key_exists('item_obscured',$arr)) ? intval($arr['item_obscured']) : $orig[0]['item_obscured'] ); + $arr['item_verified'] = ((array_key_exists('item_verified',$arr)) ? intval($arr['item_verified']) : $orig[0]['item_verified'] ); + $arr['item_retained'] = ((array_key_exists('item_retained',$arr)) ? intval($arr['item_retained']) : $orig[0]['item_retained'] ); + $arr['item_rss'] = ((array_key_exists('item_rss',$arr)) ? intval($arr['item_rss']) : $orig[0]['item_rss'] ); + $arr['item_deleted'] = ((array_key_exists('item_deleted',$arr)) ? intval($arr['item_deleted']) : $orig[0]['item_deleted'] ); + $arr['item_type'] = ((array_key_exists('item_type',$arr)) ? intval($arr['item_type']) : $orig[0]['item_type'] ); + $arr['item_hidden'] = ((array_key_exists('item_hidden',$arr)) ? intval($arr['item_hidden']) : $orig[0]['item_hidden'] ); + $arr['item_unpublished'] = ((array_key_exists('item_unpublished',$arr)) ? intval($arr['item_unpublished']) : $orig[0]['item_unpublished'] ); + $arr['item_delayed'] = ((array_key_exists('item_delayed',$arr)) ? intval($arr['item_delayed']) : $orig[0]['item_delayed'] ); + $arr['item_pending_remove'] = ((array_key_exists('item_pending_remove',$arr)) ? intval($arr['item_pending_remove']) : $orig[0]['item_pending_remove'] ); + $arr['item_blocked'] = ((array_key_exists('item_blocked',$arr)) ? intval($arr['item_blocked']) : $orig[0]['item_blocked'] ); + $arr['sig'] = ((x($arr,'sig')) ? $arr['sig'] : ''); $arr['layout_mid'] = ((array_key_exists('layout_mid',$arr)) ? dbesc($arr['layout_mid']) : $orig[0]['layout_mid'] ); diff --git a/mod/impel.php b/mod/impel.php index 94e343ed1..da7138438 100644 --- a/mod/impel.php +++ b/mod/impel.php @@ -183,7 +183,7 @@ function impel_init(&$a) { if($x['success']) { $item_id = $x['item_id']; - update_remote_id($channel,$item_id,$arr['item_restrict'],$pagetitle,$namespace,$remote_id,$arr['mid']); + update_remote_id($channel,$item_id,$arr['item_type'],$pagetitle,$namespace,$remote_id,$arr['mid']); } } diff --git a/mod/item.php b/mod/item.php index 90f681854..888d1643b 100644 --- a/mod/item.php +++ b/mod/item.php @@ -345,9 +345,33 @@ function item_post(&$a) { $app = $orig_post['app']; $title = $_REQUEST['title']; $body = $_REQUEST['body']; - $item_flags = $orig_post['item_flags']; - $item_restrict = $orig_post['item_restrict']; + $item_origin = $orig_post['item_origin']; + $item_unseen = $orig_post['item_unseen']; + $item_starred = $orig_post['item_starred']; + $item_uplink = $orig_post['item_uplink']; + $item_consensus = $orig_post['item_consensus']; + $item_wall = $orig_post['item_wall']; + $item_thread_top = $orig_post['item_thread_top']; + $item_notshown = $orig_post['item_notshown']; + $item_nsfw = $orig_post['item_nsfw']; + $item_relay = $orig_post['item_relay']; + $item_mentionsme = $orig_post['item_mentionsme']; + $item_nocomment = $orig_post['item_nocomment']; + $item_obscured = $orig_post['item_obscured']; + $item_verified = $orig_post['item_verified']; + $item_retained = $orig_post['item_retained']; + $item_rss = $orig_post['item_rss']; + $item_deleted = $orig_post['item_deleted']; + $item_type = $orig_post['item_type']; + $item_hidden = $orig_post['item_hidden']; + $item_unpublished = $orig_post['item_unpublished']; + $item_delayed = $orig_post['item_delayed']; + $item_pending_remove = $orig_post['item_pedning_remove']; + $item_blocked = $orig_post['item_blocked']; + + + $postopts = $orig_post['postopts']; $created = $orig_post['created']; $mid = $orig_post['mid']; @@ -738,20 +762,37 @@ function item_post(&$a) { $datarray['attach'] = $attachments; $datarray['thr_parent'] = $thr_parent; $datarray['postopts'] = $postopts; - $datarray['item_restrict'] = $item_restrict; - $datarray['item_flags'] = $item_flags; $datarray['item_unseen'] = $item_unseen; $datarray['item_wall'] = $item_wall; $datarray['item_origin'] = $item_origin; $datarray['item_type'] = $webpage; $datarray['item_thread_top'] = $item_thread_top; + $datarray['item_unseen'] = $item_unseen; + $datarray['item_starred'] = $item_starred; + $datarray['item_uplink'] = $item_uplink; + $datarray['item_consensus'] = $item_consensus; + $datarray['item_notshown'] = $item_notshown; + $datarray['item_nsfw'] = $item_nsfw; + $datarray['item_relay'] = $item_relay; + $datarray['item_mentionsme'] = $item_mentionsme; + $datarray['item_nocomment'] = $item_nocomment; + $datarray['item_obscured'] = $item_obscured; + $datarray['item_verified'] = $item_verified; + $datarray['item_retained'] = $item_retained; + $datarray['item_rss'] = $item_rss; + $datarray['item_deleted'] = $item_deleted; + $datarray['item_hidden'] = $item_hidden; + $datarray['item_unpublished'] = $item_unpublished; + $datarray['item_delayed'] = $item_delayed; + $datarray['item_pending_remove'] = $item_pending_remove; + $datarray['item_blocked'] = $item_blocked; + $datarray['layout_mid'] = $layout_mid; $datarray['public_policy'] = $public_policy; $datarray['comment_policy'] = map_scope($channel['channel_w_comment']); $datarray['term'] = $post_tags; $datarray['plink'] = $plink; $datarray['route'] = $route; - $datarray['item_unseen'] = $item_unseen; // preview mode - prepare the body for display and send it via json @@ -862,7 +903,7 @@ function item_post(&$a) { )); } - if($uid && $uid == $profile_uid && (! $datarray['item_restrict'])) { + if($uid && $uid == $profile_uid && (is_item_normal($datarray))) { q("update channel set channel_lastpost = '%s' where channel_id = %d", dbesc(datetime_convert()), intval($uid) diff --git a/mod/photos.php b/mod/photos.php index 52fbe5e4c..1a4a50c05 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -841,9 +841,10 @@ function photos_content(&$a) { $linked_items = fetch_post_tags($linked_items,true); $link_item = $linked_items[0]; + $item_normal = item_normal(); $r = q("select * from item where parent_mid = '%s' - and item_restrict = 0 and uid = %d $sql_extra ", + $item_normal and uid = %d $sql_extra ", dbesc($link_item['mid']), intval($link_item['uid']) diff --git a/version.inc b/version.inc index 273ae533b..aa34c32c5 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-06-10.1059 +2015-06-11.1060 diff --git a/view/css/default.css b/view/css/default.css index 2675bc2d8..fb6705894 100644 --- a/view/css/default.css +++ b/view/css/default.css @@ -14,8 +14,7 @@ main { height: 100%; } -aside#region_1, -aside#region_3 { +aside { display: table-cell; vertical-align: top; padding: 65px 7px 0px 7px; diff --git a/view/theme/redbasic/css/converse_center.css b/view/theme/redbasic/css/converse_center.css index 8e595e7ff..9b4246a5b 100644 --- a/view/theme/redbasic/css/converse_center.css +++ b/view/theme/redbasic/css/converse_center.css @@ -2,3 +2,9 @@ main { margin-left: auto; margin-right: auto; } + +aside#region_3 { + width: $aside_widthpx; + min-width: $aside_widthpx; + max-width: $aside_widthpx; +} diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 1c575a63e..946e2d7d7 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -24,7 +24,7 @@ body { height: 100%; } -aside { +aside#region_1 { width: $aside_widthpx; min-width: $aside_widthpx; max-width: $aside_widthpx; diff --git a/view/theme/redbasic/php/style.php b/view/theme/redbasic/php/style.php index 5a28fc4e3..956c1951c 100644 --- a/view/theme/redbasic/php/style.php +++ b/view/theme/redbasic/php/style.php @@ -156,8 +156,12 @@ if(file_exists('view/theme/redbasic/css/style.css')) { $aside_width = 231; // left aside and right aside are is 231px + converse width - $main_width = (($aside_width * 2) + intval($converse_width)); - + if($converse_center) { + $main_width = (($aside_width * 2) + intval($converse_width)); + } + else { + $main_width = (($aside_width) + intval($converse_width)); + } // prevent main_width smaller than 768px $main_width = (($main_width < 768) ? 768 : $main_width); @@ -205,7 +209,8 @@ if($narrow_navbar && file_exists('view/theme/redbasic/css/narrow_navbar.css')) { } if($converse_center && file_exists('view/theme/redbasic/css/converse_center.css')) { - echo file_get_contents('view/theme/redbasic/css/converse_center.css'); + $cc = file_get_contents('view/theme/redbasic/css/converse_center.css'); + echo str_replace(array_keys($options), array_values($options), $cc); } if($schemecss) { diff --git a/view/tpl/main_slider.tpl b/view/tpl/main_slider.tpl index d88bc1370..a4e2e1925 100755 --- a/view/tpl/main_slider.tpl +++ b/view/tpl/main_slider.tpl @@ -1,7 +1,9 @@ <div id="main-slider" class="slider" ><input id="main-range" type="text" name="cminmax" value="{{$val}}" /></div> <script> +$(document).ready(function() { var old_cmin = 0; var old_cmax = 99; + $("#main-range").jRange({ isRange: true, from: 0, to: 99, step: 1, scale: [{{$labels}}], width:'100%', showLabels: false, onstatechange: function(v) { var carr = v.split(","); if(carr[0] != bParam_cmin) { @@ -32,4 +34,5 @@ page_load = true; liveUpdate(); } +}); </script> |