Working on notifications (#595)

This commit is contained in:
Xavier Guimard 2016-05-30 11:32:21 +00:00
parent 12b23f18e6
commit c138514b34

View File

@ -235,10 +235,7 @@ sub getNotifBack {
$self->p->importHandlerDatas($req); $self->p->importHandlerDatas($req);
my $uid = $req->sessionInfo->{ $self->notifField }; my $uid = $req->sessionInfo->{ $self->notifField };
if ( if ( my $notifs = $self->getNotifications($uid) ) {
my $notifs = $self->getNotifications($uid){
#TODO
# Get accepted notifications # Get accepted notifications
$req->parseBody; $req->parseBody;
@ -253,6 +250,28 @@ sub getNotifBack {
push @{ $checks->{$1} }, $2; push @{ $checks->{$1} }, $2;
} }
} }
foreach my $file (values %$notifs) {
my $xml = $self->parser->parse_string($file);
foreach my $notif ($xml->documentElement->getElementsByTagName('notification') ) {
my $condition = $notif->getAttribute('condition');
my $reference = $notif->getAttribute('reference');
if(defined $refs->{$reference}) {
if(defined $condition) {
# Verity that checkboxes have been checked
}
else {
# TODO: Do the job
delete $refs->{$reference};
}
}
else {
# TODO: launch checkForUnauthUser()
}
}
}
}
else {
# TODO: redirect to portal
} }
# Else uncipher cookie, restore args and launch autoredirect # Else uncipher cookie, restore args and launch autoredirect
@ -263,8 +282,7 @@ sub getNotifBack {
sub getNotifications { sub getNotifications {
my ( $self, $uid ) = @_; my ( $self, $uid ) = @_;
my $forUser = $self->notifObject->get($uid); my $forUser = $self->notifObject->get($uid);
my $forAll = my $forAll = $self->notifObject->get( $self->conf->{notificationWildcard} );
$self->notifObject->get( $self->conf->{notificationWildcard} );
if ( $forUser and $forAll ) { if ( $forUser and $forAll ) {
return { %$forUser, %$forAll }; return { %$forUser, %$forAll };
} }