Maxscape::Page Package

Synopsis

use Maxscape::Page;

Description

The Maxscape::Page package provides the functionality to deal with the Node Tree stored in the Content Database. The run time system creates a $Page object by default. Because all content is generated within the scope of this class, the $Page object can be used within applications to access and manipulate the content generation.

Examples

# Runtime system:
  ...
  my $Page = Maxscape::Page->new (Context => $Context, Cursor => $DB);
  ...
# Example application code:
  ...
  if ($Page->CGI->Query ('Category')) {
    return $Page->ElementContent (Name => 'Form.button', Type => 'parsed');
  }
  ...
# Runtime system:
  ...
  my $Content = $Page->Document; 
  ...

List of Member Functions

  1. AttributeParameter
  2. canBeEditedBy
  3. Category
  4. CategoryName
  5. CGI
  6. changeElementContentWidget
  7. checkUploadFileName
  8. clipString
  9. completeContentTypeString
  10. ContactWidget
  11. ContentType
  12. Context
  13. createPage
  14. CreationTime
  15. CreationTimeAsString
  16. decodeCategoryName
  17. decodeText
  18. defaultElementCallback
  19. defineDataVariables
  20. displayNodeElement
  21. displayNodeElements
  22. DisplayPageByFormSelectGroup
  23. displayPageTree
  24. displayPath
  25. displayPathElement
  26. Document
  27. editElementContentByPageNumberElementName
  28. editPageElementsInlineMenu
  29. editPageElementsInlineMenuLink
  30. ElementAttribute
  31. ElementAttributes
  32. ElementContent
  33. ElementName
  34. ElementPageNumber
  35. ElementTableName
  36. encodeCategoryName
  37. escapeXML
  38. evalText
  39. evaluateTemplate
  40. executeCallback
  41. executeElementCallbacks
  42. executeFunction
  43. executeObject
  44. Exists
  45. FileAnchor
  46. finalFilter
  47. finalFilterSet
  48. generateCGI_TemplatePage
  49. generateDatabaseTemplatePage
  50. getElements
  51. HelpLinkTopMenu
  52. HierarchyPathElementQuery
  53. href
  54. HTML_encode
  55. HTML_Table
  56. HTTP_HeaderCallback
  57. HyperLink
  58. IndexOfElement
  59. initPageMenu
  60. initTemplatePage
  61. insertElement
  62. interpreteText
  63. Language
  64. LanguageQuery
  65. LanguageSelectWidget
  66. lastModificationTime
  67. lastModificationTimeAsString
  68. Link
  69. LoginRegisterWidget
  70. lookupPageElements
  71. lookupTemplate
  72. makeObject
  73. Maxscript
  74. Me
  75. MemberHomeDirectory
  76. MemberHomePath
  77. MemberMayNotEditPage
  78. MemberName
  79. MessageToUser
  80. MetaData
  81. MetaDataAttribute
  82. mxsAnchor
  83. mxsImage
  84. mxsLink
  85. mxsVideoButton
  86. mxsVideoTag
  87. new
  88. newForm
  89. NodeCounterName
  90. NodeNumberToNodePath
  91. NodePathToNumber
  92. NodeToTableName
  93. NodeType
  94. NumberOfElements
  95. openBrowserWindow
  96. Page
  97. PageGroup
  98. PageGroupIsIn
  99. PageName
  100. PageNumber
  101. PageOwner
  102. PagePath
  103. PagePathToPageNumber
  104. PageTildePath
  105. PageTree
  106. PageTreeDocumentRoot
  107. PageType
  108. PageUserGroups
  109. PageUserGroupsAsString
  110. PageValuesByPageNumber
  111. PageValuesByPagePath
  112. PageViewerIsOwner
  113. ParentCategory
  114. ParentCategoryPath
  115. parsedDatabaseFile
  116. parseEmbperl
  117. parseText
  118. PathDepth
  119. plainPagePath
  120. popParentCategory
  121. pushCGI_QueryParameter
  122. reportBugLink
  123. resizeImage
  124. search
  125. searchCategories
  126. SearchStringToRegexp
  127. selectElements
  128. setCursor
  129. setLanguage
  130. setTextEncoding
  131. showInterestGroups
  132. simpleSearch
  133. splitPath
  134. storeFormVariables
  135. TemplateAttribute
  136. TemplateContent
  137. TemplateContentWidget
  138. TemplateMainNumber
  139. TemplateName
  140. TemplateType
  141. traversePageOutputFunction
  142. URL_decode
  143. URL_encode
  144. User

Member Functions

new

Synopsis

my $Page = Maxscape::Page->new (Context  => $Context,
                                Response => $Response,
                                Request  => $Request,
                                CGI      => $CGI,
                                User     => $User,
                                Cursor   => $DB,
                                # ...
);

Description

Creates a new $Page object. It takes several objects, e.g. the $Context, $Response, $Request, $CGI and $User objects as parameters. Because these objects are defined by the run time system, mostly there is no need to create them within applications.
For programming convenience the references to the $CGI and the $User objects of the $Context object are copied to the $self pointer of the $Page object. So, you may say: $Page->CGI instead of $Page->Context->CGI, for example.

Document

Synopsis

my $DocumentContent = $Page->Document(); 

Description

The Document method generates the content of a page. Because applications are executed within its scope, the $Page object is inherited and can be used to access the $Page variables and methods within application objects.
At first, an application defined initial document callback function can be inserted into the generation loop. This is configured via the $::WebServer->{"Page.initialPageGenerationCallback"} variable. The callback can be used to initialy set up the document generation process or to implement application defined generation types (PageType). If the return code of the function is set, the returned text is send to the client and no further content is generated by the server runtime system.
The Document method distinguishes the generation types (PageType) implemented by the server. For each type an own page generation function is called, to implement the special processing sequence. At several stages further callbacks can be pluged into generation process.

Context

Synopsis

my $Context = $Page->Context;

Description

Returns the pages $Context object. It is a convenience function to access a pages context object $Page->{Context} via a function call.

Examples




User

Synopsis

my $User = $Page->User;

Description

Returns the pages $User object. It is a convenience function to access a pages user object $Page->{User} via a function call.

