diff options
author | zotlabs <mike@macgirvin.com> | 2017-08-23 21:26:09 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-08-23 21:26:09 -0700 |
commit | 4450170790de3999dc9c6f8876074e76edee8241 (patch) | |
tree | 556fccb00499add4268566956541692db68606f2 | |
parent | 66b032823b4fd941f613b0194bb8412b216cc748 (diff) | |
download | volse-hubzilla-4450170790de3999dc9c6f8876074e76edee8241.tar.gz volse-hubzilla-4450170790de3999dc9c6f8876074e76edee8241.tar.bz2 volse-hubzilla-4450170790de3999dc9c6f8876074e76edee8241.zip |
partial support (unfinished) for ajax loading cards with liveupdate; page still functions even though this isn't finished
-rw-r--r-- | Zotlabs/Module/Cards.php | 5 | ||||
-rw-r--r-- | Zotlabs/Module/Update_cards.php | 39 | ||||
-rw-r--r-- | include/conversation.php | 9 | ||||
-rw-r--r-- | view/js/main.js | 1 |
4 files changed, 51 insertions, 3 deletions
diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index f354544d5..19932769f 100644 --- a/Zotlabs/Module/Cards.php +++ b/Zotlabs/Module/Cards.php @@ -19,8 +19,7 @@ class Cards extends \Zotlabs\Web\Controller { } - - function get() { + function get($update = 0, $load = false) { if(observer_prohibited(true)) { return login(); @@ -173,7 +172,7 @@ class Cards extends \Zotlabs\Web\Controller { $items = []; } - $mode = 'channel'; + $mode = 'cards'; $content = conversation($items,$mode,false,'traditional'); diff --git a/Zotlabs/Module/Update_cards.php b/Zotlabs/Module/Update_cards.php new file mode 100644 index 000000000..bb87357e8 --- /dev/null +++ b/Zotlabs/Module/Update_cards.php @@ -0,0 +1,39 @@ +<?php + +namespace Zotlabs\Module; + +/** + * Module: update_profile + * Purpose: AJAX synchronisation of profile page + * + */ + + +class Update_cards extends \Zotlabs\Web\Controller { + +function get() { + + $profile_uid = intval($_GET['p']); + $load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0); + + header("Content-type: text/html"); + echo "<!DOCTYPE html><html><body><section></section></body></html>\r\n"; + + killme(); + + + $mod = new Cards(); + + $text = $mod->get($profile_uid,$load); + + /** + * reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well + */ + + echo str_replace("\t",' ',$text); + echo (($_GET['msie'] == 1) ? '</div>' : '</section>'); + echo "</body></html>\r\n"; + killme(); + +} +} diff --git a/include/conversation.php b/include/conversation.php index 7e0394058..0d2dd2224 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -517,6 +517,15 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa } } + elseif ($mode === 'cards') { + $profile_owner = App::$profile['profile_uid']; + $page_writeable = ($profile_owner == local_channel()); + $live_update_div = '<div id="live-cards"></div>' . "\r\n" + . "<script> var profile_uid = " . App::$profile['profile_uid'] + . "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n"; + } + + elseif ($mode === 'display') { $profile_owner = local_channel(); $page_writeable = false; diff --git a/view/js/main.js b/view/js/main.js index f20432735..bbdb0759b 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -380,6 +380,7 @@ function NavUpdate() { if($('#live-pubstream').length) { src = 'pubstream'; liveUpdate(); } if($('#live-display').length) { src = 'display'; liveUpdate(); } if($('#live-search').length) { src = 'search'; liveUpdate(); } + if($('#live-cards').length) { src = 'cards'; liveUpdate(); } if($('#live-photos').length) { if(liking) { |