diff --git a/code/AssetAdmin.php b/code/AssetAdmin.php
index 90952e47..fb8f771f 100755
--- a/code/AssetAdmin.php
+++ b/code/AssetAdmin.php
@@ -98,12 +98,6 @@ JS
);
}
-
- function index() {
- Filesystem::sync();
- return array();
- }
-
/**
* Show the content of the upload iframe. The form is specified by a template.
*/
@@ -276,7 +270,7 @@ HTML;
} else {
$record = singleton("Folder");
}
-
+
if($record) {
$fields = $record->getCMSFields();
$actions = new FieldSet();
@@ -437,7 +431,7 @@ JS;
public function SiteTreeAsUL() {
$obj = singleton('Folder');
$obj->setMarkingFilter('ClassName', ClassInfo::subclassesFor('Folder'));
- $obj->markPartialTree();
+ $obj->markPartialTree(30, null, "ChildFolders");
if($p = $this->currentPage()) $obj->markToExpose($p);
@@ -445,9 +439,10 @@ JS;
$siteTreeList = $obj->getChildrenAsUL(
'',
'"
ID\" class=\"$child->class" . $child->markingClasses() . ($extraArg->isCurrentPage($child) ? " current" : "") . "\">" . ' .
- '"Link(),0,-1), "show", $child->ID) . "\" class=\"" . ($child->hasChildren() ? " contents" : "") . "\" >" . $child->TreeTitle() . "" ',
+ '"Link(),0,-1), "show", $child->ID) . "\" class=\"" . ($child->hasChildFolders() ? " contents" : "") . "\" >" . $child->TreeTitle() . "" ',
$this,
- true
+ true,
+ "ChildFolders"
);
// Wrap the root if needs be
diff --git a/code/AssetTableField.php b/code/AssetTableField.php
index cc0e4780..45e74ea9 100755
--- a/code/AssetTableField.php
+++ b/code/AssetTableField.php
@@ -62,7 +62,7 @@ class AssetTableField extends ComplexTableField {
while($nextIDSet) {
// TO DO: In 2.4 this should be refactored to use the new data mapper.
- $nextIDSet = DB::query("SELECT ID FROM `File` WHERE ParentID IN ("
+ $nextIDSet = DB::query("SELECT ID FROM \"File\" WHERE ParentID IN ("
. implode(", " , $nextIDSet) . ") AND ClassName IN ($folderClasses)")->column();
if($nextIDSet) $folderIDs = array_merge($folderIDs, $nextIDSet);
}
diff --git a/javascript/AssetAdmin.js b/javascript/AssetAdmin.js
index 2c1a343f..9251ae0e 100755
--- a/javascript/AssetAdmin.js
+++ b/javascript/AssetAdmin.js
@@ -321,6 +321,35 @@ addfolder.prototype = {
}
}
+/**
+ * Look for new files (FilesystemSync) action
+ */
+FilesystemSyncClass = Class.create();
+FilesystemSyncClass.applyTo('#filesystemsync');
+FilesystemSyncClass.prototype = {
+ initialize: function () {
+ this.getElementsByTagName('button')[0].onclick = returnFalse;
+ },
+
+ onclick : function() {
+ statusMessage('Looking for new files');
+ var options = {
+ method: 'get',
+ onSuccess: function(t) {
+ eval(t.responseText);
+ }
+ };
+ new Ajax.Request('dev/tasks/FilesystemSyncTask',{
+ onSuccess: function(t) {
+ statusMessage("I have finished looking for files", "good");
+ },
+ onFailure: function(t) {
+ errorMessage("There was an error looking for new files");
+ }
+ });
+ return false;
+ }
+}
/**
* Delete folder action
diff --git a/tasks/FilesystemSyncTask.php b/tasks/FilesystemSyncTask.php
new file mode 100644
index 00000000..fde17ac2
--- /dev/null
+++ b/tasks/FilesystemSyncTask.php
@@ -0,0 +1,14 @@
+
+
+
+