Source Code Cross Referenced for HtmlEditorModule.java in  » Content-Management-System » openedit » com » openedit » modules » html » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » openedit » com.openedit.modules.html 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on Jan 20, 2004
003:         *
004:         * To change the template for this generated file go to
005:         * Window>Preferences>Java>Code Generation>Code and Comments
006:         */
007:        package com.openedit.modules.html;
008:
009:        import org.apache.commons.logging.Log;
010:        import org.apache.commons.logging.LogFactory;
011:
012:        import com.openedit.OpenEditException;
013:        import com.openedit.WebPageRequest;
014:        import com.openedit.modules.edit.BaseEditorModule;
015:        import com.openedit.page.Page;
016:        import com.openedit.util.PathUtilities;
017:        import com.openedit.util.URLUtilities;
018:
019:        /**
020:         * @author dbrown
021:         * @author Matt Avery, mavery@einnovation.com
022:         */
023:        public class HtmlEditorModule extends BaseEditorModule {
024:            private static final Log log = LogFactory
025:                    .getLog(HtmlEditorModule.class);
026:
027:            /**
028:             * Loads the WYSIWYG view
029:             * @param inReq
030:             * @throws Exception
031:             */
032:            public void loadView(WebPageRequest inReq) throws Exception {
033:                EditorSession session = startEditSession(inReq);
034:                inReq.putPageValue("viewcontent", session
035:                        .getWysiwygSourceVariable());
036:                //inReq.putPageValue("rawviewcontent", session.getWysiwygSource() );
037:                inReq.putPageValue("csspath", session.getCssPath());
038:                //inReq.putPageValue( "documentModified", new Boolean( session.isDocumentModified() ) );
039:            }
040:
041:            /**
042:             * Load the source code into the source code editor
043:             * @param inReq
044:             * @throws Exception
045:             */
046:            public void loadSource(WebPageRequest inReq) throws Exception {
047:                EditorSession session = startEditSession(inReq);
048:                /*		String type = inReq.getRequestParameter("type");
049:                 if ( "text".equals( type ))
050:                 {
051:                 inReq.putPageValue( "sourcecontent",  session.getOriginalSource() );
052:                 }
053:                 else
054:                 {
055:                 */inReq.putPageValue("sourcecontent", session
056:                        .getEscapedSource());
057:                //	}
058:                inReq.putPageValue("documentModified", new Boolean(session
059:                        .isDocumentModified()));
060:            }
061:
062:            /**
063:             * @param inEditorSession
064:             * @param inEditPath
065:             */
066:            protected EditorSession startEditSession(WebPageRequest inReq)
067:                    throws OpenEditException {
068:                EditorSession inEditorSession = new EditorSession();
069:                String editPath = inReq.getRequestParameter("editPath");
070:
071:                String content = null;
072:                Page editPage = getPageManager().getPage(editPath);
073:
074:                boolean multipleLang = true;
075:                String savein = inReq.getPageProperty("usemultiplelanguages");
076:                if (savein != null) {
077:                    multipleLang = Boolean.parseBoolean(savein);
078:                } else {
079:                    multipleLang = false;
080:                }
081:
082:                String selectedcode = inReq.getLanguage();
083:                String rootdir = "/translations/" + selectedcode;
084:                if (multipleLang) {
085:                    if (selectedcode == null || selectedcode.equals("default")
086:                            || editPath.startsWith(rootdir)) {
087:                        multipleLang = false;
088:                    }
089:                }
090:                if (multipleLang) {
091:                    editPath = rootdir + editPath;
092:                }
093:                boolean useDraft = createDraft(editPage, inReq.getUser());
094:                if (useDraft) {
095:                    editPath = PathUtilities.createDraftPath(editPath);
096:                    Page draft = getPageManager().getPage(editPath);
097:                    if (draft.exists()) {
098:                        //then use this content.
099:                        content = draft.getContent();
100:                    } else {
101:                        if (editPage.exists()) {
102:                            content = editPage.getContent();
103:                        }
104:                    }
105:                } else if (editPage.exists()) {
106:                    content = editPage.getContent();
107:                }
108:                if (content == null) {
109:                    content = "";
110:                }
111:                editPage = getPageManager().getPage(editPath);
112:                inEditorSession.setEditPage(editPage);
113:                inEditorSession.setOriginalSource(content);
114:                inEditorSession.setWorkingSource(content);
115:                String origUrl = inReq.getRequestParameter("origURL");
116:                inEditorSession.setOriginalUrl(origUrl);
117:
118:                URLUtilities urlUtilities = (URLUtilities) inReq
119:                        .getPageValue("url_util");
120:                if (urlUtilities != null) {
121:                    inEditorSession.setBasePath(urlUtilities
122:                            .buildStandard(editPath));
123:                }
124:                //Is this being used anymore?
125:                String parentName = inReq.getRequestParameter("parentName");
126:                inEditorSession.setParentName(parentName);
127:
128:                String location = editPage.get("editstylesheet");
129:                if (location == null) {
130:                    String il = editPage.getInnerLayout();
131:                    if (il != null) {
132:                        location = PathUtilities.extractDirectoryPath(il)
133:                                + "/style.css";
134:                    }
135:                }
136:                if (location == null) {
137:                    location = "/_styles.css";
138:                }
139:                inEditorSession.setCssPath(location);
140:
141:                Page styles = getPageManager().getPage(location);
142:                if (!styles.exists()) {
143:                    log.error("No CSS file used in editor: " + location);
144:                }
145:                inReq.putPageValue("editorSession", inEditorSession);
146:                inReq.putPageValue("editPath", inEditorSession.getEditPath());
147:
148:                return inEditorSession;
149:            }
150:
151:            public void save(WebPageRequest inReq) throws Exception {
152:                //Strip the body junk		
153:                EditorSession session = startEditSession(inReq);
154:                String content = inReq.getRequestParameter("content");
155:                if (content == null) {
156:                    content = "";
157:                }
158:                String type = inReq.getRequestParameter("contenttype");
159:                if (!"text".equals(type)) {
160:                    content = session.removeBaseHrefAndFixQuotes(content);
161:                }
162:                inReq.setRequestParameter("content", content);
163:                session.setWorkingSource(content);
164:                String path = inReq.getRequestParameter("savepath");
165:                if (path == null) {
166:                    inReq
167:                            .setRequestParameter("savepath", session
168:                                    .getEditPath());
169:                }
170:                inReq.setRequestParameter("editPath", session.getEditPath());
171:                writeContent(inReq);
172:            }
173:
174:            protected String getContent(String inPath) throws Exception {
175:                Page page = getPageManager().getPage(inPath);
176:                if (page.exists()) {
177:                    return page.getContent();
178:                }
179:                return "";
180:            }
181:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.