[otrs-cvs] CVS: ITSMCMDB/Kernel/Modules AgentITSMCMDB.pm,1.36,1.37

cvs-log at otrs.org cvs-log at otrs.org
Thu Nov 2 15:30:48 CET 2006


Update of /home/cvs/ITSMCMDB/Kernel/Modules
In directory lancelot:/tmp/cvs-serv16736/Kernel/Modules

Modified Files:
	AgentITSMCMDB.pm 
Log Message:
improved search function

Index: AgentITSMCMDB.pm
===================================================================
RCS file: /home/cvs/ITSMCMDB/Kernel/Modules/AgentITSMCMDB.pm,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -r1.36 -r1.37
*** AgentITSMCMDB.pm	2 Nov 2006 12:46:25 -0000	1.36
--- AgentITSMCMDB.pm	2 Nov 2006 14:30:46 -0000	1.37
***************
*** 374,378 ****
  
      elsif ($Self->{Subaction} eq 'RecordSearch') {
!         my $ConfigItemSelect = $Self->{ParamObject}->GetParam(Param => "ConfigItemSelect");
  
          $Output = $Self->{LayoutObject}->Header(Title => 'Search Record');
--- 374,379 ----
  
      elsif ($Self->{Subaction} eq 'RecordSearch') {
!         my $Search = 0;
!         my $ConfigItem = $Self->{ParamObject}->GetParam(Param => "ConfigItemSelect");
  
          $Output = $Self->{LayoutObject}->Header(Title => 'Search Record');
***************
*** 388,392 ****
              Name => 'ConfigItemSelect',
              Data => \%ConfigItemList,
!             SelectedID => $ConfigItemSelect,
          );
          # output block
--- 389,393 ----
              Name => 'ConfigItemSelect',
              Data => \%ConfigItemList,
!             SelectedID => $ConfigItem,
          );
          # output block
***************
*** 396,400 ****
          );
          # if config item was selected
