ePages 6.10 - DE_EPAGES/Presentation/UI/Object.pm

Package DE_EPAGES::Presentation::UI::Object

Common user interface to show, save and delete objects.

Functions

AddListToTray
AddToTray
BlockHistory
BlockMonitor
Button
ClearPermission
Delete
DeleteFile
DeleteFileReference
DeleteListedObjects
DeleteMultipleFiles
DeleteTray
DeleteTrayGroup
ForwardURL
MergeForm
Monitor
NewObject
Save
SaveOnList
SetAttributeOnListedObjects
SetCookiePopUp
SetInheritChildren
SetInvisible
SetInvisibleListedObjects
SetVisible
SetVisibleListedObjects
View
ViewCached
ViewNewObject
_redirectoToNonSSLShopDomain
addFormError
attributeValues
defaultValues
new
object
removeFile
saveFile
saveFileAttributes
savePrivateFile
servlet
testObjectDeleteListedObjects

AddListToTray

Adds objects (listed by form Object.ListedObjects) to the tray (via DE_EPAGES::Presentation::API::Object::Tray::addObjectsToClassGroup).

Syntax
$Handler->AddListToTray( $Servlet );
Input
$Servlet (object)
current servlet (contains form data)

AddToTray

Adds current object to the tray (via DE_EPAGES::Presentation::API::Object::Tray::addObjectsToClassGroup).

Syntax
$Handler->AddToTray( $Servlet );
Input
$Servlet (object)
current servlet (contains form data)

BlockHistory

Blocks the history entry of the view action.

Syntax
$Handler->BlockHistory( $Servlet );
Input
$Servlet (object)
current servlet (contains form data)

BlockMonitor

Blocks appearance of monitor.

Syntax
$Handler->BlockMonitor( $Servlet );
Input
$Servlet (object)
current servlet (contains form data)

Button

This function calls a new UI function by a pressed button of an html-form. Which buttons are allowed, is defined by form value ValidButton. No java-script is needed to select the real ChangeAction.

Syntax
$Handler->Button( $Servlet );
Example
<form href="?ChangeAction=Button">
  <input type="hidden" name="ValidButton" value="Save" />
  <input type="hidden" name="ValidButton" value="Delete" />
  <input type="submit" name="Save" value="Save This" />
  <input type="submit" name="Delete" value="Delete This" />
</form>
Input
$Servlet (object)
current servlet (contains form data)

ClearPermission

set inherit flag and deletes all other permission on all children of object.

Syntax
$Handler->ClearPermission( $Servlet );
Input
$Servlet (object)
servlet

Delete

Deletes the current object ($Servlet->object).
Discards the operation if user enables DeleteConfirmation and not $Servlet->params('ACCEPT'). Sets the $Servlet->vars('DELETE',1) in this case.

Syntax
$Handler->Delete( $Servlet );
Input
$Servlet (object)
servlet
Return
$Parent (object)
parent object of $Servlet->object

DeleteFile

Deletes a file from the public directory of the current object.. The attribute name of the file attribute is passed as form field with the name "File". The attribute value is set to undef.

Syntax
$Handler->DeleteFile( $Servlet );
Input
$Servlet (object)
servlet

DeleteFileReference

deletes file attribute value (not the image)

Input
File
image attribute alias - string

DeleteListedObjects

Deletes the selected objects. The object ids are passed in the form field 'ListObjectID'.

Syntax
$Handler->DeleteListedObjects( $Servlet, $Class);
Input
$Servlet (object)
servlet
$Class (object)
class of listed objects, required on object which are not in based on class Object (optional)

DeleteMultipleFiles

Behaves like DeleteFile, but deletes a list of files via a given List of attribute names

Syntax
$Handler->DeleteMultipleFiles( $Servlet );
Input
$Servlet (object)
servlet

DeleteTray

Removes tray of current session.

Syntax
$Handler->DeleteTray( $Servlet );
Input
$Servlet (object)
current servlet (contains form data)

DeleteTrayGroup

Removes tray group (indentified via form value 'TrayGroupID') of current session.

Syntax
$Handler->DeleteTrayGroup( $Servlet );
Input
$Servlet (object)
current servlet (contains form data)

ForwardURL

Send 302 to client with given url. Does nothing without $URL.

Syntax
$Handler->ForwardURL( $Servlet, $URL );
Input
$Servlet (object)
current servlet (contains form data)
$URL (string)
location

