Author: dbkr
Date: 2006-06-21 14:54:29 +0000 (Wed, 21 Jun 2006)
New Revision: 9332

Modified:
   trunk/freenet/src/freenet/clients/http/QueueToadlet.java
   trunk/freenet/src/freenet/clients/http/staticfiles/themes/sky/theme.css
   trunk/freenet/src/freenet/keys/FreenetURI.java
Log:
Update sky theme for progress bar. Be less verbose in the queue todlet (try to 
fit everything on the screen).



Modified: trunk/freenet/src/freenet/clients/http/QueueToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/QueueToadlet.java    2006-06-21 
09:21:48 UTC (rev 9331)
+++ trunk/freenet/src/freenet/clients/http/QueueToadlet.java    2006-06-21 
14:54:29 UTC (rev 9332)
@@ -184,12 +184,16 @@
                        writeBigHeading("Completed requests", buf);

                        if(!completedDownloadToTemp.isEmpty()) {
-                               writeTableHead("Completed downloads to 
temporary space", new String[] { "", "Identifier", "Size", "MIME-Type", 
"Download", "Persistence", "Key" }, buf );
+                               if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                       writeTableHead("Completed downloads to 
temporary space", new String[] { "", "Identifier", "Size", "MIME-Type", 
"Download", "Persistence", "Key" }, buf );
+                               else
+                                       writeTableHead("Completed downloads to 
temporary space", new String[] { "", "Size", "MIME-Type", "Download", 
"Persistence", "Key" }, buf );
                                for(Iterator i = 
completedDownloadToTemp.iterator();i.hasNext();) {
                                        ClientGet p = (ClientGet) i.next();
                                        writeRowStart(buf,p);
                                        writeDeleteCell(p, buf);
-                                       writeIdentifierCell(p, p.getURI(), buf);
+                                       if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                               writeIdentifierCell(p, 
p.getURI(), buf);
                                        writeSizeCell(p.getDataSize(), buf);
                                        writeTypeCell(p.getMIMEType(), buf);
                                        writeDownloadCell(p, buf);
@@ -201,12 +205,16 @@
                        }

                        if(!completedDownloadToDisk.isEmpty()) {
-                               writeTableHead("Completed downloads to disk", 
new String[] { "", "Identifier", "Filename", "Size", "MIME-Type", "Download", 
"Persistence", "Key" }, buf);
+                               if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                       writeTableHead("Completed downloads to 
disk", new String[] { "", "Identifier", "Filename", "Size", "MIME-Type", 
"Download", "Persistence", "Key" }, buf);
+                               else
+                                       writeTableHead("Completed downloads to 
disk", new String[] { "", "Filename", "Size", "MIME-Type", "Download", 
"Persistence", "Key" }, buf);
                                for(Iterator 
i=completedDownloadToDisk.iterator();i.hasNext();) {
                                        ClientGet p = (ClientGet) i.next();
                                        writeRowStart(buf,p);
                                        writeDeleteCell(p, buf);
-                                       writeIdentifierCell(p, p.getURI(), buf);
+                                       if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                               writeIdentifierCell(p, 
p.getURI(), buf);
                                        writeFilenameCell(p.getDestFilename(), 
buf);
                                        writeSizeCell(p.getDataSize(), buf);
                                        writeTypeCell(p.getMIMEType(), buf);
@@ -219,12 +227,16 @@
                        }

                        if(!completedUpload.isEmpty()) {
-                               writeTableHead("Completed uploads", new 
String[] { "", "Key", "Filename", "Size", "MIME-Type", "Persistence", 
"Identifier" }, buf);
+                               if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                       writeTableHead("Completed uploads", new 
String[] { "", "Identifier", "Filename", "Size", "MIME-Type", "Persistence", 
"Identifier" }, buf);
+                               else
+                                       writeTableHead("Completed uploads", new 
String[] { "", "Filename", "Size", "MIME-Type", "Persistence", "Key" }, buf);
                                for(Iterator 
i=completedUpload.iterator();i.hasNext();) {
                                        ClientPut p = (ClientPut) i.next();
                                        writeRowStart(buf,p);
                                        writeDeleteCell(p, buf);
-                                       writeIdentifierCell(p, p.getFinalURI(), 
buf);
+                                       if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                               writeIdentifierCell(p, 
p.getFinalURI(), buf);
                                        if(p.isDirect())
                                                writeDirectCell(buf);
                                        else
@@ -240,12 +252,16 @@

                        if(!completedDirUpload.isEmpty()) {
                                // FIXME include filename??
-                               writeTableHead("Completed directory uploads", 
new String[] { "", "Identifier", "Files", "Total Size", "Persistence", "Key" }, 
buf);
+                               if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                       writeTableHead("Completed directory 
uploads", new String[] { "", "Identifier", "Files", "Total Size", 
"Persistence", "Key" }, buf);
+                               else
+                                       writeTableHead("Completed directory 
uploads", new String[] { "", "Files", "Total Size", "Persistence", "Key" }, 
buf);
                                for(Iterator 
i=completedDirUpload.iterator();i.hasNext();) {
                                        ClientPutDir p = (ClientPutDir) 
i.next();
                                        writeRowStart(buf,p);
                                        writeDeleteCell(p, buf);
-                                       writeIdentifierCell(p, p.getFinalURI(), 
buf);
+                                       if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                               writeIdentifierCell(p, 
p.getFinalURI(), buf);
                                        writeNumberCell(p.getNumberOfFiles(), 
buf);
                                        writeSizeCell(p.getTotalDataSize(), 
buf);
                                        writePersistenceCell(p, buf);
@@ -260,12 +276,16 @@
                if(!(failedDownload.isEmpty() && failedUpload.isEmpty())) {
                        writeBigHeading("Failed requests", buf);
                        if(!failedDownload.isEmpty()) {
-                               writeTableHead("Failed downloads", new String[] 
{ "", "Identifier", "Filename", "Size", "MIME-Type", "Progress", "Reason", 
"Persistence", "Key" }, buf);
+                               if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                       writeTableHead("Failed downloads", new 
String[] { "", "Identifier", "Filename", "Size", "MIME-Type", "Progress", 
"Reason", "Persistence", "Key" }, buf);
+                               else
+                                       writeTableHead("Failed downloads", new 
String[] { "", "Filename", "Size", "MIME-Type", "Progress", "Reason", 
"Persistence", "Key" }, buf);
                                for(Iterator 
i=failedDownload.iterator();i.hasNext();) {
                                        ClientGet p = (ClientGet) i.next();
                                        writeRowStart(buf,p);
                                        writeDeleteCell(p, buf);
-                                       writeIdentifierCell(p, p.getURI(), buf);
+                                       if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                               writeIdentifierCell(p, 
p.getURI(), buf);
                                        if(p.isDirect())
                                                writeDirectCell(buf);
                                        else
@@ -282,12 +302,16 @@
                        }

                        if(!failedUpload.isEmpty()) {
-                               writeTableHead("Failed uploads", new String[] { 
"", "Identifier", "Filename", "Size", "MIME-Type", "Progress", "Reason", 
"Persistence", "Key" }, buf);
+                               if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                       writeTableHead("Failed uploads", new 
String[] { "", "Identifier", "Filename", "Size", "MIME-Type", "Progress", 
"Reason", "Persistence", "Key" }, buf);
+                               else
+                                       writeTableHead("Failed uploads", new 
String[] { "", "Filename", "Size", "MIME-Type", "Progress", "Reason", 
"Persistence", "Key" }, buf);
                                for(Iterator 
i=failedUpload.iterator();i.hasNext();) {
                                        ClientPut p = (ClientPut) i.next();
                                        writeRowStart(buf,p);
                                        writeDeleteCell(p, buf);
-                                       writeIdentifierCell(p, p.getFinalURI(), 
buf);
+                                       if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                               writeIdentifierCell(p, 
p.getFinalURI(), buf);
                                        if(p.isDirect())
                                                writeDirectCell(buf);
                                        else
@@ -304,12 +328,16 @@
                        }

                        if(!failedDirUpload.isEmpty()) {
-                               writeTableHead("Failed directory uploads", new 
String[] { "", "Identifier", "Files", "Total Size", "Progress", "Reason", 
"Persistence", "Key" }, buf);
+                               if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                       writeTableHead("Failed directory 
uploads", new String[] { "", "Identifier", "Files", "Total Size", "Progress", 
"Reason", "Persistence", "Key" }, buf);
+                               else
+                                       writeTableHead("Failed directory 
uploads", new String[] { "", "Files", "Total Size", "Progress", "Reason", 
"Persistence", "Key" }, buf);
                                for(Iterator 
i=failedDirUpload.iterator();i.hasNext();) {
                                        ClientPutDir p = (ClientPutDir) 
i.next();
                                        writeRowStart(buf,p);
                                        writeDeleteCell(p, buf);
-                                       writeIdentifierCell(p, p.getFinalURI(), 
buf);
+                                       if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                               writeIdentifierCell(p, 
p.getFinalURI(), buf);
                                        writeNumberCell(p.getNumberOfFiles(), 
buf);
                                        writeSizeCell(p.getTotalDataSize(), 
buf);
                                        writeProgressFractionCell(p, buf);
@@ -327,12 +355,16 @@
                                uncompletedDirUpload.isEmpty())) {
                        writeBigHeading("Requests in progress", buf);
                        if(!uncompletedDownload.isEmpty()) {
-                               writeTableHead("Downloads in progress", new 
String[] { "", "Identifier", "Filename", "Size", "MIME-Type", "Progress", 
"Persistence", "Key" }, buf);
+                               if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                       writeTableHead("Downloads in progress", 
new String[] { "", "Identifier", "Filename", "Size", "MIME-Type", "Progress", 
"Persistence", "Key" }, buf);
+                               else
+                                       writeTableHead("Downloads in progress", 
new String[] { "", "Filename", "Size", "MIME-Type", "Progress", "Persistence", 
"Key" }, buf);
                                for(Iterator i = 
uncompletedDownload.iterator();i.hasNext();) {
                                        ClientGet p = (ClientGet) i.next();
                                        writeRowStart(buf,p);
                                        writeDeleteCell(p, buf);
-                                       writeIdentifierCell(p, p.getURI(), buf);
+                                       if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                               writeIdentifierCell(p, 
p.getURI(), buf);
                                        if(p.isDirect())
                                                writeDirectCell(buf);
                                        else
@@ -348,12 +380,16 @@
                        }

                        if(!uncompletedUpload.isEmpty()) {
-                               writeTableHead("Uploads in progress", new 
String[] { "", "Identifier", "Filename", "Size", "MIME-Type", "Progress", 
"Persistence", "Key" }, buf);
+                               if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                       writeTableHead("Uploads in progress", 
new String[] { "", "Identifier", "Filename", "Size", "MIME-Type", "Progress", 
"Persistence", "Key" }, buf);
+                               else
+                                       writeTableHead("Uploads in progress", 
new String[] { "", "Filename", "Size", "MIME-Type", "Progress", "Persistence", 
"Key" }, buf);
                                for(Iterator i = 
uncompletedUpload.iterator();i.hasNext();) {
                                        ClientPut p = (ClientPut) i.next();
                                        writeRowStart(buf,p);
                                        writeDeleteCell(p, buf);
-                                       writeIdentifierCell(p, p.getFinalURI(), 
buf);
+                                       if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                               writeIdentifierCell(p, 
p.getFinalURI(), buf);
                                        if(p.isDirect())
                                                writeDirectCell(buf);
                                        else
@@ -369,12 +405,16 @@
                        }

                        if(!uncompletedDirUpload.isEmpty()) {
-                               writeTableHead("Directory uploads in progress", 
new String[] { "", "Identifier", "Files", "Total Size", "Progress", 
"Persistence", "Key" }, buf);
+                               if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                       writeTableHead("Directory uploads in 
progress", new String[] { "", "Identifier", "Files", "Total Size", "Progress", 
"Persistence", "Key" }, buf);
+                               else
+                                       writeTableHead("Directory uploads in 
progress", new String[] { "", "Files", "Total Size", "Progress", "Persistence", 
"Key" }, buf);
                                for(Iterator 
i=uncompletedDirUpload.iterator();i.hasNext();) {
                                        ClientPutDir p = (ClientPutDir) 
i.next();
                                        writeRowStart(buf,p);
                                        writeDeleteCell(p, buf);
-                                       writeIdentifierCell(p, p.getFinalURI(), 
buf);
+                                       if 
(node.getToadletContainer().isAdvancedDarknetEnabled())
+                                               writeIdentifierCell(p, 
p.getFinalURI(), buf);
                                        writeNumberCell(p.getNumberOfFiles(), 
buf);
                                        writeSizeCell(p.getTotalDataSize(), 
buf);
                                        writeProgressFractionCell(p, buf);
@@ -406,14 +446,20 @@
        private void writeProgressFractionCell(ClientRequest p, StringBuffer 
buf) {
                buf.append("<td>");

-               double frac = p.getSuccessFraction();
-               double total = p.getTotalBlocks();
+               //double frac = p.getSuccessFraction();
+               double total;
+               if(node.getToadletContainer().isAdvancedDarknetEnabled())
+                       total = p.getTotalBlocks();
+               else
+                       total = p.getMinBlocks();
                // All are fractions
                double fetched = p.getFetchedBlocks()/total;
                double failed = p.getFailedBlocks()/total;
                double failed2 = p.getFatalyFailedBlocks()/total;
                double min = p.getMinBlocks()/total;

+               double frac = fetched / total;
+               
                boolean b = p.isTotalFinalized();
                if(frac < 0) {
                        buf.append("<span 
class=\"progress_fraction_unknown\">unknown</span>");
@@ -535,7 +581,7 @@
                        String u = uri.toString(false);
                        buf.append(URLEncoder.encode(u));
                        buf.append("\">");
-                       // FIXME too long? maybe only show the human readable 
bit?
+                       u = uri.toShortString();
                        buf.append(HTMLEncoder.encode(u));
                        buf.append("</a></span>");
                } else {

Modified: 
trunk/freenet/src/freenet/clients/http/staticfiles/themes/sky/theme.css
===================================================================
--- trunk/freenet/src/freenet/clients/http/staticfiles/themes/sky/theme.css     
2006-06-21 09:21:48 UTC (rev 9331)
+++ trunk/freenet/src/freenet/clients/http/staticfiles/themes/sky/theme.css     
2006-06-21 14:54:29 UTC (rev 9332)
@@ -439,6 +439,69 @@
 table.queue span.key_is {
 }

+div.progressbar {
+       float: left;
+       margin: none;
+       margin-right: 3px;
+       background-color: #f6f9ff;
+       border: solid 1px #97beff;
+       width: 100px;
+       height:15px;
+}
+
+div.progressbar-done {
+       float: left;
+       background-color: #8092ff;
+       height:15px;
+}
+
+div.progressbar-min {
+       float: left;
+       background-color: #cad2ff;
+       height:15px;
+}
+
+div.progressbar-failed {
+       float: left;
+       background-color: #ffa0a0;
+       height:15px;
+}
+
+div.progressbar-failed2 {
+       float: left;
+       background-color: #ffd0d0;
+       background-color: #dd4040;
+       height:15px;
+}
+
+tr.priority0, td.priority0 {
+       background-color: #ffb7b7;
+}
+
+tr.priority1, td.priority1 {
+       background-color: #ffcea7;
+}
+
+tr.priority2, td.priority2 {
+       background-color: #ffeba7;
+}
+
+tr.priority3, td.priority3 {
+       background-color: #ddffa7;
+}
+
+tr.priority4, td.priority4 {
+       background-color: #a7ffbc;
+}
+
+tr.priority5, td.priority5 {
+       background-color: #a7fff8;
+}
+
+tr.priority6, td.priority6 {
+       background-color: #a7caff;
+}
+
 /* Node to node text message */
 #n2ntmtext {
        width: 100%;

Modified: trunk/freenet/src/freenet/keys/FreenetURI.java
===================================================================
--- trunk/freenet/src/freenet/keys/FreenetURI.java      2006-06-21 09:21:48 UTC 
(rev 9331)
+++ trunk/freenet/src/freenet/keys/FreenetURI.java      2006-06-21 14:54:29 UTC 
(rev 9332)
@@ -492,6 +492,31 @@
                }
                return b.toString();
        }
+       
+       public String toShortString() {
+               StringBuffer b = new StringBuffer();;
+               
+               b.append(keyType).append('@');
+               
+               if (!"KSK".equals(keyType)) {
+                       b.append("...");
+                       if (docName != null)
+                               b.append('/');
+               }
+               
+               if (docName != null)
+                       b.append(docName);
+               if(keyType.equals("USK")) {
+                       b.append('/');
+                       b.append(suggestedEdition);
+               }
+               if (metaStr != null) {
+                       for (int i = 0; i < metaStr.length; i++) {
+                               b.append("/").append(metaStr[i]);
+                       }
+               }
+               return b.toString();
+       }

        public static void main(String[] args) throws Exception {
                (new FreenetURI(args[0])).decompose();


Reply via email to