remove WebGUI::Utility::sortHash
This commit is contained in:
parent
6aa26c2e44
commit
0adbb519f0
3 changed files with 22 additions and 12 deletions
|
|
@ -696,22 +696,18 @@ sub getEditFieldForm {
|
|||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $field = shift;
|
||||
my (%fieldStatus, $f, %fieldTypes, $things);
|
||||
my $fieldId = $field->{fieldId} || "new";
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_Thingy');
|
||||
my $defaultValue;
|
||||
tie %fieldStatus, 'Tie::IxHash';
|
||||
tie %fieldTypes, 'Tie::IxHash';
|
||||
|
||||
%fieldStatus = (
|
||||
my @fieldStatus = (
|
||||
"hidden" => $i18n->get('fieldstatus hidden label'),
|
||||
"visible" => $i18n->get('fieldstatus visible label'),
|
||||
"editable" => $i18n->get('fieldstatus editable label'),
|
||||
"required" => $i18n->get('fieldstatus required label'),
|
||||
);
|
||||
|
||||
%fieldTypes = %{WebGUI::Form::FieldType->new($session)->getTypes};
|
||||
%fieldTypes = WebGUI::Utility::sortHash(%fieldTypes);
|
||||
my %fieldTypes = %{WebGUI::Form::FieldType->new($session)->getTypes};
|
||||
|
||||
$things = $self->session->db->read('select thingId, Thingy_things.label, count(*) from Thingy_things '
|
||||
.'left join Thingy_fields using(thingId) where Thingy_things.assetId = ? and fieldId != "" '
|
||||
|
|
@ -720,6 +716,11 @@ sub getEditFieldForm {
|
|||
my $fieldType = "otherThing_".$thing->{thingId};
|
||||
$fieldTypes{$fieldType} = $thing->{label};
|
||||
}
|
||||
my @fieldTypes =
|
||||
map { @$_ }
|
||||
sort { $a->[1] cmp $b->[1] }
|
||||
map { [ $_, $fieldTypes{$_} ] }
|
||||
keys %fieldTypes;
|
||||
|
||||
my $dialogPrefix;
|
||||
if ($field->{oldFieldId}){
|
||||
|
|
@ -759,7 +760,7 @@ sub getEditFieldForm {
|
|||
-label=>$i18n->get('field type label'),
|
||||
-hoverHelp=>$i18n->get('field type description'),
|
||||
-value=>$field->{fieldType} || "Text",
|
||||
-options=>\%fieldTypes,
|
||||
-options=>\@fieldTypes,
|
||||
-id=>$dialogPrefix."_fieldType_formId",
|
||||
);
|
||||
$f->raw($self->getHtmlWithModuleWrapper($dialogPrefix."_fieldInThing_module"));
|
||||
|
|
@ -793,7 +794,7 @@ sub getEditFieldForm {
|
|||
);
|
||||
$f->selectBox(
|
||||
-name=>"status",
|
||||
-options=>\%fieldStatus,
|
||||
-options=>\@fieldStatus,
|
||||
-label=>$i18n->get('field status label'),
|
||||
-hoverHelp=>$i18n->get('field status description'),
|
||||
-value=> [ $field->{status} || "editable" ] ,
|
||||
|
|
|
|||
|
|
@ -668,8 +668,12 @@ sub www_buildTimeTable {
|
|||
my ($pmAssetId) = $db->quickArray("select a.assetId from PM_wobject a, asset b where a.assetId=b.assetId and b.state not like 'trash%'");
|
||||
if($pmAssetId) {
|
||||
$pmAsset = WebGUI::Asset->newById($session,$pmAssetId);
|
||||
my %pmProjectList = %{$pmAsset->getProjectList($user->userId)};
|
||||
%projectList = WebGUI::Utility::sortHash((%projectList,%pmProjectList));
|
||||
my %pmProjectList = (%projectList, %{$pmAsset->getProjectList($user->userId)});
|
||||
%projectList =
|
||||
map { @$_ }
|
||||
sort { $a->[1] cmp $b->[1] }
|
||||
map { [ $_, $pmProjectList{$_} ] }
|
||||
keys %pmProjectList;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -232,11 +232,16 @@ sub toHtml {
|
|||
foreach my $property (keys %{$properties}) {
|
||||
my $key = $tableName.".".$property;
|
||||
$fields{$key} = qq{$property ($tableName)};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%fields = (%asset,%fields);
|
||||
%fields = WebGUI::Utility::sortHash(%fields);
|
||||
%fields =
|
||||
map { @$_ }
|
||||
sort { $a->[1] cmp $b->[1] }
|
||||
map { [ $_, $fields{$_} ] }
|
||||
keys %fields;
|
||||
|
||||
$json->{$class} = \%fields;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue