merging 5.4.4 changes

This commit is contained in:
JT Smith 2003-09-14 17:56:39 +00:00
parent eb4a6bca87
commit 2b6d4a36fc
5 changed files with 56 additions and 27 deletions

View file

@ -12,7 +12,6 @@
- Added support for record deletion in DataForm (Thanks to Hal Roberts.) - Added support for record deletion in DataForm (Thanks to Hal Roberts.)
- Templatized the HttpProxy wobject. (Thanks to Len Kranendonk.) - Templatized the HttpProxy wobject. (Thanks to Len Kranendonk.)
- Added a "Search for" and "Stop at" option to HttpProxy. (Thanks to Len Kranendonk.) - Added a "Search for" and "Stop at" option to HttpProxy. (Thanks to Len Kranendonk.)
- Fixed a bug in the PreviousDropMenu macro.
- Enhanced HTMLArea editor to include table editing. (Thanks to Irving Carrion.) - Enhanced HTMLArea editor to include table editing. (Thanks to Irving Carrion.)
@ -22,6 +21,7 @@
- Updated Portuguese translation. (Thanks to Marcelo Ennes.) - Updated Portuguese translation. (Thanks to Marcelo Ennes.)
- Updated Dutch translation. (Thanks to Leo Noordergraaf, ProcoliX, BNC Distribution, and Hugo Van der Kooij.) - Updated Dutch translation. (Thanks to Leo Noordergraaf, ProcoliX, BNC Distribution, and Hugo Van der Kooij.)
- Updated German translation. (Thanks to Andreas Graf.) - Updated German translation. (Thanks to Andreas Graf.)
- Fixed a bug in the PreviousDropMenu macro.
- Added an association for PPS attachments. - Added an association for PPS attachments.
- Readded wobject date range check that was accidentally removed. - Readded wobject date range check that was accidentally removed.
- Fixed a bug that caused incompatibility in the HTML Area image manager with - Fixed a bug that caused incompatibility in the HTML Area image manager with
@ -30,8 +30,27 @@
- Usernames can now be 100 characters long. - Usernames can now be 100 characters long.
- Page ordering wasn't always maintained when deploying packages, this is now - Page ordering wasn't always maintained when deploying packages, this is now
fixed. (Thanks to Y.H.Khoe.) fixed. (Thanks to Y.H.Khoe.)
- Errors could have occured if you specified an image name in a collateral
macro that did not exist.
- Email address didn't validate when it contained a dash (-). (Thanks to - Email address didn't validate when it contained a dash (-). (Thanks to
Fekke.) Fekke.)
- The calendar wizard was too narrow and wrapping on some browsers.
- The size attribute was missing from the email method in the Form package.
(Thanks to Andreas Graf.)
- Data Form: Was displaying mail fields in admin mode even when mailing was
disabled.
- Data Form: Dates were reset to epoch if a required field caused the form to
error.
- Data Form: If a site had two data forms with the same field names the list
template would be broken.
- Data Form: No longer keys on field name, which was dangerous, but instead
keys on fieldId.
- Data Form: Date and Date Time fields were displaying epoch to the end user
rather than human readable dates.
- Data Form: A bug in the default acknowlegement caused hidden fields to be
displayed.
- Data Form: CC and BCC would not be sent if the TO was specified as a
username or group name instead of an email address.
5.4.3 5.4.3

View file

@ -363,7 +363,7 @@ sub date {
}); });
$output .= '<input type="button" style="font-size: 8pt;" onClick="window.dateField = this.form.'. $output .= '<input type="button" style="font-size: 8pt;" onClick="window.dateField = this.form.'.
$_[0]->{name}.';calendar = window.open(\''.$session{config}{extrasURL}. $_[0]->{name}.';calendar = window.open(\''.$session{config}{extrasURL}.
'/calendar.html\',\'cal\',\'WIDTH=200,HEIGHT=250\');return false" value="'. '/calendar.html\',\'cal\',\'WIDTH=220,HEIGHT=250\');return false" value="'.
WebGUI::International::get(34).'">'; WebGUI::International::get(34).'">';
return $output; return $output;
} }
@ -454,6 +454,7 @@ sub email {
$output .= text({ $output .= text({
name=>$_[0]->{name}, name=>$_[0]->{name},
value=>$_[0]->{value}, value=>$_[0]->{value},
size=>$_[0]->{size},
extras=>' onChange="emailCheck(this.value)" '.$_[0]->{extras} extras=>' onChange="emailCheck(this.value)" '.$_[0]->{extras}
}); });
return $output; return $output;
@ -1517,7 +1518,7 @@ sub timeField {
}); });
$output .= '<input type="button" style="font-size: 8pt;" onClick="window.timeField = this.form.'. $output .= '<input type="button" style="font-size: 8pt;" onClick="window.timeField = this.form.'.
$_[0]->{name}.';clockSet = window.open(\''.$session{config}{extrasURL}. $_[0]->{name}.';clockSet = window.open(\''.$session{config}{extrasURL}.
'/timeChooser.html\',\'timeChooser\',\'WIDTH=220,HEIGHT=100\');return false" value="'. '/timeChooser.html\',\'timeChooser\',\'WIDTH=230,HEIGHT=100\');return false" value="'.
WebGUI::International::get(970).'">'; WebGUI::International::get(970).'">';
return $output; return $output;
} }