MergeForm

Merges the serialized values of form field "SerializedForm" to the current Form and Servlet vars. This is very useful for wizards with unknown form element names. Last submitted values and default values like ObjectID, ViewAction, etc. are not overwritten or added. You have to submit the last (serialized) form via #INPUT.SerializedForm on each page using this action.

Syntax
$Handler->MergeForm( $Servlet );
Input
$Servlet (object)
servlet

Monitor

Reads the response of an previous appeared (form value GUID) monitor.

Syntax
$Handler->Monitor( $Servlet );
Input
$Servlet (object)
current servlet (contains form data)

NewObject

Creates a new object and sets the attribute values.

Syntax
$NewObject = $Handler->NewObject( $Servlet );
$NewObject = $Handler->NewObject( $Servlet, $Parent );
$NewObject = $Handler->NewObject( $Servlet, $Parent, $Class );
$NewObject = $Handler->NewObject( $Servlet, $Parent, $Class, $hAttributes );
Input
$Servlet (object)
servlet
$Parent (object)
(optional) parent object
$Class (object)
(optional) class of the new object
$hAttributes (ref.hash)
(optional) attribute values to override form values
Return
$NewObject (object)
the created object

Save

Saves the attributes of the current object ($Servlet->object).

Syntax
$Handler->Save( $Servlet );
Input
$Servlet (object)
servlet

SaveOnList

Changes the attribute given with the $Name parameter to the value given in the $Value parameter for all objects in the ListedObjects form contained in the $Servlet object.

Syntax
$Handler->SaveOnList( $Servlet, $Name, Value );
Example
$self->SaveOnList($Servlet, "IsVisible", 1);
Input
$Servlet (object)
servlet containing the ListedObject form
$Name (string)
name of the attribute
$Value (depends on $Name)
value to wchich the attribute will be set

SetAttributeOnListedObjects

sets the selected objects with given attribute value. The object ids are passed in the form field 'ListObjectID'.

Syntax
$Handler->SetAttributeOnListedObjects( $Servlet, $AttributeName, $Value, $Permission);
Input
$Servlet (object)
servlet
$AttributeName (string)
name of attribute
$Value (*)
new value for each object
$Permission (string)
name of action to test each listed object (default: 'Save')

SetCookiePopUp

This function sets the session cookie PopUp.

Syntax
$Handler->SetCookiePopUp( $Servlet );
Input
$Servlet (object)
current servlet (contains form data)

SetInheritChildren

set inherit flag on selected objects.

Syntax
$Handler->SetInheritChildren( $Servlet );
Input
$Servlet (object)
servlet

SetInvisible

sets the object invisible.

Syntax
$Handler->SetInvisible( $Servlet );
Input
$Servlet (object)
servlet

SetInvisibleListedObjects

sets the selected objects invisible. The object ids are passed in the form field 'ListObjectID'.

Syntax
$Handler->SetInvisibleListedObjects( $Servlet );
Input
$Servlet (object)
servlet

SetVisible

sets the object visible.

Syntax
$Handler->SetVisible( $Servlet );
Input
$Servlet (object)
servlet

SetVisibleListedObjects

sets the selected objects visible. The object ids are passed in the form field 'ListObjectID'.

Syntax
$Handler->SetVisibleListedObjects( $Servlet );
Input
$Servlet (object)
servlet

View

UI Action to view a object without any work.

Syntax
$Handler->View();

ViewCached

UI Action to view a object, this function tries to save the processed content at file system.

Syntax
$Handler->ViewCached( $Servlet );
Input
$Servlet (object)
servlet

ViewNewObject

Returns the default attribute values for a new object.

Syntax
$Handler->ViewNewObject( $Servlet );
Input
$Servlet (object)
servlet
Return
$hDefaults (ref.hash)
default values

_redirectoToNonSSLShopDomain

Rewrites the response header to do a 301 redirect to the real shop domain without SSL.

Syntax
_redirectoToNonSSLShopDomain($Servlet);
Input
$Servlet (object)
servlet

addFormError

add a form error to current form api.

Syntax
$UI->addFormError($Error);
$UI->addFormError($aError);
Example
$UI->addFormError(); # same as next line
$UI->addFormError(GetError()) if ExistsError();
$UI->addFormError(['DirectoryNotFound', {'Directory' => $TargetDirectory }]);
Input
$Error (object)
error object
$aError (ref.array)
code and vars

