Permalink
Browse files

Dashboard: reflect tab selection in URL

  • Loading branch information...
1 parent 1d7e9ef commit 20d5975f29a9e969cbd42639d6f1f9d28b7b3c1e @cdujeu cdujeu committed Sep 13, 2016
@@ -102,13 +102,13 @@
<a id="dash_back_workspace" onclick="ajaxplorer.triggerRepositoryChange('ajxp_home'); return false;"><span class="icon-chevron-left"></span> AJXP_MESSAGE[user_dash.53]</a>
<span id="dash_title">AJXP_MESSAGE[user_dash.title]</span>
</div>
- <div id="userdashboard_main_tab" ajxpClass="AjxpTabulator" class="dashboard_main_pane horizontal_tabulator left_tabulator" ajxpOptions='{"fit":"height", "fitMarginBottom":0, "fitParent":"orbit_content", "registerAsEditorOpener":false, "saveState":false,"events":{}, "tabsTips":"middle right", "defaultTabId": "parameters","tabInfos" : [{"id":"parameters","label":"user_dash.43", "title":"user_dash.43t","iconClass":"icon-cog", "element":"account_pane"}]}'>
+ <div id="userdashboard_main_tab" ajxpClass="AjxpTabulator" class="dashboard_main_pane horizontal_tabulator left_tabulator" ajxpOptions='{"fit":"height", "fitMarginBottom":0, "fitParent":"orbit_content", "registerAsEditorOpener":false, "saveState":false, "route":{"base":"/dashboard"}, "events":{}, "tabsTips":"middle right", "defaultTabId": "profile","tabInfos" : [{"id":"profile","label":"user_dash.43", "title":"user_dash.43t","iconClass":"icon-cog", "element":"account_pane"}]}'>
<div id="account_pane" ajxpClass="AjxpReactComponent" class="tabbed_editor" ajxpOptions='{"componentNamespace":"UserAccount","componentName":"ProfilePane"}'></div>
</div>
]]></template_part>
<component_config className="AjxpTabulator::userdashboard_main_tab">
<additional_tab id="my-users-pane"
- tabInfo='{"id":"info","label":"user_dash.46", "title":"user_dash.47","iconClass":"icon-book", "element":"my-users-pane", "position":2,"dontFocus":true}'
+ tabInfo='{"id":"contacts","label":"user_dash.46", "title":"user_dash.47","iconClass":"icon-book", "element":"my-users-pane", "position":2,"dontFocus":true}'
paneInfo='{"type":"widget"}'><![CDATA[
<div id="my-users-pane" ajxpClass="AjxpPane" class="tabbed_editor">
<div class="title-flex">
@@ -427,7 +427,7 @@
</component_config>
<component_config className="AjxpTabulator::userdashboard_main_tab">
<additional_tab id="shared_pane2"
- tabInfo='{"id":"my-shared2","iconClass":"mdi mdi-share-variant","element":"shared_pane2","closeable":false,"label":"share_center.98","title":"share_center.99","dontFocus":true,"position":4}'
+ tabInfo='{"id":"shares","iconClass":"mdi mdi-share-variant","element":"shared_pane2","closeable":false,"label":"share_center.98","title":"share_center.99","dontFocus":true,"position":4}'
paneInfo='{"type":"widget"}'><![CDATA[
<div id="shared_pane2" ajxpClass="AjxpPane" class="tabbed_editor">
<div class="title-flex">
@@ -24,7 +24,7 @@
<client_configs>
<component_config className="AjxpTabulator::userdashboard_main_tab">
<additional_tab id="apikeys_pane"
- tabInfo='{"id":"my-api-data","iconClass":"icon-key","element":"apikeys_pane","closeable":false,"label":"keystore.1","title":"keystore.2","dontFocus":true,"position":6}'
+ tabInfo='{"id":"apikeys","iconClass":"icon-key","element":"apikeys_pane","closeable":false,"label":"keystore.1","title":"keystore.2","dontFocus":true,"position":6}'
paneInfo='{"type":"widget"}'><![CDATA[
<div id="apikeys_pane" ajxpClass="ApikeysPane" ajxpOptions='{}' class="tabbed_editor" style="position:relative;">
<div class="title-flex">
@@ -120,7 +120,7 @@
<client_configs>
<component_config className="AjxpTabulator::userdashboard_main_tab">
<additional_tab id="team_pane"
- tabInfo='{"id":"team_pane","position":2,"iconClass":"icon-group","element":"team_pane","closeable":false,"label":"user_dash.50","title":"user_dash.51","dontFocus":true}'
+ tabInfo='{"id":"teams","position":2,"iconClass":"icon-group","element":"team_pane","closeable":false,"label":"user_dash.50","title":"user_dash.51","dontFocus":true}'
paneInfo='{"type":"widget"}'><![CDATA[
<div id="team_pane" ajxpClass="AjxpPane" ajxpOptions='{"fit":"height"}'>
<div class="title-flex">
@@ -913,7 +913,7 @@ public function switchAction(ServerRequestInterface $requestInterface, ResponseI
} else {
$baseURL = ApplicationState::detectServerURL(true);
}
- $webdavBaseUrl = $baseURL.ConfService::getGlobalConf("WEBDAV_BASEURI")."/";
+ $webdavBaseUrl = rtrim($baseURL,"/")."/".trim(ConfService::getGlobalConf("WEBDAV_BASEURI"), "/")."/";
$davData = $loggedUser->getPref("AJXP_WEBDAV_DATA");
$digestSet = isSet($davData["HA1"]);
if (isSet($httpVars["activate"]) || isSet($httpVars["webdav_pass"])) {
@@ -631,7 +631,7 @@
<client_configs>
<component_config className="AjxpTabulator::userdashboard_main_tab">
<additional_tab id="webdav_pane"
- tabInfo='{"id":"my-webdav-data","iconClass":"icon-cog","element":"webdav_pane","closeable":false,"label":"403","title":"403","dontFocus":true,"position":3}'
+ tabInfo='{"id":"webdav","iconClass":"icon-cog","element":"webdav_pane","closeable":false,"label":"403","title":"403","dontFocus":true,"position":3}'
paneInfo='{"type":"widget"}'><![CDATA[
<div id="webdav_pane" ajxpClass="AjxpReactComponent" class="tabbed_editor" ajxpOptions='{"componentNamespace":"UserAccount","componentName":"WebDAVPane"}'></div>
]]></additional_tab>
@@ -35,6 +35,7 @@ class Router{
pydioObject.goTo(path);
}, 100);
}
+ pydio.notify("routechange", {workspace:workspace,path:path});
}
});
@@ -102,6 +102,14 @@ Class.create("AjxpTabulator", AjxpPane, {
document.observe("ajaxplorer:user_logged", this.loadState.bind(this));
this.loadState();
}
+ if(this.options.route){
+ var routeOptions = this.options.route;
+ if(pydio.Router) {
+ this._bindToRouter(routeOptions);
+ } else pydio.observeOnce("loaded", function(){
+ if(pydio.Router) this._bindToRouter(routeOptions);
+ }.bind(this));
+ }
},
@@ -484,7 +492,29 @@ Class.create("AjxpTabulator", AjxpPane, {
this._eventPath = cNode.getPath();
},
- /**
+ _bindToRouter: function(routeOptions){
+ this.observe("switch", function(tabId){
+ if(tabId){
+ pydio.Router.router.navigate(routeOptions.base + "/" + tabId);
+ }
+ });
+ this._routerObserver = function(object){
+ if('/' + object.workspace === routeOptions.base){
+ var tabId = PathUtils.getBasename(object.path);
+ if(tabId) {
+ this.switchTabulator(tabId);
+ }else{
+ this.switchTabulator(this.tabulatorData.first().id);
+ }
+ }
+ }.bind(this);
+ pydio.observe("routechange", this._routerObserver);
+ window.setTimeout(function(){
+ this.notify("switch", this.tabulatorData.first().id);
+ }.bind(this), 500);
+ },
+
+ /**
* Resizes the widget
*/
resize : function(size, loop){
@@ -604,6 +634,9 @@ Class.create("AjxpTabulator", AjxpPane, {
this.htmlElement.update("");
try{pydio.UI.removeInstanceFromCache(this.htmlElement.id);}catch(e){}
this.htmlElement = null;
+ if(this._routerObserver){
+ pydio.stopObserving("routechange", this._routerObserver);
+ }
},

0 comments on commit 20d5975

Please sign in to comment.