* use array_diff_assoc instead of array_diff ...
* improve robustness of js tree node creation
* fixes test
https://forge.tine20.org/view.php?id=10132
Change-Id: Ic2e926f8fb1ebfc3ff97a15730eaaa04221f7514
Reviewed-on: http://gerrit.tine20.com/customers/3112
Tested-by: Jenkins CI (http://ci.tine20.com/)
Tested-by: sstamer <s.stamer@metaways.de>
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
public function testCreateFolderInFolderWithSameName()
{
$path = '/personal/' .Tinebase_Core::getUser()->accountLoginName . '/' . $this->_getPersonalFilemanagerContainer()->name;
public function testCreateFolderInFolderWithSameName()
{
$path = '/personal/' .Tinebase_Core::getUser()->accountLoginName . '/' . $this->_getPersonalFilemanagerContainer()->name;
-
- $this->_json->createNode($path . '/Test1', 'folder', NULL, FALSE);
- $this->_json->createNode($path . '/Test1/Test1', 'folder', NULL, FALSE);
+
+ $result = $this->_json->createNode($path . '/Test1', 'folder', NULL, FALSE);
+ $this->assertTrue(isset($result['id']));
+ $result = $this->_json->createNode($path . '/Test1/Test1', 'folder', NULL, FALSE);
+ $this->assertTrue(isset($result['id']), 'node has not been created');
$e = new Tinebase_Exception('nothing');
try {
$this->_json->createNode($path . '/Test1/Test1/Test2', 'folder', NULL, FALSE);
$e = new Tinebase_Exception('nothing');
try {
$this->_json->createNode($path . '/Test1/Test1/Test2', 'folder', NULL, FALSE);
- } catch(Exception $e) {
+ } catch (Exception $e) {
$this->fail('The folder couldn\'t be found, so it hasn\'t ben created');
}
$this->fail('The folder couldn\'t be found, so it hasn\'t ben created');
}
$this->assertEquals(1, $result['totalcount']);
}
$this->assertEquals(1, $result['totalcount']);
}
/**
* testDeleteDownloadLinks
*/
public function testDeleteDownloadLinks()
{
$downloadLink = $this->testSaveDownloadLinkFile();
/**
* testDeleteDownloadLinks
*/
public function testDeleteDownloadLinks()
{
$downloadLink = $this->testSaveDownloadLinkFile();
-
- $result = $this->_json->deleteDownloadLinks(array($downloadLink['id']));
+
+ $this->_json->deleteDownloadLinks(array($downloadLink['id']));
try {
Filemanager_Controller_DownloadLink::getInstance()->get($downloadLink['id']);
$this->fail('link should have been deleted');
try {
Filemanager_Controller_DownloadLink::getInstance()->get($downloadLink['id']);
$this->fail('link should have been deleted');
- $missingPathParts = array_diff($this->_splitPath($path), $pathParts);
+ $missingPathParts = array_diff_assoc($this->_splitPath($path), $pathParts);
foreach ($missingPathParts as $pathPart) {
$node = $this->_treeNodeBackend->getChild($parentNode, $pathPart);
foreach ($missingPathParts as $pathPart) {
$node = $this->_treeNodeBackend->getChild($parentNode, $pathPart);
- // keep track of current path posistion
+ // keep track of current path position
array_push($pathParts, $pathPart);
// add found path to statCache
array_push($pathParts, $pathPart);
// add found path to statCache
success: function(result, request){
var nodeData = Ext.util.JSON.decode(result.responseText);
success: function(result, request){
var nodeData = Ext.util.JSON.decode(result.responseText);
+ if (nodeData.length == 0) {
+ Tine.log.err('Server returned empty node data!');
+ Ext.MessageBox.hide();
+ return;
+ }
+
// TODO add + icon if it wasn't expandable before
if(nodeData.type == 'folder') {
var nodeData = Ext.util.JSON.decode(result.responseText);
// TODO add + icon if it wasn't expandable before
if(nodeData.type == 'folder') {
var nodeData = Ext.util.JSON.decode(result.responseText);
manageProperties: function() {
if (this.scope.ctxNode) {
var node = this.scope.ctxNode,
manageProperties: function() {
if (this.scope.ctxNode) {
var node = this.scope.ctxNode,
- grantsContainer;
- if(node.attributes.nodeRecord && node.attributes.nodeRecord.data.name) {
+ grantsContainer,
+ ctxNodeName;
+ if (node.attributes.nodeRecord && node.attributes.nodeRecord.data.name) {
grantsContainer = node.attributes.nodeRecord.data.name;
} else if(node.attributes.container) {
grantsContainer = node.attributes.container;
}
grantsContainer = node.attributes.nodeRecord.data.name;
} else if(node.attributes.container) {
grantsContainer = node.attributes.container;
}
+
+ ctxNodeName = grantsContainer.name ? grantsContainer.name : grantsContainer;
var window = Tine.widgets.container.PropertiesDialog.openWindow({
var window = Tine.widgets.container.PropertiesDialog.openWindow({
- title: String.format(_('Properties for {0} "{1}"'), this.nodeName, Ext.util.Format.htmlEncode(grantsContainer.name)),
+ title: String.format(_('Properties for {0} "{1}"'), this.nodeName, Ext.util.Format.htmlEncode(ctxNodeName)),
containerName: this.nodeName,
containerName: this.nodeName,
+ // TODO fix this in Filemanager! sub-nodes do not have a container...
grantContainer: grantsContainer,
app: this.scope.app.appName
});
grantContainer: grantsContainer,
app: this.scope.app.appName
});