view src/main/webapp/datasetFieldForEditFragment.xhtml @ 10:a50cf11e5178

Rewrite LGDataverse completely upgrading to dataverse4.0
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 08 Sep 2015 17:00:21 +0200
parents
children
line wrap: on
line source

<div
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:jsf="http://xmlns.jcp.org/jsf">

    <!-- input text start -->
    <span id="pre-input-#{dsf.datasetFieldType.name}" class="pre-input-tag"/>

    <p:inputText value="#{dsfv.valueForEdit}" id="inputText" tabindex="#{block.index+1}"
                 styleClass="form-control #{dsfv.datasetField.datasetFieldType.name == 'title' and DatasetPage.editMode == 'CREATE'  ? 'datasetfield-title' : ''}"
                 rendered="#{!dsfv.datasetField.datasetFieldType.controlledVocabulary
                             and (dsfv.datasetField.datasetFieldType.fieldType == 'TEXT'
                             or dsfv.datasetField.datasetFieldType.fieldType == 'INT'
                             or dsfv.datasetField.datasetFieldType.fieldType == 'FLOAT'
                             or dsfv.datasetField.datasetFieldType.fieldType == 'URL'
                             or dsfv.datasetField.datasetFieldType.fieldType == 'DATE'
                             or dsfv.datasetField.datasetFieldType.fieldType == 'EMAIL'
                             )}"/>

    <p:watermark for="inputText" value="#{dsfv.datasetField.datasetFieldType.watermark}"></p:watermark>

    <p:inputTextarea value="#{dsfv.valueForEdit}" id="description" tabindex="#{block.index+1}"
                     rows="5" cols="60" styleClass="form-control"
                     rendered="#{dsfv.datasetField.datasetFieldType.fieldType == 'TEXTBOX'}" />

    <p:watermark for="description" value="#{dsfv.datasetField.datasetFieldType.watermark}"></p:watermark>

    <div class="ui-message ui-message-error ui-widget ui-corner-all" aria-live="polite" jsf:rendered="#{dsfvIndex eq 0 and !empty dsfv.datasetField.validationMessage}">
        <span class="ui-message-error-detail">#{dsfv.datasetField.validationMessage}</span>
    </div>

    <div class="ui-message ui-message-error ui-widget ui-corner-all" aria-live="polite" jsf:rendered="#{!empty dsfv.validationMessage}">
        <span class="ui-message-error-detail">#{dsfv.validationMessage}</span>
    </div>

    <!-- This button / script is for replication data for the title field and is client side only -->
    <ui:fragment rendered="#{dsfv.datasetField.datasetFieldType.name == 'title' and DatasetPage.editMode == 'CREATE' }">
        <input type="button" id="replicationDataButton" tabindex="#{block.index+1}"
               class="btn btn-default" value="Add &#34;Replication Data for&#34; to Title"
               onclick="replicationFor();return false;"/>

        <script type="text/javascript">
            function replicationFor() {
                $(".datasetfield-title")[0].value = "Replication Data for: " + $(".datasetfield-title")[0].value;
                $('#replicationDataButton').prop('disabled', true);
            }
        </script>
    </ui:fragment>
</div>