Skip to content

Instantly share code, notes, and snippets.

@sammso
Last active September 23, 2016 11:27
Show Gist options
  • Save sammso/8bc0bff1b5a80134216ea21cdc514cd9 to your computer and use it in GitHub Desktop.
Save sammso/8bc0bff1b5a80134216ea21cdc514cd9 to your computer and use it in GitHub Desktop.

Users

portalUtilReference=(serviceReference "com.liferay.portal.kernel.util.PortalUtil")
portalUtil=(service $portalUtilReference)
defaultCompanyId=($portalUtil getDefaultCompanyId)
userServiceReference=(serviceReference "com.liferay.portal.kernel.service.UserLocalService")
userService=(service $userServiceReference)
users=$userService getCompanyUsers $defaultCompanyId 0 100   
each $users { $it getFullName }

Dropping tables:

delete from Release_ where servletContextName = 'gradebook-service'; 
drop table SPACE_Assignment;
drop table SPACE_Submission;
<%@ include file="../init.jsp"%>

<%
	Assignment assignment =
		(Assignment) request.getAttribute("assignment");
	String redirect = request.getParameter("redirect");
	String title = (String) request.getAttribute("title");

	renderResponse.setTitle(title);
	portletDisplay.setShowBackIcon(true);
	portletDisplay.setURLBack(redirect);
		String description = "";
	
	if (assignment != null) {
		description = assignment.getDescription();
	}
%>


<c:choose>
	<c:when test="${not empty assignment}">
		<portlet:actionURL var="assignmentActionURL"
			name="/gradebook/assignment/edit">
			<portlet:param name="redirect" value="${param.redirect}" />
		</portlet:actionURL>
	</c:when>
	<c:otherwise>
		<portlet:actionURL var="assignmentActionURL"
			name="/gradebook/assignment/add">
			<portlet:param name="redirect" value="${param.redirect}" />
		</portlet:actionURL>
	</c:otherwise>
</c:choose>
<liferay-ui:error key="assignment-error" message="assignment-general-error" />
<liferay-ui:error key="assignment-id" message="assignment-id-error" />
<liferay-ui:error key="assignment-title" message="assignment-title-error" />
<liferay-ui:error key="assignment-description" message="assignment-description-error" />
<liferay-ui:error key="assignment-date" message="assignment-date-error" />


<div class="container-fluid-1280">

	<aui:model-context bean="<%=assignment%>" model="<%=Assignment.class%>" />

	<aui:form name="fm" action="${assignmentActionURL}" 
			onSubmit='<%= "event.preventDefault(); " + renderResponse.getNamespace() + "savePage();" %>' >

		<aui:input name="assignmentId" field="assignmentId" type="hidden" />
		<aui:fieldset-group markupView="lexicon">
			<aui:fieldset>
				<aui:input name="title">
					<aui:validator errorMessage="Please enter letters, words, numbers, or standard punctuation." name="custom">
					function(val, fieldNode, ruleValue) {
						var wordExpression = 
							new RegExp("^[^\\[\\]\\^$<>]*$");
						
						return wordExpression.test(val);
					}
					</aui:validator>
					<aui:validator name="required" />
				</aui:input>

				<label for="description"><liferay-ui:message key="description" /></label>	
				<div class="entry-description">
					<liferay-ui:input-editor contents="${assignment.description}"
					 editorName='alloyeditor'
					 name="descriptionEditor" placeholder="description" />
				</div>
				<aui:input name="description" type="hidden" />

				<aui:input name="dueDate">
					<aui:validator name="required" />
				</aui:input>
			</aui:fieldset>
		</aui:fieldset-group>
		<aui:button cssClass="btn-lg" type="submit" />
	</aui:form>
</div>
<aui:script>
	function <portlet:namespace />savePage() {
		var form = AUI.$(document.<portlet:namespace />fm);

		var descriptionEditor = window.<portlet:namespace />descriptionEditor;

		form.fm('description').val(descriptionEditor.getHTML());

		submitForm(form);
	}
</aui:script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment