<%
/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */
%>

<div id="<portlet:namespace />saveStructureTemplateDialogWrapper" style="display: none;">
	<aui:fieldset>
		<div id="<portlet:namespace />saveStructureTemplateDialog" class="save-structure-template-dialog">
			<div class="portlet-msg-success save-structure-message aui-helper-hidden" id="<portlet:namespace />saveStructureMessage">
				<liferay-ui:message key="your-request-processed-successfully" />
			</div>

			<aui:input cssClass="save-structure-name lfr-input-text-container" label="structure-name" name="saveStructureStructureName" size="50" type="text" />

			<aui:input cssClass="save-structure-description" cols="80" label="description" name="saveStructureStructureDescription" rows="6" type="textarea" />

			<aui:a href="#" id="showStructureIdContainer"><liferay-ui:message key="change-structure-id" /> &raquo;</aui:a>

			<div class="journal-structureid-field aui-helper-hidden" id="<portlet:namespace />structureIdContainer">
				<aui:field-wrapper label="structure-id">
					<aui:input cssClas="lfr-input-text-container" label="" name="saveStructureStructureId" type="text" />
					<aui:input label="" name="saveStructureAutogenerateId" type="checkbox" value="<%= true %>" />
				</aui:field-wrapper>
			</div>
		</div>
	</aui:fieldset>
</div>

<div class="journal-article-edit-field-wrapper aui-helper-hidden" id="<portlet:namespace />journalArticleEditFieldWrapper">
	<aui:form method="post">
		<div class="journal-article-edit-field" id="<portlet:namespace />journalArticleEditField">
			<div class="portlet-msg-success journal-message aui-helper-hidden" id="<portlet:namespace />journalMessage">
				<liferay-ui:message key="your-request-processed-successfully" />
			</div>

			<strong><liferay-ui:message key="options" /></strong>

			<aui:select disabled="<%= true %>" name="fieldType">
				<aui:option label="text-field" value="text" />
				<aui:option label="text-box" value="text_box" />
				<aui:option label="text-area" value="text_area" />
				<aui:option label="checkbox" value="boolean" />
				<aui:option label="options" />
				<aui:option label="select-box" value="list" />
				<aui:option label="multi-selection-list" value="multi-list" />
				<aui:option label="image-uploader" value="image" />
				<aui:option label="image-gallery" value="image_gallery" />
				<aui:option label="document-library" value="document_library" />
				<aui:option label="link-to-page" value="link_to_layout" />
				<aui:option label="selection-break" value="selection_break" />
			</aui:select>

			<aui:input name="fieldLabel" type="text" />

			<aui:select label="index-type" name="indexType">
				<aui:option label="not-searchable" />
				<aui:option label="searchable-keyword" value="keyword" />
				<aui:option label="searchable-text" value="text" />
			</aui:select>

			<aui:input name="predefinedValue" type="text" />

			<fieldset class="user-instructions">
				<aui:input label="instructions-for-the-user" name="instructions" type="textarea" />

				<aui:input name="displayAsTooltip" type="checkbox" value="<%= true %>" />
			</fieldset>

			<aui:input name="repeatable" type="checkbox" value="<%= true %>" />

			<aui:input name="required" type="checkbox" value="<%= true %>" />

			<aui:button-row>
				<aui:button cssClass="save-button" name="save" type="button" value="save" />

				<aui:button cssClass="cancel-button" name="cancel" type="button" value="cancel" />

				<aui:button cssClass="close-button" name="close" type="button" value="close" />
			</aui:button-row>
		</div>
	</aui:form>
</div>