!         if ($ConfigItemSelect) {
              $Self->{LayoutObject}->Block(
                  Name => 'RecordSearchAttribute',
--- 397,401 ----
          );
          # if config item was selected
!         if ($ConfigItem) {
              $Self->{LayoutObject}->Block(
                  Name => 'RecordSearchAttribute',
***************
*** 404,418 ****
              # get attributes
              my @Attributes = $Self->{ITSMCMDBObject}->AttributeSearch(
!                 ConfigItem => $ConfigItemSelect,
                  Option => 'Searchable',
                  OptionValue => 1,
              );
  
              foreach my $Key (@Attributes) {
                  my $AttributeInput = $Self->{LayoutObject}->ITSMCMDBInputText(
                      Name => $Key,
                      Size => 50,
                  );
  
                  $Self->{LayoutObject}->Block(
                      Name => 'RecordSearchAttributeRow',
--- 405,425 ----
              # get attributes
              my @Attributes = $Self->{ITSMCMDBObject}->AttributeSearch(
!                 ConfigItem => $ConfigItem,
                  Option => 'Searchable',
                  OptionValue => 1,
              );
  
+             my %AttributesData;
              foreach my $Key (@Attributes) {
+                 $AttributesData{$Key} = $Self->{ParamObject}->GetParam(Param => "$Key");
+ 
+                 # generate input field
                  my $AttributeInput = $Self->{LayoutObject}->ITSMCMDBInputText(
                      Name => $Key,
                      Size => 50,
+                     Value => $AttributesData{$Key},
                  );
  
+                 # output block
                  $Self->{LayoutObject}->Block(
                      Name => 'RecordSearchAttributeRow',
***************
*** 423,509 ****
                  );
              }
          }
  
! #        # output search result
! #        if ($SubmitSearch) {
! #            my @ConfigItemResultList = $Self->{ParamObject}->GetArray(Param => "ConfigItemSelect");
! #            if (!@ConfigItemResultList) {
! #                foreach (sort keys %ConfigItemList) {
! #                    push (@ConfigItemResultList, $_);
! #                }
! #            }
! #
! #            foreach my $ConfigItem (@ConfigItemResultList) {
! #                my @SearchResult = $Self->{ITSMCMDBObject}->RecordSearch(
! #                    ConfigItem => $ConfigItem,
! #
! #                );
! #
! #                if (@SearchResult) {
! #                    $Self->{LayoutObject}->Block(
! #                        Name => 'RecordSearchResult',
! #                        Data => {%Param},
! #                    );
! #
! #                    # get overview attribute
! #                    my @AttributeOverview = $Self->{ITSMCMDBObject}->AttributeOverviewList(
! #                        ConfigItem => $ConfigItem,
! #                    );
! #
! #                    # output table header
! #                    foreach (@AttributeOverview) {
! #                        $Self->{LayoutObject}->Block(
! #                            Name => 'RecordSearchResultColumn',
! #                            Data => {
! #                                Attribute => $_,
! #                            },
! #                        );
! #                    }
! #
! #                    foreach my $RecordID (@SearchResult) {
! #                        # set output class
! #                        if ($Param{Class} && $Param{Class} eq 'searchpassive') {
! #                            $Param{Class} = 'searchactive';
! #                        }
! #                        else {
! #                            $Param{Class} = 'searchpassive';
! #                        }
! #
! #                        $Self->{LayoutObject}->Block(
! #                            Name => 'RecordSearchResultRow',
! #                            Data => {
! #                                ConfigItem => $ConfigItem,
! #                                RecordID => $RecordID,
! #                                RecordIDHuman => sprintf("%08d", $RecordID),
! #                                %Param,
! #                            },
! #                        );
! #                        # output table header
! #                        foreach (@AttributeOverview) {
! #                            my $AttributeValue = $Self->{ITSMCMDBObject}->AttributeValueGet(
! #                                ConfigItem => $ConfigItem,
! #                                RecordID => $RecordID,
! #                                Attribute => $_,
! #                            );
! #
! #                            $Self->{LayoutObject}->Block(
! #                                Name => 'RecordSearchResultRowColumn',
! #                                Data => {
! #                                    Attribute => $AttributeValue,
! #                                    %Param,
! #                                },
! #                            );
! #                        }
! #                    }
! #
! #                    # output table footer
! #                    foreach (@AttributeOverview) {
! #                        $Self->{LayoutObject}->Block(
! #                            Name => 'RecordSearchResultColumn2',
! #                        );
! #                    }
! #                }
! #            }
! #        }
  
          $Output .= $Self->{LayoutObject}->Output(
--- 430,507 ----
                  );
              }
+             $Search = 1;
          }
  
!         # output search result
!         if ($Search) {
!             my @SearchResult = $Self->{ITSMCMDBObject}->RecordSearch(
!                 ConfigItem => $ConfigItem,
!             );
! 
!             if (@SearchResult) {
!                 $Self->{LayoutObject}->Block(
!                     Name => 'RecordSearchResult',
!                     Data => {%Param},
!                 );
!             }
! 
!             # get overview attribute
!             my @AttributeOverview = $Self->{ITSMCMDBObject}->AttributeOverviewList(
!                 ConfigItem => $ConfigItem,
!             );
! 
!             # output table header
!             foreach (@AttributeOverview) {
!                 $Self->{LayoutObject}->Block(
!                     Name => 'RecordSearchResultColumn',
!                     Data => {
!                         Attribute => $_,
!                     },
!                 );
!             }
! 
!             foreach my $RecordID (@SearchResult) {
!                 # set output class
!                 if ($Param{Class} && $Param{Class} eq 'searchpassive') {
!                     $Param{Class} = 'searchactive';
!                 }
!                 else {
!                     $Param{Class} = 'searchpassive';
!                 }
! 
!                 $Self->{LayoutObject}->Block(
!                     Name => 'RecordSearchResultRow',
!                     Data => {
!                         ConfigItem => $ConfigItem,
!                         RecordID => $RecordID,
!                         RecordIDHuman => sprintf("%08d", $RecordID),
!                         %Param,
!                     },
!                 );
!                 # output table header
!                 foreach (@AttributeOverview) {
!                     my $AttributeValue = $Self->{ITSMCMDBObject}->AttributeValueGet(
!                         ConfigItem => $ConfigItem,
!                         RecordID => $RecordID,
!                         Attribute => $_,
!                     );
! 
!                     $Self->{LayoutObject}->Block(
!                         Name => 'RecordSearchResultRowColumn',
!                         Data => {
!                             Attribute => $AttributeValue,
!                             %Param,
!                         },
!                     );
!                 }
!             }
! 
!             # output table footer
!             foreach (@AttributeOverview) {
!                 $Self->{LayoutObject}->Block(
!                     Name => 'RecordSearchResultColumn2',
!                 );
!             }
!         }
  
          $Output .= $Self->{LayoutObject}->Output(



More information about the cvs-log mailing list