21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 792 Views |
-
Rewriting SiteTreeAsUL for Admin Tab - Help?

2 June 2010 at 1:48am
Hi all,
I am setting up my own assetsadmin that instead of pulling from the regular assets folder on the server, it pulls from an assets folder on Amazon s3. I have my upload to S3 working but now I need to list my directories correctly. It looks like I need to do my own SiteTreeAsUL function which is currently writen like/**
* Return the entire site tree as a nested UL.
* @return string HTML for site tree
*/
public function SiteTreeAsUL() {$obj = singleton('Folder');
$obj->setMarkingFilter('ClassName', ClassInfo::subclassesFor('Folder'));
$obj->markPartialTree(30, null, "ChildFolders");if($p = $this->currentPage()) $obj->markToExpose($p);
// getChildrenAsUL is a flexible and complex way of traversing the tree
$siteTreeList = $obj->getChildrenAsUL(
'',
'"<li id=\"record-$child->ID\" class=\"$child->class" . $child->markingClasses() . ($extraArg->isCurrentPage($child) ? " current" : "") . "\">" . ' .
'"<a href=\"" . Controller::join_links(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\" class=\"" . ($child->hasChildFolders() ? " contents" : "") . "\" >" . $child->TreeTitle() . "</a>" ',
$this,
true,
"ChildFolders"
);// Wrap the root if needs be
$rootLink = $this->Link() . 'show/root';
$baseUrl = Director::absoluteBaseURL() . "assets";
if(!isset($rootID)) {
$siteTree = "<ul id=\"sitetree\" class=\"tree unformatted\"><li id=\"record-root\" class=\"Root\"><a href=\"$rootLink\"><strong>{$baseUrl}</strong></a>"
. $siteTreeList . "</li></ul>";
}return $siteTree;
}I need to somehow parse from the XML file I get back from Amazon that shows my files and folder structure and plug it in.
Can someone point me into the right direction? I am having a hard time wrapping my head around this.
John -
Re: Rewriting SiteTreeAsUL for Admin Tab - Help?

2 June 2010 at 2:35am
Actually, I have another idea. Can I just overwrite the sync function to upload the folder structure from my xml file to the database instead. Would that be a better idea?
John
| 792 Views | ||
|
Page:
1
|
Go to Top |

