<%-- 
    Document   : add_template
    Created on : Apr 15, 2008, 2:59:13 PM
    Author     : aili
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
   
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
   
<f:view locale="#{facade.locale}">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>PETS</title>
        <link rel="stylesheet" type="text/css" media="screen,projection" href="<h:outputText value="#{conf.appRoot}"/>/style/pets.css">
        <script src='<h:outputText value="#{conf.appRoot}"/>/Jscript/javascript_main.js' type='text/javascript'></script>
        <script type="text/javascript" src="<h:outputText value="#{conf.appRoot}"/>/Jscript/tiny_mce/tiny_mce.js"></script>
        <script type="text/javascript">
        tinyMCE.init({
            language : "<h:outputText value="#{facade.language}" />",
            mode : "textareas",
            theme : "advanced",
            
            plugins : "attributes,fullpage",

            // Theme options
            theme_advanced_buttons1 : "attributes,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect,|,bullist,numlist,|,fullpage,image,|,forecolor,backcolor,|,sub,sup",
            theme_advanced_buttons2 : "",
            theme_advanced_buttons3 : "",
            theme_advanced_toolbar_location : "top",
            theme_advanced_toolbar_align : "left",
            theme_advanced_resizing : true,
            forced_root_block : false,
            force_br_newlines : true,
            force_p_newlines : false
        });
        </script>
    </head>
<body>
    <f:loadBundle basename="pets.i18n.messages" var="msgs" />
    <table class="main_table" cellpadding="0" cellspacing="0">
        <tr>
            <td class="header" colspan="3"></td>
        </tr>
        <tr>
            <td style="width:20%" rowspan="6" valign="top" >
                <h:form>
                    <h:commandLink action="#{facade.setLocale}" value="et">
                        <f:param name="langid" value="et" />
                    </h:commandLink>
                    &nbsp;
                    <h:commandLink action="#{facade.setLocale}" value="en">
                        <f:param name="langid" value="en" />
                    </h:commandLink>
                    <div style="clear:both;height:5px;">&nbsp;</div>
                    <div class="uname_div">
                        &nbsp;
                        <c:if test="${facade.loggedIn}">
                            <h:outputLink value="#{conf.appRoot}/auth/profile_view.faces">
                                <h:outputText value="#{Session.profile.fullName}" />
                            </h:outputLink>
                            <div class="small_text">
                                &nbsp;&nbsp;
                                <h:outputText rendered="#{Session.profile.userRole == 'user'}" value="#{msgs.candidate}" />
                                <h:outputText rendered="#{Session.profile.userRole == 'local_admin'}" value="#{msgs.scorer}" />
                                <h:outputText rendered="#{Session.profile.userRole == 'admin'}" value="#{msgs.proctor}" />
                                <h:outputText rendered="#{Session.profile.userRole == 'manager'}" value="manager" />
                            </div>
                        </c:if>
                    </div>
                </h:form>
            </td>
            <td></td>
            <td style="width:20%" rowspan="6"></td>
        </tr>
    <h:form id="template">
    <tr>
        <td>  
            <table cellpadding="0" cellspacing="0" class="menu">
                <tr style="height:21px">
                    <td colspan="4" />
                    <td align="center" valign="top"><img src="../../../style/arrow_down.gif" /></td>
                </tr>
                <%@ include file="../../../WEB-INF/jspf/UserMenu.jspf" %>
            </table>
            <ul class="submenu">
                <c:if test="${!CertificateBean.activeTemplate}">
                    <li><h:outputLink value="certificates_index.faces">
                            <h:outputText value="#{msgs.cert_templates}" /></h:outputLink></li>
                    <li class="active"><h:outputText value="#{msgs.add_template}" /></li>
                </c:if>
                <c:if test="${CertificateBean.activeTemplate}">
                    <li class="active"><h:outputText value="#{msgs.cert_templates}" /></li>
                    <li><h:commandLink action="#{CertificateBean.addTemplate}" >
                            <h:outputText value="#{msgs.add_template}" /></h:commandLink></li>
                </c:if>
            </ul>
        </td>                        
    </tr>
    <tr>
        <td class="heading">
            <h:messages layout="table" />
        </td>
    </tr>
        <tr>
            <td valign="top">
                <br />
                <h:outputText value="#{msgs.Template_name}: " />
                <h:inputText value="#{CertificateBean.templateName}" />
                <br /><br />
                <h:inputTextarea styleClass="template_textarea" id="template_body" value="#{CertificateBean.templateBody}"/>
                <br /><br />
                <h:commandButton value="#{msgs.Save}" action="#{CertificateBean.saveTemplate}"/>
                <input type="button" value="<h:outputText value="#{msgs.Cancel}" />" onClick="window.location.href='certificates_index.faces'" />
            </td>
        </tr>
    </h:form>
<%@ include file="../../../WEB-INF/jspf/Footer.jspf" %>
</f:view>