#!/usr/bin/perl # MimerDesk # Web based groupware and eLearning environment # www.mimerdesk.org # # Copyright (C) 2001 Ionstream Ltd. # www.ionstream.fi # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation; either version 2 of the License, or (at your option) # any later version. # # This program is distributed with a hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #$Id: feedback.html,v 1.8 2002/06/14 01:13:18 inf Exp $ #"""""""""""""""""""""""""""""""""""""""""# # # # MimerDesk: Message Boards # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # (c) Ionstream Oy 1999 - 2001 # # # # Programmed by: Teemu Arina # # # #_________________________________________# # Begin ################################## use strict; use vars qw ($APPLICATION $ACTIVEGRP $admin_status $USER $IP $LAST_ACT $FORWARDED $trans $TIME_USED $IDLE $form $ref $sth @message_types @receivers @parts); use lib::MimerDesk; use CGI::Carp "fatalsToBrowser"; use Mail::Sendmail; # Monitoring sub send_mail; sub template_tulostus; $APPLICATION = 'Home - Feedback'; @message_types = ( 'Support request','Bug report','Logical error','Layout issue', 'Feature suggestion','I want to contribute', 'Grammar error','Spelling mistake','Positive feedback', 'Negative feedback','Uncategorized feedback' ); @parts = ( 'Language:Swedish','Language:English','Language:Finnish','Language:Dutch', 'Language:Italian','Language:German','Language:Russian','Language:Galician', 'Language:Norwegian','Language:Portuguese','Graphics:Layout', 'Graphics:Buttons','Graphics:Colors','Browsing:Speed','Browsing:Compatibility', 'Common:Administration','Common:Useability','Common:Authentication', 'Common:Documentation','Common:Other' ); @receivers = ('teemu@ionstream.fi'); # Ohjelma ################################## read_config('../config/mimerdesk.cfg'); initialize(); db_list("select if_categories.category,if_menus.menu from if_menus,if_categories where if_menus.category = if_categories.id and if_menus.activate = '1' and if_categories.activate= '1' order by if_categories.ordering,if_menus.ordering"); while (my $ref = $sth->fetchrow_hashref()) {push @parts, "$ref->{'category'}:$ref->{'menu'}";} db_end(); $form = decode_multipart(); $form->{'ID'} =~ tr/0-9//cd; $form->{'auth'} =~ tr/0-9a-z//cd; ($USER, $IP, $LAST_ACT, $FORWARDED, $TIME_USED, $IDLE, $ACTIVEGRP) = authenticate($form->{'ID'}, $form->{'auth'}, $form->{'changeGroup'}); $trans = lib::MimerDesk->new_gettext(program => 'feedback',language => $config{'language'}); $APPLICATION = $trans->gettext('Home - Feedback'); if ($form->{'quit'}) {redirect("$config{'loc_server'}$config{'bin_dir'}/index.html?ID=$form->{'ID'}&auth=$form->{'auth'}&quit=quit");} elsif ($form->{'send'}) {send_mail($USER,$form->{'summary'},$form->{'description'},$form->{'feedback'},$form->{'parts'});} else {template_tulostus("$config{'theme'}_feedback");} ############################ # Send message with e-mail # ############################ sub send_mail { my (%mail,$email,$info,$message,$receivers); my ($author,$subject,$message,$type,$parts) = @_; if (!$subject) {template_tulostus("$config{'theme'}_feedback","".$trans->gettext("You must specify a summary!")."");} elsif (!$message) {template_tulostus("$config{'theme'}_feedback","".$trans->gettext("You must specify a detailed description!")."");} db_list("select info,email from users where nimi = '$author'"); while (my $ref = $sth->fetchrow_hashref()) { $email = $ref->{'email'}; $info = $ref->{'info'}; } db_end(); my (undef,$min,$h,$day,$mon,$year,undef,undef,undef) = &utc_epoch2date(time()); my $postdate = "$day.$mon.$year $h:$min"; $receivers = join ",", @receivers; $mail{'From'} = "MimerDesk at $config{'loc_server'} <$config{'monitor_mail'}>"; $mail{'To'} = "$receivers"; my $server = $config{'mail_server'}; $mail{'Smtp'} = $server if $server; $mail{'subject'} = "MimerDesk feedback: $message_types[$type]"; $mail{'message'} .= "Date: $postdate\nIP address: $IP\nServer address: $config{'loc_server'}\n\n"; $mail{'message'} .= "User: $info ($author) <$email>\nMail: $email\nType: $message_types[$type]\nSection: $parts[$parts]\nSummary: $subject\n\n$message\n\n"; $mail{'message'} .= "_________________________________________________________________________\n"; $mail{'message'} .= "You are receiving this e-mail because you are in the MimerDesk feedback list!\n"; if (sendmail(%mail)) { $message = "".$trans->gettext("Feedback sent successfully.").""; $form->{'summary'} = undef; $form->{'description'} = undef; } else { write_log("Error sending message: $Mail::Sendmail::error", 'error'); $message = "".$trans->gettext("Error sending message: ")."$Mail::Sendmail::error. ".$trans->gettext("Please check that your e-mail address is correct in your own profile!").""; } template_tulostus("$config{'theme'}_feedback", $message); } ############################### # Lue template ja tulosta se # ############################### sub template_tulostus { my ($gen,$fulltemplate,$i,$selected,$genparts); my ($template,$message) = @_; print_header('pragma'); $ref = get_template('maintemplate',$template); $ref->{'maintemplate'} =~ s/<>/$ref->{$template}/m; $fulltemplate = $ref->{'maintemplate'}; $fulltemplate = create_buttons($fulltemplate, 'Home', 'Feedback', $form); $ref = get_template('js_doClock', 'js_help', 'js_gotosite'); my $javascripts = $ref->{'js_doClock'}.$ref->{'js_help'}.$ref->{'js_gotosite'}; foreach (@message_types) { if ($i == $form->{'feedback'}) {$selected = 'selected';} else {$selected = undef;} $gen .= qq[\n]; $i++; } undef $i; foreach (@parts) { if ($i == $form->{'parts'}) {$selected = 'selected';} else {$selected = undef;} $genparts .= qq[\n]; $i++; } $fulltemplate =~ s/<>/$javascripts/m; $fulltemplate =~ s/<>/$form->{'summary'}/m; $fulltemplate =~ s/<>/$form->{'description'}/m; $fulltemplate =~ s/<>/$message/m; $fulltemplate =~ s/<>/$gen/m; $fulltemplate =~ s/<>/$genparts/m; $fulltemplate =~ s/<>/minea/gm; $fulltemplate =~ s/<>/MimerDesk\: $APPLICATION/m; $fulltemplate = replace_tags($fulltemplate, $USER, $form->{'auth'}, $form->{'ID'}, $TIME_USED); $fulltemplate = add_popups($fulltemplate, $USER, $form->{'auth'}, $form->{'ID'}); print $fulltemplate; db_end('disconnect'); exit; }