/* * Copyright (C) 2005 - 2011 Jaspersoft Corporation. All rights reserved. * http://www.jaspersoft.com. * * Unless you have purchased a commercial license agreement from Jaspersoft, * the following license terms apply: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ // Creating RepositoryFolder class. dynamicTree.RepositoryFolder = function(options) { dynamicTree.TreeNode.call(this, options); this.Types = { Folder : new dynamicTree.TreeNode.Type('com.jaspersoft.jasperserver.api.metadata.common.domain.Folder'), SuperRoot : new dynamicTree.TreeNode.Type('superroot'), Root : new dynamicTree.TreeNode.Type('root') }; this.nodeHeaderTemplateDomId = "list_responsive_collapsible_folders:folders"; if (this.param.extra && this.param.extra.isActiveThemeFolder) { this.param.cssClass = this.ACTIVE_THEME_CLASS; } }; dynamicTree.RepositoryFolder.prototype = deepClone(dynamicTree.TreeNode.prototype); dynamicTree.RepositoryFolder.addVar('ACTIVE_THEME_CLASS', "activeTheme"); dynamicTree.RepositoryFolder.addMethod('isParent', function() { return this.param.type == this.Types.Folder.name || this.param.type == this.Types.SuperRoot.name || this.param.type == this.Types.Root.name; }); dynamicTree.RepositoryFolder.addMethod('isSuperRoot', function() { return this.param.type == this.Types.SuperRoot.name; }); dynamicTree.RepositoryFolder.addMethod('isPublic', function() { return this.param.id === 'public'; }); dynamicTree.createRepositoryTree = function(id, options) { // Creating of TreeSupport instance and replacing its method for repository usage. var orgMode = (options.organizationId != null && options.organizationId !== ""); //enable override for showing root node. if((options.bShowRoot == null)){ options.bShowRoot = !orgMode; } if (!options.nodeClass) { options.nodeClass = dynamicTree.RepositoryFolder; } options.templateDomId = "list_responsive_collapsible_folders"; var tree = new dynamicTree.TreeSupport(id, options); tree.organizationId = options.organizationId; tree.publicFolderUri = options.publicFolderUri; tree.orgMode = orgMode; tree.modifyRootObject = function (rootObj, isChildrenCallback, parentNode) { var updatedRootObj; if (isChildrenCallback) { updatedRootObj = []; for (var i=0; i