1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-22 05:31:58 +02:00

New notify script added to front end. You can test with forum 'quick reply' for now.

This commit is contained in:
Cameron 2013-06-21 01:26:30 -07:00
parent 8d7971ec69
commit e5e5c1d12c
6 changed files with 143 additions and 10 deletions
e107_core/templates
e107_handlers
e107_plugins/forum
e107_web/js/bootstrap-notify

@ -29,6 +29,9 @@ e107::js('core', 'bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js',
e107::js('core', 'bootstrap/js/bootstrap-tooltip.js','jquery');
e107::css('core', 'bootstrap/css/tooltip.css','jquery');
e107::js('core', 'bootstrap-notify/js/bootstrap-notify.js','jquery');
e107::css('core', 'bootstrap-notify/css/bootstrap-notify.css','jquery');
// ------------------
// e107::js('core', 'jquery.elastic.js', 'jquery', 2);
@ -691,6 +694,11 @@ if ($e107_popup != 1) {
echo "<div class='installer alert alert-danger alert-block text-center'><b>*** ".CORE_LAN4." ***</b><br />".CORE_LAN5."</div>";
}
if(deftrue('BOOTSTRAP'))
{
echo "<div id='uiAlert' class='notifications center'></div>"; // Popup Alert Message holder. @see http://nijikokun.github.io/bootstrap-notify/
}
// Display Welcome Message when old method activated.
if(strstr($HEADER,"{WMESSAGE")===false && strstr($FOOTER,"{WMESSAGE")===false) // Auto-detection to override old pref.
{

@ -528,7 +528,7 @@ class eMessage
}
return "
<div class='s-message alert alert-block {$type} {$bclass}'>
<div class='s-message alert alert-block fade in {$type} {$bclass}'>
<a class='close' data-dismiss='alert'>×</a>
<i class='s-message-icon s-message-".$type."'></i>
<h4 class='s-message-title'>".self::getTitle($type, $mstack)."</h4>

@ -29,11 +29,7 @@ $(document).ready(function()
var insert = $(this).attr('data-forum-insert');
var token = $(this).attr('data-token');
if(action != 'stick' && action !='unstick')
{
e.preventDefault();
}
e.preventDefault();
var script = $(this).attr("src");
@ -43,17 +39,40 @@ $(document).ready(function()
data: { thread: thread, action: action, post: post, text: text, insert:insert, e_token: token },
success: function(data) {
// alert(data);
// alert(data);
var d = $.parseJSON(data);
if(d)
{
if(d.msg)
{
alert(d.msg);
if(d.status == 'ok')
{
var alertType = 'success';
}
else {
var alertType = 'info';
}
// http://nijikokun.github.io/bootstrap-notify/
$('#uiAlert').notify({
type: alertType,
message: { text: d.msg },
fadeOut: { enabled: true, delay: 3000 }
}).show();
// alert(d.msg);
}
if(action == 'stick' || action == 'unstick' || action == 'lock' || action == 'unlock')
{
location.reload();
return;
}
if(action == 'quickreply' && d.status == 'ok' )
{
// alert(d.html);
@ -75,6 +94,9 @@ $(document).ready(function()
$(t).hide('slow');
$(p).hide('slow').slideUp(800);
}
}
}
@ -256,10 +278,10 @@ class e107forum
function ajaxModerate()
public function ajaxModerate()
{
if(!ADMIN) //FIXME check permissions per forum.
if(!$this->isModerator(USERID)) //FIXME check permissions per forum.
{
exit;
}

@ -139,6 +139,11 @@ if (MODERATOR)
}
}
if(e_AJAX_REQUEST && MODERATOR) // see javascript above.
{
$forum->ajaxModerate();
}
if(varset($pref['track_online']))
{
$member_users = $sql->db_Count('online', '(*)', "WHERE online_location REGEXP('viewforum.php.id=$forumId\$') AND online_user_id != 0");

@ -0,0 +1,6 @@
.notifications{position:fixed;}.notifications.top-right{right:10px;top:25px;}
.notifications.top-left{left:10px;top:25px;}
.notifications.bottom-left{left:10px;bottom:25px;}
.notifications.bottom-right{right:10px;bottom:25px;}
.notifications>div{position:relative;z-index:9999;margin:5px 0px;}
.notifications.center{top:48%;left:0;width:100%;}.notifications.center>div{margin:5px auto;width:20%;text-align:center;}

@ -0,0 +1,92 @@
/**
* bootstrap-notify.js v1.0.0
* --
* Copyright 2012 Nijiko Yonskai <nijikokun@gmail.com>
* Copyright 2012 Goodybag, Inc.
* --
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function ($) {
var Notification = function (element, options) {
// Element collection
this.$element = $(element);
this.$note = $('<div class="alert"></div>');
this.options = $.extend(true, {}, $.fn.notify.defaults, options);
this._link = null;
// Setup from options
if (this.options.transition)
if (this.options.transition === 'fade')
this.$note.addClass('in').addClass(this.options.transition);
else this.$note.addClass(this.options.transition);
else this.$note.addClass('fade').addClass('in');
if (this.options.type)
this.$note.addClass('alert-' + this.options.type);
else this.$note.addClass('alert-success');
if (this.options.message)
if (typeof this.options.message === 'string')
this.$note.html(this.options.message);
else if (typeof this.options.message === 'object')
if (this.options.message.html)
this.$note.html(this.options.message.html);
else if (this.options.message.text)
this.$note.text(this.options.message.text);
if (this.options.closable)
this._link = $('<a class="close pull-right">&times;</a>'),
$(this._link).on('click', $.proxy(Notification.onClose, this)),
this.$note.prepend(this._link);
return this;
};
Notification.onClose = function () {
this.options.onClose();
$(this.$note).remove();
this.options.onClosed();
};
Notification.prototype.show = function () {
if (this.options.fadeOut.enabled)
this.$note.delay(this.options.fadeOut.delay || 3000).fadeOut('slow', $.proxy(Notification.onClose, this));
this.$element.append(this.$note);
this.$note.alert();
};
Notification.prototype.hide = function () {
if (this.options.fadeOut.enabled)
this.$note.delay(this.options.fadeOut.delay || 3000).fadeOut('slow', $.proxy(Notification.onClose, this));
else Notification.onClose.call(this);
};
$.fn.notify = function (options) {
return new Notification(this, options);
};
$.fn.notify.defaults = {
type: 'success',
closable: true,
transition: 'fade',
fadeOut: {
enabled: true,
delay: 3000
},
message: null,
onClose: function () {},
onClosed: function () {}
}
})(window.jQuery);