[otrs-cvs] FAQ/Kernel/Modules AgentFAQ.pm, 1.11, 1.12 CustomerFAQ.pm, 1.4, 1.5 FAQ.pm, 1.12, 1.13 PublicFAQ.pm, 1.2, 1.3

cvs-log at otrs.org cvs-log at otrs.org
Wed Mar 26 08:42:32 GMT 2008


Comments:
Update of /home/cvs/FAQ/Kernel/Modules
In directory lancelot:/tmp/cvs-serv3613/Kernel/Modules

Modified Files:
	AgentFAQ.pm CustomerFAQ.pm FAQ.pm PublicFAQ.pm 
Log Message:
Added mulit attachments and rss support.

Author: martin

Index: AgentFAQ.pm
===================================================================
RCS file: /home/cvs/FAQ/Kernel/Modules/AgentFAQ.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** AgentFAQ.pm	26 Sep 2007 11:55:34 -0000	1.11
--- AgentFAQ.pm	26 Mar 2008 08:42:27 -0000	1.12
***************
*** 1,5 ****
  # --
  # Kernel/Modules/AgentFAQ.pm - faq module
! # Copyright (C) 2001-2007 OTRS GmbH, http://otrs.org/
  # --
  # $Id$
--- 1,5 ----
  # --
  # Kernel/Modules/AgentFAQ.pm - faq module
! # Copyright (C) 2001-2008 OTRS AG, http://otrs.org/
  # --
  # $Id$
***************
*** 7,11 ****
  # This software comes with ABSOLUTELY NO WARRANTY. For details, see
  # the enclosed file COPYING for license information (GPL). If you
! # did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
  # --
  
--- 7,11 ----
  # This software comes with ABSOLUTELY NO WARRANTY. For details, see
  # the enclosed file COPYING for license information (GPL). If you
! # did not receive this file, see http://www.gnu.org/licenses/gpl-2.0.txt.
  # --
  
***************
*** 21,26 ****
  
  use vars qw($VERSION @ISA);
! $VERSION = '$Revision$';
! $VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
  
  @ISA = qw(Kernel::Modules::FAQ);
--- 21,25 ----
  
  use vars qw($VERSION @ISA);
! $VERSION = qw($Revision$) [1];
  
  @ISA = qw(Kernel::Modules::FAQ);
***************
*** 46,50 ****
      # check needed Objects
      # ********************************************************** #
!     foreach (qw(SessionObject)) {
          $Self->{LayoutObject}->FatalError(Message => "Got no $_!") if (!$Self->{$_});
      }
--- 45,49 ----
      # check needed Objects
      # ********************************************************** #
!     for (qw(SessionObject)) {
          $Self->{LayoutObject}->FatalError(Message => "Got no $_!") if (!$Self->{$_});
      }
***************
*** 87,91 ****
      @Params = qw(ItemID ID Number Name Comment CategoryID ParentID StateID LanguageID Title UserID
      Field1 Field2 Field3 Field4 Field5 Field6 FreeKey1 FreeKey2 FreeKey3 Keywords Order Sort Nav);
!     foreach (@Params) {
          $GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_) || '';
      }
--- 86,90 ----
      @Params = qw(ItemID ID Number Name Comment CategoryID ParentID StateID LanguageID Title UserID
      Field1 Field2 Field3 Field4 Field5 Field6 FreeKey1 FreeKey2 FreeKey3 Keywords Order Sort Nav);
!     for (@Params) {
          $GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_) || '';
      }
***************
*** 96,113 ****
      if($GetParam{Nav} eq 'Normal') {
          $HeaderType = '';
!     } elsif ($GetParam{Nav} eq 'None' || $Self->{LastFAQNav}) {
          $HeaderType = 'Small';
          $Navigation = ' ';
          $Notify    = ' ';
!     } else {
          $HeaderType = '';
      }
  
-     $Self->{SessionObject}->UpdateSessionID(
-         SessionID => $Self->{SessionID},
-         Key => 'LastFAQNav',
-         Value => $HeaderType,
-     );
- 
      # store nav param
      $Self->{SessionObject}->UpdateSessionID(
--- 95,108 ----
      if($GetParam{Nav} eq 'Normal') {
          $HeaderType = '';
!     }
!     elsif ($GetParam{Nav} eq 'None' || $Self->{LastFAQNav}) {
          $HeaderType = 'Small';
          $Navigation = ' ';
          $Notify    = ' ';
!     }
!     else {
          $HeaderType = '';
      }
  
      # store nav param
      $Self->{SessionObject}->UpdateSessionID(
***************
*** 304,308 ****
  
          # db action
!         my %CategoryData = $Self->{FAQObject}->CategoryGet(CategoryID => $ParamData{CategoryID}, UserID => $Self->{UserID});
          if (!%CategoryData) {
              return $Self->{LayoutObject}->ErrorScreen();
--- 299,306 ----
  
          # db action
!         my %CategoryData = $Self->{FAQObject}->CategoryGet(
!             CategoryID => $ParamData{CategoryID},
!             UserID => $Self->{UserID},
!         );
          if (!%CategoryData) {
              return $Self->{LayoutObject}->ErrorScreen();
***************
*** 334,343 ****
              SelectedID => $CategoryData{ValidID},
          );
!         my $SelectedGroups = $Self->{FAQObject}->GetCategoryGroup(CategoryID => $ParamData{CategoryID});
          my %Groups = $Self->{GroupObject}->GroupList(Valid => 1);
          $Frontend{GroupOption} = $Self->{LayoutObject}->OptionStrgHashRef(
              Data => \%Groups,
              Name => 'PermissionGroups',
!             Size => 8,
              Multiple => 1,
              SelectedIDRefArray => $SelectedGroups,
--- 332,343 ----
              SelectedID => $CategoryData{ValidID},
          );
!         my $SelectedGroups = $Self->{FAQObject}->GetCategoryGroup(
!             CategoryID => $ParamData{CategoryID},
!         );
          my %Groups = $Self->{GroupObject}->GroupList(Valid => 1);
          $Frontend{GroupOption} = $Self->{LayoutObject}->OptionStrgHashRef(
              Data => \%Groups,
              Name => 'PermissionGroups',
!             Size => 12,
              Multiple => 1,
              SelectedIDRefArray => $SelectedGroups,
***************
*** 368,372 ****
          my @RequiredParams = qw(CategoryID Name Comment);
          my @Params = qw(ParentID ValidID);
!         foreach (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!$ParamData{$_}) {
--- 368,372 ----
          my @RequiredParams = qw(CategoryID Name Comment);
          my @Params = qw(ParentID ValidID);
!         for (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!$ParamData{$_}) {
***************
*** 374,378 ****
              }
          }
!         foreach (@Params) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!defined($ParamData{$_})) {
--- 374,378 ----
              }
          }
!         for (@Params) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!defined($ParamData{$_})) {
***************
*** 441,445 ****
              Data => \%Groups,
              Name => 'PermissionGroups',
!             Size => 8,
              Multiple => 1,
          );
--- 441,445 ----
              Data => \%Groups,
              Name => 'PermissionGroups',
!             Size => 12,
              Multiple => 1,
          );
