
#######
Article
#######


****
NAME
****


Kernel::Output::HTML::Layout::Article - Helper functions for article rendering.


****************
PUBLIC INTERFACE
****************


ArticleFields()
===============


Get article fields as returned by specific article backend.


.. code-block:: perl

     my %ArticleFields = $LayoutObject->ArticleFields(
         TicketID  => 123,   # (required)
         ArticleID => 123,   # (required)
     );


Returns article fields hash:


.. code-block:: perl

     %ArticleFields = (
         Sender => {                     # mandatory
             Label => 'Sender',
             Value => 'John Smith',
             Prio  => 100,
         },
         Subject => {                    # mandatory
             Label => 'Subject',
             Value => 'Message',
             Prio  => 200,
         },
         ...
     );



ArticlePreview()
================


Get article content preview as returned by specific article backend.


.. code-block:: perl

     my $ArticlePreview = $LayoutObject->ArticlePreview(
         TicketID   => 123,     # (required)
         ArticleID  => 123,     # (required)
         ResultType => 'plain', # (optional) plain|HTML, default: HTML
         MaxLength  => 50,      # (optional) performs trimming (for plain result only)
     );


Returns article preview in scalar form:


.. code-block:: perl

     $ArticlePreview = 'Hello, world!';



ArticleActions()
================


Get available article actions as returned by specific article backend.


.. code-block:: perl

     my @Actions = $LayoutObject->ArticleActions(
         TicketID  => 123,     # (required)
         ArticleID => 123,     # (required)
     );


Returns article action array:


.. code-block:: perl

      @Actions = (
         {
             ItemType              => 'Dropdown',
             DropdownType          => 'Reply',
             StandardResponsesStrg => $StandardResponsesStrg,
             Name                  => 'Reply',
             Class                 => 'AsPopup PopupType_TicketAction',
             Action                => 'AgentTicketCompose',
             FormID                => 'Reply' . $Article{ArticleID},
             ResponseElementID     => 'ResponseID',
             Type                  => $Param{Type},
         },
         {
             ItemType    => 'Link',
             Description => 'Forward article via mail',
             Name        => 'Forward',
             Class       => 'AsPopup PopupType_TicketAction',
             Link =>
                 "Action=AgentTicketForward;TicketID=$Ticket{TicketID};ArticleID=$Article{ArticleID}"
         },
         ...
      );



ArticleCustomerRecipientsGet()
==============================


Get customer users from an article to use as recipients.


.. code-block:: perl

     my @CustomerUserIDs = $LayoutObject->ArticleCustomerRecipientsGet(
         TicketID  => 123,     # (required)
         ArticleID => 123,     # (required)
     );


Returns array of customer user IDs who should receive a message:


.. code-block:: perl

     @CustomerUserIDs = (
         'customer-1',
         'customer-2',
         ...
     );



ArticleQuote()
==============


get body and attach e. g. inline documents and/or attach all attachments to
upload cache

for forward or split, get body and attach all attachments


.. code-block:: perl

     my $HTMLBody = $LayoutObject->ArticleQuote(
         TicketID           => 123,
         ArticleID          => 123,
         FormID             => $Self->{FormID},
         UploadCacheObject   => $Self->{UploadCacheObject},
         AttachmentsInclude => 1,
     );


or just for including inline documents to upload cache


.. code-block:: perl

     my $HTMLBody = $LayoutObject->ArticleQuote(
         TicketID           => 123,
         ArticleID          => 123,
         FormID             => $Self->{FormID},
         UploadCacheObject  => $Self->{UploadCacheObject},
         AttachmentsInclude => 0,
     );


Both will also work without rich text (if $ConfigObject->Get('Frontend::RichText')
is false), return param will be text/plain instead.