Examples

my $QueryString = $Page->User->UserId eq 'Public' ? '' : '&View=closeFrames';

CGI

Synopsis

my $CGI = $Page->CGI;

Description

Returns the pages $CGI object. It is a convenience function to access a pages CGI object $Page->{CGI} via a function call.

Examples

my $Lang = $Page->CGI->{Language};

executeCallback

Synopsis

my ($Text, $ReturnState) = $Page->executeCallback ($Object, $Function,
                                                   @Parameter);

Description

If the functions first parameter is not defined ('undef'), it takes a name of a global function and executes that function. The @Parameter parameter is passed then to this function. If this parameter is not given, the actual $Page object is passed to the called callback function, as the first parameter.

Examples

my ($CallbackText, $ReturnState) = $Page->executeCallback(undef, $FunctionName);
if ($ReturnState) {
  return $CallbackText;
} else {
  $Text = $CallbackText;
}

initTemplatePage

Synopsis

my $TemplateGenerationFunction = $Page->initTemplatePage ($PageType, $TemplateType);

Description

Initializes a template page.

generateCGI_TemplatePage

Synopsis

$Text = $Page->generateCGI_TemplatePage ($TemplateType, $TemplateGenFunction );

Description

The generateCGI_TemplatePage method implements the servers default CGI-Template generation type. The function uses the following strategie:

1. Lookup the page elements and execute a callback for each element
2. Call a page generation function to actualy generate the content
The classes PageStandardSkeleton member function is called by default, if no template generation callback function ($TemplateGenerationFunction) was passed to the function call. Within the runtime system, the callback may be configured via the global $::WebServer object configuration.

generateDatabaseTemplatePage

Synopsis

my $Text = $Page->generateDatabaseTemplatePage ($TemplateType,
                                                $TemplateGenerationFunction);

Description

The generateDatabaseTemplatePage method implements the servers default DB-Template generation type. The function uses the following strategie:

1. Lookup elements
Lookup the page elements and execute a callback for each element.

2. Lookup templates
Call a page generation function to actualy generate the content lookup the page templates and execute a callback for each template element.

3. Execute the template generation callback
Call a page generation function to actualy generate the content

The plainTemplate and the ElementTemplate template types are provided by default. To implement other template types a template generation callback function ($TemplateGenerationFunction) may passed to the function call. Within the runtime system, this has to be configured via the '$::WebServer' object's configuration.

parsedDatabaseFile

Synopsis

my $Text = $Page->parsedDatabaseFile ();

Description

The parsedDatabaseFile method implements the servers default parsedDatabaseFile generation type. A parsedDatabaseFile is a piece of text that is parsed and evaluated by the Perl interpreter.

HierarchyPathElementQuery

Synopsis

my $HierarchyPathToElementQuery = $Page->HierarchyPathElementQuery (
                                    $Context->{PageHierarchy});

Description

Constructs a page hierarchy query.

LanguageQuery

Synopsis

my ($LanguageColumn, $LanguageQuery) = $Page->LanguageQuery($TableName); 

Description

Queries the Content Database for the language.

lookupPageElements

Synopsis

$Text = $Page->lookupPageElements();

Description

This subroutine fetches the page elements from the ELEMENTS database table. After each record fetch, element callback functions may be called. Callbacks are configured in the $::WebServer configuration and pluged in via the application plugin.
The callbacks are executed in the following order: default, server, process, template.

executeElementCallbacks

Synopsis

$ElementText = $Page->executeElementCallbacks;

Description

Executes the defined element callbacks for each element.

defaultElementCallback

Synopsis

my $ElementText = $Page->defaultElementCallback($Element);

Description

The classes default element callback function. The function is executed by the run time system, if the global $::WebServer objects 'Element.Callback.default' entry is set.

lookupTemplate

Synopsis

$Text = $Page->lookupTemplate();

Description

The runtime system default function to fetch the template elements from the content database.

evaluateTemplate

Synopsis

$Text = $Page->evaluateTemplate();

Description

The runtime system default function to generate a template page.

setCursor

Synopsis

$Page->setCursor ($Cursor);

Description

Sets the current pages cursor ($Page->{Cursor}) to the taken cursor.

newForm

Synopsis

my $Form = $Page->newForm ();

Description

Creates a new Form object.

pushCGI_QueryParameter

Synopsis

$Page->pushCGI_QueryParameter ();

Description

Pushes a CGI variable onto the %CGI_QueryParameter stack, to be used in the mxsLink method.

Link

Synopsis

my $HyperLink = $Page->Link ( %P );

Description

Creates an HTML hyperlink.

Examples

my $Link = $Page->Link ( HREF        => '',
                         Text        => '',
                         Target      => '',
                         Title       => '',
                         Query       => [
                           Query1            => '',
                           ...               => '',
                           QueryN            => '',
                         ],
                         Attributes  => [ 
                           Attribute1        => '',
                           ...               => '',
                           AttributeN        => '',     
                         ]);
);

mxsLink

Synopsis

my $maxscapeLink = $Page->mxsLink ( %P );

Description

Creates a Maxscape HTML hyperlink.

Examples

my $maxscapeLink = $Page->mxsLink (
                            Sheme       => '',
                            Port        => '',
                            Process     => '',
                            Category    => '',
                            Page        => '',
                            Text        => '',
                            Target      => '',
                            QueryString => '',
                            Style       => '',
                            CSS_Class   => '',
                            CSS_ID      => '',
                            Title       => '',
                            Query       => [
                              Query1        => 'show',
                              ...           => $PropertyClass,
                              QueryN        => $PropertyParentPath,
                            ],
                            Attributes  => [ 
                              Attribute1    => '',
                              ...           => '',
                              AttributeN    => '',     
                            ]
);
# embedded link
@{[
  $Page->mxsLink (Category => '', Page => '',
    Text        => '',
    StatusLine  => '',
  )
]}

mxsVideoTag

Synopsis

my $maxscapeVideoTag = $Page->mxsVideoTag ( %P );

Description

Creates a Maxscape HTML hyperlink.

Examples