***************
*** 463,467 ****
          my @RequiredParams = qw(Name Comment);
          my @Params = qw(ParentID ValidID);
!         foreach (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!$ParamData{$_}) {
--- 463,467 ----
          my @RequiredParams = qw(Name Comment);
          my @Params = qw(ParentID ValidID);
!         for (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!$ParamData{$_}) {
***************
*** 469,473 ****
              }
          }
!         foreach (@Params) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!defined($ParamData{$_})) {
--- 469,473 ----
              }
          }
!         for (@Params) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!defined($ParamData{$_})) {
***************
*** 559,563 ****
          my @RequiredParams = qw(CategoryID Title);
          my @Params = qw(StateID LanguageID Field1 Field2 Field3 Field4 Field5 Field6 Keywords Title);
!         foreach (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!$ParamData{$_}) {
--- 559,563 ----
          my @RequiredParams = qw(CategoryID Title);
          my @Params = qw(StateID LanguageID Field1 Field2 Field3 Field4 Field5 Field6 Keywords Title);
!         for (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!$ParamData{$_}) {
***************
*** 565,594 ****
              }
          }
!         foreach (@Params) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
          }
  
-         # get submit attachment
-         my %UploadStuff = $Self->{ParamObject}->GetUploadAll(
-             Param => 'file_upload',
-             Source => 'String',
-         );
- 
          # insert item
          my $ItemID = $Self->{FAQObject}->FAQAdd(
              %ParamData,
-             %UploadStuff,
              UserID => $Self->{UserID}
          );
  
!         if ($ItemID) {
!             if (!defined($ParamData{ItemID}) && !$ParamData{ItemID}) {
!                 $ParamData{ItemID} = '';
!             }
!             return $Self->{LayoutObject}->Redirect(OP => "Action=$Self->{Action}&Subaction=View&ItemID=$ParamData{ItemID}");
!         }
!         else {
              return $Self->{LayoutObject}->ErrorScreen();
          }
      }
      # ---------------------------------------------------------- #
--- 565,596 ----
              }
          }
!         for (@Params) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
          }
  
          # insert item
          my $ItemID = $Self->{FAQObject}->FAQAdd(
              %ParamData,
              UserID => $Self->{UserID}
          );
  
!         if ( !$ItemID ) {
              return $Self->{LayoutObject}->ErrorScreen();
          }
+         # get submit attachment
+         my %UploadStuff = $Self->{ParamObject}->GetUploadAll(
+             Param => 'file_upload',
+             Source => 'String',
+         );
+         if ( %UploadStuff ) {
+             $Self->{FAQObject}->AttachmentAdd(
+                 ItemID => $ItemID,
+                 %UploadStuff,
+             );
+         }
+ 
+         return $Self->{LayoutObject}->Redirect(
+             OP => "Action=$Self->{Action}&Subaction=View&ItemID=$ItemID",
+         );
      }
      # ---------------------------------------------------------- #
***************
*** 600,604 ****
  
          # permission check
!         if (!$Self->{AccessRw}) {
              return $Self->{LayoutObject}->NoPermission(WithHeader => 'yes');
          }
--- 602,606 ----
  
          # permission check
!         if ( !$Self->{AccessRw} ) {
              return $Self->{LayoutObject}->NoPermission(WithHeader => 'yes');
          }
***************
*** 607,613 ****
          my %ParamData = ();
          my @RequiredParams = qw(CategoryID ItemID);
!         foreach (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
!             if(!$ParamData{$_}) {
                  return $Self->{LayoutObject}->FatalError(Message => "Need $_!");
              }
--- 609,615 ----
          my %ParamData = ();
          my @RequiredParams = qw(CategoryID ItemID);
!         for (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
!             if( !$ParamData{$_} ) {
                  return $Self->{LayoutObject}->FatalError(Message => "Need $_!");
              }
***************
*** 615,619 ****
  
          # db action
!         my %ItemData = $Self->{FAQObject}->FAQGet(ItemID => $ParamData{ItemID}, UserID => $Self->{UserID});
          if (!%ItemData) {
              return $Self->{LayoutObject}->ErrorScreen();
--- 617,624 ----
  
          # db action
!         my %ItemData = $Self->{FAQObject}->FAQGet(
!             ItemID => $ParamData{ItemID},
!             UserID => $Self->{UserID},
!         );
          if (!%ItemData) {
              return $Self->{LayoutObject}->ErrorScreen();
***************
*** 646,649 ****
--- 651,664 ----
              Data => { %ItemData, %Frontend },
          );
+         # add attachments
+         my @AttachmentIndex = $Self->{FAQObject}->AttachmentIndex(
+             ItemID => $ParamData{ItemID},
+         );
+         for my $Attachment ( @AttachmentIndex ) {
+             $Self->{LayoutObject}->Block(
+                 Name => 'UpdateAttachment',
+                 Data => { %ItemData, %{ $Attachment } },
+             );
+         }
  
          # fields
***************
*** 673,701 ****
          my %ParamData = ();
          my @RequiredParams = qw(Title CategoryID);
!         my @Params = qw(ItemID StateID LanguageID Field1 Field2 Field3 Field4 Field5 Field6 Keywords);
!         foreach (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
!             if(!$ParamData{$_}) {
                  return $Self->{LayoutObject}->FatalError(Message => "Need $_!");
              }
          }
!         foreach (@Params) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
          }
  
!         # db action
  
!         # get submit attachment
!         my %UploadStuff = $Self->{ParamObject}->GetUploadAll(
!             Param => 'file_upload',
!             Source => 'String',
!         );
  
          # update item
!         if ($Self->{FAQObject}->FAQUpdate(%ParamData, %UploadStuff, UserID => $Self->{UserID})) {
!             return $Self->{LayoutObject}->Redirect(OP => "Action=$Self->{Action}&Subaction=View&ItemID=$GetParam{ItemID}");
          }
          else {
!             return $Self->{LayoutObject}->ErrorScreen();
          }
      }
--- 688,750 ----
          my %ParamData = ();
          my @RequiredParams = qw(Title CategoryID);
!         my @Params = qw(ItemID StateID LanguageID Field1 Field2 Field3 Field4 Field5 Field6 Keywords
!         AttachmentUpload AttachmentDelete0 AttachmentDelete1 AttachmentDelete2 AttachmentDelete3 AttachmentDelete4
!         AttachmentDelete5 AttachmentDelete6 AttachmentDelete7 AttachmentDelete8
!         AttachmentDelete9 AttachmentDelete10 AttachmentDelete11 AttachmentDelete12
!         AttachmentDelete13 AttachmentDelete14 AttachmentDelete15 AttachmentDelete16);
!         for (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
!             if( !$ParamData{$_} ) {
                  return $Self->{LayoutObject}->FatalError(Message => "Need $_!");
              }
          }
!         for (@Params) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
          }
  
