modularise the notification popups
This commit is contained in:
parent
e9b5b0f0b4
commit
a12264193f
@ -299,7 +299,7 @@ CREATE TABLE IF NOT EXISTS `deliverq` (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `event` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`account` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`aid` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`uid` int(11) NOT NULL,
|
||||
`cid` int(11) NOT NULL,
|
||||
`message_id` char(255) NOT NULL,
|
||||
@ -328,7 +328,7 @@ CREATE TABLE IF NOT EXISTS `event` (
|
||||
KEY `adjust` (`adjust`),
|
||||
KEY `nofinish` (`nofinish`),
|
||||
KEY `ignore` (`ignore`),
|
||||
KEY `account` (`account`)
|
||||
KEY `aid` (`aid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `fcontact` (
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
define( 'UPDATE_VERSION' , 1002 );
|
||||
define( 'UPDATE_VERSION' , 1003 );
|
||||
|
||||
/**
|
||||
*
|
||||
@ -61,3 +61,13 @@ function update_r1001() {
|
||||
return UPDATE_SUCCESS;
|
||||
return UPDATE_FAILED;
|
||||
}
|
||||
|
||||
|
||||
function update_r1002() {
|
||||
$r = q("ALTER TABLE `event` CHANGE `account` `aid` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
|
||||
$r2 = q("alter table `event` drop index `account`, add index (`aid`)");
|
||||
|
||||
if($r && $r2)
|
||||
return UPDATE_SUCCESS;
|
||||
return UPDATE_FAILED;
|
||||
}
|
||||
|
24
js/main.js
24
js/main.js
@ -280,6 +280,25 @@
|
||||
if(data.notify == 0) { data.notify = ''; $('#notify-update').removeClass('show') } else { $('#notify-update').addClass('show') }
|
||||
$('#notify-update').html(data.notify);
|
||||
|
||||
if(data.register == 0) { data.register = ''; $('#register-update').removeClass('show') } else { $('#register-update').addClass('show') }
|
||||
$('#register-update').html(data.register);
|
||||
|
||||
if(data.events == 0) { data.events = ''; $('#events-update').removeClass('show') } else { $('#events-update').addClass('show') }
|
||||
$('#events-update').html(data.events);
|
||||
|
||||
if(data.events_today == 0) { data.events_today = ''; $('#events-today-update').removeClass('show') } else { $('#events-today-update').addClass('show') }
|
||||
$('#events-today-update').html(data.events_today);
|
||||
|
||||
if(data.birthdays == 0) { data.birthdays = ''; $('#birthdays-update').removeClass('show') } else { $('#birthdays-update').addClass('show') }
|
||||
$('#birthdays-update').html(data.birthdays);
|
||||
|
||||
if(data.birthdays_today == 0) { data.birthdays_today = ''; $('#birthdays-today-update').removeClass('show') } else { $('#birthdays-today-update').addClass('show') }
|
||||
$('#birthdays-today-update').html(data.birthdays_today);
|
||||
|
||||
if(data.all_events == 0) { data.all_events = ''; $('#all-events-update').removeClass('show') } else { $('#all-events-update').addClass('show') }
|
||||
$('#all-events-update').html(data.all_events);
|
||||
if(data.all_events_today == 0) { data.all_events_today = ''; $('#all-events-today-update').removeClass('show') } else { $('#all-events-today-update').addClass('show') }
|
||||
$('#all-events-today-update').html(data.all_events_today);
|
||||
|
||||
|
||||
$(data.notice).each(function() {
|
||||
@ -487,13 +506,14 @@ function updateConvItems(mode,data) {
|
||||
$(node).removeClass("drop").addClass("drophide");
|
||||
}
|
||||
|
||||
function notify_popup() {
|
||||
function notify_popup(notifyType) {
|
||||
|
||||
if($("#nav-notifications-menu").is(":visible")) {
|
||||
$("#nav-notifications-menu").hide();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* notifications template */
|
||||
var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
|
||||
var notifications_all = unescape($('<div>').append( $("#nav-notifications-see-all").clone() ).html()); //outerHtml hack
|
||||
@ -502,7 +522,7 @@ function updateConvItems(mode,data) {
|
||||
|
||||
var notify_menu = $("#nav-notifications-menu");
|
||||
|
||||
var pingExCmd = 'ping/notify' + ((localUser != 0) ? '?f=&uid=' + localUser : '');
|
||||
var pingExCmd = 'ping/' + notifyType + ((localUser != 0) ? '?f=&uid=' + localUser : '');
|
||||
$.get(pingExCmd,function(data) {
|
||||
|
||||
if(data.invalid == 1) {
|
||||
|
@ -1 +1 @@
|
||||
2012-12-16.171
|
||||
2012-12-18.173
|
||||
|
@ -14,13 +14,20 @@
|
||||
{{ if $nav.network }}
|
||||
<li id="nav-network-link" class="nav-menu $sel.network">
|
||||
<a class="$nav.network.2" href="$nav.network.0" title="$nav.network.3" >$nav.network.1</a>
|
||||
<span id="net-update" class="nav-notify"></span>
|
||||
<span id="net-update" class="nav-notify fakelink" onclick="notify_popup('network'); return false;" ></span>
|
||||
</li>
|
||||
{{ endif }}
|
||||
{{ if $nav.home }}
|
||||
<li id="nav-home-link" class="nav-menu $sel.home">
|
||||
<a class="$nav.home.2" href="$nav.home.0" title="$nav.home.3" >$nav.home.1</a>
|
||||
<span id="home-update" class="nav-notify"></span>
|
||||
<span id="home-update" class="nav-notify fakelink" onclick="notify_popup('home'); return false;" ></span>
|
||||
</li>
|
||||
{{ endif }}
|
||||
|
||||
{{ if $nav.all_events }}
|
||||
<li id="nav-all-events-link" class="nav-menu $sel.all_events">
|
||||
<a class="$nav.all_events.2" href="$nav.all_events.0" title="$nav.all_events.3" >$nav.all_events.1</a>
|
||||
<span id="all-events-update" class="nav-notify fakelink" onclick="notify_popup('all_events'); return false;" ></span>
|
||||
</li>
|
||||
{{ endif }}
|
||||
|
||||
@ -34,7 +41,7 @@
|
||||
|
||||
{{ if $nav.notifications }}
|
||||
|
||||
<li id="nav-notifications-linkmenu" class="nav-menu fakelink" onclick="notify_popup(); return false;" title="$nav.notifications.1"><span class="icon s22 notify">$nav.notifications.1</span></a>
|
||||
<li id="nav-notifications-linkmenu" class="nav-menu fakelink" onclick="notify_popup('notify'); return false;" title="$nav.notifications.1"><span class="icon s22 notify">$nav.notifications.1</span></a>
|
||||
<span id="notify-update" class="nav-notify"></span>
|
||||
<ul id="nav-notifications-menu" class="menu-popup">
|
||||
<li id="nav-notifications-see-all"><a href="$nav.notifications.all.0">$nav.notifications.all.1</a></li>
|
||||
|
Reference in New Issue
Block a user