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/SysGroupsOneCal.pm
# Copyright 2000-2003, Fred Steinberg, Brown Bear Software

# Set Groups for one Calendar

package SysGroupsOneCal;
use strict;
use CGI (':standard');

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

sub perform {
    my $self = shift;

    my ($calendarName, $save, $cancel) =
            $self->getParams (qw (CalForGroups Save Cancel));
    my $i18n  = $self->I18N;
    my $prefs = $self->prefs;
    my $message;

    if ($cancel or !defined ($calendarName) or $self->calendarName) {
        print redirect ($self->makeURL ({Op => 'SysGroups'}));
        return;
    }

    my @allGroups = sort {lc($a) cmp lc($b)} MasterDB->getGroups;

    my $calDb = Database->new ($calendarName);
    my $calPrefs = $calDb->getPreferences;
    my @origGroups = sort {lc($a) cmp lc($b)} $calPrefs->getGroups;

    if ($save) {
        # get selected groups for this cal
        my @selectedGroups = param ('SelectedGroups');
        @selectedGroups = sort {lc($a) cmp lc ($b)} @selectedGroups;

        # if groups changed, save new prefs
        my $orig = join ',', @origGroups;
        my $new  = join ',', @selectedGroups;
        if ($orig ne $new) {
            $self->{audit_formsaved}++;
            $calPrefs->setGroups (@selectedGroups);
            $calDb->setPreferences ($calPrefs);
        }
    }

    my @myGroups = $calPrefs->getGroups;

    # And display (or re-display) the form
    print header;
    print start_html ('-title'   => $i18n->get ('Calendar Groups'),
                      '-bgcolor' => 'white');

    print GetHTML->SysAdminHeader ($i18n, 'Calendar Groups', 1);

    print startform;

    print h3 ($message) if $message;

    print '<center>';
    print h2 ($i18n->get ('Calendar') . ": $calendarName");
    print h3 ($i18n->get ("Assign Groups"));

    print scrolling_list (-name     => 'SelectedGroups',
                          -Values   => \@allGroups,
                          -defaults => \@myGroups,
                          -size     => 15,
                          -multiple => 'true');

    print '<br>';
    print '<small><b>' . $i18n->get ('Note') . ': </b>';
    print $i18n->get ('control-click to choose multiple groups.');
    print '</small>';
    print '</center>';

    print '<hr>';
    print submit (-name  => 'Save',
                  -value => $i18n->get ('Save'));
    print '&nbsp;';
    print submit (-name  => 'Cancel',
                  -value => $i18n->get ('Done'));
    print '&nbsp;';
    print reset (-value  => 'Reset');

    print hidden (-name => 'Op',           -value => __PACKAGE__);
    print hidden (-name => 'CalForGroups', -value => $calendarName);

    print endform;
    print end_html;
}

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


    my $message = '-';

    return unless $message;     # don't report if nothing changed

    if ($short) {
        return $summary . " $message";
    } else {
        return $summary . "\n\n$message";
    }
}

1;

Anon7 - 2021