KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/compasssysweb/calendar/CalciumDir39/Operation/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/compasssysweb/calendar/CalciumDir39/Operation/ApproveEvents.pm
# Copyright 2002-2003, Fred Steinberg, Brown Bear Software

# Display/Approve/Delete tentative events

package ApproveEvents;
use strict;

use CGI;
use Calendar::Body;
use Calendar::BottomBars;
use Calendar::Date;
use Calendar::Footer;
use Calendar::Header;
use Calendar::ListView;
use Calendar::Name;
use Calendar::Title;

use vars ('@ISA');
@ISA = ('Operation');

sub perform {
    my $self = shift;

    if ($self->getParams ('ApproveIt')) {

        $self->{form_saved}++;
        $self->{audit_ids} = {};

        # Get event ids
        while (my ($name, $val) = each %{$self->{params}}) {
            next if ($val =~ /pending/i);
            next unless ($name =~ /Approve-(\d+)/);
            my $id = $1;
            my $action = $val; # 'approve', 'delete', 'pending'
            my ($event, $date) = $self->db->getEventById ($id);
            next unless $event;
            if ($action =~ /approve/i) {
                $event->isTentative (0);
                $self->db->replaceEvent ($event, $date);
            } elsif ($action =~ /delete/i) {
                $self->db->deleteEvent ($date, $id, 'all');
            }
            $self->{audit_ids}->{$id} = [$action, $date, $event->text];
        }

        # If no tentative events left, go back to cal
        my $eventHash = $self->db->getTentativeEvents;
        if (!keys %$eventHash) {
            print $self->redir ($self->makeURL ({Op => 'ShowIt'}));
            return;
        }
    }

    my $prefs = $self->prefs;
    my @page;
    push @page, Header->new ($prefs->Description);
    push @page, Body->new ($prefs,
                           Name->new       ($prefs),
                           Title->new      ($self, 'ignored', 'Approval'),
                           ListView->new   ($self, Date->new, Date->new,
                                            {mode => 'Approval'}),
                           Footer->new     ($prefs));

    my $cgi = CGI->new;
    print $cgi->header;
    foreach (@page) {
        print $_->getHTML, "\n";
    }

    return;
}

sub auditString {
    my ($self, $short) = @_;
    return unless $self->{form_saved};
    my $line = $self->SUPER::auditString ($short);

    if ($short) {
        $line .= ' ';
        while (my ($id, $info) = each %{$self->{audit_ids}}) {
            $line .= "$id: $info->[0],";
        }
        chop $line;
        return $line;
    }

    my $message = "These tentative events on the '" . $self->calendarName .
                  "' Calendar were processed:\n\n";

    my $text = '';
    while (my ($id, $info) = each %{$self->{audit_ids}}) {
        $text .= ' ' . sprintf ("%7s", $info->[0]) . "d - $info->[1] - " .
                "$info->[2]\n";
    }
    $text ||= '    -no events processed-';
    $message .= $text;

    return "$line\n\n$message\n";
}

1;

Anon7 - 2021