<div class="journal-fieldmodel-container" id="journalFieldModelContainer">
	<aui:fieldset>
		<div dataType="text">
			<aui:input cssClass="lfr-input-text-container" label="" name="text" size="55" type="text" />
		</div>

		<div dataType="text_area">
			<aui:input cssClass="lfr-input-text-container" label="" name="textArea" size="55" type="text" />
		</div>

		<div dataType="text_box">
			<aui:input cols="60" cssClass="lfr-textarea-container" label="" name="textBox" rows="10" size="55" type="textarea" />
		</div>

		<div dataType="image">
			<aui:input cssClass="journal-image-field lfr-input-text-container flexible" label="" name="text" size="40" type="file" />
		</div>

		<div dataType="image_gallery">
			<aui:input cssClass="lfr-input-text-container" inlineField="<%= true %>" label="" name="text" size="55" type="text" />

			<portlet:renderURL windowState="<%= LiferayWindowState.POP_UP.toString() %>" var="selectIGURL">
				<portlet:param name="struts_action" value="/journal/select_image_gallery" />
				<portlet:param name="groupId" value="<%= String.valueOf(groupId) %>" />
			</portlet:renderURL>

			<%
			Map<String,Object> data = new HashMap<String,Object>();

			data.put("ImagegalleryUrl", selectIGURL);
			%>

			<aui:button cssClass="journal-imagegallery-button" data="<%= data %>" value="select" />
		</div>

		<div dataType="document_library">
			<aui:input cssClass="lfr-input-text-container" inlineField="<%= true %>" label="" name="text" size="55" type="text" />

			<portlet:renderURL windowState="<%= LiferayWindowState.POP_UP.toString() %>" var="selectDLURL">
				<portlet:param name="struts_action" value="/journal/select_document_library" />
				<portlet:param name="groupId" value="<%= String.valueOf(groupId) %>" />
			</portlet:renderURL>

			<%
			data = new HashMap<String,Object>();

			data.put("DocumentlibraryUrl", selectDLURL);
			%>

			<aui:button cssClass="journal-documentlibrary-button" data="<%= data %>" value="select" />
		</div>

		<div dataType="boolean">
			<div class="journal-subfield">
				<aui:input cssClass="journal-article-field-label" name="booleanField" type="checkbox" />
			</div>
		</div>

		<div dataType="selection_break">
			<div class="separator"></div>
		</div>

		<div dataType="list">
			<div class="journal-list-subfield">
				<aui:select inlineField="" label="" name="list" />

				<span class="journal-icon-button journal-delete-field">
					<liferay-ui:icon image="delete" /><liferay-ui:message key="delete-selected-value" />
				</span>

				<div class="journal-edit-field-control">
					<br /><br />

					<input class="journal-list-key" title="<liferay-ui:message key="new-item" />" size="15" type="text" value="<liferay-ui:message key="new-item" />" />

					<input class="journal-list-value" size="15" title="<liferay-ui:message key="item-value" />" type="text" value="value" />

					<span class="journal-icon-button journal-add-field">
						<liferay-ui:icon image="add" /> <liferay-ui:message key="add-to-list" />
					</span>
				</div>
			</div>
		</div>

		<div dataType="multi-list">
			<div class="journal-list-subfield">
				<aui:select label="" multiple="true" name="multiList" />

				<span class="journal-icon-button journal-delete-field">
					<liferay-ui:icon image="delete" /><liferay-ui:message key="delete-selected-value" />
				</span>

				<div class="journal-edit-field-control">
					<br /><br />

					<input class="journal-list-key" size="15" title="<liferay-ui:message key="new-item" />" type="text" value="<liferay-ui:message key="new-item" />" />

					<input class="journal-list-value" size="15" title="<liferay-ui:message key="item-value" />" type="text" value="value" />

					<span class="journal-icon-button journal-add-field">
						<liferay-ui:icon image="add" /> <liferay-ui:message key="add-to-list" />
					</span>
				</div>
			</div>
		</div>

		<div dataType="link_to_layout">
			<aui:select label="" name="linkToLayout" showEmptyOption="<%= true %>">

				<%
				LayoutLister layoutLister = new LayoutLister();

				LayoutView layoutView = layoutLister.getLayoutView(layout.getGroupId(), layout.isPrivateLayout(), "root", locale);

				List layoutList = layoutView.getList();

				for (int i = 0; i < layoutList.size(); i++) {

					// id | parentId | ls | obj id | name | img | depth

					String layoutDesc = (String)layoutList.get(i);

					String[] nodeValues = StringUtil.split(layoutDesc, "|");

					long objId = GetterUtil.getLong(nodeValues[3]);
					String name = nodeValues[4];

					int depth2 = 0;

					if (i != 0) {
						depth2 = GetterUtil.getInteger(nodeValues[6]);
					}

					for (int j = 0; j < depth2; j++) {
						name = "-&nbsp;" + name;
					}

					Layout linkableLayout = null;

					try {
						linkableLayout = LayoutLocalServiceUtil.getLayout(objId);
					}
					catch (Exception e) {
					}

					if (linkableLayout != null) {
				%>

						<aui:option label="<%= name %>" value="<%= linkableLayout.getLayoutId() %>" />

				<%
				}
					}
				%>

			</aui:select>
		</div>

		<div id="repeatable-field-image-model">
			<span class="repeatable-field-image">
				<liferay-ui:icon cssClass="repeatable-field-add" image="add" />

				<liferay-ui:icon cssClass="repeatable-field-delete" image="delete" />
			</span>
		</div>
	</aui:fieldset>
</div>

<div class="aui-html-template" id="<portlet:namespace />editBtnTemplate">
	<aui:button cssClass="edit-button" type="button" value="edit-options" />
</div>

<div class="aui-html-template" id="<portlet:namespace />repeatableBtnTemplate">
	<aui:button cssClass="repeatable-button aui-helper-hidden" type="button" value="repeat" />
</div>