Taglib tests: Admin tag

This page tests that the Rivendell Admin tag works as expected.

Set up

Nothing to do - this is all set up via xml.

Results : Admin link

Adminlinks allow arbitrary items to be injected into the list of sections that the site has. This can be useful for extending the admin system with content over and above that relevant to sections directly.

When the admin tag is given a 'section' it normally returns the fields within that section so information directly relevant to the section is available as $meta$ information.

<adminlink name="adminlink" url="some-url">
  <heading>This is an admin link</heading>
</adminlink>

<r:Admin section="adminlink" id="adminlink" />
<r:Get name="{adminlink.$xxxx$}" />
<r:Get name="{adminlink.yyyy}" />

Test Expected Actual Result
Admin link $name$ adminlink adminlink PASS
Admin link name -empty- PASS
Admin link $url$ some-url some-url PASS
Admin link $heading$ This is an admin link This is an admin link PASS

Results : Admin link

When the admin tag is given a 'section' and 'children' is set to true each row returned represents a section so information about each section is available directly (i.e. not as $meta$).

<r:Admin section="adminlink" id="adminlink-sections" children="true" />
<r:Get name="{adminlink-sections.$xxxx$}" />
<r:Get name="{adminlink-sections.yyyy}" />

Test Expected Actual Result
Child section row count ($rows$) 1 1 PASS
Child section heading ($heading$) -not supported- No match for $heading$ in adminlink PASS
Child section heading (heading) Admin link child section Admin link child section PASS

Results : Module

Within rivendell.xml 'module' elements behave exactly the same as 'adminlink' elements. They are simply a convenient alias which offers a more sensible name when used with Xanadu2 sites to collect sections together into a logical group (i.e. a module).

<module name="module" url="some-url">
  <heading>This is a module</heading>
</module>

<r:Admin section="module" id="module" />
<r:Get name="{module.$xxxx$}" />
<r:Get name="{module.yyyy}" />

<r:Admin section="module" id="module-sections" children="true" />
<r:Get name="{module-sections.$xxxx$}" />
<r:Get name="{module-sections.yyyy}" />

Test Expected Actual Result
Module $name$ module module PASS
Module $url$ some-url some-url PASS
Module $heading$ This is a module This is a module PASS
Child section row count 1 1 PASS
Child section heading Module child section Module child section PASS

Results : Section list

<r:Admin id="s" />
  <Loop source="s" id="kid">
  <r:Get name="{s.xxx}" />
  </Loop>

Test Expected Actual Result
heading Meta test table Meta test table PASS
$heading$ -not supported- No match for $heading$ in PASS
hasWorkflow false false PASS
$hasWorkflow$ -not supported- No match for $hasWorkflow$ in PASS

Results : Child sections

<r:Admin section="foo" id="s" children="true"/>
<Loop source="s" id="kid">
<r:Get name="{s.xxx}" />
</Loop>

Test Expected Actual Result
heading Meta test table Meta test table PASS
$heading$ -not supported- No match for $heading$ in metatests PASS
hasWorkflow false false PASS
$hasWorkflow$ -not supported- No match for $hasWorkflow$ in metatests PASS

Results : Hidden/visible sections

Test Expected Actual Result
Display visible top level section (showall=false) true true PASS
Display hidden top level section (showall=false) false false PASS
Display visible top level section (showall=true) true true PASS
Display hidden top level section (showall=true) true true PASS
Display visible child section (showall=false) true true PASS
Display hidden child section (showall=false) false false PASS
Display visible child section (showall=true) true true PASS
Display hidden child section (showall=true) true true PASS

Results : Section based info (when getting fields for a section)

<r:Admin section="foo" id="s" />
<r:Get name="{s.$xxx$}" />