View file

@ -18,8 +18,11 @@ use WebGUI::Session;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub process { sub process {
my @param = WebGUI::Macro::getParams($_[0]); my @param = WebGUI::Macro::getParams($_[0]);
my $collateral = WebGUI::Collateral->find($param[0]); if (my $collateral = WebGUI::Collateral->find($param[0])) {
return '<img src="'.$collateral->getURL.'" '.$collateral->get("parameters").' />'; return '<img src="'.$collateral->getURL.'" '.$collateral->get("parameters").' />';
} else {
return "";
}
} }

View file

@ -18,8 +18,11 @@ use WebGUI::Session;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub process { sub process {
my @param = WebGUI::Macro::getParams($_[0]); my @param = WebGUI::Macro::getParams($_[0]);
my $collateral = WebGUI::Collateral->find($param[0]); if (my $collateral = WebGUI::Collateral->find($param[0])) {
return $collateral->getURL; return $collateral->getURL;
} else {
return "";
}
} }

View file

@ -129,7 +129,7 @@ sub getListTemplateVars {
while (my $record = $a->hashRef) { while (my $record = $a->hashRef) {
my @dataLoop; my @dataLoop;
my $b = WebGUI::SQL->read("select b.name, b.label, b.isMailField, a.value from DataForm_entryData a left join DataForm_field b my $b = WebGUI::SQL->read("select b.name, b.label, b.isMailField, a.value from DataForm_entryData a left join DataForm_field b
on a.name=b.name where a.DataForm_entryId=".$record->{DataForm_entryId}." on a.DataForm_fieldId=b.DataForm_fieldId where a.DataForm_entryId=".$record->{DataForm_entryId}."
order by b.sequenceNumber"); order by b.sequenceNumber");
while (my $data = $b->hashRef) { while (my $data = $b->hashRef) {
push(@dataLoop,{ push(@dataLoop,{
@ -189,7 +189,7 @@ sub getRecordTemplateVars {
$var->{epoch} = $entry->{submissionDate}; $var->{epoch} = $entry->{submissionDate};
$var->{"edit.URL"} = WebGUI::URL::page('func=view&wid='.$self->get("wobjectId").'&entryId='.$var->{entryId}); $var->{"edit.URL"} = WebGUI::URL::page('func=view&wid='.$self->get("wobjectId").'&entryId='.$var->{entryId});
$where .= " and b.DataForm_entryId=".$var->{entryId}; $where .= " and b.DataForm_entryId=".$var->{entryId};
$join = "left join DataForm_entryData as b on a.name=b.name"; $join = "left join DataForm_entryData as b on a.DataForm_fieldId=b.DataForm_fieldId";
$select .= ", b.value"; $select .= ", b.value";
} }
my %data; my %data;
@ -199,15 +199,19 @@ sub getRecordTemplateVars {
my $formValue = $session{form}{$data{name}}; my $formValue = $session{form}{$data{name}};
if ((not exists $data{value}) && $session{form}{func} ne "editSave" && $session{form}{func} ne "editFieldSave" && defined $formValue) { if ((not exists $data{value}) && $session{form}{func} ne "editSave" && $session{form}{func} ne "editFieldSave" && defined $formValue) {
$data{value} = $formValue; $data{value} = $formValue;
$data{value} = WebGUI::DateTime::setToEpoch($data{value}) if ($data{type} eq "date");
} }
if (not exists $data{value}) { if (not exists $data{value}) {
$data{value} = WebGUI::Macro::process($data{defaultValue}); $data{value} = WebGUI::Macro::process($data{defaultValue});
} }
my $hidden = (($data{status} eq "hidden" || ($data{isMailField} && !$self->get("mailData"))) && !$session{var}{adminOn}); my $hidden = (($data{status} eq "hidden" && !$session{var}{adminOn}) || ($data{isMailField} && !$self->get("mailData")));
my $value = $data{value};
$value = WebGUI::DateTime::epochToHuman($value,"%z") if ($data{type} eq "date");
$value = WebGUI::DateTime::epochToHuman($value) if ($data{type} eq "dateTime");
push(@fields,{ push(@fields,{
"field.form" => _createField(\%data), "field.form" => _createField(\%data),
"field.name" => $data{name}, "field.name" => $data{name},
"field.value" => $data{value}, "field.value" => $value,
"field.label" => $data{label}, "field.label" => $data{label},
"field.isMailField" => $data{isMailField}, "field.isMailField" => $data{isMailField},
"field.isHidden" => $hidden, "field.isHidden" => $hidden,
@ -284,14 +288,7 @@ sub sendEmail {
} }
} }
if ($to =~ /\@/) { if ($to =~ /\@/) {
WebGUI::Mail::send( WebGUI::Mail::send($to, $subject, $message, $cc, $from, $bcc);
$to,
$subject,
$message,
$cc,
$from,
$bcc
);
} else { } else {
my ($userId) = WebGUI::SQL->quickArray("select userId from users where username=".quote($to)); my ($userId) = WebGUI::SQL->quickArray("select userId from users where username=".quote($to));
my $groupId; my $groupId;
@ -303,6 +300,12 @@ sub sendEmail {
WebGUI::ErrorHandler::warn($_[0]->get("wobjectId").": Unable to send message, no user or group found."); WebGUI::ErrorHandler::warn($_[0]->get("wobjectId").": Unable to send message, no user or group found.");
} else { } else {
WebGUI::MessageLog::addEntry($userId, $groupId, $subject, $message); WebGUI::MessageLog::addEntry($userId, $groupId, $subject, $message);
if ($cc) {
WebGUI::Mail::send($cc, $subject, $message, "", $from);
}
if ($bcc) {
WebGUI::Mail::send($bcc, $subject, $message, "", $from);
}
} }
} }
} }
@ -555,19 +558,19 @@ sub www_exportTab {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId"))); return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
$session{header}{filename} = WebGUI::URL::urlize($_[0]->get("title")).".tab"; $session{header}{filename} = WebGUI::URL::urlize($_[0]->get("title")).".tab";
$session{header}{mimetype} = "text/plain"; $session{header}{mimetype} = "text/plain";
my @fields = WebGUI::SQL->buildArray("select name from DataForm_field where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber"); my %fields = WebGUI::SQL->buildHash("select DataForm_fieldId,name from DataForm_field where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
my $select = "select a.DataForm_entryId as entryId, a.ipAddress, a.username, a.userId, a.submissionDate"; my $select = "select a.DataForm_entryId as entryId, a.ipAddress, a.username, a.userId, a.submissionDate";
my $from = " from DataForm_entry a"; my $from = " from DataForm_entry a";
my $join; my $join;
my $where = " where a.wobjectId=".$_[0]->get("wobjectId"); my $where = " where a.wobjectId=".$_[0]->get("wobjectId");
my $orderBy = " order by a.DataForm_entryId"; my $orderBy = " order by a.DataForm_entryId";
my $columnCounter = "b"; my $columnCounter = "b";
foreach my $field (@fields) { foreach my $fieldId (keys %fields) {
my $extension = ""; my $extension = "";
$extension = "mail_" if (isIn($field, qw(to from cc bcc subject))); $extension = "mail_" if (isIn($fields{$fieldId}, qw(to from cc bcc subject)));
$select .= ", ".$columnCounter.".value as ".$extension.$field; $select .= ", ".$columnCounter.".value as ".$extension.$fields{$fieldId};
$join .= " left join DataForm_entryData ".$columnCounter." on a.DataForm_entryId=".$columnCounter.".DataForm_entryId and " $join .= " left join DataForm_entryData ".$columnCounter." on a.DataForm_entryId=".$columnCounter.".DataForm_entryId and "
.$columnCounter.".name=".quote($field); .$columnCounter.".DataForm_fieldId=".quote($fieldId);
$columnCounter++; $columnCounter++;
} }
return WebGUI::SQL->quickTab($select.$from.$join.$where.$orderBy); return WebGUI::SQL->quickTab($select.$from.$join.$where.$orderBy);
@ -618,14 +621,14 @@ sub www_process {
} }
unless ($hadErrors) { unless ($hadErrors) {
my ($exists) = WebGUI::SQL->quickArray("select count(*) from DataForm_entryData where DataForm_entryId=$entryId my ($exists) = WebGUI::SQL->quickArray("select count(*) from DataForm_entryData where DataForm_entryId=$entryId
and name=".quote($row{name})); and DataForm_fieldId=".quote($row{DataForm_fieldId}));
if ($exists) { if ($exists) {
WebGUI::SQL->write("update DataForm_entryData set value=".quote($value)." WebGUI::SQL->write("update DataForm_entryData set value=".quote($value)."
where DataForm_entryId=$entryId and name=".quote($row{name})); where DataForm_entryId=$entryId and DataForm_fieldId=".quote($row{DataForm_fieldId}));
$updating = 1; $updating = 1;
} else { } else {
WebGUI::SQL->write("insert into DataForm_entryData (DataForm_entryId,wobjectId,name,value) values WebGUI::SQL->write("insert into DataForm_entryData (DataForm_entryId,wobjectId,name,value) values
($entryId, ".$_[0]->get("wobjectId").", ".quote($row{name}).", ".quote($value).")"); ($entryId, $row{DataForm_fieldId}, ".$_[0]->get("wobjectId").", ".quote($value).")");
} }
} }
} }