1 14 15 package webEditor.interfaces; 16 17 import java.io.*; 18 import java.lang.reflect.*; 19 20 import javax.servlet.*; 21 import javax.servlet.http.*; 22 import org.w3c.dom.*; 23 24 import webEditor.core.*; 25 26 30 31 public class compositionMode { 32 33 36 private configuration initValues; 37 38 41 private presentation myEditor= null; 42 43 46 private page myDocument= null; 47 48 52 public compositionMode (configuration initParam) { 53 this.initValues = initParam; 56 } 57 58 64 public void presentation (HttpServletRequest request, PrintWriter out) 65 throws ServletException, 66 IOException { 67 68 this.myEditor = new presentation (this.initValues); 69 this.myDocument = new page (this.initValues); 70 71 String opCode = this.initValues.readValue ("HTTP Parameters", "code"); 72 73 if (opCode != null) { 74 try { 75 Method m = getClass().getMethod(opCode, new Class [0]); 77 m.invoke(this,new Object [0]); 78 } 79 catch (Exception e) { 80 out.println ("Code not supported"); 81 } 82 } 83 84 Document indexDoc = this.myDocument.homePageList (); 85 86 String outputString = this.myEditor.showIndex (indexDoc,"edit"); 87 out.println (outputString); 88 } 89 90 94 public void delete () 95 throws ServletException, IOException 96 { 97 String docID = this.initValues.readValue ("HTTP Parameters", "docID"); 98 if (docID != null) { 99 this.myDocument.removeDoc (docID); 100 } 101 } 102 103 107 public void rise () 108 throws ServletException, IOException 109 { 110 String docID = this.initValues.readValue ("HTTP Parameters", "docID"); 111 if (docID != null) { 112 this.myDocument.riseDoc (docID); 113 } 114 } 115 116 120 public void lower () 121 throws ServletException, IOException 122 { 123 String docID = this.initValues.readValue ("HTTP Parameters", "docID"); 124 if (docID != null) { 125 this.myDocument.lowerDoc (docID); 126 } 127 } 128 129 133 public void publish () 134 throws ServletException, IOException 135 { 136 Document indexDoc = this.myDocument.homePageList (); 137 138 String outputString = this.myEditor.showIndex (indexDoc,"presentation"); 139 if ( outputString != null ) { 140 this.myDocument.saveHtmlFile (outputString); 141 } 142 } 143 144 145 } 146 | Popular Tags |