Added UI Level to Article, and fixed some form bugs.
This commit is contained in:
parent
95c08144f0
commit
428200daad
5 changed files with 138 additions and 41 deletions
|
|
@ -453,7 +453,7 @@ sub group {
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub hidden {
|
sub hidden {
|
||||||
return '<input type="hidden" name="'.$_[0]->{name}.'" value="'._fixQuotes($_[0]->{value}).'">';
|
return '<input type="hidden" name="'.$_[0]->{name}.'" value="'._fixQuotes($_[0]->{value}).'">'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -465,6 +465,10 @@ sub hidden {
|
||||||
the HTMLForm package, but we decided to make it a public method
|
the HTMLForm package, but we decided to make it a public method
|
||||||
in case anybody else had a use for it.
|
in case anybody else had a use for it.
|
||||||
|
|
||||||
|
=item name
|
||||||
|
|
||||||
|
The name of this field.
|
||||||
|
|
||||||
=item options
|
=item options
|
||||||
|
|
||||||
A hash reference where the key is the "name" of the hidden field.
|
A hash reference where the key is the "name" of the hidden field.
|
||||||
|
|
@ -479,16 +483,16 @@ sub hidden {
|
||||||
sub hiddenList {
|
sub hiddenList {
|
||||||
my ($output, $key, $item);
|
my ($output, $key, $item);
|
||||||
foreach $key (keys %{$_[0]->{options}}) {
|
foreach $key (keys %{$_[0]->{options}}) {
|
||||||
foreach $item (@$_[0]->{value}) {
|
foreach $item (@{$_[0]->{value}}) {
|
||||||
if ($item eq $key) {
|
if ($item eq $key) {
|
||||||
$output .= hidden({
|
$output .= hidden({
|
||||||
name=>$key,
|
name=>$_[0]->{name},
|
||||||
value=>$item
|
value=>$key
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $output;
|
return $output."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ package WebGUI::HTMLForm;
|
||||||
|
|
||||||
use CGI::Util qw(rearrange);
|
use CGI::Util qw(rearrange);
|
||||||
use strict qw(vars refs);
|
use strict qw(vars refs);
|
||||||
|
use WebGUI::DateTime;
|
||||||
use WebGUI::Form;
|
use WebGUI::Form;
|
||||||
use WebGUI::International;
|
use WebGUI::International;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
|
|
@ -98,7 +99,7 @@ sub _subtext {
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub _tableFormRow {
|
sub _tableFormRow {
|
||||||
unless ($_[0]->{_noTable}) {
|
unless ($_[0]->{_noTable}) {
|
||||||
return '<tr><td class="formDescription" valign="top">'.$_[1].'</td><td class="tableData">'.$_[2].'</td></tr>';
|
return '<tr><td class="formDescription" valign="top">'.$_[1].'</td><td class="tableData">'.$_[2]."</td></tr>\n";
|
||||||
} else {
|
} else {
|
||||||
return $_[2];
|
return $_[2];
|
||||||
}
|
}
|
||||||
|
|
@ -244,7 +245,8 @@ sub checkList {
|
||||||
$output .= _subtext($subtext);
|
$output .= _subtext($subtext);
|
||||||
$output = $self->_tableFormRow($label,$output);
|
$output = $self->_tableFormRow($label,$output);
|
||||||
} else {
|
} else {
|
||||||
hiddenList({
|
$output = WebGUI::Form::hiddenList({
|
||||||
|
name=>$name,
|
||||||
options=>$options,
|
options=>$options,
|
||||||
value=>$value
|
value=>$value
|
||||||
});
|
});
|
||||||
|
|
@ -325,6 +327,7 @@ sub combo {
|
||||||
$output = $self->_tableFormRow($label,$output);
|
$output = $self->_tableFormRow($label,$output);
|
||||||
} else {
|
} else {
|
||||||
$output = WebGUI::Form::hiddenList({
|
$output = WebGUI::Form::hiddenList({
|
||||||
|
name=>$name,
|
||||||
options=>$options,
|
options=>$options,
|
||||||
value=>$value
|
value=>$value
|
||||||
});
|
});
|
||||||
|
|
@ -398,7 +401,7 @@ sub date {
|
||||||
} else {
|
} else {
|
||||||
$output = WebGUI::Form::hidden({
|
$output = WebGUI::Form::hidden({
|
||||||
name=>$name,
|
name=>$name,
|
||||||
value=>$value
|
value=>epochToSet($value)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$self->{_data} .= $output;
|
$self->{_data} .= $output;
|
||||||
|
|
@ -600,7 +603,8 @@ sub group {
|
||||||
$output = $self->_tableFormRow($label,$output);
|
$output = $self->_tableFormRow($label,$output);
|
||||||
} else {
|
} else {
|
||||||
my $hashRef = WebGUI::SQL->quickHashRef("select groupId,groupName from groups");
|
my $hashRef = WebGUI::SQL->quickHashRef("select groupId,groupName from groups");
|
||||||
hiddenList({
|
$output = WebGUI::Form::hiddenList({
|
||||||
|
name=>$name,
|
||||||
options=>$hashRef,
|
options=>$hashRef,
|
||||||
value=>$value
|
value=>$value
|
||||||
});
|
});
|
||||||
|
|
@ -912,15 +916,15 @@ sub new {
|
||||||
my ($noTable, $action, $method, $extras, $enctype, $tableExtras) =
|
my ($noTable, $action, $method, $extras, $enctype, $tableExtras) =
|
||||||
rearrange([noTable, action, method, extras, enctype, tableExtras], @p);
|
rearrange([noTable, action, method, extras, enctype, tableExtras], @p);
|
||||||
$noTable = $noTable || 0;
|
$noTable = $noTable || 0;
|
||||||
$header = WebGUI::Form::formHeader({
|
$header = "\n\n".WebGUI::Form::formHeader({
|
||||||
action=>$action,
|
action=>$action,
|
||||||
extras=>$extras,
|
extras=>$extras,
|
||||||
method=>$method,
|
method=>$method,
|
||||||
enctype=>$enctype
|
enctype=>$enctype
|
||||||
});
|
});
|
||||||
$header .= '<table '.$tableExtras.'>' unless ($noTable);
|
$header .= "\n<table ".$tableExtras.'>' unless ($noTable);
|
||||||
$footer = '</table>' unless ($noTable);
|
$footer = "</table>\n" unless ($noTable);
|
||||||
$footer .= '</form>';
|
$footer .= "</form>\n\n";
|
||||||
bless {_noTable => $noTable, _header => $header, _footer => $footer, _data => ''}, $self;
|
bless {_noTable => $noTable, _header => $header, _footer => $footer, _data => ''}, $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -990,7 +994,7 @@ sub password {
|
||||||
$output = $self->_tableFormRow($label,$output);
|
$output = $self->_tableFormRow($label,$output);
|
||||||
} else {
|
} else {
|
||||||
$output = WebGUI::Form::hidden({
|
$output = WebGUI::Form::hidden({
|
||||||
name=>$name.'_interval',
|
name=>$name,
|
||||||
value=>$value
|
value=>$value
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1061,7 +1065,7 @@ sub phone {
|
||||||
$output = $self->_tableFormRow($label,$output);
|
$output = $self->_tableFormRow($label,$output);
|
||||||
} else {
|
} else {
|
||||||
$output = WebGUI::Form::hidden({
|
$output = WebGUI::Form::hidden({
|
||||||
name=>$name.'_interval',
|
name=>$name,
|
||||||
value=>$value
|
value=>$value
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1224,7 +1228,8 @@ sub radioList {
|
||||||
$output .= _subtext($subtext);
|
$output .= _subtext($subtext);
|
||||||
$output = $self->_tableFormRow($label,$output);
|
$output = $self->_tableFormRow($label,$output);
|
||||||
} else {
|
} else {
|
||||||
hiddenList({
|
$output = WebGUI::Form::hiddenList({
|
||||||
|
name=>$name,
|
||||||
options=>$options,
|
options=>$options,
|
||||||
value=>[$value]
|
value=>[$value]
|
||||||
});
|
});
|
||||||
|
|
@ -1367,7 +1372,8 @@ sub select {
|
||||||
$output .= _subtext($subtext);
|
$output .= _subtext($subtext);
|
||||||
$output = $self->_tableFormRow($label,$output);
|
$output = $self->_tableFormRow($label,$output);
|
||||||
} else {
|
} else {
|
||||||
hiddenList({
|
$output = WebGUI::Form::hiddenList({
|
||||||
|
name=>$name,
|
||||||
options=>$options,
|
options=>$options,
|
||||||
value=>$value
|
value=>$value
|
||||||
});
|
});
|
||||||
|
|
@ -1481,7 +1487,7 @@ sub text {
|
||||||
$output = $self->_tableFormRow($label,$output);
|
$output = $self->_tableFormRow($label,$output);
|
||||||
} else {
|
} else {
|
||||||
$output = WebGUI::Form::hidden({
|
$output = WebGUI::Form::hidden({
|
||||||
name=>$name.'_interval',
|
name=>$name,
|
||||||
value=>$value
|
value=>$value
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1631,7 +1637,7 @@ sub url {
|
||||||
$output = $self->_tableFormRow($label,$output);
|
$output = $self->_tableFormRow($label,$output);
|
||||||
} else {
|
} else {
|
||||||
$output = WebGUI::Form::hidden({
|
$output = WebGUI::Form::hidden({
|
||||||
name=>$name.'_interval',
|
name=>$name,
|
||||||
value=>$value
|
value=>$value
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1764,7 +1770,7 @@ sub zipcode {
|
||||||
$output = $self->_tableFormRow($label,$output);
|
$output = $self->_tableFormRow($label,$output);
|
||||||
} else {
|
} else {
|
||||||
$output = WebGUI::Form::hidden({
|
$output = WebGUI::Form::hidden({
|
||||||
name=>$name.'_interval',
|
name=>$name,
|
||||||
value=>$value
|
value=>$value
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,9 @@ sub _replacement {
|
||||||
#--content adder
|
#--content adder
|
||||||
$hash{WebGUI::URL::page()} = WebGUI::International::get(1);
|
$hash{WebGUI::URL::page()} = WebGUI::International::get(1);
|
||||||
$hash{WebGUI::URL::page('op=editPage&npp='.$session{page}{pageId})} = WebGUI::International::get(2);
|
$hash{WebGUI::URL::page('op=editPage&npp='.$session{page}{pageId})} = WebGUI::International::get(2);
|
||||||
$hash{WebGUI::URL::page('op=selectPackageToDeploy')} = WebGUI::International::get(376);
|
if ($session{user}{uiLevel} >= 7) {
|
||||||
|
$hash{WebGUI::URL::page('op=selectPackageToDeploy')} = WebGUI::International::get(376);
|
||||||
|
}
|
||||||
foreach $key (keys %{$session{wobject}}) {
|
foreach $key (keys %{$session{wobject}}) {
|
||||||
$hash2{WebGUI::URL::page('func=edit&wid=new&namespace='.$key)} = $session{wobject}{$key};
|
$hash2{WebGUI::URL::page('func=edit&wid=new&namespace='.$key)} = $session{wobject}{$key};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ sub description {
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub discussionProperties {
|
sub discussionProperties {
|
||||||
my ($f,$editTimeout,$groupToModerate,%moderationType,$moderationType);
|
my ($f,$editTimeout,$interval, $units, $groupToModerate,%moderationType,$moderationType);
|
||||||
%moderationType = (before=>WebGUI::International::get(567),after=>WebGUI::International::get(568));
|
%moderationType = (before=>WebGUI::International::get(567),after=>WebGUI::International::get(568));
|
||||||
$f = WebGUI::HTMLForm->new;
|
$f = WebGUI::HTMLForm->new;
|
||||||
if ($_[0]->get("wobjectId") eq "new") {
|
if ($_[0]->get("wobjectId") eq "new") {
|
||||||
|
|
@ -173,15 +173,38 @@ sub discussionProperties {
|
||||||
$moderationType = $_[0]->get("moderationType");
|
$moderationType = $_[0]->get("moderationType");
|
||||||
}
|
}
|
||||||
$groupToModerate = $_[0]->get("groupToModerate") || 4;
|
$groupToModerate = $_[0]->get("groupToModerate") || 4;
|
||||||
$f->group("groupToPost",WebGUI::International::get(564),[$_[0]->get("groupToPost")]);
|
$f->group(
|
||||||
$f->interval("editTimeout",WebGUI::International::get(566),WebGUI::DateTime::secondsToInterval($editTimeout));
|
-name=>"groupToPost",
|
||||||
if ($session{setting}{useKarma}) {
|
-label=>WebGUI::International::get(564),
|
||||||
|
-value=>[$_[0]->get("groupToPost")],
|
||||||
|
-uiLevel=>7
|
||||||
|
);
|
||||||
|
($interval, $units) = WebGUI::DateTime::secondsToInterval($editTimeout);
|
||||||
|
$f->interval(
|
||||||
|
-name=>"editTimeout",
|
||||||
|
-label=>WebGUI::International::get(566),
|
||||||
|
-intervalValue=>$interval,
|
||||||
|
-unitsValue=>$units,
|
||||||
|
-uiLevel=>7
|
||||||
|
);
|
||||||
|
if ($session{setting}{useKarma} && $session{user}{uiLevel} <= 7) {
|
||||||
$f->integer("karmaPerPost",WebGUI::International::get(541),$_[0]->get("karmaPerPost"));
|
$f->integer("karmaPerPost",WebGUI::International::get(541),$_[0]->get("karmaPerPost"));
|
||||||
} else {
|
} else {
|
||||||
$f->hidden("karmaPerPost",$_[0]->get("karmaPerPost"));
|
$f->hidden("karmaPerPost",$_[0]->get("karmaPerPost"));
|
||||||
}
|
}
|
||||||
$f->group("groupToModerate",WebGUI::International::get(565),[$groupToModerate]);
|
$f->group(
|
||||||
$f->select("moderationType",\%moderationType,WebGUI::International::get(569),[$moderationType]);
|
-name=>"groupToModerate",
|
||||||
|
-label=>WebGUI::International::get(565),
|
||||||
|
-value=>[$groupToModerate],
|
||||||
|
-uiLevel=>7
|
||||||
|
);
|
||||||
|
$f->select(
|
||||||
|
-name=>"moderationType",
|
||||||
|
-options=>\%moderationType,
|
||||||
|
-label=>WebGUI::International::get(569),
|
||||||
|
-value=>[$moderationType],
|
||||||
|
-uiLevel=>7
|
||||||
|
);
|
||||||
return $f->printRowsOnly;
|
return $f->printRowsOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -895,13 +918,43 @@ sub www_edit {
|
||||||
$f->hidden("namespace",$_[0]->get("namespace")) if ($_[0]->get("wobjectId") eq "new");
|
$f->hidden("namespace",$_[0]->get("namespace")) if ($_[0]->get("wobjectId") eq "new");
|
||||||
$f->hidden("func","editSave");
|
$f->hidden("func","editSave");
|
||||||
$f->submit if ($_[0]->get("wobjectId") ne "new");
|
$f->submit if ($_[0]->get("wobjectId") ne "new");
|
||||||
$f->readOnly($_[0]->get("wobjectId"),WebGUI::International::get(499));
|
$f->readOnly(
|
||||||
|
-value=>$_[0]->get("wobjectId"),
|
||||||
|
-label=>WebGUI::International::get(499),
|
||||||
|
-uiLevel=>3
|
||||||
|
);
|
||||||
$f->text("title",WebGUI::International::get(99),$title);
|
$f->text("title",WebGUI::International::get(99),$title);
|
||||||
$f->yesNo("displayTitle",WebGUI::International::get(174),$displayTitle);
|
$f->yesNo(
|
||||||
$f->yesNo("processMacros",WebGUI::International::get(175),$_[0]->get("processMacros"));
|
-name=>"displayTitle",
|
||||||
$f->select("templatePosition",WebGUI::Template::getPositions($session{page}{templateId}),WebGUI::International::get(363),[$templatePosition]);
|
-label=>WebGUI::International::get(174),
|
||||||
$f->date("startDate",WebGUI::International::get(497),$startDate);
|
-value=>$displayTitle,
|
||||||
$f->date("endDate",WebGUI::International::get(498),$endDate);
|
-uiLevel=>5
|
||||||
|
);
|
||||||
|
$f->yesNo(
|
||||||
|
-name=>"processMacros",
|
||||||
|
-label=>WebGUI::International::get(175),
|
||||||
|
-value=>$_[0]->get("processMacros"),
|
||||||
|
-uiLevel=>5
|
||||||
|
);
|
||||||
|
$f->select(
|
||||||
|
-name=>"templatePosition",
|
||||||
|
-label=>WebGUI::International::get(363),
|
||||||
|
-value=>[$templatePosition],
|
||||||
|
-uiLevel=>5,
|
||||||
|
-options=>WebGUI::Template::getPositions($session{page}{templateId})
|
||||||
|
);
|
||||||
|
$f->date(
|
||||||
|
-name=>"startDate",
|
||||||
|
-label=>WebGUI::International::get(497),
|
||||||
|
-value=>$startDate,
|
||||||
|
-uiLevel=>9
|
||||||
|
);
|
||||||
|
$f->date(
|
||||||
|
-name=>"endDate",
|
||||||
|
-label=>WebGUI::International::get(498),
|
||||||
|
-value=>$endDate,
|
||||||
|
-uiLevel=>9
|
||||||
|
);
|
||||||
$f->HTMLArea("description",WebGUI::International::get(85),$_[0]->get("description"));
|
$f->HTMLArea("description",WebGUI::International::get(85),$_[0]->get("description"));
|
||||||
$f->raw($_[1]);
|
$f->raw($_[1]);
|
||||||
$f->submit;
|
$f->submit;
|
||||||
|
|
|
||||||
|
|
@ -68,19 +68,51 @@ sub www_edit {
|
||||||
$output = helpIcon(1,$namespace);
|
$output = helpIcon(1,$namespace);
|
||||||
$output .= '<h1>'.WebGUI::International::get(12,$namespace).'</h1>';
|
$output .= '<h1>'.WebGUI::International::get(12,$namespace).'</h1>';
|
||||||
$f = WebGUI::HTMLForm->new;
|
$f = WebGUI::HTMLForm->new;
|
||||||
$f->raw($_[0]->fileProperty("image",6));
|
$f->raw(
|
||||||
|
-value=>$_[0]->fileProperty("image",6),
|
||||||
|
-uiLevel=>3
|
||||||
|
);
|
||||||
%hash = (
|
%hash = (
|
||||||
right => WebGUI::International::get(15,$namespace),
|
right => WebGUI::International::get(15,$namespace),
|
||||||
left => WebGUI::International::get(16,$namespace),
|
left => WebGUI::International::get(16,$namespace),
|
||||||
center => WebGUI::International::get(17,$namespace)
|
center => WebGUI::International::get(17,$namespace)
|
||||||
);
|
);
|
||||||
$f->select("alignImage",\%hash,WebGUI::International::get(14,$namespace),[$_[0]->get("alignImage")]);
|
$f->select(
|
||||||
$f->raw($_[0]->fileProperty("attachment",9));
|
-name=>"alignImage",
|
||||||
$f->text("linkTitle",WebGUI::International::get(7,$namespace),$_[0]->get("linkTitle"));
|
-options=>\%hash,
|
||||||
$f->url("linkURL",WebGUI::International::get(8,$namespace),$_[0]->get("linkURL"));
|
-label=>WebGUI::International::get(14,$namespace),
|
||||||
$f->yesNo("convertCarriageReturns",WebGUI::International::get(10,$namespace),$_[0]->get("convertCarriageReturns")
|
-value=>[$_[0]->get("alignImage")],
|
||||||
,'',' <span style="font-size: 8pt;">'.WebGUI::International::get(11,$namespace).'</span>');
|
-uiLevel=>3
|
||||||
$f->yesNo("allowDiscussion",WebGUI::International::get(18,$namespace),$_[0]->get("allowDiscussion"));
|
);
|
||||||
|
$f->raw(
|
||||||
|
-value=>$_[0]->fileProperty("attachment",9),
|
||||||
|
-uiLevel=>1
|
||||||
|
);
|
||||||
|
$f->text(
|
||||||
|
-name=>"linkTitle",
|
||||||
|
-label=>WebGUI::International::get(7,$namespace),
|
||||||
|
-value=>$_[0]->get("linkTitle"),
|
||||||
|
-uiLevel=>3
|
||||||
|
);
|
||||||
|
$f->url(
|
||||||
|
-name=>"linkURL",
|
||||||
|
-label=>WebGUI::International::get(8,$namespace),
|
||||||
|
-value=>$_[0]->get("linkURL"),
|
||||||
|
-uiLevel=>3
|
||||||
|
);
|
||||||
|
$f->yesNo(
|
||||||
|
-name=>"convertCarriageReturns",
|
||||||
|
-label=>WebGUI::International::get(10,$namespace),
|
||||||
|
-value=>$_[0]->get("convertCarriageReturns"),
|
||||||
|
-subtext=>' <span style="font-size: 8pt;">'.WebGUI::International::get(11,$namespace).'</span>',
|
||||||
|
-uiLevel=>5
|
||||||
|
);
|
||||||
|
$f->yesNo(
|
||||||
|
-name=>"allowDiscussion",
|
||||||
|
-label=>WebGUI::International::get(18,$namespace),
|
||||||
|
-value=>$_[0]->get("allowDiscussion"),
|
||||||
|
-uiLevel=>5
|
||||||
|
);
|
||||||
$f->raw($_[0]->SUPER::discussionProperties);
|
$f->raw($_[0]->SUPER::discussionProperties);
|
||||||
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
|
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
|
||||||
return $output;
|
return $output;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue