From a9061d859290cd1dc2cb44aba18a08c7347f6033 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 13 Jun 2011 12:38:54 +0200 Subject: [PATCH] added sonia.repository.repositorybrowser.js --- scm-webapp/src/main/webapp/index.html | 1 + .../main/webapp/resources/images/document.gif | Bin 0 -> 237 bytes .../main/webapp/resources/images/folder.gif | Bin 0 -> 617 bytes .../sonia.repository.extendedinfopanel.js | 36 ++++- .../sonia.repository.repositorybrowser.js | 124 ++++++++++++++++++ 5 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 scm-webapp/src/main/webapp/resources/images/document.gif create mode 100644 scm-webapp/src/main/webapp/resources/images/folder.gif create mode 100644 scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.repositorybrowser.js diff --git a/scm-webapp/src/main/webapp/index.html b/scm-webapp/src/main/webapp/index.html index fcca2eaf60..0de37f789d 100644 --- a/scm-webapp/src/main/webapp/index.html +++ b/scm-webapp/src/main/webapp/index.html @@ -101,6 +101,7 @@ + diff --git a/scm-webapp/src/main/webapp/resources/images/document.gif b/scm-webapp/src/main/webapp/resources/images/document.gif new file mode 100644 index 0000000000000000000000000000000000000000..0c9e17f2b6165000dedf0668e99a8db6e4fac389 GIT binary patch literal 237 zcmZ?wbhEHb6krfwI3mmNcD=FFL2zkZoLd-nJ5-@bhL{Q2{z zZ{NPYfB$atmW^-UzWwy+w;w-# z+_YsQ&_D(-Q2fcl$iN`WpabH8>||igO1RFGk~zuuI52HaL}1|X4%z-r+2q;dTlS8;U(H{sMOf!AR*`}zUDxV%KLQ> loeYh2_+oSTrTBy;+eBkodV2eqtauqGPnkMdMplu*8UPy0fBgUe literal 0 HcmV?d00001 diff --git a/scm-webapp/src/main/webapp/resources/images/folder.gif b/scm-webapp/src/main/webapp/resources/images/folder.gif new file mode 100644 index 0000000000000000000000000000000000000000..a9aca8637902889bbd62e5077d9f55da543754d4 GIT binary patch literal 617 zcmV-v0+#(pNk%w1VGsZi0OooCG-aevgSwQr+<2qXdZg2BoX(lL-IBH2gM))MW~IK< z={07gtgNiy;NX&ylD^dH#Kgq2v$Ms;#gUPbHfN=gwcC-j+oYtVztrkAW~HjCs)w!D zUteG0;o&%FroPka$H&Lg-Ro^_ZFO~Zkh9v~-`|zD+?<@8g{#$@y4|_CxqN(lX=!P< z&*!Pc;y7odI%%a{U0ryFmqmE8larIKuCAe>p-+0TI%=oJ*zAjsljGy#czAfHr>8q= zr#Wb)x3{;Bve}NZ+O4gvvB~9;wA#MX>6W-jdu&}Usq|<1OyS=@=US3{=goL}hyPUe+xXr$KF|IB2D|wzjy>=b4$AgsatKV`DdG zr8j7%HfE%yrKO9o*?OhXMsuvh*X#fP{{R30000000000000000A^8LW004RbEC2ui z01yBW000NZfO>+1goSzx2#JYPJBETuV;~X`5Ka>fm?a%cf-4eOLsc3K6EqH|T@ivj zXbc)Xbr%;5Z7N=6CxRneYYD!-3&9Hj#5ZC<86OxJ56ueC&tMrM5erck78Ml-+}uYk z6f89qc>?C==S50$XK8df2J!L+CPH>@9&uE1Mk!5Z2S@~gvS9-fB5F9;VB;bTfrk(u zlKFxo#*-H)q!if5aU&BrJ~+JjVP$~HlP9y>xxz&Ti~ulW$_y|=iw', + + initComponent: function(){ + + var browserStore = new Sonia.rest.JsonStore({ + proxy: new Ext.data.HttpProxy({ + url: restUrl + 'repositories/' + this.repository.id + '/browse.json', + method: 'GET' + }), + fields: ['path', 'name', 'length', 'lastModified', 'directory'], + root: 'file.children', + idProperty: 'path', + autoLoad: true, + autoDestroy: true + }); + + var browserColModel = new Ext.grid.ColumnModel({ + defaults: { + sortable: false + }, + columns: [{ + id: 'icon', + dataIndex: 'directory', + header: '', + width: 28, + renderer: this.renderIcon, + scope: this + },{ + id: 'name', + dataIndex: 'name', + header: 'Name', + renderer: this.renderName, + scope: this + },{ + id: 'length', + dataIndex: 'length', + header: 'Length', + renderer: this.renderLength + },{ + id: 'lastModified', + dataIndex: 'lastModified', + header: 'LastModified', + renderer: Ext.util.Format.formatTimestamp + }] + }); + + var config = { + title: String.format(this.repositoryBrowserTitleText, this.repository.name), + store: browserStore, + colModel: browserColModel, + loadMask: true + }; + + Ext.apply(this, Ext.apply(this.initialConfig, config)); + Sonia.repository.RepositoryBrowser.superclass.initComponent.apply(this, arguments); + }, + + renderName: function(name, p, record){ + return name; + }, + + renderIcon: function(directory, p, record){ + var icon = null; + var name = record.data.name; + if ( directory ){ + icon = this.iconFolder; + } else { + icon = this.iconDocument; + } + return String.format(this.templateIcon, icon, name, name); + }, + + renderLength: function(length, p, record){ + var result = ''; + var directory = record.data.directory; + if ( ! directory ){ + result = Ext.util.Format.fileSize(length); + } + return result; + } + +}); + +// register xtype +Ext.reg('repositoryBrowser', Sonia.repository.RepositoryBrowser);