small improvements for history control

This commit is contained in:
Sebastian Sdorra
2011-08-11 16:14:55 +02:00
parent 920a36b6db
commit e8572f7b69
7 changed files with 93 additions and 14 deletions

View File

@@ -62,11 +62,12 @@
<!-- sonia.global -->
<script type="text/javascript" src="resources/js/sonia.global.js"></script>
<script type="text/javascript" src="resources/js/sonia.history.js"></script>
<!-- sonia.util -->
<script type="text/javascript" src="resources/js/util/sonia.util.js"></script>
<script type="text/javascript" src="resources/js/util/sonia.util.link.js"></script>
<!-- sonia.override -->
<script type="text/javascript" src="resources/js/override/ext.form.vtypes.js"></script>
<script type="text/javascript" src="resources/js/override/ext.form.field.js"></script>
@@ -74,28 +75,28 @@
<script type="text/javascript" src="resources/js/override/ext.data.store.js"></script>
<script type="text/javascript" src="resources/js/override/ext.grid.columnmodel.js"></script>
<script type="text/javascript" src="resources/js/override/ext.grid.gridpanel.js"></script>
<!-- sonia.navigation -->
<script type="text/javascript" src="resources/js/navigation/sonia.navigation.js"></script>
<script type="text/javascript" src="resources/js/navigation/sonia.navigation.navsection.js"></script>
<script type="text/javascript" src="resources/js/navigation/sonia.navigation.navpanel.js"></script>
<!-- sonia.login -->
<script type="text/javascript" src="resources/js/login/sonia.login.js"></script>
<script type="text/javascript" src="resources/js/login/sonia.login.form.js"></script>
<script type="text/javascript" src="resources/js/login/sonia.login.window.js"></script>
<!-- sonia.panel -->
<script type="text/javascript" src="resources/js/panel/sonia.panel.js"></script>
<script type="text/javascript" src="resources/js/panel/sonia.panel.syntaxhighlighterpanel.js"></script>
<!-- sonia.rest -->
<script type="text/javascript" src="resources/js/rest/sonia.rest.js"></script>
<script type="text/javascript" src="resources/js/rest/sonia.rest.jsonstore.js"></script>
<script type="text/javascript" src="resources/js/rest/sonia.rest.panel.js"></script>
<script type="text/javascript" src="resources/js/rest/sonia.rest.grid.js"></script>
<script type="text/javascript" src="resources/js/rest/sonia.rest.formpanel.js"></script>
<!-- sonia.repository -->
<script type="text/javascript" src="resources/js/repository/sonia.repository.js"></script>
<script type="text/javascript" src="resources/js/repository/sonia.repository.grid.js"></script>
@@ -108,13 +109,13 @@
<script type="text/javascript" src="resources/js/repository/sonia.repository.changesetviewergrid.js"></script>
<script type="text/javascript" src="resources/js/repository/sonia.repository.changesetviewerpanel.js"></script>
<script type="text/javascript" src="resources/js/repository/sonia.repository.repositorybrowser.js"></script>
<!-- sonia.user -->
<script type="text/javascript" src="resources/js/user/sonia.user.js"></script>
<script type="text/javascript" src="resources/js/user/sonia.user.grid.js"></script>
<script type="text/javascript" src="resources/js/user/sonia.user.formpanel.js"></script>
<script type="text/javascript" src="resources/js/user/sonia.user.panel.js"></script>
<!-- sonia.group -->
<script type="text/javascript" src="resources/js/group/sonia.group.js"></script>
<script type="text/javascript" src="resources/js/group/sonia.group.grid.js"></script>
@@ -122,7 +123,7 @@
<script type="text/javascript" src="resources/js/group/sonia.group.propertiesformpanel.js"></script>
<script type="text/javascript" src="resources/js/group/sonia.group.memberformpanel.js"></script>
<script type="text/javascript" src="resources/js/group/sonia.group.panel.js"></script>
<!-- sonia.config -->
<script type="text/javascript" src="resources/js/config/sonia.config.js"></script>
<script type="text/javascript" src="resources/js/config/sonia.config.configpanel.js"></script>
@@ -130,17 +131,17 @@
<script type="text/javascript" src="resources/js/config/sonia.config.scmconfigpanel.js"></script>
<script type="text/javascript" src="resources/js/config/sonia.config.configform.js"></script>
<script type="text/javascript" src="resources/js/config/sonia.config.simpleconfigform.js"></script>
<!-- sonia.action -->
<script type="text/javascript" src="resources/js/action/sonia.action.js"></script>
<script type="text/javascript" src="resources/js/action/sonia.action.changepasswordwindow.js"></script>
<!-- sonia.plugin -->
<script type="text/javascript" src="resources/js/plugin/sonia.plugin.js"></script>
<script type="text/javascript" src="resources/js/plugin/sonia.plugin.center.js"></script>
<script type="text/javascript" src="resources/js/plugin/sonia.plugin.store.js"></script>
<script type="text/javascript" src="resources/js/plugin/sonia.plugin.grid.js"></script>
<!-- sonia.scm -->
<script type="text/javascript" src="resources/js/sonia.scm.js"></script>
<!--/compress-->
@@ -190,5 +191,11 @@
</div>
<!-- Fields required for history management -->
<form id="history-form" class="x-hidden">
<input type="hidden" id="x-history-field" />
<iframe id="x-history-frame"></iframe>
</form>
</body>
</html>

View File

@@ -115,6 +115,12 @@ Sonia.group.Grid = Ext.extend(Sonia.rest.Grid, {
if ( debug ){
console.debug( group.name + ' selected' );
}
var token = Ext.History.getToken();
if ( token ){
var parts = token.split('|');
Ext.History.add(parts[0] + '|' + group.name);
}
Ext.getCmp('groupRmButton').setDisabled(false);
Sonia.group.setEditPanel([{

View File

@@ -102,6 +102,12 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
if ( debug ){
console.debug( item.name + ' selected' );
}
var token = Ext.History.getToken();
if ( token ){
var parts = token.split('|');
Ext.History.add(parts[0] + '|' + item.name);
}
var infoPanel = main.getInfoPanel(item.type);
infoPanel.item = item;

View File

@@ -87,3 +87,6 @@ var main = null;
// enable extjs quicktips
Ext.QuickTips.init();
// enable history
Ext.History.init();

View File

@@ -0,0 +1,43 @@
/* *
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
Ext.History.on('change', function(token){
if(token){
var parts = token.split('|');
var tab = parts[0];
if ( debug ){
console.debug( 'handle history event for ' + tab );
}
} else if (debug) {
console.debug('history token is empty');
}
});

View File

@@ -442,7 +442,14 @@ Ext.onReady(function(){
id: 'mainTabPanel',
region: 'center',
deferredRender: false,
enableTabScroll: true
enableTabScroll: true,
listeners: {
tabchange: function(tabPanel, tab){
if ( Ext.isDefined(tab) ){
Ext.History.add(tab.id);
}
}
}
});
new Ext.Viewport({

View File

@@ -102,6 +102,13 @@ Sonia.user.Grid = Ext.extend(Sonia.rest.Grid, {
if ( debug ){
console.debug( item.name + ' selected' );
}
var token = Ext.History.getToken();
if ( token ){
var parts = token.split('|');
Ext.History.add(parts[0] + '|' + item.name);
}
var panel = new Sonia.user.FormPanel({
item: item,
region: 'south',