attributeValues

Checks the form values against the type and range specification of the given class and the formatters of the given object.
Note: Call $Servlet->form->executeFormError() to abort processing in case of input errors.
You can override this function to perform additional tests. To call the default implementation, use $self->SUPER::attributeValues(@_).

Syntax
$hhValues = $Handler->attributeValues( $Servlet, $Object, $Class, $Prefix );
Example
$hhValues = $Handler->attributeValues( $Servlet, $Object, $Class, 'Address.' );
$Form->executeFormError;
Input
$Object (object)
object that specifies the context for formatters
$Class (object)
class that specifies type and range of the attributes
$Object (object)
object that specifies the context for formatters. For existing
objects this is the object that is to be saved; for new
objects this may be a direct or indirect parent object.
$Prefix (string)
prefix for input field names (default '')
Return
$hhValues (ref.hash.hash)
checked attribute values
  • Values - non-localized attribute values execpt files
    { $AttributeName => $Value }
  • Files - non-localized attribute values of type File
    { $AttributeName => $FileName }
    if the file name is undef, then the file is about to be deleted
  • LocalizedValues - localized attribute values execpt files
    { $LanguageID => { $AttributeName => {'Value'=>$Value, 'Index'=>$Index } }
  • LocalizedFiles - localized attribute values of type File
    { $LanguageID => { $AttributeName => $FileName } }
    if the file name is undef, then the file is about to be deleted

defaultValues

Returns the default attribute values for new objects of a specified class as TLE hash.

Syntax
$hValues = $Handler->defaultValues($Parent, $Class);
Input
$Parent (object)
parent object
$Class (object)
class
Return
$hValues (ref.hash.hash)
default attribute values

new

create new instance of UI. This method will be called by servlet, there is no need to call it again.

Syntax
my $Handler = DE_EPAGES::Presentation::UI::Object->new(Servlet => $Servlet);

object

Returns the object on which the current action operates.

Syntax
$Object = $UI->object;
Return
$Object (object)
object of the current request

removeFile

Deletes a file from the server.

Syntax
$Handler->removeFile( $Servlet, $Object, $Name );
$Handler->removeFile( $Servlet, $Object, $Name, $LanguageID );
Input
$Object (object)
the object, to which the image belongs (as attribute)
$Servlet (object)
current servlet (contains form data)
$Name (string)
attribute name
$LanguageID (integer)
(optional) language id

saveFile

Saves an uploaded file on the server. Returns the file name relative to object directory $Object->get('PublicPath').

Syntax
$FileName = $Handler->saveFile( $Servlet, $Object, $Name );
$FileName = $Handler->saveFile( $Servlet, $Object, $Name, $Index );
Input
$Servlet (object)
current servlet (contains form data)
$Object (object)
the object, to which the image belongs (as attribute)
$Name (string)
form field name
$Index (integer)
(optional) form field index if the form contains multiple
fields with the same name
Return
$FileName (string)
relative file name

saveFileAttributes

Saves attribute value of type File and LocalizedFile. Saves the files to the directory $Object->get('PublicPath').

Syntax
$Handler->saveFileAttributes( $Servlet, $Object, $hhValues );
Input
$Servlet (object)
servlet
$Object (object)
object
$hhValues (ref.hash.hash)
checked attribute vlaues, result of
attributeValues

savePrivateFile

Saves an uploaded file on the server. Returns the file name relative to object directory $Object->get('PrivatePath').

Syntax
$FileName = $Handler->savePrivateFile( $Servlet, $Object, $Name );
$FileName = $Handler->savePrivateFile( $Servlet, $Object, $Name, $Index );
Input
$Servlet (object)
current servlet (contains form data)
$Object (object)
the object, to which the image belongs (as attribute)
$Name (string)
form field name
$Index (integer)
(optional) form field index if the form contains multiple
fields with the same name
Return
$FileName (string)
relative file name

servlet

Returns the servlet, which calls the current action.

Syntax
$Servlet = $UI->servlet;
Return
$Servlet (object)
current servlet

testObjectDeleteListedObjects

Returns the object to test the Delete permission (this function returns the Object).

Syntax
$PermissionObject = $Handler->testObjectDeleteListedObjects( $Object );
Input
$Object (object)
object to delete
Return
$PermissionObject (object)
same object