removed old log
This commit is contained in:
parent
b2ae45a2c4
commit
5dd1f5036b
src/main/java/se/su/dsv/scipro
@ -61,8 +61,6 @@ import se.su.dsv.scipro.json.pages.JsonSentMessagePage;
|
|||||||
import se.su.dsv.scipro.json.pages.JsonSetReadPage;
|
import se.su.dsv.scipro.json.pages.JsonSetReadPage;
|
||||||
import se.su.dsv.scipro.json.pages.JsonSetStatusPage;
|
import se.su.dsv.scipro.json.pages.JsonSetStatusPage;
|
||||||
import se.su.dsv.scipro.json.pages.JsonStatusPage;
|
import se.su.dsv.scipro.json.pages.JsonStatusPage;
|
||||||
import se.su.dsv.scipro.log.pages.ProjectLogPage;
|
|
||||||
import se.su.dsv.scipro.log.pages.SupervisorLogPage;
|
|
||||||
import se.su.dsv.scipro.loginlogout.pages.LoginPage;
|
import se.su.dsv.scipro.loginlogout.pages.LoginPage;
|
||||||
import se.su.dsv.scipro.loginlogout.pages.LogoutPage;
|
import se.su.dsv.scipro.loginlogout.pages.LogoutPage;
|
||||||
import se.su.dsv.scipro.message.pages.PrivateMessagesPage;
|
import se.su.dsv.scipro.message.pages.PrivateMessagesPage;
|
||||||
@ -221,7 +219,6 @@ public class SciProApplication extends RepositoryApplication implements IThemabl
|
|||||||
mountBookmarkablePage("noproject", NoActiveProjectPage.class);
|
mountBookmarkablePage("noproject", NoActiveProjectPage.class);
|
||||||
mountBookmarkablePage("project/checklist", ProjectChecklistPage.class);
|
mountBookmarkablePage("project/checklist", ProjectChecklistPage.class);
|
||||||
mountBookmarkablePage("project/checklist/viewchecklist", ProjectViewCheckListPage.class);
|
mountBookmarkablePage("project/checklist/viewchecklist", ProjectViewCheckListPage.class);
|
||||||
mountBookmarkablePage("project/notes", ProjectLogPage.class);
|
|
||||||
mountBookmarkablePage("projectideas", ProjectIdeaPage.class);
|
mountBookmarkablePage("projectideas", ProjectIdeaPage.class);
|
||||||
mountBookmarkablePage("projectideas/submit", ProjectIdeaSubmissionPage.class);
|
mountBookmarkablePage("projectideas/submit", ProjectIdeaSubmissionPage.class);
|
||||||
/*
|
/*
|
||||||
@ -233,7 +230,6 @@ public class SciProApplication extends RepositoryApplication implements IThemabl
|
|||||||
mountBookmarkablePage("supervisor/templates/editor", SupervisorScheduleTemplatesEditorPage.class);
|
mountBookmarkablePage("supervisor/templates/editor", SupervisorScheduleTemplatesEditorPage.class);
|
||||||
mountBookmarkablePage("supervisor/templates", SupervisorScheduleTemplatesPage.class);
|
mountBookmarkablePage("supervisor/templates", SupervisorScheduleTemplatesPage.class);
|
||||||
mountBookmarkablePage("supervisor/project/details", SupervisorProjectDetailsPage.class);
|
mountBookmarkablePage("supervisor/project/details", SupervisorProjectDetailsPage.class);
|
||||||
mountBookmarkablePage("supervisor/project/details/notes", SupervisorLogPage.class);
|
|
||||||
mountBookmarkablePage("supervisor/project/details/checklist", SupervisorChecklistPage.class);
|
mountBookmarkablePage("supervisor/project/details/checklist", SupervisorChecklistPage.class);
|
||||||
mountBookmarkablePage("supervisor/project/details/addchecklist", SupervisorAddCheckListToProjectPage.class);
|
mountBookmarkablePage("supervisor/project/details/addchecklist", SupervisorAddCheckListToProjectPage.class);
|
||||||
mountBookmarkablePage("supervisor/antiplagiarism", SupervisorAntiPlagiarismLinkPage.class);
|
mountBookmarkablePage("supervisor/antiplagiarism", SupervisorAntiPlagiarismLinkPage.class);
|
||||||
|
@ -1,86 +0,0 @@
|
|||||||
package se.su.dsv.scipro.log.facade;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.LogDao;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.LogEntryDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Log;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.LogEntry;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
|
||||||
import se.su.dsv.scipro.exceptions.RenderingSafeException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Service facade for logs and their log entries.
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class LogFacade {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private LogDao logDao;
|
|
||||||
@Autowired
|
|
||||||
private LogEntryDao logEntryDao;
|
|
||||||
private final Logger logger = Logger.getLogger(LogFacade.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves a log for the given project, if none exists it will be silently created and returned.
|
|
||||||
* If the project parameter is null, a wrapped UnsupportedOperationException is thrown.
|
|
||||||
* @param p
|
|
||||||
* @return The log.
|
|
||||||
*/
|
|
||||||
@Transactional
|
|
||||||
public Log retrieveLog(final Project p){
|
|
||||||
if(p == null)
|
|
||||||
throw new RenderingSafeException(new UnsupportedOperationException("Sorry, can't retrieve a log without a valid project"));
|
|
||||||
Log log = p.getLog();
|
|
||||||
if(log == null){
|
|
||||||
logger.debug("No existing log for project "+p+", creating a new one");
|
|
||||||
log = new Log(p);
|
|
||||||
log.updateTimeStamps();
|
|
||||||
log = logDao.save(log);
|
|
||||||
p.setLog(log);
|
|
||||||
}
|
|
||||||
return log;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new log entry and makes the needed object-state linking.
|
|
||||||
* If either parameter is null, a wrapped UnsupportedOperationException is thrown.
|
|
||||||
* @param log
|
|
||||||
* @param creator
|
|
||||||
* @param contents
|
|
||||||
* @return The newly created log entry.
|
|
||||||
*/
|
|
||||||
@Transactional
|
|
||||||
public LogEntry createNewLogEntry(final Log log, final User creator, String contents){
|
|
||||||
if (log == null || creator == null)
|
|
||||||
throw new RenderingSafeException(new UnsupportedOperationException("Sorry, can't create log entries without a valid log and creator"));
|
|
||||||
LogEntry le = new LogEntry(creator, contents, log);
|
|
||||||
// le.updateTimeStamps();
|
|
||||||
return( logEntryDao.save(le));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void deleteLogEntry(LogEntry logEntry){
|
|
||||||
logEntry = logEntryDao.reLoad(logEntry);
|
|
||||||
logEntry.setDeleted(true);
|
|
||||||
logEntryDao.save(logEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Queries for all the log entries in a log
|
|
||||||
* @param log
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Transactional(readOnly=true)
|
|
||||||
public List<LogEntry> retrieveLogEntries(final Log log){
|
|
||||||
// return log.getLogEntryList();
|
|
||||||
return logEntryDao.findAllNonDeletedByLog(log);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html
|
|
||||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<wicket:remove>
|
|
||||||
<link rel="stylesheet" type="text/css" href="../../../../../../webapp/css/scipro.css"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="../../../../../../webapp/css/blueprint/screen.css"/>
|
|
||||||
</wicket:remove>
|
|
||||||
<body>
|
|
||||||
<wicket:extend>
|
|
||||||
<div wicket:id="logPanel"></div>
|
|
||||||
</wicket:extend>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,52 +0,0 @@
|
|||||||
package se.su.dsv.scipro.log.pages;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.exceptions.RenderingSafeException;
|
|
||||||
import se.su.dsv.scipro.log.panels.LogPanel;
|
|
||||||
import se.su.dsv.scipro.project.pages.ProjectPage;
|
|
||||||
import se.su.dsv.scipro.security.auth.Authorization;
|
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
|
||||||
|
|
||||||
@Authorization(authorizedRoles={Roles.STUDENT})
|
|
||||||
public class ProjectLogPage extends ProjectPage{
|
|
||||||
|
|
||||||
// @SpringBean
|
|
||||||
// private LogDao logDao;
|
|
||||||
// @SpringBean
|
|
||||||
// private LogEntryDao logEntryDao;
|
|
||||||
|
|
||||||
public ProjectLogPage(PageParameters pp) {
|
|
||||||
|
|
||||||
super(pp);
|
|
||||||
if(getActiveProject() == null || getUser() == null)
|
|
||||||
throw new RenderingSafeException(new IllegalStateException("No valid project or user"));
|
|
||||||
add(new LogPanel("logPanel",getActiveProject(),getUser()));
|
|
||||||
|
|
||||||
// /*
|
|
||||||
// * Ladda log och logEntries
|
|
||||||
// */
|
|
||||||
// super(pp);
|
|
||||||
//
|
|
||||||
// Project project = SciProSession.get().getActiveProject();
|
|
||||||
//
|
|
||||||
// Log log = null;
|
|
||||||
// if (project.getLog()==null){
|
|
||||||
// //Om projektet ännu inte har en logg måste en skapas och sparas.
|
|
||||||
// log = new Log(project);
|
|
||||||
// log = logDao.save(log);
|
|
||||||
// }else{
|
|
||||||
// log = project.getLog();
|
|
||||||
// }//annars tar vi projektets redan existerande logg
|
|
||||||
//
|
|
||||||
// List<LogEntry> logEntryList = logEntryDao.findAllNonDeletedByLog(log); //denna metod hämtar denna logs ickedeletade inlägg
|
|
||||||
//
|
|
||||||
// WriteLogEntryPanel wlep = new WriteLogEntryPanel("wlep", logEntryList);
|
|
||||||
// add(wlep);
|
|
||||||
// LogEntriesPanel lep = new LogEntriesPanel("lep", logEntryList, true);
|
|
||||||
// add(lep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html
|
|
||||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<wicket:remove>
|
|
||||||
<link rel="stylesheet" type="text/css"
|
|
||||||
href="../../../../../../webapp/css/scipro.css" />
|
|
||||||
<link rel="stylesheet" type="text/css"
|
|
||||||
href="../../../../../../webapp/css/blueprint/screen.css" />
|
|
||||||
</wicket:remove>
|
|
||||||
<body>
|
|
||||||
<wicket:extend>
|
|
||||||
<div wicket:id="logPanel"></div>
|
|
||||||
</wicket:extend>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,60 +0,0 @@
|
|||||||
package se.su.dsv.scipro.log.pages;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
|
||||||
import org.apache.wicket.markup.html.basic.Label;
|
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.SciProSession;
|
|
||||||
import se.su.dsv.scipro.activityplan.panels.SupervisorActivityPlanPanel;
|
|
||||||
import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightSupervisorMyProjects;
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.LogEntryDao;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.LogEntry;
|
|
||||||
import se.su.dsv.scipro.exceptions.RenderingSafeException;
|
|
||||||
import se.su.dsv.scipro.log.panels.LogPanel;
|
|
||||||
import se.su.dsv.scipro.log.panels.SupervisorLogPanel;
|
|
||||||
import se.su.dsv.scipro.project.panels.LogEntriesPanel;
|
|
||||||
import se.su.dsv.scipro.security.auth.Authorization;
|
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
|
||||||
import se.su.dsv.scipro.supervisor.pages.AbstractSupervisorProjectDetailsPage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author fred-fri@dsv.su.se
|
|
||||||
*
|
|
||||||
* Displays log entries to the supervisor.
|
|
||||||
*/
|
|
||||||
@Authorization(authorizedRoles={Roles.EMPLOYEE})
|
|
||||||
public class SupervisorLogPage extends AbstractSupervisorProjectDetailsPage implements MenuHighlightSupervisorMyProjects {
|
|
||||||
|
|
||||||
// @SpringBean
|
|
||||||
// private LogEntryDao logEntryDao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor. If the project or log is null
|
|
||||||
* the constructor handles it and displays the
|
|
||||||
* appropriate error message to the user.
|
|
||||||
* @param pp
|
|
||||||
*/
|
|
||||||
public SupervisorLogPage(PageParameters pp) {
|
|
||||||
super(pp);
|
|
||||||
|
|
||||||
if(projectModel.getObject() == null)
|
|
||||||
throw new RenderingSafeException(new IllegalStateException("No valid project or user"));
|
|
||||||
// add(new LogPanel("logPanel", projectModel.getObject(),SciProSession.get().getUser()));
|
|
||||||
add(new SupervisorLogPanel("logPanel", projectModel.getObject(),SciProSession.get().getUser()));
|
|
||||||
|
|
||||||
// final Label noLogLabel = new Label("lep", "No log entries yet.");
|
|
||||||
// final Label noProjectLabel = new Label("lep", "No project selected.");
|
|
||||||
// final List<LogEntry> logEntryList = logEntryDao.findAllNonDeletedByLog(projectModel.getObject().getLog());
|
|
||||||
// final LogEntriesPanel lep = new LogEntriesPanel("lep", logEntryList, false);
|
|
||||||
// if (projectModel.getObject()==null){
|
|
||||||
// add(noProjectLabel);
|
|
||||||
// } else if (projectModel.getObject().getLog()==null || logEntryList.size() == 0){
|
|
||||||
// add(noLogLabel);
|
|
||||||
// } else {
|
|
||||||
// add(lep);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html
|
|
||||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<body>
|
|
||||||
<wicket:panel>
|
|
||||||
<div class="span-22" wicket:id="formContainer">
|
|
||||||
<div class="span-10">
|
|
||||||
<form wicket:id="logEntryForm">
|
|
||||||
<div>
|
|
||||||
<textarea wicket:id="contents">This is a comment</textarea>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<!-- <input type="submit" value="Submit" id="formsubmit" /> -->
|
|
||||||
<input wicket:id="saveButton" type="submit" value="Post note" class="append-bottom"/>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="span-10 last">
|
|
||||||
<div class="append-bottom"></div>
|
|
||||||
<div class="info-box rounded-box last">
|
|
||||||
<p>What is this?</p>
|
|
||||||
<div>
|
|
||||||
Use notes to jot down stuff related to the project, or anything really. <b>Remember!</b> The notes are <b>NOT</b> private! Admins and all the people included in the project, such as other students, supervisors, reviewers etc can read them too.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div wicket:id="logEntryListContainer" class="span-22">
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
<tr wicket:id="logEntryDataView">
|
|
||||||
<td>
|
|
||||||
|
|
||||||
<div class="rounded-box">
|
|
||||||
<div class="box-title rounded">
|
|
||||||
<span wicket:id="creator">1/1/2004</span> <span> on </span> <span
|
|
||||||
wicket:id="dateCreated">1/1/2004</span>
|
|
||||||
<!-- <span><img wicket:id="deleteIcon" class="right-corner-resource" /> </span> -->
|
|
||||||
<span><a href="#" class="right-corner-resource"
|
|
||||||
wicket:id="deleteLink"> <img class="round-box-icon"
|
|
||||||
wicket:id="deleteIcon" alt="Delete" title="Delete" />
|
|
||||||
</a></span>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<span wicket:id="contents">Comment text goes here.</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<div wicket:id="emptyLabel"></div>
|
|
||||||
<div wicket:id="navigator"></div>
|
|
||||||
</div>
|
|
||||||
<wicket:child />
|
|
||||||
</wicket:panel>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,172 +0,0 @@
|
|||||||
package se.su.dsv.scipro.log.panels;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
|
||||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
|
||||||
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
|
||||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
|
||||||
import org.apache.wicket.markup.html.basic.Label;
|
|
||||||
import org.apache.wicket.markup.html.form.Form;
|
|
||||||
import org.apache.wicket.markup.html.form.TextArea;
|
|
||||||
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
|
|
||||||
import org.apache.wicket.markup.html.panel.Panel;
|
|
||||||
import org.apache.wicket.markup.repeater.Item;
|
|
||||||
import org.apache.wicket.markup.repeater.data.DataView;
|
|
||||||
import org.apache.wicket.markup.repeater.data.ListDataProvider;
|
|
||||||
import org.apache.wicket.model.PropertyModel;
|
|
||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.DomainObject;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.LogEntry;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
|
||||||
import se.su.dsv.scipro.icons.ImageObject;
|
|
||||||
import se.su.dsv.scipro.log.facade.LogFacade;
|
|
||||||
import se.su.dsv.scipro.util.DateFormatter;
|
|
||||||
import se.su.dsv.scipro.util.JavascriptEventConfirmation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generic panel with artifacts for entering and viewing log entries. Uses facade helper.
|
|
||||||
* Has a boolean method (isAuthor) that controls whether entering new entries is allowed
|
|
||||||
* (or rather, whether the artifacts for making new entries are visible). In this class
|
|
||||||
* it is set to true. For supervisors, use the extended version of this class in which
|
|
||||||
* that boolean method is overridden and set to false.
|
|
||||||
*
|
|
||||||
* @author fred
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class LogPanel extends Panel{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@SpringBean
|
|
||||||
private LogFacade logFacade; //facade class takes care of persistence etc
|
|
||||||
|
|
||||||
private Project project;
|
|
||||||
private User user;
|
|
||||||
|
|
||||||
private List<LogEntry> logEntryList; //list with the logs log entries
|
|
||||||
private WebMarkupContainer logEntryListContainer; //container for the entries
|
|
||||||
|
|
||||||
private Label emptyLabel;
|
|
||||||
private PagingNavigator pagingNavigator;
|
|
||||||
|
|
||||||
//here comes the methods to be overriden by subclasses
|
|
||||||
protected boolean isAuthor() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LogPanel(final String id, final Project project, final User user) {
|
|
||||||
super(id);
|
|
||||||
this.project = project;
|
|
||||||
this.user = user;
|
|
||||||
|
|
||||||
dataViewInit();
|
|
||||||
formInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void formInit(){
|
|
||||||
WebMarkupContainer formContainer = new WebMarkupContainer("formContainer"); //container for the form
|
|
||||||
add(formContainer);
|
|
||||||
// formContainer.add(new LogEntryForm("logEntryForm"));
|
|
||||||
formContainer.add(new CommentForm("logEntryForm"));
|
|
||||||
formContainer.setVisible(isAuthor()); //only visible to authors
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dataViewInit(){
|
|
||||||
logEntryList = logFacade.retrieveLogEntries(logFacade.retrieveLog(project));//set the list to... the list!
|
|
||||||
Collections.sort(logEntryList); //sort the list
|
|
||||||
|
|
||||||
logEntryListContainer = new WebMarkupContainer("logEntryListContainer"); //instantiate the container
|
|
||||||
logEntryListContainer.setOutputMarkupId(true); //make it ajax targetable
|
|
||||||
|
|
||||||
DataView<LogEntry> dataView = new DataView<LogEntry>("logEntryDataView", new ListDataProvider<LogEntry>(logEntryList)) { //dataview using the list
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateItem(final Item<LogEntry> item) {
|
|
||||||
final LogEntry logEntry = item.getModelObject();
|
|
||||||
|
|
||||||
item.add(new Label("contents", logEntry.getContents())); //show contents
|
|
||||||
item.add(new Label("creator", logEntry.getCreator().toString()));//show creator/author
|
|
||||||
item.add(new DateFormatter(DateFormatter.FORMAT.EXTENDED).createFormattedDateLabel("dateCreated",((DomainObject) item.getModelObject()).getDateCreated()));//and date created
|
|
||||||
|
|
||||||
AjaxLink<Void> deleteLink = new AjaxLink<Void>("deleteLink"){ //deletelink
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
@Override
|
|
||||||
public void onClick(AjaxRequestTarget target) {
|
|
||||||
logFacade.deleteLogEntry(logEntry); //set lazy deleted
|
|
||||||
logEntryList.remove(logEntry); //remove it from the list that the dataview uses
|
|
||||||
target.addComponent(logEntryListContainer); //target the container containing the dataview
|
|
||||||
|
|
||||||
emptyLabel.setVisible(logEntryList.isEmpty());
|
|
||||||
target.addComponent(emptyLabel);
|
|
||||||
pagingNavigator.setVisible(!logEntryList.isEmpty());
|
|
||||||
target.addComponent(pagingNavigator);
|
|
||||||
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public boolean isVisible(){
|
|
||||||
return (user.equals(logEntry.getCreator()));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
deleteLink.add(new JavascriptEventConfirmation("onclick", "Are you sure you want to delete this note?"));
|
|
||||||
deleteLink.add(new ImageObject("deleteIcon", ImageObject.TWENTYFOUR + ImageObject.DELETE));
|
|
||||||
item.add(deleteLink);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
dataView.setItemsPerPage(10);
|
|
||||||
logEntryListContainer.add(dataView);
|
|
||||||
pagingNavigator = new PagingNavigator("navigator", dataView);
|
|
||||||
pagingNavigator.setVisible(!logEntryList.isEmpty());
|
|
||||||
pagingNavigator.setOutputMarkupId(true);
|
|
||||||
logEntryListContainer.add(pagingNavigator);
|
|
||||||
|
|
||||||
add(logEntryListContainer);
|
|
||||||
|
|
||||||
emptyLabel = new Label("emptyLabel", "No notes to show.");
|
|
||||||
emptyLabel.setVisible(logEntryList.isEmpty());
|
|
||||||
emptyLabel.setOutputMarkupId(true);
|
|
||||||
logEntryListContainer.add(emptyLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CommentForm extends Form{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private transient String text; //no need to serialize this
|
|
||||||
|
|
||||||
public CommentForm(String id) {
|
|
||||||
super(id);
|
|
||||||
|
|
||||||
final TextArea<String> contents = new TextArea<String>("contents", new PropertyModel<String>(CommentForm.this, "text")); //textArea for user to enter the log entry
|
|
||||||
// contents.setType(String.class); this is the default
|
|
||||||
contents.setOutputMarkupId(true);
|
|
||||||
add(contents);
|
|
||||||
|
|
||||||
add(new AjaxButton("saveButton") {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
@Override
|
|
||||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
|
||||||
LogEntry le = logFacade.createNewLogEntry(logFacade.retrieveLog(project), user, text); //create the entry
|
|
||||||
logEntryList.add(le); //add the new entry to the local list that the dataview uses
|
|
||||||
Collections.sort(logEntryList); //sort the list
|
|
||||||
|
|
||||||
contents.clearInput(); //clear the text area
|
|
||||||
contents.setModelObject(null); //make sure it "knows" the model has been changed
|
|
||||||
|
|
||||||
//ajax stuff
|
|
||||||
target.addComponent(logEntryListContainer);
|
|
||||||
target.addComponent(contents);
|
|
||||||
|
|
||||||
emptyLabel.setVisible(logEntryList.isEmpty());
|
|
||||||
target.addComponent(emptyLabel);
|
|
||||||
pagingNavigator.setVisible(!logEntryList.isEmpty());
|
|
||||||
target.addComponent(pagingNavigator);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
|
||||||
<body>
|
|
||||||
<wicket:panel>
|
|
||||||
<wicket:extend>
|
|
||||||
</wicket:extend>
|
|
||||||
</wicket:panel>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||||||
package se.su.dsv.scipro.log.panels;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
|
||||||
|
|
||||||
public class SupervisorLogPanel extends LogPanel{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public SupervisorLogPanel(String id, Project project, User user) {
|
|
||||||
super(id, project, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isAuthor() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -12,7 +12,6 @@ import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightChecklist;
|
|||||||
import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightProjectIdeas;
|
import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightProjectIdeas;
|
||||||
import se.su.dsv.scipro.conference.pages.ProjectConferencePage;
|
import se.su.dsv.scipro.conference.pages.ProjectConferencePage;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
import se.su.dsv.scipro.log.pages.ProjectLogPage;
|
|
||||||
import se.su.dsv.scipro.peer.pages.ProjectPeerPortalPage;
|
import se.su.dsv.scipro.peer.pages.ProjectPeerPortalPage;
|
||||||
import se.su.dsv.scipro.project.pages.FinalSeminarProjectListPage;
|
import se.su.dsv.scipro.project.pages.FinalSeminarProjectListPage;
|
||||||
import se.su.dsv.scipro.project.pages.NoActiveProjectPage;
|
import se.su.dsv.scipro.project.pages.NoActiveProjectPage;
|
||||||
|
@ -10,7 +10,6 @@ import se.su.dsv.scipro.activityplan.pages.SupervisorActivityPlanPage;
|
|||||||
import se.su.dsv.scipro.components.AbstractMenuPanel;
|
import se.su.dsv.scipro.components.AbstractMenuPanel;
|
||||||
import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightSupervisorChecklist;
|
import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightSupervisorChecklist;
|
||||||
import se.su.dsv.scipro.conference.pages.SupervisorConferencePage;
|
import se.su.dsv.scipro.conference.pages.SupervisorConferencePage;
|
||||||
import se.su.dsv.scipro.log.pages.SupervisorLogPage;
|
|
||||||
import se.su.dsv.scipro.supervisor.pages.AbstractSupervisorProjectDetailsPage;
|
import se.su.dsv.scipro.supervisor.pages.AbstractSupervisorProjectDetailsPage;
|
||||||
import se.su.dsv.scipro.supervisor.pages.SupervisorChecklistPage;
|
import se.su.dsv.scipro.supervisor.pages.SupervisorChecklistPage;
|
||||||
import se.su.dsv.scipro.supervisor.pages.SupervisorFilePage;
|
import se.su.dsv.scipro.supervisor.pages.SupervisorFilePage;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user