1 7 8 package org.enhydra.snapper.presentation; 9 10 11 import java.net.URLEncoder ; 12 13 import org.w3c.dom.html.*; 14 import org.w3c.dom.*; 15 16 import org.enhydra.snapper.SnapperManager; 18 import org.enhydra.snapper.spec.*; 19 20 import org.enhydra.snapper.data.IndexedDO; 21 import org.enhydra.snapper.data.IndexedQuery; 22 import org.enhydra.snapper.data.NotIndexedDO; 23 import org.enhydra.snapper.data.SitesDO; 24 import org.enhydra.snapper.data.SitesQuery; 25 import org.enhydra.snapper.presentation.html.*; 26 import org.enhydra.xml.xmlc.XMLObject; 27 28 import com.lutris.appserver.server.httpPresentation.ClientPageRedirectException; 29 import com.lutris.appserver.server.sql.DBTransaction; 30 31 32 public class NotIndexedPresentation extends BasePO { 33 34 protected XMLObject getDOM() throws Exception { 35 36 NotIndexedListHTML htmlPage; 37 NotIndexed[] niArray = null; 38 Site[] list = null; 39 NotIndexed ni = null; 40 String siteName = "", siteId=""; 41 42 htmlPage = (NotIndexedListHTML)comms.xmlcFactory.create(NotIndexedListHTML.class); 43 44 try { 45 siteName = comms.request.getParameter("name"); 46 siteId = comms.request.getParameter("id"); 47 51 53 55 56 ni = NotIndexedFactory.getNotIndexed("org.enhydra.snapper.business.NotIndexedImpl"); 57 58 niArray = ni.getListForID(dbTransaction, siteId); 59 60 }catch (Exception ex){ 61 System.out.println("Exception: "+ex); 62 niArray = null; 63 } 64 65 66 HTMLTableRowElement templateRow = htmlPage.getElementTemplateRow(); 67 htmlPage.setTextSiteName(siteName); 68 69 HTMLElement fileLinkCellTemplate = htmlPage.getElementFileLink(); 70 templateRow.removeAttribute("id"); 71 73 Node pathTable = templateRow.getParentNode(); 74 String link; 75 if (niArray != null && niArray.length != 0){ 76 for (int num = 0; num < niArray.length; num++) { 77 try{ 78 NotIndexed current = niArray[num]; 79 String type = current.getLink().substring(current.getLink().lastIndexOf(".")+1, current.getLink().lastIndexOf(".")+4); 81 String linkOfFile = current.getLink(); 82 83 if(SnapperManager.getInstance().getFileSeparatorConvention()!=null && 84 SnapperManager.getInstance().getFileSeparatorConvention().equalsIgnoreCase("unix")) { 85 86 linkOfFile = linkOfFile.replaceAll("\\\\","/"); 87 } 88 if(!(linkOfFile.indexOf("(")>0 && linkOfFile.indexOf(")")>0)) 89 { 90 link = "DM_DownloadPO.po?id=" + URLEncoder.encode(linkOfFile,"UTF-8") + "&type=" + type; 91 } 92 else 93 { 94 link = "DM_DownloadPO.po?id=" + URLEncoder.encode(linkOfFile.substring(0,linkOfFile.indexOf("(")),"UTF-8")+ "&type=" + "zip"; 95 } 96 97 htmlPage.getElementFileLink().setHref(link); 98 99 htmlPage.setTextFileLink(linkOfFile); 100 101 pathTable.appendChild(templateRow.cloneNode(true)); 102 103 link = "DeleteIndexed.po?action=files&id=" + siteId; 104 htmlPage.getElementDeleteLink().setHref(link); 105 htmlPage.getElementSiteId().setValue(siteId); 106 107 108 } 109 110 catch (Exception ex) {ex.printStackTrace();} 111 } 112 } 113 114 templateRow.getParentNode().removeChild(templateRow); 115 return htmlPage; 116 } 117 118 119 } 120 | Popular Tags |