!         my $Redirect = 1;
!         # attachment delete
!         for ( 0 .. 16 ) {
!             if ( $ParamData{"AttachmentDelete$_"} ) {
!                 $Redirect = 0;
!                 $Self->{FAQObject}->AttachmentDelete(
!                     ItemID => $ParamData{ItemID},
!                     FileID => $_,
!                 );
!             }
!         }
  
!         # attachment upload
!         if ( $ParamData{AttachmentUpload} ) {
!             $Redirect = 0;
!             my %UploadStuff = $Self->{ParamObject}->GetUploadAll(
!                 Param  => "file_upload",
!                 Source => 'string',
!             );
!             $Self->{FAQObject}->AttachmentAdd(
!                 ItemID => $ParamData{ItemID},
!                 %UploadStuff,
!             );
!         }
  
          # update item
!         my $Update = $Self->{FAQObject}->FAQUpdate(
!             %ParamData,
!             UserID => $Self->{UserID},
!         );
! 
!         if ( !$Update ) {
!             return $Self->{LayoutObject}->ErrorScreen();
!         }
! 
!         if ( $Redirect ) {
!             return $Self->{LayoutObject}->Redirect(
!                 OP => "Action=$Self->{Action}&Subaction=View&ItemID=$GetParam{ItemID}",
!             );
          }
          else {
!             return $Self->{LayoutObject}->Redirect(
!                 OP => "Action=$Self->{Action}&Subaction=Update&ItemID=$GetParam{ItemID}&CategoryID=$GetParam{CategoryID}",
!             );
          }
      }
***************
*** 716,720 ****
          my %ParamData = ();
          my @RequiredParams = qw(CategoryID ItemID);
!         foreach (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!$ParamData{$_}) {
--- 765,769 ----
          my %ParamData = ();
          my @RequiredParams = qw(CategoryID ItemID);
!         for (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!$ParamData{$_}) {
***************
*** 722,726 ****
              }
          }
!         foreach (@Params) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
          }
--- 771,775 ----
              }
          }
!         for (@Params) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
          }
***************
*** 760,764 ****
          my %ParamData = ();
          my @RequiredParams = qw(CategoryID ItemID);
