Append total of notifications & Fix menu toggle (#2012)

This commit is contained in:
Christophe Maudoux 2019-11-19 22:01:44 +01:00
parent adfd86d7fe
commit 4d60dac78d
13 changed files with 25 additions and 12 deletions

View File

@ -15,10 +15,9 @@ use feature 'state';
extends 'Lemonldap::NG::Common::Conf::AccessLib';
our $VERSION = '2.0.6';
our $VERSION = '2.0.7';
has notifAccess => ( is => 'rw' );
has notifFormat => ( is => 'rw' );
#############################
@ -75,7 +74,6 @@ sub addRoutes {
{ done => { ':notificationId' => 'deleteDoneNotification' } },
['DELETE']
);
}
sub setNotifAccess {
@ -158,6 +156,7 @@ sub notifications {
my ( $notifs, $res );
$notifs = $self->notifAccess->$sub();
my $total = ( keys %$notifs );
# Restrict to wanted values
if (
@ -201,6 +200,7 @@ sub notifications {
result => 1,
count => $count,
values => $res,
total => $total
}
);
}
@ -221,7 +221,7 @@ sub notifications {
}
}
return $self->sendJSONresponse( $req,
{ result => 1, count => scalar(@r), values => \@r } );
{ result => 1, count => scalar(@r), values => \@r, total => $total } );
}
}
@ -289,6 +289,7 @@ sub newNotification {
$self->logger->debug("Notification Date = $json->{date}");
unless ( $json->{date} =~ /^\d{4}-\d{2}-\d{2}$/ ) {
$self->logger->error("Malformed date");
return $self->sendError( $req, "Malformed date", 200 );
}
@ -312,8 +313,8 @@ sub newNotification {
delete $json->{xml};
};
if ($@) {
$self->logger->error("Notification malformed $@");
return $self->sendError( $req, "Notification malformed: $@", 200 );
$self->logger->error("Malformed notification $@");
return $self->sendError( $req, "Malformed notification: $@", 200 );
}
$newNotif = to_json($json);
}

View File

@ -125,11 +125,12 @@ llapp.controller 'NotificationsExplorerCtrl', [ '$scope', '$translator', '$locat
$scope.waiting = false
$scope.init()
# Open node
$scope.stoggle = (scope) ->
node = scope.$modelValue
if node.nodes.length == 0
$scope.updateTree node.value, node.nodes, node.level, node.over, node.query, node.count
scope.toggle()
scope.toggle()
$scope.notifDate = (s) ->
if s?
@ -182,8 +183,8 @@ llapp.controller 'NotificationsExplorerCtrl', [ '$scope', '$translator', '$locat
n.level = level + 1
n.query = query
n.over = over
node.push n
$scope.total = data.total if value == ''
$scope.waiting = false
, (resp) ->
$scope.waiting = false

View File

@ -20,7 +20,7 @@
];
overScheme = function(v, level, over) {
console.log('overSchema => level', level, 'over', over);
console.log('overScheme => level', level, 'over', over);
if (level === 1 && v.length > over) {
return "uid=" + v + "*&groupBy=substr(uid," + (level + over + 1) + ")";
} else {
@ -143,8 +143,8 @@
node = scope.$modelValue;
if (node.nodes.length === 0) {
$scope.updateTree(node.value, node.nodes, node.level, node.over, node.query, node.count);
return scope.toggle();
}
return scope.toggle();
};
$scope.notifDate = function(s) {
var d;
@ -207,6 +207,9 @@
}
node.push(n);
}
if (value === '') {
$scope.total = data.total;
}
}
return $scope.waiting = false;
}, function(resp) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -491,6 +491,7 @@
"notAValidPerlExpression":"عبارة بيرل ليست صحيحة",
"notification":"تفعيل",
"notifications":"إشعار",
"notification_s":"notification(s)",
"notificationDefaultCond":"Default condition",
"notificationServer":"إشعارالخادم",
"notificationServerDELETE":"DELETE method",

View File

@ -491,6 +491,7 @@
"notAValidPerlExpression":"Not a valid Perl expression",
"notification":"Activation",
"notifications":"Notifications",
"notification_s":"notification(s)",
"notificationDefaultCond":"Default condition",
"notificationServer":"Notification server",
"notificationServerDELETE":"DELETE method",

View File

@ -491,6 +491,7 @@
"notAValidPerlExpression":"Not a valid Perl expression",
"notification":"Activation",
"notifications":"Notifications",
"notification_s":"notification(s)",
"notificationDefaultCond":"Default condition",
"notificationServer":"Notification server",
"notificationServerDELETE":"DELETE method",

View File

@ -491,6 +491,7 @@
"notAValidPerlExpression":"Pas une expression Perl valide",
"notification":"Activation",
"notifications":"Notifications",
"notification_s":"notification(s)",
"notificationDefaultCond":"Condition par défaut",
"notificationServer":"Serveur de notifications",
"notificationServerDELETE":"Méthode DELETE",

View File

@ -491,6 +491,7 @@
"notAValidPerlExpression":"Non una valida espressione Perl",
"notification":"Attivazione",
"notifications":"Notifiche",
"notification_s":"notification(s)",
"notificationDefaultCond":"Default condition",
"notificationServer":"Server di notifica",
"notificationServerDELETE":"DELETE method",

View File

@ -491,6 +491,7 @@
"notAValidPerlExpression":"Không phải là một biểu thức Perl hợp lệ",
"notification":"Kích hoạt",
"notifications":"Thông báo",
"notification_s":"notification(s)",
"notificationDefaultCond":"Default condition",
"notificationServer":"Máy chủ Thông báo",
"notificationServerDELETE":"DELETE method",

View File

@ -491,6 +491,7 @@
"notAValidPerlExpression":"Not a valid Perl expression",
"notification":"激活",
"notifications":"Notifications",
"notification_s":"notification(s)",
"notificationDefaultCond":"Default condition",
"notificationServer":"Notification server",
"notificationServerDELETE":"DELETE method",

View File

@ -21,6 +21,7 @@
</ul>
</div>
</div>
<div ng-show="data.length!=0" class="text-center"><p class="badge">{{total}} <span trspan="notification_s"></span></p></div>
<div class="region region-sidebar-first">
<section id="block-superfish-1" class="block block-superfish clearfix">
<div ui-tree data-drag-enabled="false" id="tree-root">