/* * Copyright 2007-2017 Charles du Jeu - Abstrium SAS * This file is part of Pydio. * * Pydio 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. * * Pydio 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 Pydio. If not, see . * * The latest code can be found at . */ import NodeListCustomProvider from './NodeListCustomProvider' import DataModelBadge from '../elements/DataModelBadge' export default React.createClass({ propTypes:{ paneData:React.PropTypes.object, pydio:React.PropTypes.instanceOf(Pydio), nodeClicked:React.PropTypes.func, startOpen:React.PropTypes.bool, onBadgeIncrease: React.PropTypes.func, onBadgeChange: React.PropTypes.func }, getInitialState:function(){ var dataModel = new PydioDataModel(true); var rNodeProvider = new RemoteNodeProvider(); dataModel.setAjxpNodeProvider(rNodeProvider); rNodeProvider.initProvider(this.props.paneData.options['nodeProviderProperties']); var rootNode = new AjxpNode("/", false, "loading", "folder.png", rNodeProvider); dataModel.setRootNode(rootNode); return { open:false, componentLaunched:!!this.props.paneData.options['startOpen'], dataModel:dataModel }; }, toggleOpen:function(){ this.setState({open:!this.state.open, componentLaunched:true}); }, onBadgeIncrease: function(newValue, prevValue, memoData){ if(this.props.onBadgeIncrease){ this.props.onBadgeIncrease(this.props.paneData, newValue, prevValue, memoData); if(!this.state.open) this.toggleOpen(); } }, onBadgeChange(newValue, prevValue, memoData){ if(this.props.onBadgeChange){ this.props.onBadgeChange(this.props.paneData, newValue, prevValue, memoData); if(!this.state.open) this.toggleOpen(); } }, render:function(){ var messages = this.props.pydio.MessageHash; var paneData = this.props.paneData; const title = messages[paneData.options.title] || paneData.options.title; const className = 'simple-provider ' + (paneData.options['className'] ? paneData.options['className'] : ''); const titleClassName = 'section-title ' + (paneData.options['titleClassName'] ? paneData.options['titleClassName'] : ''); var badge; if(paneData.options.dataModelBadge){ badge = ; } var emptyMessage; if(paneData.options.emptyChildrenMessage){ emptyMessage = } var component; if(this.state.componentLaunched){ var entryRenderFirstLine; if(paneData.options['tipAttribute']){ entryRenderFirstLine = function(node){ var meta = node.getMetadata().get(paneData.options['tipAttribute']); if(meta){ return
])+)?(\/)?>|<\/\w+>/gi, '')}>{node.getLabel()}
; }else{ return node.getLabel(); } }; } component = ( ); } return (
{this.state.open?messages[514]:messages[513]} {title} {badge}
{component} {emptyMessage}
); } });