NAME

ApTest::Base::TreeData - base class for managing a tree of objects

AUTHOR

Shane P. McCarron <shane@aptest.com>

COPYRIGHT

Copyright 2001-2016 Applied Testing and Technology, Inc. All Rights Reserved.

SYNOPSIS

use ApTest::Base::TreeData ;

use base qw( ApTest::Base::TreeData ) ;

METHODS

lastTreeJsBuild - accessor for the last time the tree data structure was built

 $time = $ref->lastTreeJsBuild( type, [ now ] );

type is a string - either "plain" (for plain files) or "tests" (for test tree in TestDB) or "reqs" (in ReqDB).

now is an optional flag. If set to 1, the time stamp is set to now. If set to -1, the time stamp is set to 0 (i.e. "never built"). Defaults to 0.

Returns the last time the JavaScript code for displaying a tree of reqs/tests/files was built.

treeJs - accessor for the cache JavaScript for generating a tree

 $code = $ref->_treeJs( type, [ data ] );

type is a string - either "plain" (for plain files) or "tests" (for test tree in TestDB) or "reqs" (in ReqDB).

data is an optional string to store.

Returns the stored JavaScript for the given type.

Should use the fileBrowserCode() method to obtain the code normally.

plainFiles - get a list of uploaded files

my $files = $ref->plainFiles( [dir], [recurse] );

dir is an optional directory to search in. Defaults to the root directory.

recurse is an optional boolean flag to specify if the list should return the contents of subdirectories (1) or not (0). Defaults to 1.

Returns an arrayref of files.

fileBrowserCode - get the JavaScript for a file browser

   my $code = $ref->fileBrowserCode( type );

type is a string - either "plain" (for plain files) or "tests" (for test tree in TestDB) or "reqs" (in ReqDB).

Returns a string of JavaScript code suitable for use with filebrowser.js to produce a tree structure of files.

If there is code cached and it was built after the lastCacheUpdate timestamp, then the cached code is returned.

Copyright © 2000-2013 Applied Testing and Technology, Inc. All rights reserved.