dieppe at freenetproject.org a ?crit :
> Author: dieppe
> Date: 2008-04-14 21:58:13 +0000 (Mon, 14 Apr 2008)
> New Revision: 19339
>
> Modified:
>
> trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBPublishTransportPanel.java
> trunk/apps/thingamablog/src/net/sf/thingamablog/transport/FCPTransport.java
> Log:
> Fix the activelink insert on remote node
> Fix a bug when the user manually enter the requestURI and don't add a
> slash at the end of the URI
>
>
and remove some dead code (we don't use disk method to get the files
anymore, but direct method)
>
> Modified:
> trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBPublishTransportPanel.java
> ===================================================================
> ---
> trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBPublishTransportPanel.java
> 2008-04-14 20:49:35 UTC (rev 19338)
> +++
> trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBPublishTransportPanel.java
> 2008-04-14 21:58:13 UTC (rev 19339)
> @@ -271,8 +271,12 @@
> }
> String url = fcpPanel.getRequestUri();
>
> int firstSlash = url.indexOf('/');
> - // The url will be use for the next edition of the
> flog, so it must point to the next edition
> - url = url.substring(0,firstSlash+1) +
> ASCIIconv.convertNonAscii(fcpPanel.getFlogSSKPath()) + "/" +
> (fcpPanel.getEditionNumber()+1) + "/";
> + if (firstSlash != -1) {
> + // The url will be use for the next edition of
> the flog, so it must point to the next edition
> + url = url.substring(0,firstSlash+1) +
> ASCIIconv.convertNonAscii(fcpPanel.getFlogSSKPath()) + "/" +
> (fcpPanel.getEditionNumber()+1) + "/";
> + } else {
> + url = url + "/" +
> ASCIIconv.convertNonAscii(fcpPanel.getFlogSSKPath()) + "/" +
> (fcpPanel.getEditionNumber()+1) + "/";
> + }
> weblog.setBlogUrls("none",url,url,url);
> pt.setEdition(fcpPanel.getEditionNumber());
> pt.setSSKPath(fcpPanel.getFlogSSKPath());
>
> Modified:
> trunk/apps/thingamablog/src/net/sf/thingamablog/transport/FCPTransport.java
> ===================================================================
> ---
> trunk/apps/thingamablog/src/net/sf/thingamablog/transport/FCPTransport.java
> 2008-04-14 20:49:35 UTC (rev 19338)
> +++
> trunk/apps/thingamablog/src/net/sf/thingamablog/transport/FCPTransport.java
> 2008-04-14 21:58:13 UTC (rev 19339)
> @@ -135,9 +135,7 @@
> long[] fileLength = new long[1];
> try {
> InputStream fileEntryInputStream =
> createFileInputStream(file, fileLength);
> - String path = ((String)
> ht.get(element)).substring(arcPath.length());
> - FileEntry fileEntry = createDirectFileEntry(file.getName(),
> fileEntryInputStream, fileLength);
> -// FileEntry fileEntry = createDiskFileEntry(file, path);
>
> + FileEntry fileEntry = createDirectFileEntry(file.getName(),
> fileEntryInputStream, fileLength);
> if (fileEntry != null) {
> System.out.println("File to insert : " +
> fileEntry.getFilename());
> totalBytes += fileLength[0];
> @@ -149,14 +147,20 @@
> }
> // If there is an active link set, we publish it
> if (activeLink) {
> - File file = new File(activeLinkPath);
> - String content = DefaultMIMETypes.guessMIMEType(file.getName());
> - FileEntry fileEntry = new DiskFileEntry("activelink.png",
> content, file.getPath());
> - if (fileEntry != null) {
> - System.out.println("File to insert : activelink.png");
> - totalBytes += file.length();
> - putDir.addFileEntry(fileEntry);
> - }
> + File file = new File(activeLinkPath);
> + long[] fileLength = new long[1];
> + InputStream fileEntryInputStream;
> + try {
> + fileEntryInputStream = createFileInputStream(file,
> fileLength);
> + FileEntry fileEntry =
> createDirectFileEntry("activelink.png", fileEntryInputStream, fileLength);
> + if (fileEntry != null) {
> + System.out.println("File to insert : activelink.png");
> + totalBytes += file.length();
> + putDir.addFileEntry(fileEntry);
> + }
> + } catch (IOException ex) {
> + logger.log(Level.WARNING, ex.getMessage());
> + }
> }
> try {
> tp.publishStarted(totalBytes);
> @@ -198,13 +202,6 @@
> return success;
> }
>
> - private FileEntry createDiskFileEntry(File file, String path){
> - String content = DefaultMIMETypes.guessMIMEType(file.getName());
> - System.out.println("File path : " + file.getPath());
> - FileEntry fileEntry = new DiskFileEntry(path + file.getName(),
> content, file.getPath());
> - return fileEntry;
> - }
> -
> private FileEntry createDirectFileEntry(String filename, InputStream
> fileEntryInputStream, long[] fileLength){
> String content = DefaultMIMETypes.guessMIMEType(filename);
> FileEntry fileEntry = new DirectFileEntry(filename, content,
> fileEntryInputStream, fileLength[0]);
>
> _______________________________________________
> cvs mailing list
> cvs at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
>
>