/* * 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 PluginEditor from './PluginEditor' import {Toggle, IconButton} from 'material-ui' const PluginsList = React.createClass({ mixins:[AdminComponents.MessagesConsumerMixin], togglePluginEnable:function(node, toggled) { var nodeId = PathUtils.getBasename(node.getPath()); var params = { get_action: "edit", sub_action: "edit_plugin_options", plugin_id: nodeId, DRIVER_OPTION_AJXP_PLUGIN_ENABLED: toggled ? "true" : "false", DRIVER_OPTION_AJXP_PLUGIN_ENABLED_ajxptype: "boolean" }; PydioApi.getClient().request(params, function (transport) { node.getMetadata().set("enabled", this.context.getMessage(toggled?'440':'441', '')); this.forceUpdate(); pydio.fire("admin_clear_plugins_cache"); }.bind(this)); return true; }, renderListIcon:function(node){ if(!node.isLeaf()){ return (
); } var onToggle = function(e, toggled){ e.stopPropagation(); var res = this.togglePluginEnable(node, toggled); if(!res){ } }.bind(this); return (
{e.stopPropagation()}}>
); }, renderSecondLine:function(node){ return node.getMetadata().get('plugin_description'); }, renderActions:function(node){ if(!node.isLeaf()){ return null; } var edit = function(){ if(this.props.openRightPane){ this.props.openRightPane({ COMPONENT:PluginEditor, PROPS:{ rootNode:node, docAsAdditionalPane:true, className:"vertical edit-plugin-inpane", closeEditor:this.props.closeRightPane }, CHILDREN:null }); } }.bind(this); return (
); }, reload: function(){ this.refs.list.reload(); }, render:function(){ return ( ); } }); export {PluginsList as default}