Test Expected Actual Result
$heading$ Test table Test table PASS
$info$ A table for doing tests with. A table for doing tests with. PASS
$pkey$ ref ref PASS
$title1$ ref ref PASS
$title2$ varchar_field varchar_field PASS
$title3$ -empty- PASS
$searchfields$ (set explicitly in xml) varchar_field,text_field varchar_field,text_field PASS
$searchfields$ (set to true, inherit titles) ref,varchar_field ref,varchar_field PASS
$haspos$ (pos not present) false false PASS
$haspos$ (pos present) true true PASS
$haspos$ (pos present but not ordered on) true true PASS
$heading$ (when none set) headless headless PASS
$pkey$ (not workflowed) ref ref PASS
$resourcepkey$ (not workflowed) ref ref PASS
$hasfield(xxx)$ (when it does) true true PASS
$hasfield(xxx)$ (when it doesn't) false false PASS

Results : Field based info

<r:Admin section="foo" id="s" showall="true" />
<r:Loop source="s" id="f">
  <r:Get name="{f.xxx}" />
</r:Loop>

Test Expected Actual Result
fieldname (xml attribute: name) ref ref PASS
label Some label Some label PASS
type varchar varchar PASS
isfile (xml attribute: file) true true PASS
formtype (HTML type from DB type) TEXT TEXT PASS
haseditor (xml attribute: editor) true true PASS
isrequired (xml attribute: required) true true PASS
format ?*@??*.??* ?*@??*.??* PASS
ishidden (xml attribute: hidden) true true PASS
tagging mytags mytags PASS
HasBits (xml attribute: bits) true true PASS
isunique (xml attribute: unique) true true PASS
length (short one) 8 8 PASS
length (long one) 1024 1024 PASS
maxfilesize 500000 500000 PASS
ispassword (xml attribute: password = true) true true PASS
ispassword (xml attribute: password = md5) true true PASS
password (xml attribute: password = true) true true PASS
password (xml attribute: password = md5) md5 md5 PASS
isvirusscanned (xml attribute: virusscanner) true true PASS
directory (xml attribute: dir) uploads\metatests\ uploads/metatests/ FAIL
height (has not been set) -1 -1 PASS
heightmax 2000 2000 PASS
minvalue (xml attribute: min) 1.0 1.0 PASS
maxvalue (xml attribute: max) 99.0 99.0 PASS
values (literals) 1, 2, 3, 4 1, 2, 3, 4 PASS
values (from foreign section) {labeltests2.ref} {labeltests2.ref} PASS
width (has been set) 400 400 PASS
widthmax 3000 3000 PASS
isworkflowed (xml attribute: workflowed) false false PASS
isoverwriteable (xml attribute: overwrite) true true PASS
isprimarykey (xml attribute: pk) true true PASS
thumbwidth 120 120 PASS
thumbheight 100 100 PASS
thumbdir uploads\metatests\ uploads/metatests\ FAIL
update now now PASS
isradio (xml attribute: radio) true true PASS
isreadonly (xml attribute: readonly) true true PASS
isspecial (xml attribute: special = false on active field) false false PASS
isspecial (xml attribute: not set on pos field) true true PASS
labels (from foreign section) {labeltests2.title} {labeltests2.title} PASS
labels (literals) One, Two, Three, Four One, Two, Three, Four PASS
Imagegenerator test-image-generator test-image-generator PASS
Videogenerator test-video-generator test-video-generator PASS
default now now PASS
insert now now PASS

Yet to add: ENDYEAR, FORMATERRORMSG, HOURS, MINUTES, MINUTEINTERVAL, NULLLABEL, NULLVALUE, ORDER, PADCOLOUR, TIMEPREFIX, PRECISION, RESTRICT, ROWS, SCALE, SECONDS, STARTYEAR

Results : Restriction related info

As of Rivendell v2.8.8 field level restriction values are supported via .$fieldview$ and .$fieldedit$ (distinct from .$view$ and .$edit$ which refer to section based restrictions) when using the admin tag on a section. If a section restriction conflicts with a field level one then a logical AND is applied. In short both must be set to 'true' for the field level one to return 'true'.

Test Expected Actual Result
Unspecified section + Public field (view) true true PASS
Unspecified section + Public field (edit) true true PASS
Unspecified section + Private field (view) false false PASS
Unspecified section + Private field (edit) false false PASS
Unspecified section + Unspecified field (view) true true PASS
Unspecified section + Unspecified field (edit) true true PASS
Private section + Public field (view) false false PASS
Private section + Public field (edit) false false PASS
Private section + Private field (view) false false PASS
Private section + Private field (edit) false false PASS
Private section + Unspecified field (view) false false PASS
Private section + Unspecified field (edit) false false PASS