<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:a4j="http://richfaces.org/a4j"
               >
<rich:modalPanel id="message">
<f:facet name="header">Message</f:facet>
        <f:facet name="controls">
            <h:panelGroup>
                <h:graphicImage value="/img/modal/close.png" style="cursor:pointer" id="hidelink7"/>
                <rich:componentControl for="message" attachTo="hidelink7" operation="hide" event="onclick"/>
            </h:panelGroup>
        </f:facet>
        <a4j:form id="messageForm">
        <a4j:region renderRegionOnly="true">
        
            <h:panelGrid columns="1" id="editContent">
            <h:outputText rendered="#{modalPanelHelper.searchRequired}" value="Owner: "></h:outputText>
            <h:panelGroup rendered="#{modalPanelHelper.searchRequired}">
            	
            	<h:inputText rendered="#{modalPanelHelper.searchRequired}" value="#{message.ownerLogin}" id="text" />
                <rich:suggestionbox rendered="#{modalPanelHelper.searchRequired}" height="200" width="200" usingSuggestObjects="false" 
            suggestionAction="#{treeActionManager.availableUserLogins}" var="suggest" for="text" fetchValue="#{login}" id="suggestion">
            <h:column>
                        <h:outputText value="#{suggest}" />
                    </h:column>
            </rich:suggestionbox>
            </h:panelGroup>
            	<h:outputText value="Theme: "></h:outputText>
            	<h:outputText rendered="#{!modalPanelHelper.sendRequired}" value="#{message.theme}"></h:outputText>
            	<h:inputText rendered="#{modalPanelHelper.sendRequired}" required="true" id="theme" value="#{message.theme}">
                </h:inputText>
                <h:outputText value="Content: "></h:outputText>
                <h:outputText rendered="#{!modalPanelHelper.sendRequired}" value="#{message.message}"></h:outputText>
                <h:inputTextarea rendered="#{modalPanelHelper.sendRequired}" style="width:100%; height:100%" required="true" id="message" value="#{message.message}">
                </h:inputTextarea>
            </h:panelGrid>
            </a4j:region>
            <a4j:commandButton rendered="#{message.friendshipRequest and !modalPanelHelper.sendRequired}" value="Add to friends" reRender="panelBar" actionListener="#{treeActionManager.addToFriends(message.author)}" id="friendbutton" >
            <rich:toolTip followMouse="true" direction="top-right"
								showDelay="100" styleClass="tooltip">
								<span style="white-space: nowrap">
								 It is request for friendship message. You may add this user to your friends by clicking on the 'Add to Friends button'</span>
							</rich:toolTip>
            
            </a4j:commandButton>
            <a4j:commandButton rendered="#{modalPanelHelper.sendRequired}" oncomplete="#{rich:component('message')}.hide()" value="Send" actionListener="#{modalPanelHelper[modalPanelHelper.actionName]}" id="storebutton" />
                <button type="button" id="cancelbutton" onclick="#{rich:component('message')}.hide()">Close</button>
        </a4j:form>
    </rich:modalPanel>
    </ui:composition>