!         foreach (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!$ParamData{$_}) {
--- 809,813 ----
          my %ParamData = ();
          my @RequiredParams = qw(CategoryID ItemID);
!         for (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!$ParamData{$_}) {
***************
*** 785,808 ****
      # ---------------------------------------------------------- #
      elsif ($Self->{Subaction} eq 'Download') {
!         @Params = qw(ItemID);
  
          # permission check
!         if (!$Self->{AccessRo}) {
              return $Self->{LayoutObject}->NoPermission(WithHeader => 'yes');
          }
          # manage parameters
!         foreach (@Params) {
!             if(!($GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_))) {
                  return $Self->{LayoutObject}->FatalError(Message => "Need $_");
              }
          }
          # db action
!         my %ItemData = $Self->{FAQObject}->FAQGet(ItemID => $GetParam{ItemID}, UserID => $Self->{UserID});
          if (!%ItemData) {
              return $Self->{LayoutObject}->ErrorScreen();
          }
  
!         if (%ItemData) {
!             return $Self->{LayoutObject}->Attachment(%ItemData);
          }
          else {
--- 834,866 ----
      # ---------------------------------------------------------- #
      elsif ($Self->{Subaction} eq 'Download') {
!         @Params = qw(ItemID FileID);
  
          # permission check
!         if ( !$Self->{AccessRo} ) {
              return $Self->{LayoutObject}->NoPermission(WithHeader => 'yes');
          }
          # manage parameters
!         for (@Params) {
!             if( !defined ($GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_)) ) {
                  return $Self->{LayoutObject}->FatalError(Message => "Need $_");
              }
          }
          # db action
!         my %ItemData = $Self->{FAQObject}->FAQGet(
!             ItemID => $GetParam{ItemID},
!             UserID => $Self->{UserID},
!         );
! 
          if (!%ItemData) {
              return $Self->{LayoutObject}->ErrorScreen();
          }
  
!         # get attachments
!         my %File = $Self->{FAQObject}->AttachmentGet(
!             ItemID => $GetParam{ItemID},
!             FileID => $GetParam{FileID},
!         );
!         if ( %File ) {
!             return $Self->{LayoutObject}->Attachment(%File);
          }
          else {
***************
*** 838,842 ****
          my %ParamData = ();
          my @RequiredParams = qw(CategoryID ItemID);
!         foreach (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!$ParamData{$_}) {
--- 896,900 ----
          my %ParamData = ();
          my @RequiredParams = qw(CategoryID ItemID);
!         for (@RequiredParams) {
              $ParamData{$_} = $Self->{ParamObject}->GetParam(Param => $_);
              if(!$ParamData{$_}) {
***************
*** 862,866 ****
          $Frontend{CssRow} = 'searchactive';
          my @History = @{$Self->{FAQObject}->FAQHistoryGet(ItemID => $ItemData{ItemID})};
!         foreach my $Row (@History) {
  
              # css configuration
--- 920,924 ----
          $Frontend{CssRow} = 'searchactive';
          my @History = @{$Self->{FAQObject}->FAQHistoryGet(ItemID => $ItemData{ItemID})};
!         for my $Row (@History) {
  
              # css configuration
***************
*** 935,939 ****
          if($Self->{LastFAQNav}) {
              $Self->GetItemSmallView();
!         } else {
              my %FAQArticle = $Self->{FAQObject}->FAQGet(
                  FAQID => $Self->{ParamObject}->GetParam(Param => 'ItemID'),
--- 993,1004 ----
          if($Self->{LastFAQNav}) {
              $Self->GetItemSmallView();
!         }
!         else {
!             # store last screen (to get back from linkin object mask)
!             $Self->{SessionObject}->UpdateSessionID(
!                 SessionID => $Self->{SessionID},
!                 Key => 'LastScreenView',
!                 Value => $Self->{RequestedURL},
!             );
              my %FAQArticle = $Self->{FAQObject}->FAQGet(
                  FAQID => $Self->{ParamObject}->GetParam(Param => 'ItemID'),
***************
*** 984,988 ****
      $Output .= $Navigation || $DefaultNavigation;
      if(!$Notify) {
!         foreach my $Notify (@{$Self->{Notify}}) {
              $Output .= $Self->{LayoutObject}->Notify(
                  Priority => $Notify->[0],
--- 1049,1053 ----
      $Output .= $Navigation || $DefaultNavigation;
      if(!$Notify) {
!         for my $Notify (@{$Self->{Notify}}) {
              $Output .= $Self->{LayoutObject}->Notify(
                  Priority => $Notify->[0],

Author: martin

Index: CustomerFAQ.pm
===================================================================
RCS file: /home/cvs/FAQ/Kernel/Modules/CustomerFAQ.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CustomerFAQ.pm	18 Jan 2007 14:11:20 -0000	1.4
--- CustomerFAQ.pm	26 Mar 2008 08:42:27 -0000	1.5
***************
*** 1,5 ****
  # --
  # Kernel/Modules/CustomerFAQ.pm - faq module
! # Copyright (C) 2001-2007 OTRS GmbH, http://otrs.org/
  # --
  # $Id$
--- 1,5 ----
  # --
  # Kernel/Modules/CustomerFAQ.pm - faq module
! # Copyright (C) 2001-2008 OTRS AG, http://otrs.org/
  # --
  # $Id$
***************
*** 7,11 ****
  # This software comes with ABSOLUTELY NO WARRANTY. For details, see
  # the enclosed file COPYING for license information (GPL). If you
! # did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
  # --
  
--- 7,11 ----
  # This software comes with ABSOLUTELY NO WARRANTY. For details, see
  # the enclosed file COPYING for license information (GPL). If you
! # did not receive this file, see http://www.gnu.org/licenses/gpl-2.0.txt.
  # --
  
***************
*** 17,26 ****
  
  use vars qw($VERSION);
! $VERSION = '$Revision$';
! $VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
  
  our @ISA = qw(Kernel::Modules::FAQ);
  
- # --
  sub new {
      my $Type = shift;
--- 17,24 ----
  
  use vars qw($VERSION);
! $VERSION = qw($Revision$) [1];
  
  our @ISA = qw(Kernel::Modules::FAQ);
  
  sub new {
      my $Type = shift;
***************
*** 40,44 ****
          Types => ['external','public']
      );
!     # check needed Opjects
      # ********************************************************** #
      foreach (qw(UserObject)) {
--- 38,42 ----
          Types => ['external','public']
      );
!     # check needed Objects
      # ********************************************************** #
      foreach (qw(UserObject)) {
***************
*** 48,52 ****
      return $Self;
  }
! # --
  sub Run {
      my $Self = shift;
--- 46,50 ----
      return $Self;
  }
! 
  sub Run {
      my $Self = shift;
***************
*** 78,82 ****
      if ($GetParam{Nav}) {
          $HeaderType = 'Small';
!     } else {
          $HeaderType = '';
      }
--- 76,81 ----
      if ($GetParam{Nav}) {
          $HeaderType = 'Small';
!     }
!     else {
          $HeaderType = '';
      }
***************
*** 131,134 ****
--- 130,134 ----
          # get param
          my $ItemID  = $Self->{ParamObject}->GetParam(Param => 'ItemID');
+         my $FileID  = $Self->{ParamObject}->GetParam(Param => 'FileID');
          # db action
          my %ItemData = $Self->{FAQObject}->FAQGet(ItemID => $ItemID);
***************
*** 137,141 ****
          }
          if ($ItemData{StateTypeName} eq 'external' || $ItemData{StateTypeName} eq 'public') {
!             return $Self->{LayoutObject}->Attachment(%ItemData);
          }
          else {
--- 137,148 ----
          }
          if ($ItemData{StateTypeName} eq 'external' || $ItemData{StateTypeName} eq 'public') {
!             my %File = $Self->{FAQObject}->AttachmentGet(
!                 ItemID => $ItemID,
!                 FileID => $FileID,
!             );
!             if (!%File) {
!                 return $Self->{LayoutObject}->FatalError(Message => "No File found!");
!             }
!             return $Self->{LayoutObject}->Attachment(%File);
          }
          else {
***************
*** 224,228 ****
      return $Output;
  }
- # --
  
  1;
--- 231,234 ----

Author: martin

Index: FAQ.pm
===================================================================
RCS file: /home/cvs/FAQ/Kernel/Modules/FAQ.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** FAQ.pm	19 Mar 2008 10:52:50 -0000	1.12
--- FAQ.pm	26 Mar 2008 08:42:27 -0000	1.13
***************
*** 18,23 ****
  
  use vars qw($VERSION);
! $VERSION = '$Revision$';
! $VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
  
  sub new {
--- 18,22 ----
  
  use vars qw($VERSION);
! $VERSION = qw($Revision$) [1];
  
  sub new {
***************
*** 29,38 ****
      bless ($Self, $Type);
  
!     foreach (keys %Param) {
          $Self->{$_} = $Param{$_};
      }
  
      # check needed Opjects
!     foreach (qw(ParamObject DBObject LayoutObject LogObject ConfigObject UserObject)) {
          $Self->{LayoutObject}->FatalError(Message => "Got no $_!") if (!$Self->{$_});
      }
--- 28,37 ----
      bless ($Self, $Type);
  
!     for (keys %Param) {
          $Self->{$_} = $Param{$_};
      }
  
      # check needed Opjects
!     for (qw(ParamObject DBObject LayoutObject LogObject ConfigObject UserObject)) {
          $Self->{LayoutObject}->FatalError(Message => "Got no $_!") if (!$Self->{$_});
      }
***************
*** 57,77 ****
      $Self->{Notify} = [];
  
-     # store last screen
-     if($Self->{SessionObject}) {
-         if($Self->{Subaction} eq 'Explorer') {
-             $Self->{SessionObject}->UpdateSessionID(
-                 SessionID => $Self->{SessionID},
-                 Key => 'LastScreenOverview',
-                 Value => $Self->{RequestedURL},
-             );
-         }
-         else {
-             $Self->{SessionObject}->UpdateSessionID(
-                 SessionID => $Self->{SessionID},
-                 Key => 'LastScreenView',
-                 Value => $Self->{RequestedURL},
-             );
-         }
-     }
      return $Self;
  }
--- 56,59 ----
***************
*** 88,104 ****
      $GetParam{Order} = $Self->{ParamObject}->GetParam(Param => 'Order') || 'Title';
      $GetParam{Sort} = $Self->{ParamObject}->GetParam(Param => 'Sort') || 'up';
!     foreach (@Params) {
          if(!$GetParam{$_} && !($GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_))) {
              return $Self->{LayoutObject}->FatalError(Message => "Need parameter $_");
          }
      }
-     # store back link
-     if($Self->{SessionObject}) {
-         $Self->{SessionObject}->UpdateSessionID(
-             SessionID => $Self->{SessionID},
-             Key => 'LastScreenView',
-             Value => $Self->{RequestedURL},
-         );
-     }
      # db action
      my %CategoryData = ();
--- 70,78 ----
      $GetParam{Order} = $Self->{ParamObject}->GetParam(Param => 'Order') || 'Title';
      $GetParam{Sort} = $Self->{ParamObject}->GetParam(Param => 'Sort') || 'up';
!     for (@Params) {
          if(!$GetParam{$_} && !($GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_))) {
              return $Self->{LayoutObject}->FatalError(Message => "Need parameter $_");
          }
      }
      # db action
      my %CategoryData = ();
***************
*** 110,114 ****
      }
      # dtl block
-     $Frontend{LastScreenOverview} = $Self->{RequestedURL};
      $Self->{LayoutObject}->Block(
          Name => 'Explorer',
--- 84,87 ----
***************
*** 124,130 ****
              Name => 'ExplorerTitle',
              Data => {
!                         'Name' => $CategoryData{Name},
!                         'Comment' => $CategoryData{Comment}
!                     },
          );
      }
--- 97,103 ----
              Name => 'ExplorerTitle',
              Data => {
!                 Name    => $CategoryData{Name},
!                 Comment => $CategoryData{Comment}
!             },
          );
      }
***************
*** 133,139 ****
              Name => 'ExplorerTitle',
              Data => {
!                         'Name' => $Self->{ConfigObject}->Get('FAQ::Default::RootCategoryName'),
!                         'Comment' => $Self->{ConfigObject}->Get('FAQ::Default::RootCategoryComment')
!                     },
          );
      }
--- 106,112 ----
              Name => 'ExplorerTitle',
              Data => {
!                 Name    => $Self->{ConfigObject}->Get('FAQ::Default::RootCategoryName'),
!                 Comment => $Self->{ConfigObject}->Get('FAQ::Default::RootCategoryComment')
!             },
          );
      }
***************
*** 208,212 ****
      if($Self->{ConfigObject}->Get('FAQ::Explorer::Path::Show')) {
          my @CategoryList = @{$Self->{FAQObject}->FAQPathListGet(CategoryID => $Param{CategoryID})};
!         foreach my $Data (@CategoryList) {
              $Self->{LayoutObject}->Block(
                  Name => 'FAQPathCategoryElement',
--- 181,185 ----
      if($Self->{ConfigObject}->Get('FAQ::Explorer::Path::Show')) {
          my @CategoryList = @{$Self->{FAQObject}->FAQPathListGet(CategoryID => $Param{CategoryID})};
!         for my $Data (@CategoryList) {
              $Self->{LayoutObject}->Block(
                  Name => 'FAQPathCategoryElement',
***************
*** 226,230 ****
  
      # check needed parameters
!     foreach (qw(Order Sort)) {
          if (!$Param{$_}) {
              $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!")
--- 199,203 ----
  
      # check needed parameters
!     for (qw(Order Sort)) {
          if (!$Param{$_}) {
              $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!")
***************
*** 254,258 ****
              Name => 'ExplorerCategoryList',
          );
!         foreach (@CategoryIDs) {
              my %Data = $Self->{FAQObject}->CategoryGet(CategoryID => $_);
              $Data{CategoryNumber} = $Self->{FAQObject}->CategoryCount(
--- 227,231 ----
              Name => 'ExplorerCategoryList',
          );
!         for (@CategoryIDs) {
              my %Data = $Self->{FAQObject}->CategoryGet(CategoryID => $_);
              $Data{CategoryNumber} = $Self->{FAQObject}->CategoryCount(
***************
*** 285,289 ****
  
      # check needed parameters
!     foreach (qw(Order Sort)) {
          if (!$Param{$_}) {
              $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!")
--- 258,262 ----
  
      # check needed parameters
!     for (qw(Order Sort)) {
          if (!$Param{$_}) {
              $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!")
***************
*** 305,309 ****
              Data => {%Param}
          );
!         foreach (@ItemIDs) {
              my %Frontend = ();
              my %Data = $Self->{FAQObject}->FAQGet(ItemID => $_);
--- 278,282 ----
              Data => {%Param}
          );
!         for (@ItemIDs) {
              my %Frontend = ();
              my %Data = $Self->{FAQObject}->FAQGet(ItemID => $_);
***************
*** 333,337 ****
      if($Self->{ConfigObject}->Get('FAQ::Explorer::LastChange::Show')) {
          # check needed parameters
!         foreach (qw(CategoryID)) {
              if (!defined($Param{$_})) {
                  $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!")
--- 306,310 ----
      if($Self->{ConfigObject}->Get('FAQ::Explorer::LastChange::Show')) {
          # check needed parameters
!         for (qw(CategoryID)) {
              if (!defined($Param{$_})) {
                  $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!")
***************
*** 365,368 ****
--- 338,347 ----
                  Name => 'ExplorerLatestChange'
              );
+             if ( $Param{Mode} =~ /public/i ) {
+                 $Self->{LayoutObject}->Block(
+                     Name => 'ExplorerLatestChangeRss',
+                     Data => { },
+                 );
+             }
              if (@CategoryIDs) {
                  @ItemIDs = $Self->{FAQObject}->FAQSearch(
***************
*** 386,390 ****
              );
          }
!         foreach (@ItemIDs) {
              my %Data = $Self->{FAQObject}->FAQGet(ItemID => $_);
              $Self->{LayoutObject}->Block(
--- 365,369 ----
              );
          }
!         for (@ItemIDs) {
              my %Data = $Self->{FAQObject}->FAQGet(ItemID => $_);
              $Self->{LayoutObject}->Block(
***************
*** 404,408 ****
      if($Self->{ConfigObject}->Get('FAQ::Explorer::LastCreate::Show')) {
          # check needed parameters
!         foreach (qw(CategoryID)) {
              if (!defined($Param{$_})) {
                  $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!")
--- 383,387 ----
      if($Self->{ConfigObject}->Get('FAQ::Explorer::LastCreate::Show')) {
          # check needed parameters
!         for (qw(CategoryID)) {
              if (!defined($Param{$_})) {
                  $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!")
***************
*** 436,439 ****
--- 415,424 ----
                  Name => 'ExplorerLatestCreate'
              );
+             if ( $Param{Mode} =~ /public/i ) {
+                 $Self->{LayoutObject}->Block(
+                     Name => 'ExplorerLatestCreateRss',
+                     Data => { },
+                 );
+             }
              if (@CategoryIDs) {
                  @ItemIDs = $Self->{FAQObject}->FAQSearch(
***************
*** 458,462 ****
          }
          # dtl block
!         foreach (@ItemIDs) {
              my %Data = $Self->{FAQObject}->FAQGet(ItemID => $_);
              $Self->{LayoutObject}->Block(
--- 443,447 ----
          }
          # dtl block
!         for (@ItemIDs) {
              my %Data = $Self->{FAQObject}->FAQGet(ItemID => $_);
              $Self->{LayoutObject}->Block(
***************
*** 476,480 ****
      if($Self->{ConfigObject}->Get('FAQ::Explorer::QuickSearch::Show')) {
          # check needed parameters
!         foreach (qw()) {
              if (!$Param{$_}) {
                  $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!")
--- 461,465 ----
      if($Self->{ConfigObject}->Get('FAQ::Explorer::QuickSearch::Show')) {
          # check needed parameters
!         for (qw()) {
              if (!$Param{$_}) {
                  $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!")
***************
*** 499,503 ****
  
      # manage parameters
!     foreach (@Params) {
          if (!($GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_))) {
              $Self->{LayoutObject}->FatalError(Message => "Need parameter $_");
--- 484,488 ----
  
      # manage parameters
!     for (@Params) {
          if (!($GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_))) {
              $Self->{LayoutObject}->FatalError(Message => "Need parameter $_");
***************
*** 505,515 ****
      }
      # db action
!     my %ItemData = $Self->{FAQObject}->FAQGet(ItemID => $GetParam{ItemID}, UserID => $Self->{UserID});
      # html quoting
!     foreach my $Key (qw (Field1 Field2 Field3 Field4 Field5 Field6)) {
          if ($Self->{ConfigObject}->Get('FAQ::Item::HTML')) {
              my @Array = split /pre>/, $ItemData{$Key};
              my $Text = '';
!             foreach (@Array) {
                  if ($_ =~ /(.*)\<\/$/) {
                      $Text .= 'pre>'.$_.'pre>';
--- 490,503 ----
      }
      # db action
!     my %ItemData = $Self->{FAQObject}->FAQGet(
!         ItemID => $GetParam{ItemID},
!         UserID => $Self->{UserID},
!     );
      # html quoting
!     for my $Key (qw (Field1 Field2 Field3 Field4 Field5 Field6)) {
          if ($Self->{ConfigObject}->Get('FAQ::Item::HTML')) {
              my @Array = split /pre>/, $ItemData{$Key};
              my $Text = '';
!             for (@Array) {
                  if ($_ =~ /(.*)\<\/$/) {
                      $Text .= 'pre>'.$_.'pre>';
***************
*** 572,580 ****
      }
      # item attachment
!     if (defined($ItemData{Filename})) {
          $Self->{LayoutObject}->Block(
              Name => 'FAQItemViewAttachment',
!             Data => { %Param, %ItemData },
          );
      }
      # item fields
--- 560,577 ----
      }
      # item attachment
!     my @AttachmentIndex = $Self->{FAQObject}->AttachmentIndex(
!         ItemID => $GetParam{ItemID},
!     );
!     if ( @AttachmentIndex ) {
          $Self->{LayoutObject}->Block(
              Name => 'FAQItemViewAttachment',
!             Data => { %ItemData },
          );
+         for my $Attachment ( @AttachmentIndex ) {
+             $Self->{LayoutObject}->Block(
+                 Name => 'FAQItemViewAttachmentRow',
+                 Data => { %ItemData, %{ $Attachment } },
+             );
+         }
      }
      # item fields
***************
*** 606,612 ****
              }
              my %ObjectType = %{$Links{$LinkType}};
!             foreach my $Object (sort keys %ObjectType) {
                  my %Data = %{$ObjectType{$Object}};
!                 foreach my $Item (sort keys %Data) {
                      if ( !$LinkTypeBox{$LinkType} ) {
                          $Self->{LayoutObject}->Block(
--- 603,609 ----
              }
              my %ObjectType = %{$Links{$LinkType}};
!             for my $Object (sort keys %ObjectType) {
                  my %Data = %{$ObjectType{$Object}};
!                 for my $Item (sort keys %Data) {
                      if ( !$LinkTypeBox{$LinkType} ) {
                          $Self->{LayoutObject}->Block(
***************
*** 641,645 ****
  
      # manage parameters
!     foreach (@Params) {
          if (!($GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_))) {
              $Self->{LayoutObject}->FatalError(Message => "Need parameter $_");
--- 638,642 ----
  
      # manage parameters
!     for (@Params) {
          if (!($GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_))) {
              $Self->{LayoutObject}->FatalError(Message => "Need parameter $_");
***************
*** 647,651 ****
      }
      # db action
!     my %ItemData = $Self->{FAQObject}->FAQGet(ItemID => $GetParam{ItemID}, UserID => $Self->{UserID});
      if (!%ItemData) {
          return $Self->{LayoutObject}->ErrorScreen();
--- 644,651 ----
      }
      # db action
!     my %ItemData = $Self->{FAQObject}->FAQGet(
!         ItemID => $GetParam{ItemID},
!         UserID => $Self->{UserID},
!     );
      if (!%ItemData) {
          return $Self->{LayoutObject}->ErrorScreen();
***************
*** 691,699 ****
          UserID => $Self->{UserID},
      );
!     foreach my $LinkType (sort keys %Links) {
          my %ObjectType = %{$Links{$LinkType}};
!         foreach my $Object (sort keys %ObjectType) {
              my %Data = %{$ObjectType{$Object}};
!             foreach my $Item (sort keys %Data) {
                  $Self->{LayoutObject}->Block(
                      Name => "Link$LinkType",
--- 691,699 ----
          UserID => $Self->{UserID},
      );
!     for my $LinkType (sort keys %Links) {
          my %ObjectType = %{$Links{$LinkType}};
!         for my $Object (sort keys %ObjectType) {
              my %Data = %{$ObjectType{$Object}};
!             for my $Item (sort keys %Data) {
                  $Self->{LayoutObject}->Block(
                      Name => "Link$LinkType",
***************
*** 713,717 ****
  
      # manage parameters
!     foreach (@Params) {
          if (!($GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_))) {
              $Self->{LayoutObject}->FatalError(Message => "Need parameter $_");
--- 713,717 ----
  
      # manage parameters
!     for (@Params) {
          if (!($GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_))) {
              $Self->{LayoutObject}->FatalError(Message => "Need parameter $_");
***************
*** 719,728 ****
      }
      # db action
!     my %ItemData = $Self->{FAQObject}->FAQGet(ItemID => $GetParam{ItemID}, UserID => $Self->{UserID});
      if (!%ItemData) {
          return $Self->{LayoutObject}->ErrorScreen();
      }
      # html quoting
!     foreach my $Key (qw (Field1 Field2 Field3 Field4 Field5 Field6)) {
          if ($Self->{ConfigObject}->Get('FAQ::Item::HTML')) {
              $ItemData{$Key} =~ s/\n/\<br\>/g;
--- 719,731 ----
      }
      # db action
!     my %ItemData = $Self->{FAQObject}->FAQGet(
!         ItemID => $GetParam{ItemID},
!         UserID => $Self->{UserID},
!     );
      if (!%ItemData) {
          return $Self->{LayoutObject}->ErrorScreen();
      }
      # html quoting
!     for my $Key (qw (Field1 Field2 Field3 Field4 Field5 Field6)) {
          if ($Self->{ConfigObject}->Get('FAQ::Item::HTML')) {
              $ItemData{$Key} =~ s/\n/\<br\>/g;
***************
*** 764,772 ****
          );
          # links
!         foreach my $LinkType (sort keys %Links) {
              my %ObjectType = %{$Links{$LinkType}};
!             foreach my $Object (sort keys %ObjectType) {
                  my %Data = %{$ObjectType{$Object}};
!                 foreach my $Item (sort keys %Data) {
                      $Self->{LayoutObject}->Block(
                          Name => "Link$LinkType",
--- 767,775 ----
          );
          # links
!         for my $LinkType (sort keys %Links) {
              my %ObjectType = %{$Links{$LinkType}};
!             for my $Object (sort keys %ObjectType) {
                  my %Data = %{$ObjectType{$Object}};
!                 for my $Item (sort keys %Data) {
                      $Self->{LayoutObject}->Block(
                          Name => "Link$LinkType",
***************
*** 787,791 ****
  
      # manage parameters
!     foreach (@Params) {
          if(!exists($Param{$_})) {
              return $Self->{LayoutObject}->FatalError(Message => "Need parameter $_");
--- 790,794 ----
  
      # manage parameters
!     for (@Params) {
          if(!exists($Param{$_})) {
              return $Self->{LayoutObject}->FatalError(Message => "Need parameter $_");
***************
*** 800,804 ****
          }
      }
!     foreach my $Key (sort( { $ItemFields{$a}{Prio} <=> $ItemFields{$b}{Prio} } keys(%ItemFields))) {
          my %StateTypeData = %{$Self->{FAQObject}->StateTypeGet(
              Name => $ItemFields{$Key}{Show}
--- 803,807 ----
          }
      }
!     for my $Key (sort( { $ItemFields{$a}{Prio} <=> $ItemFields{$b}{Prio} } keys(%ItemFields))) {
          my %StateTypeData = %{$Self->{FAQObject}->StateTypeGet(
              Name => $ItemFields{$Key}{Show}
***************
*** 827,831 ****
  
      # manage parameters
!     foreach (@Params) {
          if (!exists($Param{$_})) {
              return $Self->{LayoutObject}->FatalError(Message => "Need parameter $_");
--- 830,834 ----
  
      # manage parameters
!     for (@Params) {
          if (!exists($Param{$_})) {
              return $Self->{LayoutObject}->FatalError(Message => "Need parameter $_");
***************
*** 841,845 ****
      }
      my $String = '';
!     foreach my $Key (sort( { $ItemFields{$a}{Prio} <=> $ItemFields{$b}{Prio} } keys(%ItemFields))) {
          my %StateTypeData = %{$Self->{FAQObject}->StateTypeGet(
              Name => $ItemFields{$Key}{Show}
--- 844,848 ----
      }
      my $String = '';
!     for my $Key (sort( { $ItemFields{$a}{Prio} <=> $ItemFields{$b}{Prio} } keys(%ItemFields))) {
          my %StateTypeData = %{$Self->{FAQObject}->StateTypeGet(
              Name => $ItemFields{$Key}{Show}
***************
*** 859,863 ****
  
      # check needed parameters
!     foreach (qw(ItemData)) {
          if (!$Param{$_}) {
              $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!");
--- 862,866 ----
  
      # check needed parameters
!     for (qw(ItemData)) {
          if (!$Param{$_}) {
              $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!");
***************
*** 896,900 ****
      if ($Self->{Subaction} eq 'Vote' && $Flag) {
          # check needed parameters
!         foreach (qw(ItemData)) {
              if (!$Param{$_}) {
                  $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!")
--- 899,903 ----
      if ($Self->{Subaction} eq 'Vote' && $Flag) {
          # check needed parameters
!         for (qw(ItemData)) {
              if (!$Param{$_}) {
                  $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!")
***************
*** 904,908 ****
          my %GetParam = ();
          my @Params = qw(ItemID Rate);
!         foreach (@Params) {
              $GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_);
          }
--- 907,911 ----
          my %GetParam = ();
          my @Params = qw(ItemID Rate);
!         for (@Params) {
              $GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_);
          }
***************
*** 943,947 ****
  
      # check needed parameters
!     foreach (qw(ItemData)) {
          if (!$Param{$_}) {
              $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!")
--- 946,950 ----
  
      # check needed parameters
!     for (qw(ItemData)) {
          if (!$Param{$_}) {
              $Self->{LayoutObject}->FatalError(Message => "Need parameter $_!")
***************
*** 954,958 ****
  
      my %VotingRates = %{$Self->{ConfigObject}->Get('FAQ::Item::Voting::Rates')};
!     foreach my $key ( sort( { $b <=> $a } keys(%VotingRates ) ) ) {
          my %Data = ("Value"=>$key, "Title"=>$VotingRates{$key} );
          $Self->{LayoutObject}->Block(
--- 957,961 ----
  
      my %VotingRates = %{$Self->{ConfigObject}->Get('FAQ::Item::Voting::Rates')};
!     for my $key ( sort( { $b <=> $a } keys(%VotingRates ) ) ) {
          my %Data = ("Value"=>$key, "Title"=>$VotingRates{$key} );
          $Self->{LayoutObject}->Block(
***************
*** 971,975 ****
  
      # get params
!     foreach (qw(LanguageIDs CategoryIDs)) {
          my @Array = $Self->{ParamObject}->GetArray(Param => $_);
          if (@Array) {
--- 974,978 ----
  
      # get params
!     for (qw(LanguageIDs CategoryIDs)) {
          my @Array = $Self->{ParamObject}->GetArray(Param => $_);
          if (@Array) {
***************
*** 977,981 ****
          }
      }
!     foreach (qw(QuickSearch Number Title What Keyword)) {
          $GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_);
      }
--- 980,984 ----
          }
      }
!     for (qw(QuickSearch Number Title What Keyword)) {
          $GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_);
      }
***************
*** 1052,1056 ****
              Data => { %Param, %Frontend },
          );
!         foreach (@ItemIDs) {
              %Frontend = ();
              my %Data = $Self->{FAQObject}->FAQGet(ItemID => $_);
--- 1055,1059 ----
              Data => { %Param, %Frontend },
          );
!         for (@ItemIDs) {
              %Frontend = ();
              my %Data = $Self->{FAQObject}->FAQGet(ItemID => $_);
***************
*** 1093,1108 ****
      my %Frontend = ();
  
-     # store last queue screen
-     $Self->{SessionObject}->UpdateSessionID(
-         SessionID => $Self->{SessionID},
-         Key => 'LastScreenOverview',
-         Value => $Self->{RequestedURL},
-     );
-     # store last screen
-     $Self->{SessionObject}->UpdateSessionID(
-         SessionID => $Self->{SessionID},
-         Key => 'LastScreenView',
-         Value => $Self->{RequestedURL},
-     );
      $Self->{LayoutObject}->Block(
          Name => 'SystemHistory',
--- 1096,1099 ----
***************
*** 1112,1116 ****
      $Frontend{CssRow} = '';
      my @History = @{$Self->{FAQObject}->HistoryGet()};
!     foreach my $Row (@History) {
          # css configuration
          if($Frontend{CssRow} eq 'searchpassive') {
--- 1103,1107 ----
      $Frontend{CssRow} = '';
      my @History = @{$Self->{FAQObject}->HistoryGet()};
!     for my $Row (@History) {
          # css configuration
          if($Frontend{CssRow} eq 'searchpassive') {

Author: martin

Index: PublicFAQ.pm
===================================================================
RCS file: /home/cvs/FAQ/Kernel/Modules/PublicFAQ.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PublicFAQ.pm	20 Oct 2006 12:06:37 -0000	1.2
--- PublicFAQ.pm	26 Mar 2008 08:42:27 -0000	1.3
***************
*** 1,5 ****
  # --
! # Kernel/Modules/CustomerFAQ.pm - faq module
! # Copyright (C) 2001-2006 OTRS GmbH, http://otrs.org/
  # --
  # $Id$
--- 1,5 ----
  # --
! # Kernel/Modules/PublicFAQ.pm - faq module
! # Copyright (C) 2001-2008 OTRS AG, http://otrs.org/
  # --
  # $Id$
***************
*** 7,11 ****
  # This software comes with ABSOLUTELY NO WARRANTY. For details, see
  # the enclosed file COPYING for license information (GPL). If you
! # did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
  # --
  
--- 7,11 ----
  # This software comes with ABSOLUTELY NO WARRANTY. For details, see
  # the enclosed file COPYING for license information (GPL). If you
! # did not receive this file, see http://www.gnu.org/licenses/gpl-2.0.txt.
  # --
  
***************
*** 17,26 ****
  
  use vars qw($VERSION);
! $VERSION = '$Revision$';
! $VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
  
  our @ISA = qw(Kernel::Modules::FAQ);
  
- # --
  sub new {
      my $Type = shift;
--- 17,24 ----
  
  use vars qw($VERSION);
! $VERSION = qw($Revision$) [1];
  
  our @ISA = qw(Kernel::Modules::FAQ);
  
  sub new {
      my $Type = shift;
***************
*** 41,47 ****
      );
  
!     # check needed Opjects
      # ********************************************************** #
!     foreach (qw()) {
          $Self->{LayoutObject}->FatalError(Message => "Got no $_!") if (!$Self->{$_});
      }
--- 39,45 ----
      );
  
!     # check needed Objects
      # ********************************************************** #
!     for (qw()) {
          $Self->{LayoutObject}->FatalError(Message => "Got no $_!") if (!$Self->{$_});
      }
***************
*** 49,53 ****
      return $Self;
  }
! # --
  sub Run {
      my $Self = shift;
--- 47,51 ----
      return $Self;
  }
! 
  sub Run {
      my $Self = shift;
***************
*** 79,82 ****
--- 77,99 ----
      # ---------------------------------------------------------- #
      if ($Self->{Subaction} eq 'Explorer') {
+         # add rss feed link
+         $Self->{LayoutObject}->Block(
+             Name => 'MetaLink',
+             Data => {
+                 Rel => 'alternate',
+                 Type => 'application/rss+xml',
+                 Title => '$Text{"FAQ News (new created)"}',
+                 Href => '$Env{"Baselink"}Action=$Env{"Action"}&Subaction=rss&Type=Created',
+             },
+         );
+         $Self->{LayoutObject}->Block(
+             Name => 'MetaLink',
+             Data => {
+                 Rel => 'alternate',
+                 Type => 'application/rss+xml',
+                 Title => '$Text{"FAQ News (recently changed)"}',
+                 Href => '$Env{"Baselink"}Action=$Env{"Action"}&Subaction=rss&Type=Changed',
+             },
+         );
          $HeaderTitle = 'Explorer';
          $Header = $Self->{LayoutObject}->CustomerHeader(
***************
*** 107,110 ****
--- 124,187 ----
      }
      # ---------------------------------------------------------- #
+     # rss
+     # ---------------------------------------------------------- #
+     elsif ($Self->{Subaction} eq 'rss') {
+         my $Type   = $Self->{ParamObject}->GetParam(Param => 'Type') || 'Changed';
+         my $States = $Self->{FAQObject}->StateTypeList(
+             Types => ['public']
+         );
+ 
+         my @IDs = $Self->{FAQObject}->FAQSearch(
+             States => $States,
+             Order  => $Type,
+             Sort   => 'ASC',
+             Limit  => 20,
+         );
+ 
+         # generate rss feed
+         use XML::RSS::SimpleGen;
+         rss_new( "http://".$ENV{HTTP_HOST} );
+         my $Title = $Self->{ConfigObject}->Get('Product') . ' FAQ';
+         rss_title( $Title );
+ 
+         for my $ItemID ( @IDs ) {
+             my %Article = $Self->{FAQObject}->FAQGet(
+                 ItemID => $ItemID,
+             );
+             my $Preview = '';
+             for my $Count ( 1..2 ) {
+                 if ( $Article{"Field$Count"} ) {
+                     $Preview .= $Article{"Field$Count"};
+                 }
+             }
+ 
+             # remove html tags
+             $Preview =~ s/\<.+?\>//gs;
+ 
+             # replace "  " with " " space
+             $Preview =~ s/  / /mg;
+ 
+             # reduce size of preview
+             $Preview =~ s/^(.{80}).*$/$1\[\.\.\]/gs;
+ 
+             rss_item(
+                 "http://$ENV{HTTP_HOST}$Self->{LayoutObject}->{Baselink}Action=$Self->{Action}&ItemID=$ItemID",
+                 $Article{Title},
+                 $Preview,
+             );
+         }
+         my $Output = rss_as_string();
+ 
+         if ( !$Output ) {
+             return $Self->{LayoutObject}->FatalError(Message => "Can't create RSS file!");
+         }
+         return $Self->{LayoutObject}->Attachment(
+             Content     => $Output,
+             ContentType => 'text/xml',
+             Type        => 'inline',
+         );
+     }
+ 
+     # ---------------------------------------------------------- #
      # download item
      # ---------------------------------------------------------- #
***************
*** 112,115 ****
--- 189,193 ----
          # get param
          my $ItemID  = $Self->{ParamObject}->GetParam(Param => 'ItemID');
+         my $FileID  = $Self->{ParamObject}->GetParam(Param => 'FileID');
          # db action
          my %ItemData = $Self->{FAQObject}->FAQGet(ItemID => $ItemID);
***************
*** 118,122 ****
          }
          if ($ItemData{StateTypeName} eq 'public') {
!             return $Self->{LayoutObject}->Attachment(%ItemData);
          }
          else {
--- 196,207 ----
          }
          if ($ItemData{StateTypeName} eq 'public') {
!             my %File = $Self->{FAQObject}->AttachmentGet(
!                 ItemID => $ItemID,
!                 FileID => $FileID,
!             );
!             if (!%File) {
!                 return $Self->{LayoutObject}->FatalError(Message => "No File found!");
!             }
!             return $Self->{LayoutObject}->Attachment(%File);
          }
          else {
***************
*** 178,182 ****
      $Output .= $Header || $DefaultHeader;
      if(!$Notify) {
!         foreach my $Notify (@{$Self->{Notify}}) {
              $Output .= $Self->{LayoutObject}->Notify(
                  Priority => $Notify->[0],
--- 263,267 ----
      $Output .= $Header || $DefaultHeader;
      if(!$Notify) {
!         for my $Notify (@{$Self->{Notify}}) {
              $Output .= $Self->{LayoutObject}->Notify(
                  Priority => $Notify->[0],
***************
*** 190,194 ****
      return $Output;
  }
- # --
  
  1;
--- 275,278 ----


More information about the cvs-log mailing list