Skip to content

Commit b06749c

Browse files
committed
v1.3.00
1 parent ead3509 commit b06749c

4 files changed

Lines changed: 18 additions & 20 deletions

File tree

Feed/feed_view.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,21 @@
1919
along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
*/
2121

22+
use Gibbon\Services\Format;
23+
2224
//Module includes
2325
include './modules/'.$session->get('module').'/moduleFunctions.php';
2426

2527
if (isActionAccessible($guid, $connection2, '/modules/Feed/feed_view.php') == false) {
2628
//Acess denied
27-
echo "<div class='error'>";
28-
echo __('You do not have access to this action.');
29-
echo '</div>';
29+
$page->addError(__('You do not have access to this action.'));
3030
} else {
3131
//Proceed!
3232
$page->breadcrumbs->add(__('View Feed'));
3333

3434
//Get action with highest precendence
3535
$highestAction = getHighestGroupedAction($guid, $_GET['q'], $connection2);
36-
if ($highestAction == false) { echo "<div class='error'>";
37-
echo __('The highest grouped action cannot be determined.');
38-
echo '</div>';
36+
if ($highestAction == false) { echo Format::alert(__('The highest grouped action cannot be determined.'), 'error');
3937
} else {
4038
echo '<h2>';
4139
echo __('Feed');

Feed/feed_view_ajax.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@
3333
$gibbonPersonID = $_GET['gibbonPersonID'] ?? null;
3434

3535
if (is_null($gibbonPersonID) or $gibbonPersonID=='') {
36-
echo "<div class='error'>";
37-
echo __('You have not specified one or more required parameters.');
38-
echo '</div>';
36+
echo Format::alert(__('You have not specified one or more required parameters.'), 'error');
3937
}
4038
else {
4139
$feeds = array();
@@ -147,9 +145,7 @@
147145
}
148146

149147
if ($feedCount==0) {
150-
echo "<div class='error'>";
151-
echo __('There are no records to display.');
152-
echo '</div>';
148+
echo Format::alert(__('There are no records to display.'), 'error');
153149
}
154150
else {
155151
$entries = array();
@@ -186,9 +182,7 @@
186182
$entries=array_slice($entries, 0, 20) ;
187183

188184
if (count($entries)<1) {
189-
echo "<div class='error'>";
190-
echo __('There are no records to display.');
191-
echo '</div>';
185+
echo Format::alert(__('There are no records to display.'), 'error');
192186
}
193187
else {
194188
$count = 0;

Feed/hook_dashboard_feedView.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
*/
2121

22+
use Gibbon\Services\Format;
23+
2224
$returnInt = null;
2325

2426
//Only include module include if it is not already included (which it may be been on the index page)
2527
require_once $session->get('absolutePath').'/modules/Feed/moduleFunctions.php';
2628

2729
if (isActionAccessible($guid, $connection2, '/modules/Feed/feed_view.php') == false) {
2830
// Access denied
29-
$returnInt .= "<div class='error'>";
30-
$returnInt .= 'You do not have access to this action.';
31-
$returnInt .= '</div>';
31+
$returnInt .= Format::alert('You do not have access to this action.', 'error');
3232
} else {
3333
$returnInt .= getFeed($connection2, $guid, $gibbonPersonID);
3434
}

Feed/moduleFunctions.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,14 @@ function getFeed($connection2, $guid, $gibbonPersonID)
3737
$output .= '</p>';
3838

3939
$output .= '<script type=\'text/javascript\'>
40-
$(document).ready(function(){
41-
$(\'#feedOuter-' . $gibbonPersonID . '\').load(\'' . $session->get('absoluteURL') . '/modules/Feed/feed_view_ajax.php?gibbonPersonID=' . $gibbonPersonID . '\')});
40+
document.addEventListener("DOMContentLoaded", function(){
41+
var el = document.getElementById("feedOuter-' . $gibbonPersonID . '");
42+
if (el) {
43+
fetch("' . $session->get('absoluteURL') . '/modules/Feed/feed_view_ajax.php?gibbonPersonID=' . $gibbonPersonID . '")
44+
.then(function(r){ return r.text(); })
45+
.then(function(html){ el.innerHTML = html; });
46+
}
47+
});
4248
</script>' ;
4349

4450
$output .= '<div id=\'feedOuter-' . $gibbonPersonID . '\' style=\'width: 100%\'>' ;

0 commit comments

Comments
 (0)