my $maxscapeLink = $Page->mxsVideoTag (
                            Sheme       => '',
                            Port        => '',
                            Process     => '',
                            Category    => '',
                            Page        => '',
                            Text        => '',
                            Target      => '',
                            QueryString => '',
                            Style       => '',
                            CSS_Class   => '',
                            CSS_ID      => '',
                            Title       => '',
                            Query       => [
                              Query1        => 'show',
                              ...           => $PropertyClass,
                              QueryN        => $PropertyParentPath,
                            ],
                            Attributes  => [ 
                              Attribute1    => '',
                              ...           => '',
                              AttributeN    => '',     
                            ]
);
# embedded link
@{[
  $Page->mxsVideoTag (Category => '', Page => '',
    Text        => '',
    StatusLine  => '',
  )
]}

mxsVideoButton

Synopsis

my $maxscapeVideoTag = $Page->mxsVideoButton ( %P );

Description

Creates a Maxscape HTML hyperlink.

Examples

my $maxscapeLink = $Page->mxsVideoButton (
                            Text        => '',
                            Style       => '',
                            CSS_Class   => '',
                            CSS_ID      => '',
                            Title       => '',
);
# Embedded link:
@{[
  $Page->mxsVideoButton (
    Text        => 'Play/Pause Registration Video',
    StatusLine  => 'Play/Pause Registration Video',
  )
]}

HelpLinkTopMenu

Synopsis

my $HelpLinkTopMenu = $Page->HelpLinkTopMenu ( %P )

Description

Opens a help page in a browser tab or window.

Examples

$HelpLinkTopMenu = $Page->HelpLinkTopMenu (
    Name         => '',
    Process      => '',
    Category     => '',
    Page         => '',
    StatusLine   => '',
    Text         => '',
    Style        => '',
    StatusLine   => '',
    WindowParameter => "resizable=yes,scrollbars=yes,toolbar=no"
            . ",menubar=no,width=600,height=450,top=140,left=200",
  )

openBrowserWindow

Synopsis

my $openBrowserWindowLink = $Page->openBrowserWindow ( %P )

Description

Opens a browser window.

Examples

$openBrowserWindowLink = $Page->openBrowserWindow (
    Name         => '',
    Process      => '',
    Category     => '',
    Page         => '',
    StatusLine   => '',
    Text         => '',
    Style        => '',
    StatusLine   => '',
    WindowParameter => "resizable=yes,scrollbars=yes,toolbar=no"
            . ",menubar=no,width=600,height=450,top=140,left=200",
  )
# embedded link
@{[
  $Page->openBrowserWindow (
    Name         => 'Music',
    Category     => '',
    Page         => '',
    StatusLine   => '',
    Text         => 'Music',
    Style        => '',
    StatusLine   => '',
    WindowParameter => "resizable=yes,scrollbars=yes,toolbar=no,menubar=no,"
      . "width=600,height=$Page->{Layout}{WindowHeight},top=$Page->{Layout}{WindowTop},left=200",
  )
]}

mxsImage

Synopsis

my $ImageLink = $Page->mxsImage ( %P );

Description

Maxscape style image.

Examples

my $ImageLink = $Page->mxsImage (
  Process      => '',
  src          => '/Images/Help.gif',
  width        => 20,
  height       => 20,
  alt          => 'Help',
  title        => $self->ElementContent(Name => 'Help'),
  border       => 0,
  #align="Ausrichtung" hspace="10" vspace="10">
);

resizeImage

Synopsis

$Page->resizeImage ( maxSize => 250, UserId => $UserId, Type => $ProfileType );

Description

Resizes an image using the GD library.

checkUploadFileName

Synopsis

my $ErrorMessage = $Page->checkUploadFileName ( FileName => $FileName );

Description

Checks the file name of an uploaded file.

Examples

my %MimeTypes = ('png'  => 'image/png',
                 'gif'  => 'image/gif',
                 'jpeg' => 'image/jpeg',
                 'jpg'  => 'image/jpeg',
                 'bmp'  => 'image/bmp',
                );
$Error = $Page->checkUploadFileName(FileName => $PictureName, MimeTypes => \%MimeTypes, );
if ($Error)
{
  return $ErrorMessage;
}

mxsAnchor

Synopsis

my $AnchorText = $Page->mxsAnchor ( %P );

Description

Creates an HTML link.

Examples

 $AnchorText = $Page->mxsAnchor (
  Process      => $p{Process},
  Sheme        => $p{Sheme},
  Port         => $p{Port},
  Page         => $p{Page},
  Category     => $p{Category},
  Target       => $p{Target},
  Text         => $p{Text},
  QueryString  => $p{QueryString},
);

HyperLink

Synopsis

$HyperLink = $Page->HyperLink ( %P );

Description

Creates an HTML hyperlink.

Examples

@{[ $Page->HyperLink(
      Process      => $Process,
      Method       => $Method,
      Page         => $Page,
      Category     => $Category,
      QueryString  => $QueryString,
      Text         => $Text
    )
]}

href

Synopsis

$HyperLink = $Page->href ();

Description

Creates an HTML hyperlink by href.

Examples

