svnno****@sourc*****
svnno****@sourc*****
2007年 8月 24日 (金) 10:42:52 JST
Revision: 462 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=462 Author: shinsuke Date: 2007-08-24 10:42:52 +0900 (Fri, 24 Aug 2007) Log Message: ----------- added document order controll. Added Paths: ----------- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderOrderEditorPage.java pal-admin/trunk/src/main/webapp/view/site/folderOrderEditor.html -------------- next part -------------- Added: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderOrderEditorPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderOrderEditorPage.java 2007-08-24 01:40:54 UTC (rev 461) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderOrderEditorPage.java 2007-08-24 01:42:52 UTC (rev 462) @@ -0,0 +1,225 @@ +/* + * Copyright 2005-2007 Portal Application Laboratory and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package jp.sf.pal.admin.web.site; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import jp.sf.pal.admin.entity.NodeInfo; +import jp.sf.pal.common.CommonException; +import jp.sf.pal.common.util.FacesMessageUtil; + +import org.seasar.framework.log.Logger; +import org.seasar.teeda.extension.annotation.takeover.TakeOver; +import org.seasar.teeda.extension.annotation.takeover.TakeOverType; +import org.seasar.teeda.extension.annotation.validator.Required; + +public class FolderOrderEditorPage extends AbstractSiteEditorPage implements + Serializable { + + /** + * + */ + private static final long serialVersionUID = -6925976356083695370L; + + /** + * Logger for this class + */ + private static final Logger logger = Logger + .getLogger(FolderOrderEditorPage.class); + + private List<Map<String, String>> documentItems; + + private int documentIndex; + + @Required + private String document; + + private String documentName; + + /** + * @return the documentName + */ + public String getDocumentName() { + return documentName; + } + + /** + * @param documentName the documentName to set + */ + public void setDocumentName(String documentName) { + this.documentName = documentName; + } + + /** + * @return the documentItems + */ + public List<Map<String, String>> getDocumentItems() { + return documentItems; + } + + /** + * @param documentItems the documentItems to set + */ + public void setDocumentItems(List<Map<String, String>> documentItems) { + this.documentItems = documentItems; + } + + /** + * @return the documentIndex + */ + public int getDocumentIndex() { + return documentIndex; + } + + /** + * @param documentIndex the documentIndex to set + */ + public void setDocumentIndex(int documentIndex) { + this.documentIndex = documentIndex; + } + + /** + * @return the document + */ + public String getDocument() { + return document; + } + + /** + * @param document the document to set + */ + public void setDocument(String document) { + this.document = document; + } + + public Class<?> initialize() { + return null; + } + + public Class<?> prerender() { + // parse request parameters + parseRequestParameters(); + + if (getPath() == null) { + setPath("/"); + } + + if (getReturnPath() == null) { + setReturnPath("/"); + } + + // check node + int type = getSiteEditorService().getNodeInfoType(getPath()); + if (type == NodeInfo.PAGE) { + return PageInfoEditorPage.class; + } else if (type == NodeInfo.LAYOUT) { + return LayoutInfoEditorPage.class; + } + + try { + getSiteEditorService().loadPage(this); + } catch (CommonException e) { + FacesMessageUtil.addErrorMessage(e.getMessageId()); + logger.log("EPA0006", new Object[] { this.toString() }, e); + } + + // render FacesMessages + FacesMessageUtil.renderMessages(); + return null; + } + + @TakeOver(type = TakeOverType.INCLUDE, properties = "mode,path,returnPath") + public Class<?> doUp() { + try { + getSiteEditorService().moveDocumentUp(this); + FacesMessageUtil.addInfoMessage("updated.document.order"); + return FolderOrderEditorPage.class; + } catch (CommonException e) { + FacesMessageUtil.addErrorMessage(e.getMessageId()); + logger.log("EPA0005", new Object[] { this.toString() }, e); + } catch (Exception e) { + FacesMessageUtil.addErrorMessage("could.not.update.document.order"); + logger.log("EPA0007", new Object[] { this.toString() }, e); + } + return null; + } + + @TakeOver(type = TakeOverType.INCLUDE, properties = "mode,path,returnPath") + public Class<?> doDown() { + try { + getSiteEditorService().moveDocumentDown(this); + FacesMessageUtil.addInfoMessage("updated.document.order"); + return FolderOrderEditorPage.class; + } catch (CommonException e) { + FacesMessageUtil.addErrorMessage(e.getMessageId()); + logger.log("EPA0005", new Object[] { this.toString() }, e); + } catch (Exception e) { + FacesMessageUtil.addErrorMessage("could.not.update.document.order"); + logger.log("EPA0007", new Object[] { this.toString() }, e); + } + return null; + } + + @TakeOver(type = TakeOverType.INCLUDE, properties = "mode,path,returnPath") + public Class<?> doAdd() { + try { + getSiteEditorService().addDocumentOrder(this); + FacesMessageUtil.addInfoMessage("added.document.order"); + return FolderOrderEditorPage.class; + } catch (CommonException e) { + FacesMessageUtil.addErrorMessage(e.getMessageId()); + logger.log("EPA0005", new Object[] { this.toString() }, e); + } catch (Exception e) { + FacesMessageUtil.addErrorMessage("could.not.add.document.order"); + logger.log("EPA0007", new Object[] { this.toString() }, e); + } + return null; + } + + @TakeOver(type = TakeOverType.INCLUDE, properties = "mode,path,returnPath") + public Class<?> doDelete() { + try { + getSiteEditorService().deleteDocumentOrder(this); + FacesMessageUtil.addInfoMessage("deleted.document.order"); + return FolderOrderEditorPage.class; + } catch (CommonException e) { + FacesMessageUtil.addErrorMessage(e.getMessageId()); + logger.log("EPA0005", new Object[] { this.toString() }, e); + } catch (Exception e) { + FacesMessageUtil.addErrorMessage("could.not.delete.document.order"); + logger.log("EPA0007", new Object[] { this.toString() }, e); + } + return null; + } + + public String getDoUpValue() { + return getLabelHelper().getLabelValue("up"); + } + + public String getDoDownValue() { + return getLabelHelper().getLabelValue("down"); + } + + public String getDoAddValue() { + return getLabelHelper().getLabelValue("add"); + } + + public String getDoDeleteValue() { + return getLabelHelper().getLabelValue("delete"); + } +} Property changes on: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderOrderEditorPage.java ___________________________________________________________________ Name: svn:eol-style + native Added: pal-admin/trunk/src/main/webapp/view/site/folderOrderEditor.html =================================================================== --- pal-admin/trunk/src/main/webapp/view/site/folderOrderEditor.html 2007-08-24 01:40:54 UTC (rev 461) +++ pal-admin/trunk/src/main/webapp/view/site/folderOrderEditor.html 2007-08-24 01:42:52 UTC (rev 462) @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:te="http://www.seasar.org/teeda/extension"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <link rel="stylesheet" type="text/css" href="../../css/global.css" /> + </head> + <body> + <form id="folderEditorForTreeForm"> + <input id="path" type="hidden"/> + <input id="returnPath" type="hidden"/> +<!-- tree: BEGIN --> + <div style="width: 28%;height: 400px;float: left;border: 1px solid #666666;overflow: auto;"> + <div id="nodeItems"> + <div id="isFolder" style="white-space: nowrap;"> + <a id="jumpFolderInfoEditor" href="folderInfoEditor.html?mode=c&path=a&returnPath=b" style=""> + <img id="folderIcon" src="" border="0" style="vertical-align:middle;" /> + <span id="name-folder">Name</span> + </a> + </div> + <div id="isPage" style="white-space: nowrap;"> + <a id="jumpPageInfoEditor" href="pageInfoEditor.html?mode=c&path=a&returnPath=b" style=""> + <img id="pageIcon" src="" border="0" style="vertical-align:middle;" /> + <span id="name-page">Name</span> + </a> + </div> + </div> + </div> +<!-- tree: END --> + </form> +<!-- content: BEGIN --> + <dir style="width: 70%;float: left;padding: 5px;margin: 0px;"> + <form id="folderEditorForTabForm"> + <input id="path" type="hidden"/> + <input id="returnPath" type="hidden"/> + <div style="height: 20px;margin-bottom: 5px;padding: 2px;border: 1px dotted black;"> + <div style="float: left;"> + <label id="pathLabel">Path:</label> + <span id="currentPath">/path/path</span> + </div> + <div style="float: right;width:50px;text-align: right;"> + <a id="returnPathLink" href="" style="text-decoration: none;"><span id="finishLabel">Finish</span></a> + </div> + </div> + <div style="clear: both;padding: 0px 0px 3px 10px; margin:10px 0px 5px 0px;border-bottom:1px solid #000000;"> + <a id="jumpFolderInfoEditor-tab" href="folderInfoEditor.html?mode=c&path=a&returnPath=b" style="text-decoration: none;"> + <span id="infoTabLabel" style="font-weight: bold;color:#ffffff;background-color:#999999;border:1px solid #000000; padding: 3px 5px 3px 5px; margin: 0px 0px;">Info</span> + </a> + <a id="jumpFolderAddFolderAndPageEditor-tab" href="folderAddFolderAndPageEditor.html?mode=c&path=a&returnPath=b" style="text-decoration: none;"> + <span id="addTabLabel" style="font-weight: bold;color:#ffffff;background-color:#999999;border:1px solid #000000; padding: 3px 5px 3px 5px; margin: 0px 0px;">Add</span> + </a> + <label id="orderTabLabel" style="border-top:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #ffffff;border-left:1px solid #000000;padding: 3px 5px 3px 5px; margin: 0px 0px;">Order</label> + <a id="jumpFolderSecurityEditor-tab" href="folderSecurityEditor.html?mode=c&path=a&returnPath=b" style="text-decoration: none;"> + <span id="securityTabLabel" style="font-weight: bold;color:#ffffff;background-color:#999999;border:1px solid #000000; padding: 3px 5px 3px 5px; margin: 0px 0px;">Security</span> + </a> +<!-- + <a id="jumpPageMetadataEditor-tab" href="folderMetadataEditor.html?mode=c&path=a&returnPath=b" style="text-decoration: none;"> + <span id="metadataTabLabel" style="font-weight: bold;color:#ffffff;background-color:#999999;border:1px solid #000000; padding: 3px 5px 3px 5px; margin: 0px 0px;">Metadata</span> + </a> + --> + </div> + <div> + <span id="allMessages" fatalClass="portlet-msg-error" errorClass="portlet-msg-error" warnClass="portlet-msg-alert" infoClass="portlet-msg-info"></span> + </div> + </form> + <div> + <form id="folderEditorForListForm"> + <input id="path" type="hidden"/> + <input id="returnPath" type="hidden"/> + <div style="clear:both;"> + <div style="width:120px;float: left;"><label id="changeOrderTitleLabel" for="document">Title:</label></div> + <select id="document" size="10" style="width:200px;"> + <option value="bbb">hoge</option> + </select> + </div> + <div id="isEditable-update" style="margin-top: 20px;text-align: center;"> + <input id="doDown" type="button" value="Down"/> + <input id="doUp" type="button" value="Up"/> + <input id="doDelete" type="button" value="Delete" style="margin-left:20px;"/> + </div> + </form> + <form id="folderEditorForAddForm"> + <input id="path" type="hidden"/> + <input id="returnPath" type="hidden"/> + <div style="clear:both;margin-top:20px;"> + <div style="width:120px;float: left;"><label id="documentNameLabel" for="documentName">Document Name:</label></div> + <input id="documentName" type="text" size="30"/> + <input id="doAdd" type="button" value="Add"/> + </div> + </form> + </div> + </dir> + <br style="clear: both;" /> +<!-- content: END --> + </body> +</html> Property changes on: pal-admin/trunk/src/main/webapp/view/site/folderOrderEditor.html ___________________________________________________________________ Name: svn:eol-style + native