/* * 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 . */ const React = require('react') const ReactDOM = require('react-dom') const XMLUtils = require('pydio/util/xml') const PathUtils = require('pydio/util/path') const FuncUtils = require('pydio/util/func') const ResourcesManager = require('pydio/http/resources-manager') import PydioContextProvider from './PydioContextProvider' export default class Builder{ constructor(pydio){ this._pydio = pydio; this.guiLoaded = false; this._componentsRegistry = new Map(); this._pydio.observe('repository_list_refreshed', this.pageTitleObserver.bind(this)); this._pydio.getContextHolder().observe('context_loaded', this.pageTitleObserver.bind(this)); } insertChildFromString(parent, html){ let element = document.createElement('div'); element.innerHTML = html; for(let i = 0; i < element.childNodes.length; i++){ parent.appendChild(element.childNodes[i].cloneNode(true)); } } pageTitleObserver(){ const ctxNode = this._pydio.getContextNode(); document.title = this._pydio.Parameters.get('customWording').title + ' - ' + ctxNode.getLabel(); } initTemplates(){ if(!this._pydio.getXmlRegistry()) return; const tNodes = XMLUtils.XPathSelectNodes(this._pydio.getXmlRegistry(), "client_configs/template[@component]"); for(let i=0;i