@{[ $Page->href (qq(http://ApplicationServer.com/@@{[ $Page->User->UserId ]}), 'Tab',) ]}

FileAnchor

Synopsis

my $AnchorText = $Page->Anchor ( %P );

Description

Returns an anchor to a file.

Examples

$AnchorText = $Page->Anchor (
  Sheme        => $p{Sheme},
  Port         => $p{Port},
  Path         => $p{Path},
  Text         => $p{Text},
);

NodeCounterName

Synopsis

my $NodeCounterName = $Page->NodeCounterName ($NodeType);

Description

Returns the node counter name for this node type (PageCounter, CategoryCounter, TemplateCounter).

PageValuesByPageNumber

Synopsis

$PageData = $Page->PageValuesByPageNumber ($PageNumber, $QueryColumns, $Cursor);

Description

Asks the database for the page values of a page.

Examples

$PageData = $Page->PageValuesByPageNumber ($PageNumber, $QueryColumns);

my $Category = ${PageData}{NODE_CATEGORY};
my $Page     = ${PageData}{NODE_NAME};

NodePathToNumber

Synopsis

my $PageNumber = $Page->NodePathToNumber ($PageCategory, $PageName, $NodeType);

Description

Asks the database for the $PageNumber of a node. If the $NodeType is ommitted 'Document' is assumed.

Exists

Synopsis

my $PageNumber = $Page->Exists ($PageCategory, $PageName, $NodeType);

Description

Asks the database for the $PageNumber of a page. If the $NodeType is ommitted 'Document' is assumed.

PagePathToPageNumber

Synopsis

my ($PageNumber, $NodeType, $PageGeneration) =
      $Page->PagePathToPageNumber ($PageCategory, $PageName, $NodeType);

Description

Asks the database for the '$PageNumber, $NodeType, $PageGeneration' of a page.

NodeNumberToNodePath

Synopsis

my ($NodeCategory, $NodeName) = $Page->NodeNumberToNodePath ($PageNumber);

Description

Returns the .

PageValuesByPagePath

Synopsis

@P = $Page->PageValuesByPagePath ($PageCategory, $PageName);

Description

Asks the database for the '$PageNumber, $NodeType, $PageGeneration' of a page.

Examples

($PageNumber, $NodeType, $PageGeneration, $PageOwner, $PageGroup, $TemplateType,
 $TemplateName, $TemplateNumber, $CreationDate,
  $ModificationDate) =  $Page->PageValuesByPagePath ($PageCategory, $PageName);

executeFunction

Synopsis

$Text = $Page->executeFunction ($Function, $Object);

Description

Executes a function passing the '$Object' object to it.

executeObject

Synopsis

$Text = $Page->executeObject ( $ClassName, $MemberFunction, $Parameter );

Description

Executes a member function of an object, passing the '$Parameter' object to it. By default the '$Page' object is passed as the parameter.

makeObject

Synopsis

$Object = $Page->makeObject (%P);

Description

Makes an object, passing the '%P' parameter to the 'new' function of the object.

Examples

$Object = $Page->makeObject (ClassName => 'myObject',);

SearchStringToRegexp

Synopsis

my $Regexp = $Page->SearchStringToRegexp ($QueryString);

Description

Returns a regexp of $QueryString for case-insensetive database search. The percent character '%' is used as a wildcard.

simpleSearch

Synopsis

$Text = $Page->simpleSearch( %P );

Description

The default function to search the content database.

Examples

 
$Text .= $Page->simpleSearch('Cursor' => $self-{Cursor},
             'QueryString'       => $QueryString,
             'Type'              => $searchType, # all, Content, Attribute
             'Category'          => $searchCategory,
             'Page'              => $searchPage,
             'Mode'              => 'Page',      #
             ElementNameQuery    => 'Text%',
             'Function'          => '::_printRow',
             DontQueryHashedOutElements => 1,    # 0, 1
             #'orderDirection'    => 'DESC',
             'NoResultFoundText' => 'Nothing found.'
             );

$Text .= $Page->simpleSearch('Cursor' => $self-{Cursor},
      QueryString        => $QueryString,
      #Type              => $searchType, # all, Content, Attribute
      Category           => $Page->CGI}->Query('Search.Category'), #$searchCategory,
      searchCategories   => $Page->Search.Categories'},
      Mode               => 'allTablesInSequenceTemplates', # 'allTables' 'Page', 'allTablesInSequence'
      ElementNameQuery   => 'Text%',
      Page               => $Page->CGI}->Query('Search.Page'), #$searchPage,
#      otherColumns       => 'NODE_DESCRIPTION, NODE_TITLE',
      otherColumns       => 'NODE_TITLE',
      Function           => $Function,
      orderDirection     => 'DESC',
      sinceTime          => $sinceTime,
      DontQueryHashedOutElements => 1,  # 0, 1
      'Query.Privilege'  => 1,
      StringToShort      => $Form->start_tr . $Form->start_td
                         .  'String to short!'
                         .  $Form->end_td . $Form->end_tr,
      NoResultFoundText  => $Form->start_tr . $Form->start_td
                          . ' No match found...'
                          . $Form->end_td . $Form->end_tr,
    );

search

Synopsis

$Text .= $Page->search( %P );

Description

Examples

$Text .= $Page->search('DBConnection' => $::DB,
                       'QueryString' => $QueryString, 'Action' => $Action,
                       'type' => $CGI->{'search.type'}, # Pages, all, Content, Attribute
                       'Category' => $searchCategory,
                       'Page' => $searchPage,
                       'Function' => '::_printRow',
                       'NoResultFoundText' => &::_printRowLine("Nicht's gefunden."));

searchCategories

Synopsis

my $Text = $Page->searchCategories (QueryString => 'PageName',
                                    Function    => 'FunctionName',);

Description

Searches the content database categories for the query string.

Page

Synopsis

my $Page = $Page->Page(); 

Description

Pages are categorized within the 'application servers' page tree. They could be accessed via their page name and category.

PageName

Synopsis

my $Page = $Page->Name(); # synonym
my $Page = $Page->PageName(); 

Description

Pages are categorized within the 'application servers' page tree. They could be accessed via their page name and category.

Category

Synopsis

my $Category = $Page->Category(); 

Description

Pages are categorized within the 'application servers' page tree. They could be accessed via their page name and category.

CategoryName

Synopsis

my $Category = $Page->CategoryName(); 

Description

Pages are categorized within the 'application servers' page tree. They could be accessed via their page name and category.

PagePath

Synopsis

my $PagePath = $Page->PagePath();

Description

Returns the page path (e.g. Category=MyCategory&Page=MyPage).

PageTildePath

Synopsis

my $MemberHomePagePath = $Page->PageTildePath();

Description

Converts a users profile path (e.g. ~Max) into the real page path.

plainPagePath

Synopsis

my $Path = $Page->plainPagePath(); 
my $Path = $Page->plainPagePath($CategoryName, $PageName); 

Description

Pages are categorized within the 'application servers' page tree. They could be accessed via their page name and category.

Me

Synopsis

my $MyPageAndCategory = $Page->Me(); 

Description

PageNumber

Synopsis

my $PageNumber = $Context->PageNumber();

Description

Returns the number of the page.

NodeType

Synopsis

my $NodeType = $self->NodeType(); 

Description

The node type of a page is given by the member function NodeType.

PageType

Synopsis

my $PageType = $Page->PageType(); 

Description

How a page actualy is generated, depends on the 'Generation Type' of the page (see the UserGuide also).

MetaData

Synopsis

my $MetaData = $Page->MetaData(); 

Description

Meta date are given by the member function MetaData.

MetaDataAttribute

Synopsis

my $MetaDataAttribute = $Page->MetaDataAttribute ($AttributeName, $MetaData); 

Description

Returns a META_DATA attribute.

ContentType

Synopsis

my $ContentType = $Page->ContentType(); 

Description

The content type of a page is given by the member function ContentType.

completeContentTypeString

Synopsis

my $ContentTypeString = $Page->completeContentTypeString('text/html'); 

# $ContentTypeString yields "Content-Type: text/html\n\n"

my $HTML_Text = $ContentTypeString . "Hallo world.";
...

Description

Completes the 'Content-Type' line to be send to a client to the nesseccary form. Within the servers runtime system, defaults are taken from the '$::WebServer' object.

TemplateType

Synopsis

my $TemplateType = $Page->TemplateType(); 

Within database templates use:

@{[ $Page->TemplateType() ]}

Description

A page may be generated via a template stored in the database or an application function. The type of template is provided by the above function call.
The type of a template defines a class of templates, using a set of related templates, elements and methods to generate a page, whereas the HTML layout my differ. This can be used to change the 'look and feel' of a site with a few mouse clicks, - if the system is well designed.
Currently the following types are predefined:

ElementTemplate
The defines some standart elements and adds additional HTML code.

plainTemplate
No elements are predefined. The page is constructed only from the templates and elements.

The 'Template Types' may be used, to define classes of templates working on a similar set of elements and application functions, but having a different design and layout. Thus, if the site's template structure is well defined, you can change the 'look and feel' with a few mouse click's.

TemplateName

Synopsis

my $TemplateName = $Page->TemplateName(); 

Description

Name of the template.

TemplateMainNumber

Synopsis

my $TemplateNumber = $Page->TemplateMainNumber(); 

Description

Returns the number of the main template.

PageOwner

Synopsis

my $PageOwner = $Page->PageOwner();

Description

Return the owner of a page from the Context object.

PageGroup

Synopsis

my $PageGroup = $Page->PageGroup();

Description

Each page page has an owner and belongs to a group. The owner of a page is given by the above function.

PageGroupIsIn

Synopsis

my $Yes = $Page->PageGroupIsIn ('Public,Users', $PageGroups);

Description

Checks if a page is in the given groups. If $PageGroups is ommitted the current page is checked.

PageUserGroups

Synopsis

my $PageUserGroups = $Page->PageUserGroups ();

Description

Returns all the user groups of the given user that matches the page groups as a list..

PageUserGroupsAsString

Synopsis

my $PageUserGroupsAsString = $Page->PageUserGroupsAsString ();

Description

Returns all the user groups of the given user that matches the page groups as a string..

CreationTime

Synopsis

my $CreationTime = $Page->CreationTime ();

Description

Returns the creation time of a page.

CreationTimeAsString

Synopsis

my $CreationTimeAsString = $Page->CreationTimeAsString ();

Description

Returns the creation time of a page as a string.

lastModificationTime

Synopsis

my $lastModificationTime = $Page->lastModificationTime ();

Description

Returns the time, the page was last modified.

lastModificationTimeAsString

Synopsis

my $lastModificationTimeAsString = $Page->lastModificationTimeAsString ();

Description

Returns the time, the page was last modified, as a string.

HTML_encode

Synopsis

my $lastModificationTimeAsString = $Page->HTML_encode ();

Description

Convenience function.

URL_encode

Synopsis

my $Encoded = $Page->URL_encode ();

Description

Convenience function.

URL_decode

Synopsis

my $Encoded = $Page->URL_decode ();

Description

Convenience function.

ElementTableName

Synopsis

my $TableName = $Page->ElementTableName ();

Description

Convenience function.

getElements

Synopsis

my @Elements = $Page->getElements (Name => 'Text');

Description

Returns a list reference to the elements with the name 'Name'.

ElementName

Synopsis

my $ElementName = $Page->ElementName (Number => 3);

Description

Returns the name of element $i.

NumberOfElements

Synopsis

my $NumberOfElements = $Page->NumberOfElements();

Description

Convenience function.

ElementAttribute

Synopsis

my $ElementAttribute = $Page->ElementAttribute (Number => $i);

Description

Returns the attribute of element $i. If a parameter is given, returns the value of that parameter. Attribute parameter must have the form:

Type="myType" myAttribute="foo" ...
In an array context it returns the list of attributes with the name given by the 'Name' funtction parameter.

Examples

my $ElementAttribute = $Page->ElementAttribute (Number => 3);

my $ElementAttribute = $Page->ElementAttribute (Number    => $i,
                                                Parameter => 'Type');

my @ActionAttributes = $Page->ElementAttribute (Name => 'Actions') ;

AttributeParameter

Synopsis

my $ElementAttributeParameter = $Page->AttributeParameter(
                                          'Attribute' => $Attribute,
                                          'Parameter' => $Parameter);

if ($Page->AttributeParameter('Attribute' => $Attribute, 'Parameter' => 'Type') eq 'parsed') { ... }
my $ElementAttributeHashReference = $Page->AttributeParameter('Attribute' => ${$Element}{ELEMENT_ATTRIBUTE}); my $TypeValue = ${$ElementAttributeHashReference}{Type};

Description

Returns the 'Type' parameter value of the taken attribute, if called with the 'Parameter' parameter. Else if no 'Parameter' parameter is passed to the subroutine, returns a hash reference containing the values of all attribute parameters of the form:
my1stParameter="myParameterValue" my2ndParameter="myParameterValue" a.s.o.

ElementAttributes

Synopsis

my $ElementAttributes = $Page->ElementAttributes(Number => $i);

Description

Returns the attribute of element $i.

ElementContent

Synopsis

my $Content = $Page->ElementContent (Number       => $i,
                                     Name         => 'ElementName',
                                     Type         => 'parsed', # 'parsed', 'execute'
                                     DefaultValue => '',
                                     Separator    => $::SP,
);

Description

Returns the content of the database element given by the parameters 'Number' and/or 'Name'. The content can additionaly be parsed by the Perl interpreter, as specified by the Type parameter.

Examples

# Returns the content of the elements with the element number $i.

  my $ElementContent = $Page->ElementContent(Number => $i);

# Returns the content of elements with the element name 'Text'.

  my $Content = $Page->ElementContent(Name => 'Text');

changeElementContentWidget

Synopsis

my $Form = $Page->changeElementContentWidget (%P);

Description

Form to change the size of a ${::TEXTAREA} tag.

ElementPageNumber

Synopsis

my $ElementPageNumber = $Page->ElementPageNumber(Number => $i);

Description

Returns the page number of element $i (if configured).

IndexOfElement

Synopsis

$Page->IndexOfElement($Name, $Elements);

Description

parseText

Synopsis

my $parsedText = $Page->parseText ($Text);

Description

The taken parameter '$Text' is parsed by the PERL interpreter, thus doing variable substitution and executes embedded closure function calls. So, this function call may be expensive, what mostly doesn't matter.

Examples

my $Text = "The generation type is: \@{[\$Page->PageType]}.";
my $parsedText = $Page->parseText ($Text);
if ($Page->Error) {
  $Text .= $Page->printError;
  $Page->resetError;
}

evalText

Synopsis

my $Text = $Page->evalText ($Text);

Description

The taken parameter '$Text' is PERL code, which is executed by the function via an internal call of the interpreter.

Examples

my $Text = $Page->evalText ($Text);
if ($Page->Error) {
  $Text .= "Error=$Text.";
}

parseEmbperl

Synopsis

my $Text = $Page->parseEmbperl ($Text);

Description

The taken parameter '$Text' is HTML with embeded PERL code, which is executed by the function, via an internal call of the HTML::Embperl interpreter.

Examples

my $Text = $Page->parseEmbperl ($Text);
if ($Page->Error) {
  $Text .= "Error: " . $Text;
}

defineDataVariables

Synopsis

$Page->defineDataVariables (%P);

Description

Assigns variables to the Page objects data container.

Examples

$Page->defineDataVariables (Speed => 1,);
my $Speed = $Page->{Data}{Speed};

escapeXML

Synopsis

my $Text = $Page->escapeXML ($Text);

Description

Converts XML text.

selectElements

Synopsis

$Page->selectElements (%P);

Description

Displays elements by its name, below the category 'PageCategory'.

Examples

&{[
$Page->selectElements (ElementName  => 'Title',
                       PageCategory => "/Profile%",
                       CSS_Style    => 'padding-left:20px;')
]}

TemplateAttribute

Synopsis

$Page->TemplateAttribute (%P);

Description

Return a template elements attribute.

TemplateContent

Synopsis

my $TemplateContent = $Page->TemplateContent (%P);

Description

Returns the content of a template element.

TemplateContentWidget

Synopsis

$Page->TemplateContentWidget (%P);

Description

Returns an HTML widget.

ParentCategoryPath

Synopsis

my $ParentPath = $Page->ParentCategoryPath ($Path);

Description

Returns the path to the parent category of $Path. If $Path is omitted, $Path is set to the current category.

ParentCategory

Synopsis

my $ParentName = $Page->ParentCategory ($Path);

Description

Returns the name of the $Path's parent category. If $Path is omitted, $Path is set to the current category.

PageTree

Synopsis

my $Text = $self->PageTree (%P);

Description

Returns a page tree of the content database.

Examples

my $Text = $Page->PageTree (Category               => $Category,
                            openFolderImage        => '',
                            encodeTextFunctionName => 'Maxscape::Page::encodeCategoryName',
                            changeSlashTo          => '',);

traversePageOutputFunction

Synopsis

$Page->traversePageOutputFunction ($self, $Table, $Page);

Description

Method to display a row of the node tree.

displayPath

Synopsis

my $Path = $Page->displayPath (%P);

Description

Displays a clickable path to the current category.

Examples

my $Text = $Page->displayPath ( Category               => $Category,
                                openFolderImage        => '', # text of the root category
                                encodeTextFunctionName => '',
                                changeSlashTo          => '',
                                Mode                   => '',
);
my $Text = $Page->displayPath ( Category               => $CategoryPath,
                                openFolderImage        => '', # text of the root category
                                encodeTextFunctionName => '',
                                encodeTextFunctionName => 'Maxscape::Page::encodeCategoryName',
                                changeSlashTo          => ' > ',
                                Mode                   => 'PathToQueryString',
                                CGI_VariableName       => $Page->{CGI}->{myCGI_Variable},
                                thisPagePath           => '/Hyperlinks',
                                StartCategoryNr        => $StartCategoryNr,
                                StartCategory          => 2,
                                RootPage               => 'Index.Categories',
                                RootPage               => $RootPage,
                                QueryString            => $QueryString,
                                openFolderImage        => $RootText,
                                dontShowRootElement    => 1,
);

displayPathElement

Synopsis

my $Text = $Page->displayPathElement($Category, $PageName, $Text,
              $QueryString, $encodeTextFunctionName, $changeSlashTo
);

Description

Displays a path element of a category path.

displayPageTree

Synopsis

my $Text = $Page->displayPageTree (%P);

Description

Displays a page tree of the content database.

Examples

$CategoryName = $Page->displayPageTree (
  'Callback'     => qq(\$Page),
);

editElementContentByPageNumberElementName

Synopsis

my $Text = $Page->editElementContentByPageNumberElementName (%P);

Description

Edit an element given by its element name. Returns 'EditElement: No elements found!', in case there is no element.

Examples

my $Text = $Page->editElementContentByPageNumberElementName (
             TableName               => $TableName,   # default = 'ELEMENTS'
             PageNumber              => $PageNumber,  # default = $Page->PageNumber
             ElementName             => $ElementName, # default = 'Text'
             TextareaSubmitSeparator => '',
             TextareaCols            => '60',
             TextareaRows            => '20',
             hiddenQueryString       => '',
           );

createPage

Synopsis

$ErrorText = $Page->createPage (%P);

Description

Creates a page in the content tree.

Examples

$ErrorText = $Page->createPage (
                  Category  => '/User/Project',
                  Page      => 'TestProject',
                  UserId    => $UserId,
                  PageGoup  => 'TestProject', 
);

insertElement

Synopsis

$ErrorText = $Page->insertElement (%P);

Description

Inserts an element into a node.

Examples

$ErrorText = $Page->insertElement (
               TableName        => $TableName,        # default = 'ELEMENTS'
               PageNumber       => $PageNumber,       # default = $Page->PageNumber
               ElementNumber    => $ElementNumber,    # default = 999
               ElementName      => $ElementName,      # default = 'Text'
               ElementAttribute => $ElementAttribute, # default = 'Text'
               ElementContent   => $ElementContent,   # default = 'Text'
);

encodeCategoryName

Synopsis

my $CategoryName = $Page->encodeCategoryName ($CategoryName, $changeSlashTo, $SlashIs);

Description

Encodes a category name.

clipString

Synopsis

my $clipString = $Page->clipString ($String);

Description

Clips a string. Default is 30 character.

Examples

my $clipString = $Page->clipString ($String, 100);

showInterestGroups

Synopsis

my $Groups = $Page->showInterestGroups ($Groups);

Description

Displays InterestGroups.

decodeCategoryName

Synopsis

my $CategoryName = $Page->decodeCategoryName ($CategoryName);

Description

Decodes category names.

storeFormVariables

Synopsis

my $CategoryName = $Page->storeFormVariables (%P);

Description

Function to store the variables of a form for later use.

Examples

$Page->storeFormVariables (FormType        => 'PageName',
                           excludeExactly  => {Page => 1, Category => 1,
                                               DisplayCategories => 1,
                                               FormState => 1, },
                           excludeByMatch  => '__CATEGORY__',

initPageMenu

Synopsis

my $Page->initPageMenu (otherText => $UserChannelText . $otherMenuText);

Description

Initialises the systems Menu Object.

finalFilterSet

Synopsis

$Page->finalFilterSet ? return $Page->finalFilter : '';

Description

The finalFilterSet subroutine first looks if a finalFilter is enabled via the $WebServer object's configuration mechanism. If an application server's local enableFinalFilter subroutine is supplied, it is executed.
This gives applications the possibility to define the conditions under which the finalFilter is invoked (see 'finalFilter' subroutine).

Examples

# e.g. in the servers 'ProcessConfiguration.pl' file:

use Maxscape::ServerApplication;

# e.g. in the servers 'ServerApplication.pm' file:
# /maxscape/server/'application server id'/lib/perl/Maxscape/ServerApplication.pm

%ServerInitialisationData = (
  WebServer => {
    ...
    'Page.enableFinalFilter' =>
                              'Maxscape::ServerApplication::enableFinalFilter',
    'Page.finalFilterCallback'   => 'Maxscape::ServerApplication::finalFilter',
    ...
    ...
  }
);

sub enableFinalFilter {
  my $self = shift;
  return ($self->{CGI}->{"Search.QueryString"} || $self->ContentType() eq 'XML');
}

finalFilter

Synopsis

print $Page->finalFilter();

Description

The the final filter callback is enabled, the 'Page.finalFilterCallback' function is executed, giving applications the chance to parse/change the previously collected document content (see 'finalFilterSet' subroutine).

Examples

# for example in the servers 'ServerApplication.pm' file:
# /maxscape/server/'application server id'/lib/perl/Maxscape/ServerApplication.pm

sub finalFilter {
  my ($self) = shift;
  my ($Text) = @_;

  my $ContentType = $self->ContentType;
  if ($ContentType eq 'XML') {
    $Text = myXMLParser ($self, $Text);
  }
  my $CGI = $self->{CGI};
  if ($CGI->{QueryString}) {

    my $Substitute = $CGI->{QueryString"};
    ...
  }
}

HTTP_HeaderCallback

Synopsis

my $HTTP_HeaderCallback = $Page->HTTP_HeaderCallback;

Description

Executes the HTTP header callback function $::WebServer->{'Page.HTTP_HeaderCallback'}.

Language

Synopsis

$Language = $Page->Language(); # de, en

Description

Returns the language to be displayed (CGI variable 'Language').

setLanguage

Synopsis

$Language = $Page->setLanguage(); # de, en

Description

Sets the Pages and the CGI objects language variables.

LanguageSelectWidget

Synopsis

my $LanguagSelectorWidget = $Page->LanguageSelectWidget (%P);

Description

Return a widget to select the language of a displayed page.

Examples

my $LanguagWidget = $Page->LanguageSelectWidget (
                      Class       => 'LanguageSelectWidget',
                      Separator   => ' | ', # 'no'
                      Target      => $Target,
                      Text        => 'Deutsch',
                      QueryString => $QueryString,
                      Title       => 'Seite in Deutsch.',
                      Style       => $Style,
                      CSS_Class   => $Class,
                      CSS_ID      => $ID,
);

ContactWidget

Synopsis

my $ContactWidget = $Page->ContactWidget (%P);

Description

Outputs a widget to the contact page.

Examples

my $ContactLink = $Page->ContactWidget (
     Style     => $LinkStyle,
     CSS_Class => $Class,
     Separator => 'none', # none, e.g. |
     Target    => '_top',
);

editPageElementsInlineMenuLink

Synopsis

my $editPageElementsInlineMenuLink = $Page->editPageElementsInlineMenuLink ();

Description

Return a widget to edit the displayed page.

Examples

To be added.

editPageElementsInlineMenu

Synopsis

my $editPageElementsInlineMenu = $Page->editPageElementsInlineMenu ();

Description

Return a widget to edit the displayed page.

Examples

To be added.

PageTreeDocumentRoot

Synopsis

$Page->PageTreeDocumentRoot;

Description

Returns the DocumentRoot of PageTree Content Manager.

Examples

my $PageTreeDocumentRoot = $Page->PageTreeDocumentRoot;

canBeEditedBy

Synopsis

$Page->canBeEditedBy ('Users');

Description

Finds out if someone may edit a page.

Examples

my $canEdit = $Page->canBeEditedBy ('Administrator');

MemberMayNotEditPage

Synopsis

my $MemberMayNotEditPage = $Page->MemberMayNotEditPage ('Users');

Description

Finds out if someone may edit a page or page element. Return the 'noEditText' text, if a member may not edit the page or element. Otherwise returns ''.

Examples

my $cannotEdit = $Page->MemberMayNotEditPage (
                   PageOwner       => $Page->{Context}->{NODE_OWNER},
                   PageWriteGroups => $Page->{Context}->{NODE_WRITE_GROUPS},);
                   noEditText      => 'Not allowed',);

PageViewerIsOwner

Synopsis

my $ViewerIsOwner = $Page->PageViewerIsOwner ();

Description

Finds out, if the page viewer is also the page owner.

displayNodeElement

Synopsis

my $NodeElementAsText = $Page->displayNodeElement ($PageCategory, $PageName,
                                                   'Template', $Page->{Cursor});

Description

Displays the elements of content tree node as a text.

displayNodeElements

Synopsis

my $NodeElementsAsText = $Page->displayNodeElements (\@Templates, 'Template',
                                                     '', $Page->{Cursor});

Description

Returns the elements of content tree nodes as a text.

Examples

my $PageCategory = '/Templates/DB-Template/UserTemplate';
my @Templates = ({ CategoryName => $PageCategory, PageName => 'SongList' },
                 { CategoryName => $PageCategory, PageName => 'simpleLayout' },
);
my $Text = $Page->displayNodeElements (\@Templates);

NodeToTableName

Synopsis

my $TableName = $self->NodeToTableName ($NodeType, $PageType);

Description

Return the associated database table name. This method needs to be worked out!

setTextEncoding

Synopsis

use Encode qw(decode encode);
$Page->setTextEncoding('utf-8');
$Page->setTextEncoding('iso-8859-1');

Description

Sets the text encoding.

decodeText

Synopsis

Not used so far.

Description

interpreteText

Synopsis

my $HTML = $Page->interpreteText ( Text => $Text,
              ContentType => $ContentType, ImageDirectory => $Dir);

Description

An XML parser.

HTML_Table

Synopsis

my $HTML_Table = $Page->HTML_Table (%P);

Description

Returns an HTML table.

Examples

my $HTML_Table = $Page->HTML_Table (
                   Type      => 'ThreeColumns',
                   table     => '<table cellspacing="0" cellpadding="0">',
                   colgroup  => '<colgroup>
                     <col width="25%"> 
                     <col width="5%"> 
                     <col width="70%"> 
                   <colgroup>',
                   tr        => '<tr>',
                   td        => '<td id="glossary">',
                   Content   => [
                                     [ 'API', ' - ', 'API' ],
                                   ],
);

my $HTML_Table = $Page->HTML_Table (
   # th  => '<tr colspan="2"><th align="left">Table Header<th><tr>',
   tr    => '<tr>',
   td    => '<td nowrap>',
   colgroup  => '<colgroup> <col width="30%"> <col width="70%"> <colgroup>',
   Content   => [
                     [ 'Header', 'Content' . $::DOT ],
                     [ '', '' . $::DOT ],
                   ],
   style => 'padding: 0px ' . $Page->{Layout}{ContentInnerPadding}
         .  qq( 0px $Page->{Layout}{ContentInnerPadding};),
   );

DisplayPageByFormSelectGroup

Synopsis

my $Text = $Page->DisplayPageByFormSelectGroup (%P);

Description

Displays pages by FormSelectGroup.

Examples

my $Text = $Text = $Page->DisplayPageByFormSelectGroup (
                     LinkText   => $Page->pge('Anzeigen', 'Display'),
                     Target     => '_top',
                     CSS_Class  => 'smallMenu',);

splitPath

Synopsis

my $splitPath = $Page->splitPath ($Path, $StartLevel, $EndLevel);

Description

Splits a path.

Examples

my $splitPath = $splitPath = $Page->splitPath($Path, 1, 3);

popParentCategory

Synopsis

my ($ParentCategory, $CategoryName) = $Page->popParentCategory($Path);

Description

Returns the parent category and the category name.

Examples

my ($ParentCategory, $CategoryName) = $Page->popParentCategory($AbsolutePath);

PathDepth

Synopsis

my $PathDepth = $Page->PathDepth ("/User/Home/T/Template-Manager");

Description

Returns the path depth.

MemberName

Synopsis

my $MemberName = $Page->MemberName;

Description

Returns the member name.

MemberHomePath

Synopsis

my $MemberHomePath = $Page->MemberHomePath ();

Description

Return the home path of a member. Outside a members home category path, the $MemberAccountName must be provided.

Examples

my $MemberHomePath = $Page->MemberHomePath ($MemberAccountName);

MemberHomeDirectory

Synopsis

my $MemberHomeDirectory = $Page->MemberHomeDirectory ();

Description

Return the root directory of a member.

Maxscript

Synopsis

my $interpretedText = $Page->Maxscript ($Text);

Description

A stub for the Maxscript parser. Creates a Maxscript object and executes the Maxscript method on the $Text parameter.

LoginRegisterWidget

Synopsis



Description

$Page->LoggedInRegisterWidget ( %P );

Examples

$Page->LoginRegisterWidget ( LinkStyle        => $LinkStyle,
                             RegisterCategory => '/',
                             NewLine          => $Page->{Layout}{MenuNewLine},
                             LinkTarget       => $Page->{Layout}{LinkTarget},
                             CSS_Class        => 'LoginAnchor',
);

MessageToUser

Synopsis

my $Text = $Page->MessageToUser ();

Description

Examples

$Error = $self->MessageToUser ('InputError', (
          en => 'A node name may not contain a forward slash!',
          de => ''));

reportBugLink

Synopsis

my $BugLink = $Page->reportBugLink (
                Category => '/Forum/Index',
                Texts    => { en=>'report bugs and make suggestions',
                              de=>'melden Sie Bugs und schlagen Sie etwas vor', }
);

Description

Returns an hyperlink to the report bugs page.

1
Next ∙ Previous ∙ Top ∙ Join ∙ Contact © Maxscape