Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
NEXUS-466: checksum applet fix for Firefox3
Browse files Browse the repository at this point in the history
git-svn-id: file:///opt/svn/repositories/sonatype.org/nexus/branches/nexus-1.0.0@1532 2aa8b3fc-8ebb-4439-a84f-95066eaea8ab
  • Loading branch information
dip committed Sep 12, 2008
1 parent e00ac0c commit 8cb9458
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
2 changes: 2 additions & 0 deletions nexus-webapp/src/main/webapp/js/Sonatype.js
Expand Up @@ -23,6 +23,8 @@
window.Sonatype = function(){
return {
init : function() {
Ext.isGecko3=!Ext.isSafari&&navigator.userAgent.toLowerCase().indexOf("rv:1.9")>-1;

Ext.get('header').hide();
Ext.get('welcome-tab').hide();

Expand Down
Expand Up @@ -209,16 +209,14 @@ Sonatype.repoServer.SearchPanel = function(config){
width: 300
},
{
xtype: 'browsebutton',
xtype: Ext.isGecko3 ? 'button' : 'browsebutton',
text: 'Browse...',
searchPanel: this,
tooltip: 'Click to select a file. It will not be uploaded to the ' +
'remote server, an SHA1 checksum is calculated locally and sent to ' +
'Nexus to find a match. This feature requires Java applet ' +
'support in your web browser.',
handler: function( b ) {
var filename = b.detachInputFile().getValue();

if ( ! document.digestApplet ) {
b.searchPanel.grid.fetchMoreBar.addText(
'<div id="checksumContainer" style="width:10px">' +
Expand All @@ -229,18 +227,35 @@ Sonatype.repoServer.SearchPanel = function(config){
);
}

var filename = null;

if ( Ext.isGecko3 ) {
filename = document.digestApplet.selectFile();
}
else {
var fileInput = b.detachInputFile();
filename = fileInput.getValue();
}

if ( ! filename ) {
return;
}

b.disable();
if ( document.digestApplet ) {
b.searchPanel.setFilenameLabel( b.searchPanel, 'Loading...' );
var f = function( b, filename ) {
b.searchPanel.searchField.setRawValue(
document.digestApplet.digest( filename ) );
b.searchPanel.setFilenameLabel( b.searchPanel, filename );
b.enable();
b.searchPanel.startSearch( b.searchPanel );
b.searchPanel.setFilenameLabel( b.searchPanel, 'Calculating checksum...' );

var f = function( b, filename ) {
var sha1 = 'error calculating checksum';
if ( document.digestApplet ) {
sha1 = document.digestApplet.digest( filename );
}
f.defer( 200, b, [b, filename] );

b.searchPanel.searchField.setRawValue( sha1 );
b.searchPanel.setFilenameLabel( b.searchPanel, filename );
b.enable();
b.searchPanel.startSearch( b.searchPanel );
}
f.defer( 200, b, [b, filename] );
}
}
];
Expand Down Expand Up @@ -279,23 +294,6 @@ Sonatype.repoServer.SearchPanel = function(config){
]
});

//@note: commented out detail view
//this.gsm = this.grid.getSelectionModel();
//
//this.gsm.on('rowselect', function(sm, index, record){
// detailViewTpl.overwrite(this.detailView.body, record.data);
//}, this, {buffer:250}); //@todo: reduce the delay for invocation (buffer value)
//
//this.grid.store.on({
// 'datachanged' : function(){
// this.detailView.body.update('');
// },
// 'clear' : function(){
// this.detailView.body.update('');
// },
// scope: this
//});

this.on({
'render' : function(){
this.searchField.focus();
Expand Down Expand Up @@ -406,7 +404,7 @@ Ext.extend(Sonatype.repoServer.SearchPanel, Ext.Panel, {

gavEnterHandler: function(f, e) {
if(e.getKey() == e.ENTER){
this.startGAVSearch();
this.startGAVSearch();
}
}

Expand Down

0 comments on commit 8cb9458

Please sign in to comment.