Merge branch 'release-2011-12-21'
This commit is contained in:
commit
d397f99b6f
.gitignorepom.xml
resources/db_update_scripts
src/main/java/se/su/dsv/scipro
ApplicationSettings.javaDataInitialiser.javaSciProApplication.javaSciProSession.java
activityplan
facade
panels
admin
pages
AbstractAdminMatchPage.htmlAbstractAdminMatchPage.javaAdminCheckListPage.htmlAdminCheckListPage.javaAdminEditProjectIdeaPanel.htmlAdminEditProjectIdeaPanel.javaAdminScheduleTemplatesPage.javaProjectManagementPage.htmlProjectManagementPage.javaSystemMaintenancePage.htmlSystemMaintenancePage.java
match
AdminExemptionCreatePanel.htmlAdminExemptionCreatePanel.javaAdminExemptionPage.htmlAdminExemptionPage.javaAdminExemptionPanel.htmlAdminExemptionPanel.javaAdminKeywordPage.htmlAdminKeywordPage.javaAdminManageMatchPeriodsPage.htmlAdminManageMatchPeriodsPage.javaAdminManageMatchSupervisorPage.htmlAdminManageMatchSupervisorPage.javaAdminManageProjectIdeaPage.htmlAdminManageProjectIdeaPage.javaAdminMatchPeriodsPanel.htmlAdminMatchPeriodsPanel.javaAdminMatchSettingsPerProjectClassPage.htmlAdminMatchSettingsPerProjectClassPage.javaAutomaticMatchPage.htmlAutomaticMatchPage.javaAutomaticMatchPanel.htmlAutomaticMatchPanel.java
panels
AdminListCheckListTemplatePanel.htmlAdminListCheckListTemplatePanel.javaAdminRolesPanel.htmlAdminRolesPanel.javaAdminTabMenuPanel.javaAdminViewCheckListTemplatePanel.htmlAdminViewCheckListTemplatePanel.javaManualImportExportPanel.htmlManualImportExportPanel.javaManualMatchPanel.htmlManualMatchPanel.javaProjectIdeaActionPanel.htmlProjectIdeaActionPanel.java
match
AdminEditProjectIdeaPanel.htmlAdminEditProjectIdeaPanel.javaAdminManageProjectIdeaPanel.javaCreateKeywordPanel.htmlCreateKeywordPanel.javaEditKeywordPanel.htmlEditKeywordPanel.javaManageKeywordPanel.htmlManageKeywordPanel.javaMatchProjectIdeaManuallyPanel.javaProjectIdeaActionPanel.htmlProjectIdeaActionPanel.java
basepages
basepanels
checklists/panels
AlternateVariationPanel.htmlAlternateVariationPanel.javaAnswerDialogPanel.htmlAnswerDialogPanel.javaCheckListModel.javaFunctionalEditChecklistTemplatePanel.htmlFunctionalEditChecklistTemplatePanel.javaFunctionalListCheckListTemplatePanel.htmlFunctionalListCheckListTemplatePanel.javaListCheckListPanel.htmlListCheckListPanel.javaListCheckListTemplatePanel.javaShowChecklistFilePanel.htmlShowChecklistFilePanel.javaSummaryPanel.javaSupervisorAddChecklistPanel.htmlSupervisorAddChecklistPanel.javaSupervisorCategoryInfoPanel.htmlSupervisorCategoryInfoPanel.javaViewCheckListPanel.htmlViewCheckListPanel.javaViewCheckListPanel_by_questions.htmlViewCheckListPanel_by_respondent.htmlViewCheckListTemplatePanel.java
commentthread/panels
2
.gitignore
vendored
2
.gitignore
vendored
@ -9,3 +9,5 @@
|
||||
/.settings/*
|
||||
/.classpath/*
|
||||
/target/*
|
||||
bin
|
||||
.externalToolBuilders/
|
||||
|
25
pom.xml
25
pom.xml
@ -40,6 +40,12 @@
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Apache commons -->
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
<!-- LOGGING DEPENDENCIES - LOG4J -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@ -240,6 +246,17 @@
|
||||
<artifactId>wamblee-wicket-components</artifactId>
|
||||
<version>0.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- GUI test dependencies -->
|
||||
|
||||
<dependency>
|
||||
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@ -286,6 +303,14 @@
|
||||
</testResource>
|
||||
</testResources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.10</version>
|
||||
<configuration>
|
||||
<argLine>-Xmx512m</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<version>2.3.2</version>
|
||||
<inherited>true</inherited>
|
||||
|
220
resources/db_update_scripts/update_db-2011-12-21.sql
Normal file
220
resources/db_update_scripts/update_db-2011-12-21.sql
Normal file
@ -0,0 +1,220 @@
|
||||
ALTER TABLE `checklist_template` ADD `templateNumber` INT NOT NULL DEFAULT '999';
|
||||
ALTER TABLE `worker_data` ADD `lastSuccessfulRun` DATETIME NULL DEFAULT '2011-11-28 01:00:00' AFTER `lastRun`;
|
||||
|
||||
ALTER TABLE `project_class_settings` ADD `minAuthors` int(11) NOT NULL DEFAULT '1';
|
||||
ALTER TABLE `project_class_settings` ADD `maxAuthors` int(11) NOT NULL DEFAULT '2';
|
||||
|
||||
CREATE TABLE `ApplicationPeriod` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`dateCreated` datetime NOT NULL,
|
||||
`lastModified` datetime NOT NULL,
|
||||
`version` int(11) NOT NULL,
|
||||
`endDate` datetime DEFAULT NULL,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
`startDate` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `ApplicationPeriod_project_class` (
|
||||
`ApplicationPeriod_id` bigint(20) NOT NULL,
|
||||
`projectClass_id` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`ApplicationPeriod_id`,`projectClass_id`),
|
||||
KEY `FK97FDEC24BEC322C1` (`ApplicationPeriod_id`),
|
||||
KEY `FK97FDEC24B2B6081F` (`projectClass_id`),
|
||||
CONSTRAINT `FK97FDEC24B2B6081F` FOREIGN KEY (`projectClass_id`) REFERENCES `project_class` (`id`),
|
||||
CONSTRAINT `FK97FDEC24BEC322C1` FOREIGN KEY (`ApplicationPeriod_id`) REFERENCES `ApplicationPeriod` (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `Exemption` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`dateCreated` datetime NOT NULL,
|
||||
`lastModified` datetime NOT NULL,
|
||||
`version` int(11) NOT NULL,
|
||||
`comment` varchar(255) DEFAULT NULL,
|
||||
`author_id` bigint(20) NOT NULL,
|
||||
`grantedBy_id` bigint(20) NOT NULL,
|
||||
`projectClass_id` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `author_id` (`author_id`,`projectClass_id`),
|
||||
KEY `FK47352BA9B2B6081F` (`projectClass_id`),
|
||||
KEY `FK47352BA9314EAC85` (`author_id`),
|
||||
KEY `FK47352BA9DEC4D3D8` (`grantedBy_id`),
|
||||
CONSTRAINT `FK47352BA9DEC4D3D8` FOREIGN KEY (`grantedBy_id`) REFERENCES `user` (`id`),
|
||||
CONSTRAINT `FK47352BA9314EAC85` FOREIGN KEY (`author_id`) REFERENCES `role` (`id`),
|
||||
CONSTRAINT `FK47352BA9B2B6081F` FOREIGN KEY (`projectClass_id`) REFERENCES `project_class` (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `KeywordType` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`dateCreated` datetime NOT NULL,
|
||||
`lastModified` datetime NOT NULL,
|
||||
`version` int(11) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `Keyword` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`dateCreated` datetime NOT NULL,
|
||||
`lastModified` datetime NOT NULL,
|
||||
`version` int(11) NOT NULL,
|
||||
`deleted` bit(1) NOT NULL,
|
||||
`keyword` varchar(255) DEFAULT NULL,
|
||||
`type_id` bigint(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `FK32ADB5C9D59A80CA` (`type_id`),
|
||||
KEY `deleted_index` (`deleted`),
|
||||
CONSTRAINT `FK32ADB5C9D59A80CA` FOREIGN KEY (`type_id`) REFERENCES `KeywordType` (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `Language` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`dateCreated` datetime NOT NULL,
|
||||
`lastModified` datetime NOT NULL,
|
||||
`version` int(11) NOT NULL,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `projectIdea` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`dateCreated` datetime NOT NULL,
|
||||
`lastModified` datetime NOT NULL,
|
||||
`version` int(11) NOT NULL,
|
||||
`externalSupervisorInfo` varchar(255) DEFAULT NULL,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`practicalHow` varchar(1024) NOT NULL,
|
||||
`theoryHow` varchar(1024) NOT NULL,
|
||||
`what` varchar(1024) NOT NULL,
|
||||
`why` varchar(1024) NOT NULL,
|
||||
`match_id` bigint(20) DEFAULT NULL,
|
||||
`preferredSupervisor_id` bigint(20) DEFAULT NULL,
|
||||
`project_id` bigint(20) DEFAULT NULL,
|
||||
`projectClass_id` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `FKC7F5C9B0C1813915` (`project_id`),
|
||||
KEY `FKC7F5C9B048F01CA1` (`match_id`),
|
||||
KEY `FKC7F5C9B0B2B6081F` (`projectClass_id`),
|
||||
KEY `FKC7F5C9B0225C6E84` (`preferredSupervisor_id`),
|
||||
CONSTRAINT `FKC7F5C9B0225C6E84` FOREIGN KEY (`preferredSupervisor_id`) REFERENCES `role` (`id`),
|
||||
CONSTRAINT `FKC7F5C9B0B2B6081F` FOREIGN KEY (`projectClass_id`) REFERENCES `project_class` (`id`),
|
||||
CONSTRAINT `FKC7F5C9B0C1813915` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `matchings` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`dateCreated` datetime NOT NULL,
|
||||
`lastModified` datetime NOT NULL,
|
||||
`version` int(11) NOT NULL,
|
||||
`commentForAdmin` varchar(1024) DEFAULT NULL,
|
||||
`commentForStudent` varchar(1024) DEFAULT NULL,
|
||||
`points` int(11) NOT NULL,
|
||||
`status` varchar(255) DEFAULT NULL,
|
||||
`type` varchar(255) DEFAULT NULL,
|
||||
`createdBy_id` bigint(20) NOT NULL,
|
||||
`projectIdea_id` bigint(20) NOT NULL,
|
||||
`supervisor_id` bigint(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `FK24A2D4169AA5FCB` (`createdBy_id`),
|
||||
KEY `FK24A2D4164E31D7A1` (`projectIdea_id`),
|
||||
KEY `FK24A2D416BCA56165` (`supervisor_id`),
|
||||
CONSTRAINT `FK24A2D416BCA56165` FOREIGN KEY (`supervisor_id`) REFERENCES `role` (`id`),
|
||||
CONSTRAINT `FK24A2D4164E31D7A1` FOREIGN KEY (`projectIdea_id`) REFERENCES `projectIdea` (`id`),
|
||||
CONSTRAINT `FK24A2D4169AA5FCB` FOREIGN KEY (`createdBy_id`) REFERENCES `user` (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
ALTER TABLE projectIdea ADD CONSTRAINT `FKC7F5C9B048F01CA1` FOREIGN KEY (`match_id`) REFERENCES `matchings` (`id`);
|
||||
|
||||
CREATE TABLE `projectIdea_Keyword` (
|
||||
`projectIdea_id` bigint(20) NOT NULL,
|
||||
`keywords_id` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`projectIdea_id`,`keywords_id`),
|
||||
KEY `FK6C66763A4E31D7A1` (`projectIdea_id`),
|
||||
KEY `FK6C66763AAE316F00` (`keywords_id`),
|
||||
CONSTRAINT `FK6C66763AAE316F00` FOREIGN KEY (`keywords_id`) REFERENCES `Keyword` (`id`),
|
||||
CONSTRAINT `FK6C66763A4E31D7A1` FOREIGN KEY (`projectIdea_id`) REFERENCES `projectIdea` (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `projectIdea_Language` (
|
||||
`projectIdea_id` bigint(20) NOT NULL,
|
||||
`languages_id` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`projectIdea_id`,`languages_id`),
|
||||
KEY `FKA10C45274E31D7A1` (`projectIdea_id`),
|
||||
KEY `FKA10C452755E687C` (`languages_id`),
|
||||
CONSTRAINT `FKA10C452755E687C` FOREIGN KEY (`languages_id`) REFERENCES `Language` (`id`),
|
||||
CONSTRAINT `FKA10C45274E31D7A1` FOREIGN KEY (`projectIdea_id`) REFERENCES `projectIdea` (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `projectIdea_role` (
|
||||
`projectIdea_id` bigint(20) NOT NULL,
|
||||
`authors_id` bigint(20) NOT NULL,
|
||||
KEY `FK1904FDA54E31D7A1` (`projectIdea_id`),
|
||||
KEY `FK1904FDA57FEBE8A8` (`authors_id`),
|
||||
CONSTRAINT `FK1904FDA57FEBE8A8` FOREIGN KEY (`authors_id`) REFERENCES `role` (`id`),
|
||||
CONSTRAINT `FK1904FDA54E31D7A1` FOREIGN KEY (`projectIdea_id`) REFERENCES `projectIdea` (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `Employee_projectLimits` (
|
||||
`Employee_id` bigint(20) NOT NULL,
|
||||
`projectLimits` int(11) DEFAULT NULL,
|
||||
`projectLimits_KEY` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`Employee_id`,`projectLimits_KEY`),
|
||||
KEY `FKFFE408E01BF5E55` (`projectLimits_KEY`),
|
||||
KEY `FKFFE408E05FCBC05F` (`Employee_id`),
|
||||
CONSTRAINT `FKFFE408E05FCBC05F` FOREIGN KEY (`Employee_id`) REFERENCES `role` (`id`),
|
||||
CONSTRAINT `FKFFE408E01BF5E55` FOREIGN KEY (`projectLimits_KEY`) REFERENCES `project_class` (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `Employee_Keyword` (
|
||||
`role_id` bigint(20) NOT NULL,
|
||||
`keywords_id` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`role_id`,`keywords_id`),
|
||||
KEY `FKB402CDFB7B617197` (`role_id`),
|
||||
KEY `FKB402CDFBAE316F00` (`keywords_id`),
|
||||
CONSTRAINT `FKB402CDFBAE316F00` FOREIGN KEY (`keywords_id`) REFERENCES `Keyword` (`id`),
|
||||
CONSTRAINT `FKB402CDFB7B617197` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `Employee_Language` (
|
||||
`role_id` bigint(20) NOT NULL,
|
||||
`languages_id` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`role_id`,`languages_id`),
|
||||
KEY `FK603173EA55E687C` (`languages_id`),
|
||||
KEY `FK603173EA7B617197` (`role_id`),
|
||||
CONSTRAINT `FK603173EA7B617197` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
|
||||
CONSTRAINT `FK603173EA55E687C` FOREIGN KEY (`languages_id`) REFERENCES `Language` (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `Student_Exemption` (
|
||||
`role_id` bigint(20) NOT NULL,
|
||||
`exemptions_id` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`role_id`,`exemptions_id`),
|
||||
UNIQUE KEY `exemptions_id` (`exemptions_id`),
|
||||
KEY `FKEB360B202B6C61BA` (`role_id`),
|
||||
KEY `FKEB360B20259AA500` (`exemptions_id`),
|
||||
CONSTRAINT `FKEB360B20259AA500` FOREIGN KEY (`exemptions_id`) REFERENCES `Exemption` (`id`),
|
||||
CONSTRAINT `FKEB360B202B6C61BA` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
ALTER TABLE log ENGINE = InnoDB;
|
||||
ALTER TABLE log ADD CONSTRAINT `FK1A344C1813915` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`);
|
||||
|
||||
ALTER TABLE log_entry ENGINE = InnoDB;
|
||||
ALTER TABLE log_entry ADD CONSTRAINT `FK88028BB7AA87FAB5` FOREIGN KEY (`log_id`) REFERENCES `log` (`id`);
|
||||
ALTER TABLE log_entry ADD CONSTRAINT `FK88028BB7E44F4DBE` FOREIGN KEY (`creator_id`) REFERENCES `user` (`id`);
|
||||
|
||||
ALTER TABLE checklist_template_checklist_category ENGINE = InnoDB;
|
||||
ALTER TABLE checklist_category ENGINE = InnoDB;
|
||||
ALTER TABLE checklist_template_checklist_category ADD CONSTRAINT `FK4E82F44372B51E82` FOREIGN KEY (`checklist_template_id`) REFERENCES `checklist_template` (`id`);
|
||||
ALTER TABLE checklist_template_checklist_category ADD CONSTRAINT `FK4E82F4438725F1D` FOREIGN KEY (`categories_id`) REFERENCES `checklist_category` (`id`);
|
||||
|
||||
CREATE TABLE `checklist_checklist_category` (
|
||||
`checklist_id` bigint(20) NOT NULL,
|
||||
`categories_id` bigint(20) NOT NULL,
|
||||
`version` int(4) NOT NULL DEFAULT '0',
|
||||
KEY `FK54F86EB08725F1D` (`categories_id`),
|
||||
KEY `FK54F86EB01F327355` (`checklist_id`),
|
||||
CONSTRAINT `FK54F86EB01F327355` FOREIGN KEY (`checklist_id`) REFERENCES `checklist` (`id`),
|
||||
CONSTRAINT `FK54F86EB08725F1D` FOREIGN KEY (`categories_id`) REFERENCES `checklist_category` (`id`)
|
||||
) ENGINE=InnoDB;
|
@ -8,33 +8,36 @@ package se.su.dsv.scipro;
|
||||
*
|
||||
*/
|
||||
public class ApplicationSettings {
|
||||
|
||||
private boolean enableRemoteUserLookup;
|
||||
private String remoteLookupUrl;
|
||||
private String remoteLookupUser;
|
||||
private String remoteLookupPassword;
|
||||
private boolean acceptExternalAuthentication;
|
||||
|
||||
public boolean isEnableRemoteUserLookup() {
|
||||
return enableRemoteUserLookup;
|
||||
}
|
||||
|
||||
public void setEnableRemoteUserLookup(boolean enableRemoteUserLookup) {
|
||||
this.enableRemoteUserLookup = enableRemoteUserLookup;
|
||||
}
|
||||
|
||||
public void setRemoteLookupUrl(String remoteLookupUrl) {
|
||||
this.remoteLookupUrl = remoteLookupUrl;
|
||||
}
|
||||
|
||||
public String getRemoteLookupUrl() {
|
||||
return remoteLookupUrl;
|
||||
}
|
||||
|
||||
public String getRemoteLookupUser() {
|
||||
return remoteLookupUser;
|
||||
}
|
||||
public void setRemoteLookupUser(String remoteLookupUser) {
|
||||
this.remoteLookupUser = remoteLookupUser;
|
||||
}
|
||||
|
||||
public String getRemoteLookupPassword() {
|
||||
return remoteLookupPassword;
|
||||
}
|
||||
public void setRemoteLookupPassword(String remoteLookupPassword) {
|
||||
this.remoteLookupPassword = remoteLookupPassword;
|
||||
}
|
||||
|
||||
public boolean isAcceptExternalAuthentication(){
|
||||
return acceptExternalAuthentication;
|
||||
}
|
||||
|
||||
public void setAcceptExternalAuthentication(boolean pAcceptExternalAuthentication){
|
||||
acceptExternalAuthentication = pAcceptExternalAuthentication;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,14 +3,18 @@ package se.su.dsv.scipro;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ChecklistCategoryDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.LanguageDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.UsernameDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.ChecklistCategory;
|
||||
import se.su.dsv.scipro.data.dataobjects.Language;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.dataobjects.Username;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.KeywordTypeDao;
|
||||
import se.su.dsv.scipro.match.dataobject.KeywordType;
|
||||
|
||||
/**
|
||||
* Class defines default data to be pumped into database via dao-access.
|
||||
@ -26,6 +30,11 @@ public class DataInitialiser {
|
||||
private ProjectClassDao projectClassDao;
|
||||
@Autowired
|
||||
private ChecklistCategoryDao checklistCategoryDao;
|
||||
@Autowired
|
||||
private LanguageDao languageDao;
|
||||
@Autowired
|
||||
private KeywordTypeDao keywordTypeDao;
|
||||
|
||||
/**
|
||||
* Creates some default table entries for empty installations.
|
||||
*/
|
||||
@ -33,7 +42,10 @@ public class DataInitialiser {
|
||||
createDefaultProjectClasses();
|
||||
createDefaultUsers();
|
||||
createDefaultChecklistCategories();
|
||||
createDefaultLanguages();
|
||||
createDefaultKeywordTypes();
|
||||
}
|
||||
|
||||
private void createDefaultProjectClasses(){
|
||||
if( (projectClassDao.countAll() + projectClassDao.countAllLazyDeleted()) < 3){
|
||||
final ProjectClass masterClass = new ProjectClass(ProjectClass.MASTER,"Master","Master degree thesis project");;
|
||||
@ -105,4 +117,24 @@ public class DataInitialiser {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createDefaultLanguages() {
|
||||
if (languageDao.countAll() < 2) {
|
||||
final Language swedish = new Language("Swedish");
|
||||
final Language english = new Language("English");
|
||||
languageDao.save(swedish);
|
||||
languageDao.save(english);
|
||||
}
|
||||
}
|
||||
|
||||
private void createDefaultKeywordTypes() {
|
||||
for(KeywordTypeDao.TYPE type : KeywordTypeDao.TYPE.values()){
|
||||
if(keywordTypeDao.findByType(type) == null){
|
||||
KeywordType newType = new KeywordType(type.toDbName());
|
||||
newType = keywordTypeDao.save(newType);
|
||||
if(newType == null)
|
||||
throw new IllegalStateException("Something went wrong when creating the default set of KeywordType's");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,8 @@ import se.su.dsv.scipro.knol.resource.page.BookmarkableCategoryResourcePage;
|
||||
import se.su.dsv.scipro.knol.resource.page.BookmarkableResourcePage;
|
||||
import se.su.dsv.scipro.knol.resource.page.BookmarkableTagResourcePage;
|
||||
import se.su.dsv.scipro.knol.resource.page.ResourcePage;
|
||||
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.LogoutPage;
|
||||
import se.su.dsv.scipro.message.pages.PrivateMessagesPage;
|
||||
@ -76,7 +78,6 @@ import se.su.dsv.scipro.peer.pages.SupervisorPeerReviewGuidePage;
|
||||
import se.su.dsv.scipro.peer.pages.SupervisorPeerReviewPage;
|
||||
import se.su.dsv.scipro.peer.pages.SupervisorPeerStatsPage;
|
||||
import se.su.dsv.scipro.project.pages.FinalSeminarProjectListPage;
|
||||
import se.su.dsv.scipro.project.pages.LogPage;
|
||||
import se.su.dsv.scipro.project.pages.NoActiveProjectPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectChecklistPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectFilePage;
|
||||
@ -95,7 +96,6 @@ import se.su.dsv.scipro.supervisor.pages.SupervisorAddCheckListToProjectPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorAntiPlagiarismLinkPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorChecklistPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorFinalSeminarListingPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorLogPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorProjectDetailsPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorProjectsFinalSeminarPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorScheduleTemplatesEditorPage;
|
||||
@ -223,7 +223,7 @@ public class SciProApplication extends RepositoryApplication implements IThemabl
|
||||
mountBookmarkablePage("noproject", NoActiveProjectPage.class);
|
||||
mountBookmarkablePage("project/checklist", ProjectChecklistPage.class);
|
||||
mountBookmarkablePage("project/checklist/viewchecklist", ProjectViewCheckListPage.class);
|
||||
mountBookmarkablePage("project/notes", LogPage.class);
|
||||
mountBookmarkablePage("project/notes", ProjectLogPage.class);
|
||||
|
||||
/*
|
||||
* Supervisor pages
|
||||
@ -380,7 +380,7 @@ public class SciProApplication extends RepositoryApplication implements IThemabl
|
||||
if(session != null){
|
||||
if(session.isLoggedIn()){
|
||||
if(!helper.isRemoteUserValid(session.getUser())){//This check may not be needed and may hinder performance, but better safe than sorry for now.
|
||||
logger.debug("User is logged in as '"+session.getUser().getEmailAddress()+"', but conflicting info ('"+helper.getExternalAuthRemoteUser()+"') is supplied via external authentication protocols.");
|
||||
logger.debug("User is logged in as '"+session.getUser()+"', but conflicting info ('"+helper.getExternalAuthRemoteUser()+"') is supplied via external authentication protocols.");
|
||||
}
|
||||
}else{
|
||||
//logger.info("Attempting sign in with external auth data");
|
||||
|
@ -14,6 +14,7 @@ import org.apache.wicket.injection.web.InjectorHolder;
|
||||
import org.apache.wicket.protocol.http.WebSession;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.data.controllers.NotificationController;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||
@ -21,9 +22,9 @@ import se.su.dsv.scipro.data.dao.interfaces.UserSettingsDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
||||
import se.su.dsv.scipro.json.IUserLookupFromUsername;
|
||||
import se.su.dsv.scipro.json.RemoteLookupOptions;
|
||||
import se.su.dsv.scipro.json.RemoteLookupOptions.LOOKUP_DEPTH;
|
||||
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||
import se.su.dsv.scipro.io.ExternalImporter;
|
||||
import se.su.dsv.scipro.io.exceptions.ExternalImportException;
|
||||
import se.su.dsv.scipro.security.auth.Authenticator;
|
||||
import se.su.dsv.scipro.security.auth.roles.Admin;
|
||||
import se.su.dsv.scipro.security.auth.roles.DefaultRole;
|
||||
@ -33,7 +34,6 @@ import se.su.dsv.scipro.security.auth.roles.IRole;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
import se.su.dsv.scipro.security.auth.roles.Student;
|
||||
import se.su.dsv.scipro.security.auth.roles.SysAdmin;
|
||||
import se.su.dsv.scipro.util.KeyValuePair;
|
||||
|
||||
public class SciProSession extends WebSession {
|
||||
|
||||
@ -49,9 +49,11 @@ public class SciProSession extends WebSession {
|
||||
private ProjectDao projectDao;
|
||||
@SpringBean
|
||||
private UserSettingsDao userSettingsDao;
|
||||
@SpringBean
|
||||
private NotificationController notificationController;
|
||||
|
||||
@SpringBean
|
||||
private IUserLookupFromUsername userLookupFromUsername;
|
||||
private ExternalImporter externalImporter;
|
||||
|
||||
private List<IRole> iRoles = new ArrayList<IRole>();
|
||||
private User user = null;
|
||||
@ -178,9 +180,14 @@ public class SciProSession extends WebSession {
|
||||
if(iRoles.isEmpty()){
|
||||
iRoles.add(new DefaultRole());
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Set active project from users settings
|
||||
UserSettings userSettings = userSettingsDao.getUserSettings(user);
|
||||
if(userSettings != null){
|
||||
//TODO fix this call so it does not throw Null Pointers
|
||||
//notificationController.notifyFirstTimeLogin(user);
|
||||
Project activeProject = userSettings.getActiveProject();
|
||||
if(activeProject != null)
|
||||
activeProjectId = activeProject.getId();
|
||||
@ -190,11 +197,16 @@ public class SciProSession extends WebSession {
|
||||
userSettings = new UserSettings(user);
|
||||
activeProjectId = null;
|
||||
}
|
||||
//Set Notification priority to Low as default.
|
||||
if(userSettings.getNotificationPriority() == null) {
|
||||
userSettings.setNotificationPriority(NotificationPriority.LOW);
|
||||
}
|
||||
// With this userSettings.created() will return a users first login date and userSettings.modified() will return last login
|
||||
userSettings.setLastModified(new Date());
|
||||
userSettings = userSettingsDao.save(userSettings);
|
||||
logger.info("User: "+getLoggedInIdentity()+ " logged in to "+this.getApplication().getClass().getSimpleName()+
|
||||
" as: "+user.getFirstName()+" "+user.getLastName()+" "+user.getUserNames()+ " at: "+new Date());
|
||||
logger.info("Roles assigned: " +iRoles);
|
||||
loggedIn = true;
|
||||
return loggedIn;
|
||||
}
|
||||
@ -266,7 +278,13 @@ public class SciProSession extends WebSession {
|
||||
return false;
|
||||
}
|
||||
private User doUserLookup(final String username, final String realm) {
|
||||
final User u = userLookupFromUsername.lookup(new KeyValuePair<String>(username,realm), new RemoteLookupOptions(LOOKUP_DEPTH.PROJECT_AND_PARTICIPANTS));
|
||||
logger.debug("Attempting external import of user: " +username+"@"+realm);
|
||||
try{
|
||||
externalImporter.importUser(username+"@"+realm, true);
|
||||
}catch(final ExternalImportException eie){
|
||||
this.error("The user: "+username+"@"+realm+" was not found, try logging in manually.");
|
||||
}
|
||||
final User u = userDao.getUserByUsername(username, realm);
|
||||
if(u == null)
|
||||
logger.warn(username + " authenticated successfully, but the user was not available from remote system.");
|
||||
return u;
|
||||
|
@ -11,6 +11,7 @@ import javax.persistence.PersistenceException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.wicket.markup.html.form.upload.FileUpload;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.joda.time.DateMidnight;
|
||||
import org.joda.time.DateTime;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -19,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.FileDescriptionDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectScheduleDao;
|
||||
@ -27,6 +29,7 @@ import se.su.dsv.scipro.data.dao.interfaces.ScheduleTemplateDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||
import se.su.dsv.scipro.data.dataobjects.ChecklistCategory;
|
||||
import se.su.dsv.scipro.data.dataobjects.FileDescription;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
@ -63,6 +66,8 @@ public class ProjectScheduleFacade {
|
||||
|
||||
@Autowired
|
||||
private CheckListQuestionDao checklistQuestionDao;
|
||||
@Autowired
|
||||
private CheckListTemplateDao checklistTemplateDao;
|
||||
|
||||
public static final String BASE_PATH = "schedule_events";
|
||||
|
||||
@ -218,9 +223,16 @@ public class ProjectScheduleFacade {
|
||||
//added by fred. takes care of creating and adding a checklist to the events, using the checklist template connected to the event in the event template.
|
||||
final CheckListTemplate clt = eventTemplate.getChecklistTemplate()!=null?eventTemplate.getChecklistTemplate():null;
|
||||
if (clt!=null){
|
||||
CheckList cl = new CheckList(clt.getName(), schedule.getProject());
|
||||
|
||||
CheckListTemplate clt2 = checklistTemplateDao.reLoad(clt);
|
||||
List<ChecklistCategory> categoryList = new ArrayList<ChecklistCategory>();
|
||||
for(ChecklistCategory cc : clt2.getCategories()){
|
||||
categoryList.add(cc);
|
||||
}
|
||||
|
||||
CheckList cl = new CheckList(clt.getName(), schedule.getProject(), categoryList);
|
||||
// checkListDao.save(cl);
|
||||
for(String question : clt.getQuestions()){
|
||||
for (String question : clt.getQuestions()){
|
||||
CheckListQuestion clQuestion = new CheckListQuestion(question, cl.getNumberOfQuestions());
|
||||
cl.addQuestion(checklistQuestionDao.save(clQuestion));
|
||||
}
|
||||
|
@ -5,15 +5,15 @@
|
||||
<div>
|
||||
<form wicket:id="modeForm">
|
||||
<span wicket:id="modeGroup">
|
||||
<input type="radio" wicket:id="upcoming"/>Show upcoming events<br/>
|
||||
<input type="radio" wicket:id="past"/>Show past events<br/>
|
||||
<input type="radio" wicket:id="between"/>Show events between<br/>
|
||||
<input type="radio" wicket:id="upcoming"/>Show upcoming activities<br/>
|
||||
<input type="radio" wicket:id="past"/>Show past activities<br/>
|
||||
<input type="radio" wicket:id="between"/>Show activities between<br/>
|
||||
<span wicket:id="dateSelection">
|
||||
<span wicket:id="dateFrom">datePicker</span><br/>
|
||||
and <br/>
|
||||
<span wicket:id="dateTo">datePicker</span><br/>
|
||||
</span>
|
||||
<input type="radio" wicket:id="all"/>Show all events<br/>
|
||||
<input type="radio" wicket:id="all"/>Show all activities<br/>
|
||||
<input type="submit" style="display:none"/>
|
||||
</span>
|
||||
</form>
|
||||
@ -22,17 +22,17 @@
|
||||
<div wicket:id="editDialog">
|
||||
<div wicket:id="addScheduleEventPanel"></div>
|
||||
</div>
|
||||
<div><a href="#" wicket:id="createLink">create new event>></a></div>
|
||||
<div><a href="#" wicket:id="createLink">create new activity>></a></div>
|
||||
|
||||
<div wicket:id="addDialog">
|
||||
<div wicket:id="addScheduleEventPanel"></div>
|
||||
</div>
|
||||
<div><a href="#" wicket:id="addFromTemplateLink">add events from template>></a></div>
|
||||
<div><a href="#" wicket:id="addFromTemplateLink">add predefined activity plan using an activity plan template>></a></div>
|
||||
|
||||
<div wicket:id="saveAsTemplateDialog">
|
||||
<div wicket:id="saveAsTemplatePanel"></div>
|
||||
</div>
|
||||
<div><a href="#" wicket:id="saveAsTemplateLink">save as template>></a></div>
|
||||
<div><a href="#" wicket:id="saveAsTemplateLink">save as activity plan template>></a></div>
|
||||
|
||||
<div wicket:id=dataViewContainer>
|
||||
<div>
|
||||
@ -66,7 +66,7 @@
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="6" wicket:id="emptyLabel">No events in activity plan yet</td>
|
||||
<td colspan="6" wicket:id="emptyLabel">No activities in activity plan yet</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -11,6 +11,7 @@ import java.util.Set;
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.ajax.AjaxEventBehavior;
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
@ -43,6 +44,7 @@ import se.su.dsv.scipro.icons.ImageObject;
|
||||
import se.su.dsv.scipro.project.pages.ProjectViewCheckListPage;
|
||||
import se.su.dsv.scipro.repository.panels.FileViewDeletePanel;
|
||||
import se.su.dsv.scipro.util.DateFormatter;
|
||||
import se.su.dsv.scipro.util.JavascriptEventConfirmation;
|
||||
|
||||
public class ActivityPlanPanel extends Panel {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -113,6 +115,27 @@ public class ActivityPlanPanel extends Panel {
|
||||
sdp.setDateBoundaries(dateFrom.getModelObject(), dateTo.getModelObject());
|
||||
}
|
||||
};
|
||||
dateFrom.addOnChangeAjaxBehavior(new AjaxFormComponentUpdatingBehavior("onchange") {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void onUpdate(AjaxRequestTarget target) {
|
||||
sdp.setSearchMode(modeGroup.getModelObject());
|
||||
sdp.setDateBoundaries(dateFrom.getModelObject(), dateTo.getModelObject());
|
||||
}
|
||||
});
|
||||
dateTo.addOnChangeAjaxBehavior(new AjaxFormComponentUpdatingBehavior("onchange") {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void onUpdate(AjaxRequestTarget target) {
|
||||
sdp.setSearchMode(modeGroup.getModelObject());
|
||||
sdp.setDateBoundaries(dateFrom.getModelObject(), dateTo.getModelObject());
|
||||
}
|
||||
});
|
||||
|
||||
//Add radio button components to radio button control group based on available search-modes
|
||||
final ProjectScheduleEventDataProvider.SEARCH_MODE[] arr = ProjectScheduleEventDataProvider.SEARCH_MODE.values();
|
||||
//Java enums are stupid, why can't I just offset this with a named constant like in a "real" language ?
|
||||
@ -190,7 +213,7 @@ public class ActivityPlanPanel extends Panel {
|
||||
dataViewContainer = new WebMarkupContainer("dataViewContainer");
|
||||
|
||||
//Add info for the user should there be no events to display.
|
||||
emptyLabel = new Label("emptyLabel", "No events to show.");
|
||||
emptyLabel = new Label("emptyLabel", "No activities to show.");
|
||||
dataViewContainer.add(emptyLabel);
|
||||
emptyLabel.setOutputMarkupId(true); //Needs to be AJAX-enabled.
|
||||
|
||||
@ -266,7 +289,7 @@ public class ActivityPlanPanel extends Panel {
|
||||
return (willRenderDeleteLink(event));
|
||||
}
|
||||
}.add(new ImageObject("editImage", ImageObject.SIXTEEN + ImageObject.EDIT)));
|
||||
item.add(new AjaxLink<Void>("deleteEventLink"){
|
||||
final AjaxLink<Void> deleteEventLink = new AjaxLink<Void>("deleteEventLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
@ -279,7 +302,10 @@ public class ActivityPlanPanel extends Panel {
|
||||
public boolean isVisible(){
|
||||
return (willRenderDeleteLink(event));
|
||||
}
|
||||
}.add(new ImageObject("deleteImage", ImageObject.SIXTEEN + ImageObject.DELETE)));
|
||||
};
|
||||
deleteEventLink.add(new ImageObject("deleteImage", ImageObject.SIXTEEN + ImageObject.DELETE));
|
||||
deleteEventLink.add(new JavascriptEventConfirmation("onclick", "Are you sure you want to delete this event?"));
|
||||
item.add(deleteEventLink);
|
||||
}
|
||||
};
|
||||
|
||||
@ -311,7 +337,7 @@ public class ActivityPlanPanel extends Panel {
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
ProjectScheduleEvent dummy = new ProjectScheduleEvent();
|
||||
dummy.setDate(new Date());
|
||||
dummy.setName("new event");
|
||||
dummy.setName("new activity");
|
||||
dummy.setCreator(getUser());
|
||||
dummy.setProjectSchedule(getProjectSchedule());
|
||||
editScheduleEventPanel.setDataFromEvent(dummy);
|
||||
@ -376,11 +402,14 @@ public class ActivityPlanPanel extends Panel {
|
||||
sortFields.add("fileUpload");
|
||||
//do a simple translation
|
||||
final HashMap<String, String> headerMap = new HashMap<String,String>();
|
||||
headerMap.put("date","Event Date");
|
||||
headerMap.put("name", "Event name");
|
||||
headerMap.put("fileUpload", "Event resource");
|
||||
headerMap.put("date","Activity date");
|
||||
headerMap.put("name", "Activity name");
|
||||
headerMap.put("fileUpload", "Activity resource");
|
||||
for(final SortSpecifier spec : sdp.getAvailableSortSpecifiers(sortFields)){
|
||||
final String fieldBaseName = spec.getFieldName();
|
||||
if (fieldBaseName.equals("date")){
|
||||
sdp.setSortSpecifier(spec);
|
||||
}
|
||||
final Link<Void> link = new Link<Void>(fieldBaseName+"Sort"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
|
@ -8,7 +8,7 @@
|
||||
<wicket:panel>
|
||||
<form wicket:id="form">
|
||||
<div class="formRow">
|
||||
<strong>From template:</strong>
|
||||
<strong>From activity plan template:</strong>
|
||||
<select wicket:id="fromTemplate"></select>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
|
@ -19,9 +19,7 @@ import org.apache.wicket.model.PropertyModel;
|
||||
|
||||
import se.su.dsv.scipro.components.CustomDateTimeField;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.FileDescription;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectScheduleEvent;
|
||||
import se.su.dsv.scipro.util.DateFormatter;
|
||||
|
||||
/**
|
||||
* Abstract base class for handling editing/adding of ScheduleEvents
|
||||
@ -124,7 +122,7 @@ public abstract class EditScheduleEventPanel extends Panel {
|
||||
this.editable = editable;
|
||||
}
|
||||
/**
|
||||
* Deaults to true.
|
||||
* Defaults to true.
|
||||
* @return
|
||||
*/
|
||||
public boolean isEditable(){
|
||||
|
@ -14,7 +14,7 @@ public abstract class SaveAsTemplatePanel extends Panel {
|
||||
|
||||
public SaveAsTemplatePanel(final String id){
|
||||
super(id);
|
||||
final TextField<String> name = new TextField<String>("name",new Model<String>("template name"));
|
||||
final TextField<String> name = new TextField<String>("name",new Model<String>("Activity plan template name"));
|
||||
final TextArea<String> description = new TextArea<String>("description",new Model<String>("..."));
|
||||
name.setRequired(true);
|
||||
Form<Void> form = new Form<Void>("form"){
|
||||
|
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:extend>
|
||||
<div class="span-22 last">
|
||||
<div wicket:id="feedbackPanel"></div>
|
||||
<div class="span-5 append-1" wicket:id="menuPanel"></div>
|
||||
<div class="span-15 last">
|
||||
<wicket:child />
|
||||
</div>
|
||||
</div>
|
||||
</wicket:extend>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,57 @@
|
||||
package se.su.dsv.scipro.admin.pages;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
||||
|
||||
import se.su.dsv.scipro.admin.pages.match.AdminKeywordPage;
|
||||
import se.su.dsv.scipro.admin.pages.match.AdminManageMatchPeriodsPage;
|
||||
import se.su.dsv.scipro.admin.pages.match.AdminManageMatchSupervisorPage;
|
||||
import se.su.dsv.scipro.admin.pages.match.AdminManageProjectIdeaPage;
|
||||
import se.su.dsv.scipro.admin.pages.match.AdminMatchSettingsPerProjectClassPage;
|
||||
import se.su.dsv.scipro.admin.pages.match.AutomaticMatchPage;
|
||||
import se.su.dsv.scipro.admin.pages.match.AdminExemptionPage;
|
||||
import se.su.dsv.scipro.admin.pages.settings.AdminFinalSeminarSettingsPage;
|
||||
import se.su.dsv.scipro.admin.pages.settings.AdminFinalSeminarSettingsPerProjectClassPage;
|
||||
import se.su.dsv.scipro.admin.pages.settings.AdminGeneralSettingsPage;
|
||||
import se.su.dsv.scipro.admin.pages.settings.AdminPeerSettingsPage;
|
||||
import se.su.dsv.scipro.admin.pages.settings.AdminProjectClassSettingsPage;
|
||||
import se.su.dsv.scipro.admin.pages.settings.AdminServerEnvironmentSettingsPage;
|
||||
|
||||
import se.su.dsv.scipro.components.AbstractMenuPanel;
|
||||
import se.su.dsv.scipro.security.auth.Authorization;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
|
||||
@Authorization(authorizedRoles = { Roles.SYSADMIN })
|
||||
public abstract class AbstractAdminMatchPage extends AbstractAdminPage {
|
||||
|
||||
public AbstractAdminMatchPage(PageParameters pp) {
|
||||
super(pp);
|
||||
add(new FeedbackPanel("feedbackPanel").setOutputMarkupId(true));
|
||||
|
||||
add(new AbstractMenuPanel("menuPanel", AbstractAdminMatchPage.class, this.getClass()){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected List<MenuItem> getItemList() {
|
||||
final List<MenuItem> items = new ArrayList<MenuItem>();
|
||||
items.add(new MenuItem("Project ideas", AdminManageProjectIdeaPage.class));
|
||||
items.add(new MenuItem("Author limits", AdminMatchSettingsPerProjectClassPage.class));
|
||||
items.add(new MenuItem("Automatic match", AutomaticMatchPage.class));
|
||||
items.add(new MenuItem("Manage keywords", AdminKeywordPage.class));
|
||||
items.add(new MenuItem("Student exemptions", AdminExemptionPage.class));
|
||||
items.add(new MenuItem("Supervisor settings", AdminManageMatchSupervisorPage.class));
|
||||
items.add(new MenuItem("Application Periods", AdminManageMatchPeriodsPage.class));
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MenuType getMenuType() {
|
||||
return MenuType.VERTICAL;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>CheckLists</title>
|
||||
@ -7,14 +7,15 @@
|
||||
<body>
|
||||
<wicket:extend>
|
||||
<div class="span-22 last">
|
||||
<!-- Left column -->
|
||||
<div class="span-11 last">
|
||||
<div wicket:id="cCLPanel"></div>
|
||||
</div>
|
||||
<!-- Left column -->
|
||||
<!-- <div class="span-11 last"> -->
|
||||
<!-- <div wicket:id="cCLPanel"></div> -->
|
||||
<!-- </div> -->
|
||||
<!-- Right column -->
|
||||
<div class="span-11 last">
|
||||
<div wicket:id="listCLPanel"></div>
|
||||
</div>
|
||||
<!-- <div class="span-11 last"> -->
|
||||
<!-- <div wicket:id="listCLPanel"></div> -->
|
||||
<div wicket:id="flcltp"></div>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</wicket:extend>
|
||||
</body>
|
||||
|
@ -4,6 +4,7 @@ import org.apache.wicket.PageParameters;
|
||||
|
||||
import se.su.dsv.scipro.admin.panels.AdminListCheckListTemplatePanel;
|
||||
import se.su.dsv.scipro.checklists.panels.CreateChecklistTemplatePanel;
|
||||
import se.su.dsv.scipro.checklists.panels.FunctionalListCheckListTemplatePanel;
|
||||
import se.su.dsv.scipro.data.enums.CheckListRole;
|
||||
import se.su.dsv.scipro.security.auth.Authorization;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
@ -21,8 +22,9 @@ public class AdminCheckListPage extends AbstractAdminPage {
|
||||
|
||||
public AdminCheckListPage(PageParameters pp) {
|
||||
super(pp);
|
||||
add(new CreateChecklistTemplatePanel("cCLPanel"));
|
||||
add(new AdminListCheckListTemplatePanel("listCLPanel", pp, CheckListRole.ADMIN));
|
||||
// add(new CreateChecklistTemplatePanel("cCLPanel"));
|
||||
// add(new AdminListCheckListTemplatePanel("listCLPanel", pp, CheckListRole.ADMIN));
|
||||
add(new FunctionalListCheckListTemplatePanel("flcltp"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<a href="#" wicket:id="dialogLink">Edit</a>
|
||||
<div wicket:id="dialog">
|
||||
<a href="#" wicket:id="watsonLink">Project idea details</a>
|
||||
|
|
||||
<a href="#" wicket:id="actionLink">Actions</a>
|
||||
<div wicket:id="mainPanel"></div>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,96 @@
|
||||
package se.su.dsv.scipro.admin.pages;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
import se.su.dsv.scipro.admin.panels.ProjectIdeaActionPanel;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
import se.su.dsv.scipro.supervisor.panels.WatsonInfoPanel;
|
||||
|
||||
public class AdminEditProjectIdeaPanel extends Panel {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Panel watsonPanel;
|
||||
private Panel actionPanel;
|
||||
private Panel currentPanel;
|
||||
private Dialog dialog;
|
||||
private AjaxFallbackLink<Void> watsonLink;
|
||||
private AjaxFallbackLink<Void> actionLink;
|
||||
|
||||
public AdminEditProjectIdeaPanel(String id, IModel<Match> matchModel) {
|
||||
super(id);
|
||||
|
||||
dialog = new Dialog("dialog");
|
||||
dialog.setTitle("Edit project idea: " + matchModel.getObject().getProjectIdea().getTitle());
|
||||
add(dialog);
|
||||
add(new AjaxLink<Void>("dialogLink") {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
if (target != null) {
|
||||
dialog.open(target);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
watsonPanel = new WatsonInfoPanel("mainPanel", matchModel.getObject().getProjectIdea());
|
||||
actionPanel = new ProjectIdeaActionPanel("mainPanel", matchModel);
|
||||
currentPanel = watsonPanel;
|
||||
currentPanel.setOutputMarkupId(true);
|
||||
watsonPanel.setOutputMarkupId(true);
|
||||
actionPanel.setOutputMarkupId(true);
|
||||
watsonLink = new AjaxFallbackLink<Void>("watsonLink") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return currentPanel != watsonPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
currentPanel.replaceWith(watsonPanel);
|
||||
currentPanel = watsonPanel;
|
||||
|
||||
if (target != null) {
|
||||
target.addComponent(currentPanel);
|
||||
target.addComponent(actionLink);
|
||||
target.addComponent(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
watsonLink.setOutputMarkupId(true);
|
||||
dialog.add(watsonLink);
|
||||
|
||||
actionLink = new AjaxFallbackLink<Void>("actionLink") {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return currentPanel != actionPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
currentPanel.replaceWith(actionPanel);
|
||||
currentPanel = actionPanel;
|
||||
|
||||
if (target != null) {
|
||||
target.addComponent(currentPanel);
|
||||
target.addComponent(watsonLink);
|
||||
target.addComponent(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
actionLink.setOutputMarkupId(true);
|
||||
dialog.add(actionLink);
|
||||
|
||||
dialog.add(currentPanel);
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
@Authorization(authorizedRoles={Roles.SYSADMIN,Roles.ADMIN})
|
||||
public class AdminScheduleTemplatesPage extends AbstractAdminPage {
|
||||
|
||||
public static final String MAIN_MENU_LABEL = "Schedule Templates";
|
||||
public static final String MAIN_MENU_LABEL = "Activity plan templates";
|
||||
|
||||
public AdminScheduleTemplatesPage(final PageParameters pp){
|
||||
super(pp);
|
||||
|
@ -2,78 +2,8 @@
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:extend>
|
||||
<table class="rounded-corner">
|
||||
<tr>
|
||||
<th class="rounded-left-top"><a href="#" wicket:id="idSort">Id</a></th>
|
||||
<th><a href="#" wicket:id="lastModifiedSort">Modified</a></th>
|
||||
<th><a href="#" wicket:id="titleSort">Title</a></th>
|
||||
<th><a href="#" wicket:id="headSupervisorSort">Head supervisor</a></th>
|
||||
<th class="rounded-right-top">Edit</th>
|
||||
</tr>
|
||||
<tr wicket:id="projectDataView">
|
||||
<td><span wicket:id="id">[id]</span></td>
|
||||
<td><span wicket:id="modified"></span></td>
|
||||
<td><span wicket:id="title">[title]</span></td>
|
||||
<td><span wicket:id="headSupervisor">[A Person]</span></td>
|
||||
<td><a href=# wicket:id="editLink">Edit</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="span-18 last">
|
||||
<span wicket:id="navigator">[dataview navigator]</span>
|
||||
</div>
|
||||
|
||||
<div class="span-18 last">
|
||||
<a href=# wicket:id="createLink">Create new project</a>
|
||||
</div>
|
||||
|
||||
<div class="span-18 last">
|
||||
<div wicket:id="feedback"></div>
|
||||
</div>
|
||||
|
||||
<div class="span-18 last form-border" wicket:id="formContainer">
|
||||
<form wicket:id="projectCreationForm">
|
||||
<div>
|
||||
<strong>Exists in Daisy/Match-system</strong>
|
||||
<div wicket:id="existsInOtherSystems">NO</div>
|
||||
</div>
|
||||
<label for="projectTitle">Project title</label>
|
||||
<div>
|
||||
<input type="text" id="projectTitle" wicket:id="titleField"
|
||||
size="60"></input>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="projectClass">Type of project</label>
|
||||
</div>
|
||||
<span wicket:id="projectClass"> <input type="radio"
|
||||
id="projectClass" />
|
||||
</span>
|
||||
|
||||
<div>
|
||||
<label for="students">Participating students</label>
|
||||
</div>
|
||||
<div wicket:id="projectParticipants" id="students"></div>
|
||||
|
||||
<div>
|
||||
<label for="headSupervisor">Head supervisor</label>
|
||||
</div>
|
||||
<div wicket:id="headSupervisor" id="headSupervisor"></div>
|
||||
|
||||
<div>
|
||||
<label for="followers">Add/edit project followers</label>
|
||||
</div>
|
||||
|
||||
<div wicket:id="followers" id="followers"></div>
|
||||
|
||||
|
||||
<div class="span-18 last">
|
||||
<input type="submit" name="Save" title="Save" value="Save" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<wicket:extend>
|
||||
<div wicket:id="pmp"></div>
|
||||
</wicket:extend>
|
||||
</body>
|
||||
</html>
|
@ -1,391 +1,17 @@
|
||||
package se.su.dsv.scipro.admin.pages;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.wicket.Component;
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.Response;
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
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.RadioChoice;
|
||||
import org.apache.wicket.markup.html.form.RequiredTextField;
|
||||
import org.apache.wicket.markup.html.link.Link;
|
||||
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
|
||||
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
||||
import org.apache.wicket.markup.repeater.Item;
|
||||
import org.apache.wicket.markup.repeater.data.DataView;
|
||||
import org.apache.wicket.model.CompoundPropertyModel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.apache.wicket.validation.validator.StringValidator;
|
||||
import org.odlabs.wiquery.core.effects.EffectBehavior;
|
||||
import org.odlabs.wiquery.core.effects.EffectSpeed;
|
||||
import org.odlabs.wiquery.core.effects.basic.Delay;
|
||||
import org.odlabs.wiquery.core.effects.fading.FadeOut;
|
||||
import org.wicketstuff.objectautocomplete.ObjectAutoCompleteBuilder;
|
||||
import org.wicketstuff.objectautocomplete.ObjectAutoCompleteField;
|
||||
import org.wicketstuff.objectautocomplete.ObjectAutoCompleteRenderer;
|
||||
import org.wicketstuff.objectautocomplete.ObjectReadOnlyRenderer;
|
||||
|
||||
import se.su.dsv.scipro.components.autocomplete.AutoCompletionChoicesProvider;
|
||||
import se.su.dsv.scipro.components.autocomplete.MultiObjectAutoCompleteBuilder;
|
||||
import se.su.dsv.scipro.components.autocomplete.MultiObjectAutoCompleteField;
|
||||
import se.su.dsv.scipro.components.autocomplete.MultiObjectAutoCompleteObjectConverter;
|
||||
import se.su.dsv.scipro.components.autocomplete.MultiObjectAutoCompleteRenderer;
|
||||
import se.su.dsv.scipro.components.autocomplete.TeamMemberMultiObjectAutoCompleteBuilder;
|
||||
import se.su.dsv.scipro.components.autocomplete.TeamMemberMultiObjectAutoCompleteField;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectTeamMember;
|
||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||
import se.su.dsv.scipro.data.facade.ProjectFacade;
|
||||
import se.su.dsv.scipro.dataproviders.ProjectDataProvider;
|
||||
import se.su.dsv.scipro.dataproviders.SortSpecifier;
|
||||
import se.su.dsv.scipro.dataproviders.SortableDataProvider;
|
||||
import se.su.dsv.scipro.project.panels.ProjectManagementPanel;
|
||||
import se.su.dsv.scipro.security.auth.Authorization;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
import se.su.dsv.scipro.util.DateFormatter;
|
||||
import se.su.dsv.scipro.util.WiQueryCoreEffectsHelper;
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
@Authorization(authorizedRoles={Roles.SYSADMIN,Roles.ADMIN})
|
||||
public class ProjectManagementPage extends AbstractAdminPage {
|
||||
|
||||
public static final String MAIN_MENU_LABEL = "Manage Projects";
|
||||
|
||||
@SpringBean
|
||||
private ProjectDao projectDao;
|
||||
@SpringBean
|
||||
private ProjectClassDao projectClassDao;
|
||||
@SpringBean
|
||||
private RoleDao roleDao;
|
||||
|
||||
@SpringBean
|
||||
private ProjectFacade facade;
|
||||
|
||||
private final WebMarkupContainer formContainer;
|
||||
private ProjectCreationForm form;
|
||||
private CompoundPropertyModel<ProjectContainer> projectModel;
|
||||
|
||||
public ProjectManagementPage(PageParameters pp){
|
||||
|
||||
public ProjectManagementPage(PageParameters pp) {
|
||||
super(pp);
|
||||
FeedbackPanel feedbackPanel = new FeedbackPanel("feedback");
|
||||
feedbackPanel.add(new EffectBehavior(new Delay(5000))).add(new EffectBehavior(new FadeOut(EffectSpeed.SLOW)));
|
||||
add(feedbackPanel);
|
||||
|
||||
formContainer = new WebMarkupContainer("formContainer");
|
||||
formContainer.setOutputMarkupId(true);
|
||||
formContainer.setOutputMarkupPlaceholderTag(true);
|
||||
add(formContainer);
|
||||
|
||||
projectModel = new CompoundPropertyModel<ProjectContainer>(new ProjectContainer(new Project()));
|
||||
|
||||
form = new ProjectCreationForm("projectCreationForm", projectModel);
|
||||
formContainer.add(form);
|
||||
formContainer.setVisible(false);
|
||||
|
||||
final SortableDataProvider<Project> dataProvider = new ProjectDataProvider(/*SortableDataProvider.MODIFIED_DESC*/);
|
||||
DataView<Project> dataView = new DataView<Project>("projectDataView",dataProvider, 20) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(final Item<Project> item) {
|
||||
final Project project = item.getModelObject();
|
||||
item.add(new DateFormatter().createFormattedDateLabel("modified", project.getLastModified()));
|
||||
item.add(new Label("id", project.getId().toString()));
|
||||
item.add(new Label("title", project.getTitle()));
|
||||
String supervisorString = "";
|
||||
if(project.getHeadSupervisor() != null)
|
||||
supervisorString = project.getHeadSupervisor().getUser().toString();
|
||||
item.add(new Label("headSupervisor", supervisorString));
|
||||
item.add(new AjaxLink<Void>("editLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
updateCreationForm(projectDao.reLoad(project));
|
||||
target.addComponent(WiQueryCoreEffectsHelper.slideDown(formContainer, EffectSpeed.FAST));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
add(dataView);
|
||||
add(new PagingNavigator("navigator", dataView));
|
||||
|
||||
//Add sorting controllers
|
||||
final Set<String> wantedControllers = new HashSet<String>();
|
||||
wantedControllers.add("id");
|
||||
wantedControllers.add("lastModified");
|
||||
wantedControllers.add("title");
|
||||
wantedControllers.add("headSupervisor");
|
||||
for(final SortSpecifier spec : dataProvider.getAvailableSortSpecifiers(wantedControllers)){
|
||||
add(new Link<Void>(spec.getFieldName()+"Sort"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onClick(){
|
||||
SortSpecifier current = dataProvider.getSortSpecifier();
|
||||
if(!spec.equals(current))
|
||||
dataProvider.setSortSpecifier(spec);
|
||||
else
|
||||
dataProvider.setAscendingOrder(!dataProvider.isAscendingOrder());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
AjaxLink<Void> createLink = new AjaxLink<Void>("createLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
//updateCreationForm(projectDao.findAll().get(0));
|
||||
updateCreationForm(new Project());
|
||||
//target.addComponent(formContainer);
|
||||
target.addComponent(WiQueryCoreEffectsHelper.slideDown(formContainer, EffectSpeed.FAST));
|
||||
}
|
||||
};
|
||||
add(createLink);
|
||||
}
|
||||
|
||||
private void updateCreationForm(Project project){
|
||||
formContainer.setVisible(true);
|
||||
formContainer.removeAll();
|
||||
|
||||
projectModel.setObject(new ProjectContainer(project));
|
||||
form = new ProjectCreationForm("projectCreationForm",projectModel);
|
||||
|
||||
formContainer.add(form);
|
||||
}
|
||||
|
||||
private class ProjectCreationForm extends Form<ProjectContainer> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private RequiredTextField<String> titleField;
|
||||
private MultiObjectAutoCompleteField<Student, Long> participantsSelector;
|
||||
private ObjectAutoCompleteField<Employee, Long> headSupervisorSelector;
|
||||
private TeamMemberMultiObjectAutoCompleteField<ProjectTeamMember, Long> projectTeamMemberSelector;
|
||||
|
||||
public ProjectCreationForm(String id, IModel<ProjectContainer> model) {
|
||||
super(id,model);
|
||||
|
||||
boolean editEnabled = true;
|
||||
|
||||
titleField = new RequiredTextField<String>("titleField",new PropertyModel<String>(projectModel,"title"));
|
||||
titleField.add(new StringValidator.MaximumLengthValidator(200));
|
||||
add(titleField);
|
||||
String existsString = "NO";
|
||||
if(projectModel.getObject().getOriginalProject().getIdentifier() != null){
|
||||
existsString = "YES";
|
||||
editEnabled = false;
|
||||
}
|
||||
add(new Label("existsInOtherSystems", existsString));
|
||||
|
||||
List<ProjectClass> projectClassChoices = projectClassDao.findAll();
|
||||
Collections.sort(projectClassChoices);
|
||||
RadioChoice<ProjectClass> projectClass = new RadioChoice<ProjectClass>("projectClass", projectClassChoices);
|
||||
projectClass.setRequired(true);
|
||||
add(projectClass);
|
||||
|
||||
addProjectParticipantsSelection();
|
||||
|
||||
addHeadSupervisorSelection();
|
||||
|
||||
addProjectFollowerSelector();
|
||||
|
||||
titleField.setEnabled(editEnabled);
|
||||
participantsSelector.setEnabled(editEnabled);
|
||||
headSupervisorSelector.setEnabled(editEnabled);
|
||||
projectTeamMemberSelector.setEnabled(editEnabled);
|
||||
projectClass.setEnabled(editEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubmit(){
|
||||
boolean success = true;
|
||||
Project project = getModelObject().recreateProject();
|
||||
|
||||
project.getProjectParticipants().addAll(participantsSelector.getSelectedObjects());
|
||||
|
||||
if(project.getProjectParticipants().isEmpty()){
|
||||
success = false;
|
||||
error("Please add at least one participant");
|
||||
}
|
||||
if(headSupervisorSelector.getModelObject() != null)
|
||||
project.setHeadSupervisor((Employee) roleDao.load(headSupervisorSelector.getModelObject()));
|
||||
|
||||
if(success){
|
||||
boolean newProject = project.getId() == null;
|
||||
project = projectDao.save(project);
|
||||
if(newProject){
|
||||
facade.generateChecklists(project);
|
||||
info("New project saved");
|
||||
}
|
||||
else
|
||||
info("Project saved");
|
||||
formContainer.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void addProjectParticipantsSelection(){
|
||||
AutoCompletionChoicesProvider<Student> provider = new AutoCompletionChoicesProvider<Student>(){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Iterator<Student> getChoices(String input) {
|
||||
return roleDao.findStudentQuery(input.toLowerCase(), 6).iterator();
|
||||
}
|
||||
};
|
||||
|
||||
MultiObjectAutoCompleteRenderer<Student> renderer = new MultiObjectAutoCompleteRenderer<Student>(){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public String getTextValue(Student s){
|
||||
return s.getUser().toString();
|
||||
}
|
||||
protected String getIdValue(Student s){
|
||||
return s.getId().toString();
|
||||
}
|
||||
};
|
||||
|
||||
MultiObjectAutoCompleteObjectConverter<Long, Student> objectConverter = new MultiObjectAutoCompleteObjectConverter<Long, Student>(){
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Student convertToObject(Long id) {
|
||||
return (Student) roleDao.load(id);
|
||||
}
|
||||
};
|
||||
|
||||
MultiObjectAutoCompleteBuilder<Student, Long> builder = new MultiObjectAutoCompleteBuilder<Student, Long>(provider);
|
||||
builder.autoCompleteRenderer(renderer);
|
||||
builder.idType(Long.class);
|
||||
builder.objectConverter(objectConverter);
|
||||
//builder.resultListItemCssClass(Arrays.asList(new String[]{"icon", "icon-project"}));
|
||||
|
||||
participantsSelector = builder.build("projectParticipants");
|
||||
participantsSelector.setSelectedObjects(new ArrayList<Student>(projectModel.getObject().getProjectParticipants()));
|
||||
|
||||
add(participantsSelector);
|
||||
}//addProjectParticipantsSelection
|
||||
|
||||
private void addHeadSupervisorSelection(){
|
||||
org.wicketstuff.objectautocomplete.AutoCompletionChoicesProvider<Employee> provider = new org.wicketstuff.objectautocomplete.AutoCompletionChoicesProvider<Employee>(){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Iterator<Employee> getChoices(String input) {
|
||||
return roleDao.findEmployeeQuery(input.toLowerCase(), 6).iterator();
|
||||
}
|
||||
};
|
||||
|
||||
ObjectAutoCompleteRenderer<Employee> renderer = new ObjectAutoCompleteRenderer<Employee>(){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected String getTextValue(Employee e){
|
||||
return e.getUser().toString();
|
||||
}
|
||||
@Override
|
||||
protected String getIdValue(Employee e){
|
||||
return e.getId().toString();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ObjectAutoCompleteBuilder<Employee, Long> builder = new ObjectAutoCompleteBuilder<Employee, Long>(provider);
|
||||
builder.autoCompleteRenderer(renderer);
|
||||
builder.idType(Long.class);
|
||||
builder.searchLinkText("[Edit]");
|
||||
|
||||
builder.readOnlyRenderer(new ObjectReadOnlyRenderer<Long>(){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Component getObjectRenderer(String id, final IModel<Long> pModel, IModel<String> pSearchTextModel) {
|
||||
return new Label(id, new IModel<String>(){
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final IModel<Long> idModel = pModel;
|
||||
@Override
|
||||
public String getObject(){
|
||||
return roleDao.load(idModel.getObject()).getUser().toString();
|
||||
}
|
||||
@Override
|
||||
public void detach() {
|
||||
//Ignore
|
||||
}
|
||||
@Override
|
||||
public void setObject(String object) {
|
||||
//Ignore
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
headSupervisorSelector = builder.build("headSupervisor",new PropertyModel<Long>(projectModel, "headSupervisorId"));
|
||||
headSupervisorSelector.setRequired(true);
|
||||
|
||||
add(headSupervisorSelector);
|
||||
}//addHeadSupervisorSelection()
|
||||
|
||||
private void addProjectFollowerSelector(){
|
||||
AutoCompletionChoicesProvider<ProjectTeamMember> provider = new AutoCompletionChoicesProvider<ProjectTeamMember>(){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Iterator<ProjectTeamMember> getChoices(String input) {
|
||||
return roleDao.findProjectTeamMemberQuery(input.toLowerCase(), 6).iterator();
|
||||
}
|
||||
};
|
||||
|
||||
MultiObjectAutoCompleteRenderer<ProjectTeamMember> renderer = new MultiObjectAutoCompleteRenderer<ProjectTeamMember>(){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public String getTextValue(ProjectTeamMember p){
|
||||
return p.getUser().toString();
|
||||
}
|
||||
@Override
|
||||
protected String getIdValue(ProjectTeamMember p){
|
||||
return p.getId().toString();
|
||||
}
|
||||
@Override
|
||||
protected void renderObject(ProjectTeamMember object, Response response, String criteria) {
|
||||
response.write("<li idvalue=\"" + getIdValueForObject(object) + "\" textvalue=\"" + getTextValueForObject(object) + "\">");
|
||||
renderChoice(object, response, criteria);
|
||||
response.write("</li>");
|
||||
}
|
||||
};
|
||||
|
||||
MultiObjectAutoCompleteObjectConverter<Long, ProjectTeamMember> objectConverter = new MultiObjectAutoCompleteObjectConverter<Long, ProjectTeamMember>(){
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ProjectTeamMember convertToObject(Long id) {
|
||||
return (ProjectTeamMember) roleDao.load(id);
|
||||
}
|
||||
};
|
||||
|
||||
TeamMemberMultiObjectAutoCompleteBuilder<ProjectTeamMember, Long> builder = new TeamMemberMultiObjectAutoCompleteBuilder<ProjectTeamMember, Long>(provider);
|
||||
builder.autoCompleteRenderer(renderer);
|
||||
builder.idType(Long.class);
|
||||
builder.objectConverter(objectConverter);
|
||||
//builder.resultListItemCssClass(Arrays.asList(new String[]{"icon", "icon-project"}));
|
||||
|
||||
projectTeamMemberSelector = builder.build("followers",new PropertyModel<List<ProjectTeamMember>>(projectModel,"projectTeamMembers"), projectModel);
|
||||
projectTeamMemberSelector.setSelectedObjects(projectModel.getObject().getProjectTeamMembers());
|
||||
|
||||
add(projectTeamMemberSelector);
|
||||
|
||||
}//addProjectFollowerSelector
|
||||
}//ProjectCreationForm
|
||||
add(new ProjectManagementPanel("pmp"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,10 @@
|
||||
<a href=# wicket:id="adminlink">Browse</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="span-18 last">
|
||||
<h5 class="peer-title">Manual import/export</h5>
|
||||
<span wicket:id="manualImportExportPanel"></span>
|
||||
</div>
|
||||
<div class="span-18 last">
|
||||
<h5 class="peer-title">System notice</h5>
|
||||
<form wicket:id="systemNoticeForm">
|
||||
@ -24,11 +28,11 @@
|
||||
<table class="rounded-corner">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rounded-left-top">Description:</th>
|
||||
<th>Last started:</th>
|
||||
<th>Runs every:</th>
|
||||
<th>First run:</th>
|
||||
<th class="rounded-right-top">Start manually:</th>
|
||||
<th class="rounded-left-top">Description</th>
|
||||
<th>Last started</th>
|
||||
<th>Last successful run</th>
|
||||
<th>Runs every</th>
|
||||
<th class="rounded-right-top">Start manually</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
@ -42,8 +46,8 @@
|
||||
<tr wicket:id="scheduleList">
|
||||
<td><span wicket:id="descr">[thread description]</span></td>
|
||||
<td><span wicket:id="lastRun"></span></td>
|
||||
<td><span wicket:id="lastSuccessfulRun"></span></td>
|
||||
<td><span wicket:id="period"></span></td>
|
||||
<td><span wicket:id="firstRun"></span></td>
|
||||
<td><a href=# wicket:id="startLink">Start</a><br /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -1,6 +1,7 @@
|
||||
package se.su.dsv.scipro.admin.pages;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -20,6 +21,7 @@ import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.apache.wicket.util.time.Duration;
|
||||
|
||||
import se.su.dsv.scipro.SciProApplication;
|
||||
import se.su.dsv.scipro.admin.panels.ManualImportExportPanel;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.WorkerDataDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.WorkerData;
|
||||
import se.su.dsv.scipro.repository.pages.SysAdminFilePage;
|
||||
@ -29,11 +31,14 @@ import se.su.dsv.scipro.util.DateFormatter;
|
||||
import se.su.dsv.scipro.workerthreads.AbstractWorker;
|
||||
import se.su.dsv.scipro.workerthreads.Scheduler;
|
||||
import se.su.dsv.scipro.workerthreads.WorkerSchedule;
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
@Authorization(authorizedRoles={Roles.SYSADMIN})
|
||||
public class SystemMaintenancePage extends AbstractAdminPage {
|
||||
|
||||
public static final String MAIN_MENU_LABEL = "System Maintenance";
|
||||
public static final int REFRESH_TIMER = 120;
|
||||
|
||||
|
||||
@SpringBean
|
||||
private WorkerDataDao workerDataDao;
|
||||
@ -58,7 +63,7 @@ public class SystemMaintenancePage extends AbstractAdminPage {
|
||||
runningContainer.setOutputMarkupId(true);
|
||||
scheduledContainer.setOutputMarkupId(true);
|
||||
|
||||
runningContainer.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(2)){
|
||||
runningContainer.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(REFRESH_TIMER)){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
@ -70,7 +75,7 @@ public class SystemMaintenancePage extends AbstractAdminPage {
|
||||
super.onPostProcessTarget(target);
|
||||
}
|
||||
});
|
||||
|
||||
add(new ManualImportExportPanel("manualImportExportPanel"));
|
||||
add(runningContainer);
|
||||
add(scheduledContainer);
|
||||
|
||||
@ -82,7 +87,7 @@ public class SystemMaintenancePage extends AbstractAdminPage {
|
||||
private void updateRunning(){
|
||||
runningContainer.removeAll();
|
||||
List<String> runningList = new ArrayList<String>();
|
||||
for(AbstractWorker aw : Scheduler.runningWorkers)
|
||||
for(AbstractWorker aw : Scheduler.getRunningWorkers())
|
||||
runningList.add(aw.getName());
|
||||
|
||||
ListView<String> runningListView = new ListView<String>("runningList", runningList) {
|
||||
@ -102,7 +107,16 @@ public class SystemMaintenancePage extends AbstractAdminPage {
|
||||
|
||||
private void updateScheduled(){
|
||||
scheduledContainer.removeAll();
|
||||
List<WorkerSchedule<AbstractWorker>> scheduleList = new ArrayList<WorkerSchedule<AbstractWorker>>(Scheduler.workerSchedules);
|
||||
List<WorkerSchedule<AbstractWorker>> scheduleList = new ArrayList<WorkerSchedule<AbstractWorker>>(Scheduler.getWorkerSchedules());
|
||||
//Sorting list according to last run scheduler
|
||||
Collections.sort(scheduleList, new Comparator<WorkerSchedule<AbstractWorker>>(){
|
||||
@Override
|
||||
public int compare(WorkerSchedule<AbstractWorker> o1, WorkerSchedule<AbstractWorker> o2) {
|
||||
final Date d1 = o1.getWorkerThread().getLastSuccessfulRun();
|
||||
final Date d2 = o2.getWorkerThread().getLastSuccessfulRun();
|
||||
return (d1.compareTo(d2));
|
||||
}
|
||||
});
|
||||
ListView<WorkerSchedule<AbstractWorker>> scheduleListView = new ListView<WorkerSchedule<AbstractWorker>>("scheduleList", scheduleList){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -111,12 +125,17 @@ public class SystemMaintenancePage extends AbstractAdminPage {
|
||||
final WorkerSchedule<AbstractWorker> ws = item.getModelObject();
|
||||
String workerName = AbstractWorker.getNameString(ws.getClazz());
|
||||
WorkerData wd = workerDataDao.getWorkerDataByName(workerName);
|
||||
Date lastRun = null;//new Date(0);
|
||||
if(wd != null)
|
||||
|
||||
Date lastRun = null; //new Date(0);
|
||||
Date lastSuccessfulRun = null;
|
||||
if(wd != null) {
|
||||
lastRun = wd.getLastRun();
|
||||
lastSuccessfulRun = wd.getLastSuccessfulRun();
|
||||
}
|
||||
DateFormatter dateFormatter = new DateFormatter();
|
||||
|
||||
item.add(dateFormatter.createFormattedDateLabel("lastRun",lastRun));
|
||||
item.add(dateFormatter.createFormattedDateLabel("firstRun", ws.getFirstTime()));
|
||||
item.add(dateFormatter.createFormattedDateLabel("lastSuccessfulRun", lastSuccessfulRun));
|
||||
item.add(new Label("period", Scheduler.getElapsedTimeHoursMinutesSecondsString(ws.getPeriod())));
|
||||
item.add(new Label("descr", ws.toString()));
|
||||
item.add(new AjaxFallbackLink<Void>("startLink"){
|
||||
@ -156,7 +175,7 @@ public class SystemMaintenancePage extends AbstractAdminPage {
|
||||
public RunningPanel(String id) {
|
||||
super(id);
|
||||
List<String> runningList = new ArrayList<String>();
|
||||
for(AbstractWorker aw : Scheduler.runningWorkers)
|
||||
for(AbstractWorker aw : Scheduler.getRunningWorkers())
|
||||
runningList.add(aw.getName());
|
||||
|
||||
ListView<String> runningListView = new ListView<String>("runningList", runningList) {
|
||||
|
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<form wicket:id="exemptionForm">
|
||||
|
||||
<!-- Fix max lengths -->
|
||||
<table>
|
||||
<tr>
|
||||
<td>Level: <select wicket:id="selectProjectClass"></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Author: <div wicket:id="selectAuthor"></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Comment: <div><textarea wicket:id="comment"></textarea></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input wicket:id="createButton" type="submit" value="Save" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,79 @@
|
||||
package se.su.dsv.scipro.admin.pages.match;
|
||||
|
||||
import org.apache.wicket.markup.html.form.Button;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.TextArea;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.components.ProjectClassSelector;
|
||||
import se.su.dsv.scipro.components.StudentSelector;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.AuthorDao;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.ExemptionDao;
|
||||
import se.su.dsv.scipro.match.dataobject.Exemption;
|
||||
|
||||
public class AdminExemptionCreatePanel extends Panel {
|
||||
|
||||
@SpringBean
|
||||
ExemptionDao exemptionDao;
|
||||
|
||||
@SpringBean
|
||||
AuthorDao authorDao;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public AdminExemptionCreatePanel(final String id) {
|
||||
this(id, new Model<Exemption>(new Exemption()));
|
||||
}
|
||||
|
||||
public AdminExemptionCreatePanel(String id, IModel<Exemption> model) {
|
||||
super(id);
|
||||
|
||||
add(new ExemptionForm("exemptionForm", model));
|
||||
}
|
||||
|
||||
private class ExemptionForm extends Form<Exemption> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private ProjectClassSelector projectClassSelect;
|
||||
private StudentSelector studentSelector;
|
||||
private TextArea<String> comment;
|
||||
|
||||
public ExemptionForm(String id, final IModel<Exemption> model) {
|
||||
super(id, model);
|
||||
projectClassSelect = new ProjectClassSelector("selectProjectClass");
|
||||
add(projectClassSelect);
|
||||
studentSelector = new StudentSelector("selectAuthor");
|
||||
studentSelector.getSelector().setRequired(true);
|
||||
add(studentSelector);
|
||||
|
||||
comment = new TextArea<String>("comment",
|
||||
new PropertyModel<String>(model, "comment"));
|
||||
add(comment);
|
||||
|
||||
Button createButton = new Button("createButton");
|
||||
add(createButton);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSubmit() {
|
||||
Exemption exemption = getModelObject();
|
||||
exemption.setProjectClass(projectClassSelect.getModelObject());
|
||||
exemption.setGrantedBy(SciProSession.get().getUser());
|
||||
exemption.setAuthor(authorDao.getOrCreate(studentSelector.getModelObject().getUser()));
|
||||
try {
|
||||
exemptionDao.save(exemption);
|
||||
info("Exemption created.");
|
||||
} catch (DataIntegrityViolationException e) {
|
||||
error("Only one exemption per author and project class allowed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:extend>
|
||||
<div wicket:id="adminExemptionPanel"></div>
|
||||
</wicket:extend>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,14 @@
|
||||
package se.su.dsv.scipro.admin.pages.match;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
|
||||
import se.su.dsv.scipro.admin.pages.AbstractAdminMatchPage;
|
||||
|
||||
public class AdminExemptionPage extends AbstractAdminMatchPage {
|
||||
|
||||
public AdminExemptionPage(PageParameters pp) {
|
||||
super(pp);
|
||||
add(new AdminExemptionPanel("adminExemptionPanel"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<!-- Edit/add dialog -->
|
||||
<div wicket:id="dialog">
|
||||
<div wicket:id="dialogContent"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="search">Search:</label> <input type="text" class="text"
|
||||
id="search" wicket:id="searchField" />
|
||||
</div>
|
||||
<div class="margin">
|
||||
<a href=# wicket:id="createLink"><img
|
||||
wicket:id="addIcon" alt="" /> Grant exemption</a>
|
||||
<div wicket:id="container">
|
||||
|
||||
<table class="rounded-corner">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rounded-left-top">Granted exemptions</th>
|
||||
<th>Comment</th>
|
||||
<th>Level</th>
|
||||
<th>Granted by</th>
|
||||
<th class="rounded-right-top">Revoke exemption</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5" class="rounded-foot"> </td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr wicket:id="listView">
|
||||
<td><span wicket:id="name"></span></td>
|
||||
<td><span wicket:id="comment"></span></td>
|
||||
<td><span wicket:id="level"></span></td>
|
||||
<td><span wicket:id="grantedBy"></span></td>
|
||||
<td><a href=# wicket:id="removeLink"><img
|
||||
wicket:id="removeIcon" alt="" /></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<div wicket:id="pagingNavigator"></div>
|
||||
</div>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,147 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package se.su.dsv.scipro.admin.pages.match;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.form.Button;
|
||||
import org.apache.wicket.markup.html.form.TextField;
|
||||
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
|
||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
||||
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.IDataProvider;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
import se.su.dsv.scipro.dataproviders.QueryableDataProvider;
|
||||
import se.su.dsv.scipro.icons.ImageObject;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.ExemptionDao;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.ExemptionDaoParams;
|
||||
import se.su.dsv.scipro.match.dataobject.Exemption;
|
||||
|
||||
public class AdminExemptionPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = -2758001349423204276L;
|
||||
private String userSearch;
|
||||
private DataView<Exemption> dataView;
|
||||
private WebMarkupContainer container;
|
||||
|
||||
@SpringBean
|
||||
private ExemptionDao exemptionDao;
|
||||
|
||||
public AdminExemptionPanel(String id) {
|
||||
super(id);
|
||||
TextField<String> searchField =
|
||||
new TextField<String>("searchField", new PropertyModel<String>(
|
||||
this, "userSearch"));
|
||||
container = new WebMarkupContainer("container");
|
||||
container.setOutputMarkupId(true);
|
||||
|
||||
OnChangeAjaxBehavior userSearchTextBehaviour =
|
||||
new OnChangeAjaxBehavior() {
|
||||
|
||||
private static final long serialVersionUID =
|
||||
-3243439315735164519L;
|
||||
|
||||
@Override
|
||||
protected void onUpdate(AjaxRequestTarget target) {
|
||||
updateListView(container);
|
||||
container.add(dataView);
|
||||
container.add(new PagingNavigator("pagingNavigator",
|
||||
dataView));
|
||||
target.addComponent(container);
|
||||
}
|
||||
|
||||
};
|
||||
final Dialog dialog = new Dialog("dialog");
|
||||
dialog.setModal(true);
|
||||
dialog.setAutoOpen(false);
|
||||
dialog.add(new EmptyPanel("dialogContent"));
|
||||
|
||||
dialog.setWidth(500);
|
||||
dialog.setHeight(360);
|
||||
add(dialog);
|
||||
|
||||
AjaxLink<Void> createLink = new AjaxLink<Void>("createLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
dialog.replace(new AdminExemptionCreatePanel("dialogContent"));
|
||||
target.addComponent(dialog);
|
||||
dialog.setTitle("Grant exemption...");
|
||||
dialog.open(target);
|
||||
}
|
||||
};
|
||||
add(createLink);
|
||||
createLink.add(new ImageObject("addIcon", ImageObject.SIXTEEN + ImageObject.ADD));
|
||||
|
||||
searchField.add(userSearchTextBehaviour);
|
||||
add(searchField);
|
||||
updateListView(container);
|
||||
|
||||
container.add(dataView);
|
||||
add(container);
|
||||
container.add(new PagingNavigator("pagingNavigator", dataView));
|
||||
|
||||
}
|
||||
|
||||
private void updateListView(final WebMarkupContainer container) {
|
||||
container.removeAll();
|
||||
ExemptionDaoParams exemptionDaoParams = new ExemptionDaoParams();
|
||||
if (userSearch != null) {
|
||||
if (userSearch.length() >= 3) {
|
||||
exemptionDaoParams.setAuthorNameLike(userSearch);
|
||||
}
|
||||
}
|
||||
loadUserDataView(new QueryableDataProvider<Exemption, ExemptionDaoParams>(
|
||||
exemptionDao, exemptionDaoParams));
|
||||
|
||||
};
|
||||
|
||||
public void loadUserDataView(IDataProvider<Exemption> exemptionDataProvider) {
|
||||
dataView =
|
||||
new DataView<Exemption>("listView", exemptionDataProvider, 10) {
|
||||
|
||||
private static final long serialVersionUID =
|
||||
2828792237574112923L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(Item<Exemption> item) {
|
||||
final Exemption excemption = item.getModelObject();
|
||||
item.add(new Label("name", excemption.getAuthor().getUser()
|
||||
.getFullName()));
|
||||
item.add(new Label("level", excemption.getProjectClass()
|
||||
.getName()));
|
||||
item.add(new Label("comment", excemption.getComment()));
|
||||
item.add(new Label("grantedBy", excemption.getGrantedBy()
|
||||
.getFullName()));
|
||||
|
||||
AjaxLink<Void> removeLink = new AjaxLink<Void>("removeLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
exemptionDao.delete(exemptionDao.reLoad(excemption));
|
||||
info("Revoked exemption");
|
||||
target.addComponent(container);
|
||||
target.addComponent(getPage().get("feedbackPanel"));
|
||||
}
|
||||
};
|
||||
item.add(removeLink);
|
||||
removeLink.add(new ImageObject("removeIcon", ImageObject.SIXTEEN + ImageObject.DELETE));
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:extend>
|
||||
<div><b>Unit</b></div>
|
||||
<div wicket:id="manageUnitKeyword"></div>
|
||||
<div><b>Area</b></div>
|
||||
<div wicket:id="manageAreaKeyword"></div>
|
||||
<div><b>Word</b></div>
|
||||
<div wicket:id="manageWordKeyword"></div>
|
||||
</wicket:extend>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,22 @@
|
||||
package se.su.dsv.scipro.admin.pages.match;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.admin.pages.AbstractAdminMatchPage;
|
||||
import se.su.dsv.scipro.admin.panels.match.ManageKeywordPanel;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.KeywordTypeDao;
|
||||
|
||||
public class AdminKeywordPage extends AbstractAdminMatchPage {
|
||||
|
||||
@SpringBean
|
||||
private KeywordTypeDao keywordTypeDao;
|
||||
|
||||
public AdminKeywordPage(PageParameters pp) {
|
||||
super(pp);
|
||||
add(new ManageKeywordPanel("manageUnitKeyword", keywordTypeDao.findByType(KeywordTypeDao.TYPE.UNIT)));
|
||||
add(new ManageKeywordPanel("manageAreaKeyword", keywordTypeDao.findByType(KeywordTypeDao.TYPE.RESEARCH_AREA)));
|
||||
add(new ManageKeywordPanel("manageWordKeyword", keywordTypeDao.findByType(KeywordTypeDao.TYPE.REGULAR)));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:extend>
|
||||
<div wicket:id="adminMatchPeriodsPanel"></div>
|
||||
</wicket:extend>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,12 @@
|
||||
package se.su.dsv.scipro.admin.pages.match;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
|
||||
import se.su.dsv.scipro.admin.pages.AbstractAdminMatchPage;
|
||||
|
||||
public class AdminManageMatchPeriodsPage extends AbstractAdminMatchPage {
|
||||
public AdminManageMatchPeriodsPage(PageParameters pp) {
|
||||
super(pp);
|
||||
add(new AdminMatchPeriodsPanel("adminMatchPeriodsPanel"));
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:extend>
|
||||
<div wicket:id="manageSupervisorPanel"></div>
|
||||
</wicket:extend>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,15 @@
|
||||
package se.su.dsv.scipro.admin.pages.match;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
|
||||
import se.su.dsv.scipro.admin.pages.AbstractAdminMatchPage;
|
||||
import se.su.dsv.scipro.match.panel.AdminManageSupervisorPanel;
|
||||
|
||||
public class AdminManageMatchSupervisorPage extends AbstractAdminMatchPage {
|
||||
|
||||
public AdminManageMatchSupervisorPage(PageParameters pp) {
|
||||
super(pp);
|
||||
add(new AdminManageSupervisorPanel("manageSupervisorPanel"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:extend>
|
||||
<div wicket:id="manageProjectIdeaPanel"></div>
|
||||
<div wicket:id="rejectedProjectIdeaPanel"></div>
|
||||
<div wicket:id="waitingProjectIdeaPanel"></div>
|
||||
</wicket:extend>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,22 @@
|
||||
package se.su.dsv.scipro.admin.pages.match;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
|
||||
import se.su.dsv.scipro.admin.pages.AbstractAdminMatchPage;
|
||||
import se.su.dsv.scipro.match.panel.AdminManageProjectIdeaPanel;
|
||||
import se.su.dsv.scipro.match.panel.AdminRejectedProjectIdeaPanel;
|
||||
import se.su.dsv.scipro.match.panel.AdminWaitingProjectIdeaPanel;
|
||||
import se.su.dsv.scipro.security.auth.Authorization;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
|
||||
@Authorization(authorizedRoles={Roles.SYSADMIN})
|
||||
public class AdminManageProjectIdeaPage extends AbstractAdminMatchPage {
|
||||
|
||||
public AdminManageProjectIdeaPage(PageParameters pp) {
|
||||
super(pp);
|
||||
add(new AdminManageProjectIdeaPanel("manageProjectIdeaPanel"));
|
||||
add(new AdminRejectedProjectIdeaPanel("rejectedProjectIdeaPanel"));
|
||||
add(new AdminWaitingProjectIdeaPanel("waitingProjectIdeaPanel"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div class="margin">
|
||||
<div class="info-box rounded-box">If no application period is active, authors can not create new project ideas.</div>
|
||||
<a href=# wicket:id="createLink"><img wicket:id="addIcon" alt="" />Create application period</a>
|
||||
<div wicket:id="container">
|
||||
<table class="rounded-corner">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rounded-left-top">Start date</th>
|
||||
<th>End date</th>
|
||||
<th>Project types</th>
|
||||
<th>Name</th>
|
||||
<th>Edit</th>
|
||||
<th class="rounded-right-top">Delete</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="6" class="rounded-foot"> </td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr wicket:id="repeatingView">
|
||||
<td><span wicket:id="startDate"></span></td>
|
||||
<td><span wicket:id="endDate"></span></td>
|
||||
<td><span wicket:id="type"></span></td>
|
||||
<td><span wicket:id="name"></span></td>
|
||||
<td><a href=# wicket:id="editLink"><img wicket:id="editIcon" alt="" /></a></td>
|
||||
<td><a href=# wicket:id="removeLink"><img wicket:id="removeIcon" alt="" /></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div wicket:id="pagingNavigator"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Edit/add dialog -->
|
||||
<div wicket:id="dialog">
|
||||
<div wicket:id="dialogContent"></div>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,120 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package se.su.dsv.scipro.admin.pages.match;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
|
||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||
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.IDataProvider;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
import se.su.dsv.scipro.dataproviders.SortableDataProvider;
|
||||
import se.su.dsv.scipro.icons.ImageObject;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.ApplicationPeriodDao;
|
||||
import se.su.dsv.scipro.match.dataobject.ApplicationPeriod;
|
||||
import se.su.dsv.scipro.match.facade.ApplicationPeriodFacade;
|
||||
import se.su.dsv.scipro.match.panel.MatchPeriodEditPanel;
|
||||
import se.su.dsv.scipro.util.DateFormatter;
|
||||
import se.su.dsv.scipro.util.JavascriptEventConfirmation;
|
||||
|
||||
public class AdminMatchPeriodsPanel extends Panel {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private DataView<ApplicationPeriod> dataView;
|
||||
private WebMarkupContainer container;
|
||||
@SpringBean
|
||||
private ApplicationPeriodDao applicationPeriodDao;
|
||||
@SpringBean
|
||||
private ApplicationPeriodFacade facade;
|
||||
private final Dialog dialog;
|
||||
public AdminMatchPeriodsPanel(String id) {
|
||||
super(id);
|
||||
container = new WebMarkupContainer("container");
|
||||
container.setOutputMarkupId(true);
|
||||
//Edit/Create dialog
|
||||
dialog = new Dialog("dialog");
|
||||
dialog.setModal(true);
|
||||
dialog.setAutoOpen(false);
|
||||
dialog.add(new EmptyPanel("dialogContent"));
|
||||
dialog.setWidth(500);
|
||||
dialog.setHeight(360);
|
||||
add(dialog);
|
||||
//Create new link
|
||||
final AjaxLink<Void> createLink = new AjaxLink<Void>("createLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
dialog.replace(new MatchPeriodEditPanel("dialogContent"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public boolean isEditable(){
|
||||
return true;
|
||||
}
|
||||
});
|
||||
target.addComponent(dialog);
|
||||
dialog.setTitle("Create Application Period");
|
||||
dialog.open(target);
|
||||
}
|
||||
};
|
||||
createLink.add(new ImageObject("addIcon", ImageObject.SIXTEEN + ImageObject.ADD));
|
||||
add(createLink);
|
||||
//Load repeater data
|
||||
loadData(new SortableDataProvider<ApplicationPeriod>(applicationPeriodDao,ApplicationPeriod.class){
|
||||
private static final long serialVersionUID = 1L;
|
||||
});
|
||||
container.add(dataView);
|
||||
add(container);
|
||||
container.add(new PagingNavigator("pagingNavigator", dataView));
|
||||
}
|
||||
private void loadData(IDataProvider<ApplicationPeriod> provider){
|
||||
dataView = new DataView<ApplicationPeriod>("repeatingView",provider){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
protected void populateItem(final Item<ApplicationPeriod> item) {
|
||||
final ApplicationPeriod appPeriod = item.getModelObject();
|
||||
item.add(new DateFormatter(DateFormatter.FORMAT.DEFAULT).createFormattedDateLabel("startDate", appPeriod.getStartDate()));
|
||||
item.add(new DateFormatter(DateFormatter.FORMAT.DEFAULT).createFormattedDateLabel("endDate", appPeriod.getEndDate()));
|
||||
item.add(new Label("type",appPeriod.getProjectClass().toString()));
|
||||
item.add(new Label("name",appPeriod.getName()));
|
||||
final AjaxLink<Void> editLink = new AjaxLink<Void>("editLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
dialog.replace(new MatchPeriodEditPanel("dialogContent",new Model<ApplicationPeriod>(appPeriod)){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public boolean isEditable(){
|
||||
return true;
|
||||
}
|
||||
});
|
||||
target.addComponent(dialog);
|
||||
dialog.setTitle("Edit Application Period");
|
||||
dialog.open(target);
|
||||
}
|
||||
};
|
||||
editLink.add(new ImageObject("editIcon", ImageObject.SIXTEEN + ImageObject.EDIT));
|
||||
final AjaxLink<Void> removeLink = new AjaxLink<Void>("removeLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
facade.removeApplicationPeriod(appPeriod);
|
||||
target.addComponent(container);
|
||||
}
|
||||
};
|
||||
removeLink.add(new JavascriptEventConfirmation("onclick", "Are you sure you want to remove this application period?"));
|
||||
removeLink.add(new ImageObject("removeIcon", ImageObject.SIXTEEN + ImageObject.DELETE));
|
||||
item.add(editLink);
|
||||
item.add(removeLink);
|
||||
}
|
||||
};
|
||||
dataView.setItemsPerPage(10);
|
||||
}
|
||||
}
|
37
src/main/java/se/su/dsv/scipro/admin/pages/match/AdminMatchSettingsPerProjectClassPage.html
Normal file
37
src/main/java/se/su/dsv/scipro/admin/pages/match/AdminMatchSettingsPerProjectClassPage.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:extend>
|
||||
|
||||
<div class="append-bottom">
|
||||
<h5 class="peer-title">Settings for levels</h5>
|
||||
<form wicket:id="settingsForm">
|
||||
<ul class="no-list-style">
|
||||
<li wicket:id="projectClassList" class="append-bottom">
|
||||
<h5 wicket:id="projectClassName" class="peer-box-subtitle"></h5>
|
||||
<div>
|
||||
<form wicket:id="projectClassSettingsForm">
|
||||
<table>
|
||||
<tr>
|
||||
<td><label for="1">Set min authors: </label></td>
|
||||
<td><input type="text" wicket:id="minAuthors" name="1" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="2">Set max authors: </label></td>
|
||||
<td><input type="text" wicket:id="maxAuthors" name="2" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<button type="submit" wicket:id="submit">
|
||||
Save changes
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</wicket:extend>
|
||||
</body>
|
||||
</html>
|
75
src/main/java/se/su/dsv/scipro/admin/pages/match/AdminMatchSettingsPerProjectClassPage.java
Normal file
75
src/main/java/se/su/dsv/scipro/admin/pages/match/AdminMatchSettingsPerProjectClassPage.java
Normal file
@ -0,0 +1,75 @@
|
||||
package se.su.dsv.scipro.admin.pages.match;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.form.Button;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.TextField;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.model.CompoundPropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.admin.pages.AbstractAdminMatchPage;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClassSettings;
|
||||
|
||||
public class AdminMatchSettingsPerProjectClassPage extends AbstractAdminMatchPage {
|
||||
|
||||
@SpringBean
|
||||
private ProjectClassDao projectClassDao;
|
||||
|
||||
public AdminMatchSettingsPerProjectClassPage(final PageParameters pp){
|
||||
super(pp);
|
||||
|
||||
final Form<Void> settingsForm = new Form<Void>("settingsForm"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onSubmit(){
|
||||
info("Match settings saved");
|
||||
}
|
||||
};
|
||||
|
||||
settingsForm.add(new ListView<ProjectClass>("projectClassList", projectClassDao.findAll()){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<ProjectClass> item) {
|
||||
item.add(new Label("projectClassName", item.getModelObject().getName()));
|
||||
item.add(new SettingsPerProjectClassForm("projectClassSettingsForm", item.getModelObject()));
|
||||
add(item);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
settingsForm.add(new Button("submit"));
|
||||
add(settingsForm);
|
||||
}
|
||||
|
||||
private class SettingsPerProjectClassForm extends Form<ProjectClassSettings> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SettingsPerProjectClassForm(final String id, final ProjectClass projectClass){
|
||||
super(id, new CompoundPropertyModel<ProjectClassSettings>(projectClass.getProjectClassSettings()));
|
||||
|
||||
|
||||
TextField<Integer> minAuthors = new TextField<Integer>("minAuthors");
|
||||
minAuthors.setRequired(true);
|
||||
add(minAuthors);
|
||||
|
||||
TextField<Integer> maxAuthors = new TextField<Integer>("maxAuthors");
|
||||
maxAuthors.setRequired(true);
|
||||
add(maxAuthors);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubmit(){
|
||||
ProjectClass projectClass = projectClassDao.save(getModelObject().getProjectClass());
|
||||
getModelObject().setProjectClass(projectClass);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:extend>
|
||||
<div wicket:id="automaticMatchPanel"></div>
|
||||
</wicket:extend>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,14 @@
|
||||
package se.su.dsv.scipro.admin.pages.match;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
|
||||
import se.su.dsv.scipro.admin.pages.AbstractAdminMatchPage;
|
||||
|
||||
public class AutomaticMatchPage extends AbstractAdminMatchPage {
|
||||
|
||||
public AutomaticMatchPage(PageParameters pp) {
|
||||
super(pp);
|
||||
add(new AutomaticMatchPanel("automaticMatchPanel"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div class="margin">
|
||||
<form wicket:id="matchingForm">
|
||||
<form wicket:id="weightsForm">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Keyword points: <select wicket:id="keywordPoints"></select></td>
|
||||
<td>Research area points: <select wicket:id="researchAreaPoints"></select></td>
|
||||
<td>Preferred supervisor points: <select wicket:id="preferredSupervisorPoints"></select></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<p>There are <span wicket:id="numUnmatchedProjectIdeas"></span> unmatched project ideas that will be sent through the matching algorithm if you perform an automatic matching now.</p>
|
||||
<input type="submit" wicket:id="runAlgorithm" value="Run match algorithm" />
|
||||
</form>
|
||||
<div wicket:id="container">
|
||||
<form wicket:id="suggestMatchesForm">
|
||||
<button wicket:id="suggestMatches">Suggest these matches to supervisors</button>
|
||||
</form>
|
||||
<table class="rounded-corner">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rounded-left-top">Level</th>
|
||||
<th>Title</th>
|
||||
<th>Supervisor (Points)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3" class="rounded-foot"> </td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr wicket:id="listView">
|
||||
<td><span wicket:id="level"></span></td>
|
||||
<td><span wicket:id="title"></span></td>
|
||||
<td><span wicket:id="supervisor"></span> (<span wicket:id="points"></span>)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<div wicket:id="pagingNavigator"></div>
|
||||
</div>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,243 @@
|
||||
package se.su.dsv.scipro.admin.pages.match;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
||||
import org.apache.wicket.injection.web.InjectorHolder;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.form.DropDownChoice;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
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.IDataProvider;
|
||||
import org.apache.wicket.markup.repeater.data.ListDataProvider;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.match.Matcher;
|
||||
import se.su.dsv.scipro.match.Matcher.Result;
|
||||
import se.su.dsv.scipro.match.Weights;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.MatchDao;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
|
||||
public class AutomaticMatchPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = -2758001349423204276L;
|
||||
private static Logger logger = Logger.getLogger(AutomaticMatchPanel.class);
|
||||
private WebMarkupContainer container;
|
||||
|
||||
@SpringBean
|
||||
private MatchDao matchDao;
|
||||
|
||||
private MatchingForm matchingForm;
|
||||
private Form<Void> suggestMatchesForm;
|
||||
|
||||
private Result result;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public AutomaticMatchPanel(String id) {
|
||||
super(id);
|
||||
|
||||
MatchingData matchingData = new MatchingData();
|
||||
matchingData.setWeights(new Weights());
|
||||
|
||||
suggestMatchesForm = new Form<Void>("suggestMatchesForm") {
|
||||
{
|
||||
add(new AjaxButton("suggestMatches", this) {
|
||||
|
||||
@Override
|
||||
protected void onSubmit(AjaxRequestTarget target,
|
||||
Form<?> form) {
|
||||
try {
|
||||
|
||||
for (Match match : result.matches) {
|
||||
match.setCreatedBy(SciProSession.get().getUser());
|
||||
match.setStatus(Match.Status.PUBLISHED);
|
||||
matchDao.save(match);
|
||||
}
|
||||
info("Saved " + result.matches.size() + " matches");
|
||||
} catch (Exception e) {
|
||||
error("Unable to create matches, cause: " + e.getMessage());
|
||||
logger.error("Unable to create matches after automatic matching.", e);
|
||||
}
|
||||
|
||||
target.addComponent(getPage().get("feedbackPanel"));
|
||||
target.addComponent(container);
|
||||
hideContainer();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
suggestMatchesForm.setOutputMarkupId(true);
|
||||
|
||||
matchingForm = new MatchingForm("matchingForm",
|
||||
new Model<MatchingData>(matchingData)) {
|
||||
|
||||
@Override
|
||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||
|
||||
Matcher matcher = getMatcher();
|
||||
result = matcher.match();
|
||||
if (result.matches.size() > 0) {
|
||||
container.setVisible(true);
|
||||
updateListView(container, result.matches);
|
||||
|
||||
container.add(suggestMatchesForm);
|
||||
target.addComponent(container);
|
||||
} else {
|
||||
target.addComponent(getPage().get("feedbackPanel"));
|
||||
info("No project ideas could be automatically matched.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
add(matchingForm);
|
||||
matchingForm.setOutputMarkupId(true);
|
||||
|
||||
container = new WebMarkupContainer("container");
|
||||
container.setOutputMarkupId(true);
|
||||
hideContainer();
|
||||
|
||||
add(container);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void hideContainer() {
|
||||
container.setVisible(false).setOutputMarkupPlaceholderTag(true);
|
||||
}
|
||||
|
||||
private void updateListView(final WebMarkupContainer container, List<Match> matches) {
|
||||
container.removeAll();
|
||||
DataView<Match> dataView = loadUserDataView(new ListDataProvider<Match>(matches));
|
||||
container.add(dataView);
|
||||
container.add(new PagingNavigator("pagingNavigator", dataView));
|
||||
};
|
||||
|
||||
public DataView<Match> loadUserDataView(IDataProvider<Match> exemptionDataProvider) {
|
||||
return
|
||||
new DataView<Match>("listView", exemptionDataProvider, 10) {
|
||||
|
||||
private static final long serialVersionUID =
|
||||
2828792237574112923L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(Item<Match> item) {
|
||||
final Match match = item.getModelObject();
|
||||
item.add(new Label("level", match.getProjectIdea().getProjectClass().getName()));
|
||||
item.add(new Label("title", match.getProjectIdea().getTitle()));
|
||||
item.add(new Label("supervisor", match.getSupervisor().getUser().getFullName()));
|
||||
item.add(new Label("points", Integer.toString(match.getPoints())));
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
private static class MatchingData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Weights weights;
|
||||
|
||||
public Weights getWeights() {
|
||||
return weights;
|
||||
}
|
||||
|
||||
public void setWeights(Weights weights) {
|
||||
this.weights = weights;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static abstract class MatchingForm extends Form<MatchingData> {
|
||||
|
||||
private static final long serialVersionUID = -7401634683907888772L;
|
||||
|
||||
private WeightsForm weightsForm;
|
||||
|
||||
|
||||
|
||||
public MatchingForm(String id, Model<MatchingData> model) {
|
||||
super(id, model);
|
||||
|
||||
PropertyModel<Weights> weightsModel =
|
||||
new PropertyModel<Weights>(model, "weights");
|
||||
weightsForm = new WeightsForm("weightsForm", weightsModel);
|
||||
add(weightsForm);
|
||||
|
||||
long numProjectIdeasToBeMatched = getMatcher().numProjectIdeasToBeMatched();
|
||||
add(new Label("numUnmatchedProjectIdeas",
|
||||
Long.toString(numProjectIdeasToBeMatched)));
|
||||
|
||||
AjaxButton createButton = new AjaxButton("runAlgorithm", this) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||
MatchingForm.this.onSubmit(target, form);
|
||||
}
|
||||
|
||||
};
|
||||
add(createButton);
|
||||
if (numProjectIdeasToBeMatched == 0) {
|
||||
createButton.setVisible(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected abstract void onSubmit(AjaxRequestTarget target, Form<?> form);
|
||||
|
||||
|
||||
public Matcher getMatcher() {
|
||||
Matcher matcher = new Matcher(null, getModelObject().getWeights());
|
||||
InjectorHolder.getInjector().inject(matcher);
|
||||
return matcher;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static class WeightsForm extends Form<Weights> {
|
||||
private static final long serialVersionUID = 5707885553461955433L;
|
||||
|
||||
public WeightsForm(String id, IModel<Weights> model) {
|
||||
super(id, model);
|
||||
|
||||
add(createDropDown(model, "keywordPoints"));
|
||||
add(createDropDown(model, "researchAreaPoints"));
|
||||
add(createDropDown(model, "preferredSupervisorPoints"));
|
||||
}
|
||||
|
||||
private DropDownChoice<Integer> createDropDown(IModel<Weights> model, String weightName) {
|
||||
ArrayList<Integer> choices = new ArrayList<Integer>();
|
||||
for (int i = 1; i<15; i++) {
|
||||
choices.add(i);
|
||||
}
|
||||
DropDownChoice<Integer> dropDown =
|
||||
new DropDownChoice<Integer>(weightName,
|
||||
new PropertyModel<Integer>(model, weightName), choices);
|
||||
dropDown.setNullValid(false);
|
||||
dropDown.setRequired(true);
|
||||
return dropDown;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -8,6 +8,16 @@
|
||||
<wicket:panel>
|
||||
<div wicket:id="dialog">
|
||||
<form wicket:id="form">
|
||||
<div>
|
||||
<div>Template name</div>
|
||||
<input style="width:500px;" wicket:id="nameField" type="text" />
|
||||
</div>
|
||||
|
||||
<!-- <div style="width:300px; display:table"> -->
|
||||
<!-- <label for="MyInput" style="display:table-cell; width:1px">label text</label> -->
|
||||
<!-- <input type="text" id="MyInput" style="display:table-cell; width:100%" /> -->
|
||||
<!-- </div> -->
|
||||
|
||||
<div wicket:id="categoryPanel"></div>
|
||||
<div wicket:id="checkListDialog"></div>
|
||||
<p></p>
|
||||
@ -24,12 +34,13 @@
|
||||
<th class="rounded-left-top">Name</th>
|
||||
<th>Categories</th>
|
||||
<th>Questions</th>
|
||||
<th></th>
|
||||
<th class="rounded-right-top">Delete</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4" class="rounded-foot"> </td>
|
||||
<td colspan="5" class="rounded-foot"> </td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
@ -38,6 +49,15 @@
|
||||
wicket:id="templateName"></span></a></span></td>
|
||||
<td><span wicket:id="categories"></span></td>
|
||||
<td><span wicket:id="templateOuestion"></span></td>
|
||||
<td><div class="split-row">
|
||||
<a href="#" wicket:id="moveUpLink"><img
|
||||
wicket:id="upArrowImage" /></a>
|
||||
</div>
|
||||
<div class="split-row">
|
||||
<a href="#" wicket:id="moveDownLink"><img
|
||||
wicket:id="downArrowImage" alt="Down" title="Down" /></a>
|
||||
</div>
|
||||
</td>
|
||||
<td><a href="#" wicket:id="delete">
|
||||
<img wicket:id="deleteIcon" alt="Delete" title="Delete" />
|
||||
</a></td>
|
||||
@ -45,6 +65,8 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- <a wicket:id="newLink">Create new checklist</a> -->
|
||||
<button wicket:id="newLink">Create new checklist</button>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -1,5 +1,6 @@
|
||||
package se.su.dsv.scipro.admin.panels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
@ -12,6 +13,8 @@ import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.basic.MultiLineLabel;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.RequiredTextField;
|
||||
import org.apache.wicket.markup.html.form.TextField;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||
@ -23,9 +26,11 @@ import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.checklists.panels.ChecklistCategoryPanel;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||
import se.su.dsv.scipro.data.dataobjects.ChecklistCategory;
|
||||
import se.su.dsv.scipro.data.enums.CheckListRole;
|
||||
@ -52,6 +57,13 @@ public class AdminListCheckListTemplatePanel extends Panel{
|
||||
private ChecklistCategoryPanel categoryPanel;
|
||||
private Form<CheckListTemplate> form;
|
||||
|
||||
private TextField<String> nameField;
|
||||
private AjaxLink<Void> newLink;
|
||||
private WebMarkupContainer container;
|
||||
private int NO_NUMBER = 999;
|
||||
private ListView<CheckListTemplate> checkListTemplates;
|
||||
private int nrOfTemplates = 0;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public AdminListCheckListTemplatePanel(String id, PageParameters pp, final CheckListRole role) {
|
||||
@ -62,11 +74,75 @@ public class AdminListCheckListTemplatePanel extends Panel{
|
||||
dialog.setAutoOpen(false);
|
||||
dialog.setWidth(550);
|
||||
dialog.setHeight(700);
|
||||
tmpform.add(new EmptyPanel("nameField"));
|
||||
tmpform.add(new EmptyPanel("categoryPanel"));
|
||||
tmpform.add(new EmptyPanel("checkListDialog"));
|
||||
tmpform.add(new EmptyPanel("saveLink"));
|
||||
dialog.add(tmpform);
|
||||
add(dialog);
|
||||
|
||||
templateNumberSetup();
|
||||
|
||||
newLink = new AjaxLink<Void>("newLink") {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
|
||||
CheckListTemplate clt = new CheckListTemplate("New checklist template (change this to real name)", SciProSession.get().getUser());
|
||||
clt.setCategories(new ArrayList<ChecklistCategory>());
|
||||
// clt = CheckListTemplateDao.save(clt);
|
||||
|
||||
ArrayList<String> questionList = new ArrayList<String>();
|
||||
questionList.add(new String("Example question (remove this and add relevant questions)"));
|
||||
clt.setQuestions(questionList);
|
||||
|
||||
form = new Form<CheckListTemplate>("form");
|
||||
|
||||
nameField = new RequiredTextField<String>("nameField", new Model<String>(clt.getName()));
|
||||
nameField.setOutputMarkupId(true);
|
||||
|
||||
categories = clt.getCategories();
|
||||
categoryPanel = new ChecklistCategoryPanel("categoryPanel", categories);
|
||||
vclPanel = new AdminViewCheckListTemplatePanel("checkListDialog", clt);
|
||||
|
||||
|
||||
|
||||
AjaxButton saveLink = new AjaxButton("saveLink", new Model<String>("Save template")) {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||
CheckListTemplate tmp = checkListTemplateDao.save(checkListTemplateDao.load(vclPanel.getCheckListTemplateId()));
|
||||
|
||||
tmp.setName(nameField.getModelObject());
|
||||
|
||||
tmp.setCategories(categoryPanel.getSelectedCategories());
|
||||
List<CheckListTemplate> templates = checkListTemplateDao.findTemplates();
|
||||
tmp.setTemplateNumber(templates.size()-1);
|
||||
checkListTemplateDao.save(tmp);
|
||||
target.addComponent(container);
|
||||
dialog.close(target);
|
||||
}
|
||||
};
|
||||
|
||||
form.add(nameField);
|
||||
|
||||
form.add(categoryPanel);
|
||||
form.add(vclPanel);
|
||||
|
||||
form.add(saveLink);
|
||||
dialog.replace(form);
|
||||
|
||||
target.addComponent(dialog);
|
||||
dialog.open(target);
|
||||
}
|
||||
|
||||
};
|
||||
add(newLink);
|
||||
|
||||
final IModel<List<CheckListTemplate>> checkListTemplateModel = new LoadableDetachableModel<List<CheckListTemplate>>() {
|
||||
|
||||
@ -74,13 +150,15 @@ public class AdminListCheckListTemplatePanel extends Panel{
|
||||
|
||||
@Override
|
||||
protected List<CheckListTemplate> load() {
|
||||
return checkListTemplateDao.findAll();
|
||||
List<CheckListTemplate> templates = checkListTemplateDao.findTemplates();
|
||||
nrOfTemplates = templates.size();
|
||||
return templates;
|
||||
}
|
||||
};
|
||||
|
||||
final WebMarkupContainer container = new WebMarkupContainer("container");
|
||||
container = new WebMarkupContainer("container");
|
||||
container.setOutputMarkupId(true);
|
||||
ListView<CheckListTemplate> checkListTemplates = new ListView<CheckListTemplate>("checkListTemplates", checkListTemplateModel) {
|
||||
checkListTemplates = new ListView<CheckListTemplate>("checkListTemplates", checkListTemplateModel) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -90,12 +168,38 @@ public class AdminListCheckListTemplatePanel extends Panel{
|
||||
Label templateOwner = new Label("templateOwner", new PropertyModel<String>(item.getModel(), "creator"));
|
||||
Label templateOuestion = new Label("templateOuestion", new PropertyModel<String>(item.getModel(), "numberOfQuestions"));
|
||||
|
||||
|
||||
String labelMsg = getChecklistCategoryString(item.getModelObject().getCategories());
|
||||
|
||||
MultiLineLabel categoriesLabel = new MultiLineLabel("categories", new Model<String>(labelMsg));
|
||||
|
||||
AjaxLink<Void> moveUpLink = new AjaxLink<Void>("moveUpLink") {
|
||||
int itemPos = item.getModelObject().getTemplateNumber();
|
||||
private static final long serialVersionUID = 1529565679210978293L;
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
swapTemplates(itemPos, itemPos - 1);
|
||||
target.addComponent(container);
|
||||
}
|
||||
};
|
||||
|
||||
AjaxLink<Void> moveDownLink = new AjaxLink<Void>("moveDownLink") {
|
||||
int itemPos = item.getModelObject().getTemplateNumber();
|
||||
private static final long serialVersionUID = 1529565679210978293L;
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
swapTemplates(itemPos, itemPos + 1);
|
||||
target.addComponent(container);
|
||||
}
|
||||
};
|
||||
moveUpLink.add(new ImageObject("upArrowImage", ImageObject.THIRTYTWO + ImageObject.UPARROW));
|
||||
moveDownLink.add(new ImageObject("downArrowImage", ImageObject.THIRTYTWO + ImageObject.DOWNARROW));
|
||||
item.add(moveUpLink);
|
||||
item.add(moveDownLink);
|
||||
|
||||
if(item.getModelObject().getTemplateNumber() == 0){
|
||||
moveUpLink.setVisible(false);
|
||||
}else if(item.getModelObject().getTemplateNumber() == (nrOfTemplates-1)){
|
||||
moveDownLink.setVisible(false);
|
||||
}
|
||||
|
||||
AjaxLink<Void> deleteLink = new AjaxLink<Void>("delete") {
|
||||
|
||||
@ -137,37 +241,35 @@ public class AdminListCheckListTemplatePanel extends Panel{
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
form = new Form<CheckListTemplate>("form");
|
||||
|
||||
nameField = new RequiredTextField<String>("nameField", new PropertyModel<String>(item.getModelObject(), "name"));
|
||||
nameField.setOutputMarkupId(true);
|
||||
|
||||
categories = item.getModelObject().getCategories();
|
||||
categoryPanel = new ChecklistCategoryPanel("categoryPanel", categories);
|
||||
vclPanel = new AdminViewCheckListTemplatePanel("checkListDialog", item.getModelObject());
|
||||
|
||||
|
||||
|
||||
AjaxButton saveLink = new AjaxButton("saveLink", new Model<String>("Save template")) {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||
CheckListTemplate tmp = checkListTemplateDao.save(checkListTemplateDao.load(vclPanel.getCheckListTemplateId()));
|
||||
|
||||
tmp.setName(nameField.getModelObject());
|
||||
|
||||
tmp.setCategories(categoryPanel.getSelectedCategories());
|
||||
checkListTemplateDao.save(tmp);
|
||||
target.addComponent(container);
|
||||
dialog.close(target);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
form.add(nameField);
|
||||
form.add(categoryPanel);
|
||||
form.add(vclPanel);
|
||||
|
||||
|
||||
dialog.setTitle(vclPanel.getCheckListTemplate().getName());
|
||||
form.add(saveLink);
|
||||
dialog.replace(form);
|
||||
|
||||
target.addComponent(dialog);
|
||||
dialog.open(target);
|
||||
}
|
||||
@ -200,6 +302,28 @@ public class AdminListCheckListTemplatePanel extends Panel{
|
||||
|
||||
return labelMsg;
|
||||
}
|
||||
|
||||
private void templateNumberSetup(){
|
||||
List<CheckListTemplate> templates = checkListTemplateDao.findAll();
|
||||
for(CheckListTemplate t : templates){
|
||||
if(t.getTemplateNumber() == NO_NUMBER){
|
||||
t.setTemplateNumber(templates.indexOf(t));
|
||||
t = checkListTemplateDao.save(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void swapTemplates(int index1, int index2){
|
||||
List<CheckListTemplate> templates = checkListTemplateDao.findTemplates();
|
||||
if(index1 >= 0 && index2 < templates.size()){
|
||||
templates.get(index1).setTemplateNumber(index2);
|
||||
templates.get(index2).setTemplateNumber(index1);
|
||||
checkListTemplateDao.save(templates.get(index1));
|
||||
checkListTemplateDao.save(templates.get(index2));
|
||||
System.out.println("Swapped " + index1 + " and " + index2);
|
||||
checkListTemplates.detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,11 +3,12 @@
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div wicket:id="feedback"></div>
|
||||
<div wicket:id="editUserDialog"><span wicket:id="dialogContent"></span></div>
|
||||
<div>
|
||||
<label for="search">Search:</label> <input type="text" class="text"
|
||||
id="search" wicket:id="searchField" />
|
||||
</div>
|
||||
|
||||
<div class="margin" wicket:id="view">
|
||||
<input type="radio">
|
||||
</div>
|
||||
@ -31,7 +32,7 @@
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr wicket:id="userDataView">
|
||||
<td><span wicket:id="userInfo"></span></td>
|
||||
<td><a href="#" wicket:id="editUserLink"><span wicket:id="userInfo"></span></a></td>
|
||||
<td><input type="checkbox" wicket:id="studentCheckBox" /></td>
|
||||
<td><input type="checkbox" wicket:id="employeeCheckBox" /></td>
|
||||
<td><input type="checkbox" wicket:id="adminCheckBox" /></td>
|
||||
|
@ -9,30 +9,31 @@ import java.util.List;
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior;
|
||||
import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.form.RadioChoice;
|
||||
import org.apache.wicket.markup.html.form.TextField;
|
||||
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
|
||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
||||
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.EmptyDataProvider;
|
||||
import org.apache.wicket.markup.repeater.data.IDataProvider;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Admin;
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.data.dataobjects.SysAdmin;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.dataproviders.FinalSeminarAfterNowDataProvider;
|
||||
import se.su.dsv.scipro.dataproviders.FinalSeminarBeforeNowDataProvider;
|
||||
import se.su.dsv.scipro.dataproviders.UserSearchDataProvider;
|
||||
import se.su.dsv.scipro.opponent.panels.OpponentListViewPanel;
|
||||
import se.su.dsv.scipro.user.panels.UserProfilePanelFactory;
|
||||
|
||||
/**
|
||||
* @author Johan Aschan - aschan@dsv.su.se
|
||||
@ -51,13 +52,16 @@ public class AdminRolesPanel extends Panel {
|
||||
private String userSearch;
|
||||
private DataView<User> dataView;
|
||||
@SpringBean
|
||||
private UserProfilePanelFactory userProfilePanelFactory;
|
||||
@SpringBean
|
||||
private RoleDao roleDao;
|
||||
private String selected = "All";
|
||||
private RoleEnum selectedRole = RoleEnum.ALL;
|
||||
|
||||
private Dialog editUserDialog;
|
||||
|
||||
public AdminRolesPanel(String id) {
|
||||
super(id);
|
||||
|
||||
add(new FeedbackPanel("feedback"));
|
||||
TextField<String> searchField = new TextField<String>("searchField",
|
||||
new PropertyModel<String>(this, "userSearch"));
|
||||
final WebMarkupContainer container = new WebMarkupContainer("container");
|
||||
@ -118,6 +122,15 @@ public class AdminRolesPanel extends Panel {
|
||||
add(container);
|
||||
container.add(new PagingNavigator("pagingNavigator", dataView));
|
||||
|
||||
setupEditUserDialog();
|
||||
}
|
||||
|
||||
private void setupEditUserDialog() {
|
||||
editUserDialog = new Dialog("editUserDialog");
|
||||
editUserDialog.setAutoOpen(false);
|
||||
editUserDialog.setModal(true);
|
||||
editUserDialog.add(new EmptyPanel("dialogContent"));
|
||||
add(editUserDialog);
|
||||
}
|
||||
|
||||
public void checkRole() {
|
||||
@ -142,14 +155,28 @@ public class AdminRolesPanel extends Panel {
|
||||
public void loadUserDataView(IDataProvider<User> userDataProvider) {
|
||||
dataView = new DataView<User>("userDataView", userDataProvider, 10) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(Item<User> item) {
|
||||
final User user = item.getModelObject();
|
||||
//Add ajax link to edit the user
|
||||
AjaxLink<Void> editUserLink = new AjaxLink<Void>("editUserLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
editUserDialog.replace(userProfilePanelFactory.createUserProfilePanelForUser("dialogContent",user,editUserDialog));
|
||||
editUserDialog.setTitle("Edit user");
|
||||
target.addComponent(editUserDialog);
|
||||
editUserDialog.open(target);
|
||||
}
|
||||
};
|
||||
item.add(editUserLink);
|
||||
String userInfo = user.getFirstName() + " "
|
||||
+ user.getLastName() + " <" + user.getEmailAddress()
|
||||
+ ">";
|
||||
Label userInfoLabel = new Label("userInfo", userInfo);
|
||||
item.add(userInfoLabel);
|
||||
editUserLink.add(userInfoLabel);
|
||||
boolean student = false, sysAdmin = false, admin = false, employee = false;
|
||||
|
||||
if (roleDao.isStudent(user))
|
||||
|
@ -15,6 +15,7 @@ import se.su.dsv.scipro.admin.pages.AdminScheduleTemplatesPage;
|
||||
import se.su.dsv.scipro.admin.pages.AdminStartPage;
|
||||
import se.su.dsv.scipro.admin.pages.ProjectManagementPage;
|
||||
import se.su.dsv.scipro.admin.pages.SystemMaintenancePage;
|
||||
import se.su.dsv.scipro.admin.pages.match.AdminManageProjectIdeaPage;
|
||||
import se.su.dsv.scipro.admin.pages.settings.AdminGeneralSettingsPage;
|
||||
import se.su.dsv.scipro.components.AbstractMenuPanel;
|
||||
import se.su.dsv.scipro.components.menuhighlighting.MenuHighlightAdminPeer;
|
||||
@ -34,7 +35,7 @@ public class AdminTabMenuPanel extends AbstractMenuPanel {
|
||||
|
||||
items.add(new MenuItem("Start", AdminStartPage.class));
|
||||
items.add(new MenuItem("Project management", ProjectManagementPage.class));
|
||||
items.add(new MenuItem("Schedule templates", AdminScheduleTemplatesPage.class));
|
||||
items.add(new MenuItem("Activity plan templates", AdminScheduleTemplatesPage.class));
|
||||
items.add(new MenuItem("System maintenance", SystemMaintenancePage.class));
|
||||
items.add(new MenuItem("All final seminars", AdminFinalSeminarPage.class));
|
||||
items.add(new MenuItem("All peers", AdminPeerListPage.class, MenuHighlightAdminPeer.class));
|
||||
@ -44,6 +45,7 @@ public class AdminTabMenuPanel extends AbstractMenuPanel {
|
||||
items.add(new MenuItem("Role management", AdminRolePage.class));
|
||||
items.add(new MenuItem("Project partner", AdminProjectPartnerPage.class));
|
||||
items.add(new MenuItem("CheckList", AdminCheckListPage.class));
|
||||
items.add(new MenuItem("Match", AdminManageProjectIdeaPage.class));
|
||||
|
||||
return items;
|
||||
}
|
||||
|
@ -5,26 +5,69 @@
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<wicket:panel>
|
||||
<div class="append-bottom"></div>
|
||||
<div class="rounded-box">
|
||||
<div class="box-title">Write questions that can be answered
|
||||
with</div>
|
||||
<div>
|
||||
<table class="legend-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><img wicket:id="green"></td>
|
||||
<td><img wicket:id="yellow"></td>
|
||||
<td><img wicket:id="red"></td>
|
||||
<td><img wicket:id="grey"></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>OK</td>
|
||||
<td>Minor corrections</td>
|
||||
<td>Not done</td>
|
||||
<td>Not applicable</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div wicket:id="container">
|
||||
<table class="rounded-table seminar-table even-rows">
|
||||
<tr>
|
||||
<th colspan="4"><div wicket:id="templateName"></div></th>
|
||||
</tr>
|
||||
<!-- <th colspan="4"><div wicket:id="templateName"></div></th> -->
|
||||
<th colspan="4">Questions</th>
|
||||
</tr>
|
||||
<tr wicket:id="questions">
|
||||
<td colspan="2"><span wicket:id="questionNrLabel"></span><span wicket:id="questionLabel"></span></td>
|
||||
<td><div class="split-row"><a href="#" wicket:id="moveUpLink"><img wicket:id="upArrowImage"/></a></div>
|
||||
<div class="split-row"><a href="#" wicket:id="moveDownLink"><img wicket:id="downArrowImage" alt="Down" title="Down"/></a></div></td>
|
||||
<td width="10"><a href="#" wicket:id="delete">
|
||||
<img wicket:id="deleteIcon" alt="Delete" title="Delete"/>
|
||||
<td colspan="2"><span wicket:id="questionNrLabel"></span><span
|
||||
wicket:id="questionLabel"></span></td>
|
||||
<td><div class="split-row">
|
||||
<a href="#" wicket:id="moveUpLink"><img
|
||||
wicket:id="upArrowImage" /></a>
|
||||
</div>
|
||||
<div class="split-row">
|
||||
<a href="#" wicket:id="moveDownLink"><img
|
||||
wicket:id="downArrowImage" alt="Down" title="Down" /></a>
|
||||
</div></td>
|
||||
<td width="10"><a href="#" wicket:id="delete"> <img
|
||||
wicket:id="deleteIcon" alt="Delete" title="Delete" />
|
||||
</a></td>
|
||||
</tr>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
<tr>
|
||||
<td colspan="4"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div wicket:id="feedbackField"></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<form wicket:id="addQuestionForm">
|
||||
<div><input wicket:id="questionField" type="text" /></div>
|
||||
<div>
|
||||
<input wicket:id="questionField" style="width: 500px;" type="text" />
|
||||
</div>
|
||||
<input wicket:id="addQuestionButton" type="submit" />
|
||||
</form>
|
||||
</wicket:panel>
|
||||
|
@ -44,6 +44,11 @@ public class AdminViewCheckListTemplatePanel extends Panel {
|
||||
List<String> questions = clt.getQuestions();
|
||||
this.clt = clt;
|
||||
|
||||
add(new ImageObject("green", ImageObject.PATH + ImageObject.LIGHT_GREEN));
|
||||
add(new ImageObject("yellow", ImageObject.PATH + ImageObject.LIGHT_YELLOW));
|
||||
add(new ImageObject("red", ImageObject.PATH + ImageObject.LIGHT_RED));
|
||||
add(new ImageObject("grey", ImageObject.PATH + ImageObject.LIGHT_GREY));
|
||||
|
||||
//Setup form-details
|
||||
final IModel<String> templateNameModel = new Model<String>(clt.getName());
|
||||
final AjaxEditableLabel<String> templateNameLabel = new AjaxEditableLabel<String>("templateName",
|
||||
@ -141,9 +146,15 @@ public class AdminViewCheckListTemplatePanel extends Panel {
|
||||
}else{
|
||||
error("Question text can not be empty");
|
||||
}
|
||||
|
||||
questionField.clearInput(); //clear the text area
|
||||
questionField.setModelObject(null); //make sure it "knows" the model has been changed
|
||||
|
||||
|
||||
question = "";
|
||||
counter = 0;
|
||||
target.addComponent(container);
|
||||
target.addComponent(questionField);
|
||||
}
|
||||
};
|
||||
addQuestionButton.setOutputMarkupId(true);
|
||||
|
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<wicket:enclosure child="importExportForm">
|
||||
<form wicket:id="importExportForm">
|
||||
<div>Import user (username): <input type="text" wicket:id="importUserName"/></div>
|
||||
<div>Import user (userid): <input type="text" wicket:id="importUserId"/></div>
|
||||
<div>Import project (id): <input type="text" wicket:id="importProjectId"/></div>
|
||||
<div>Import projects matching title: <input type="text" wicket:id="importProjectTitle"/></div>
|
||||
<div>Export project (id): <input type="text" wicket:id="exportProjectId"/></div>
|
||||
<div>Include linked projects (only applies when importing users): <input type="checkbox" wicket:id="includeLinkedProjects"/></div>
|
||||
<div>Import all supervisors: <input type="checkbox" wicket:id="importSupervisors"/></div>
|
||||
<div><input type="submit"/></div>
|
||||
</form>
|
||||
</wicket:enclosure>
|
||||
<div wicket:id="statusMessage"></div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,188 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package se.su.dsv.scipro.admin.panels;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.form.CheckBox;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.TextField;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.CompoundPropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.ApplicationSettings;
|
||||
import se.su.dsv.scipro.io.ExternalImporter;
|
||||
import se.su.dsv.scipro.io.exceptions.ExternalImportException;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
|
||||
public class ManualImportExportPanel extends Panel {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Label statusMessage = new Label("statusMessage","");
|
||||
@SpringBean
|
||||
private ExternalImporter externalImporter;
|
||||
@SpringBean
|
||||
private ExternalImporter externalExporter;
|
||||
@SpringBean
|
||||
private ApplicationSettings applicationSettings;
|
||||
private Form<ImportExportParams> importExportForm;
|
||||
private static final Logger logger = Logger.getLogger(ManualImportExportPanel.class);
|
||||
|
||||
public ManualImportExportPanel(String id) {
|
||||
super(id);
|
||||
init();
|
||||
}
|
||||
private void init(){
|
||||
statusMessage.setOutputMarkupId(true);
|
||||
if(hasRemote())
|
||||
setMessage("Using remote: "+getRemoteUrl());
|
||||
else
|
||||
setMessage("No remote configured");
|
||||
add(statusMessage);
|
||||
setupForm();
|
||||
}
|
||||
private void setupForm(){
|
||||
importExportForm = new Form<ImportExportParams>("importExportForm",new CompoundPropertyModel<ImportExportParams>(new ImportExportParams())){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onSubmit(){
|
||||
final ImportExportParams params = getModelObject();
|
||||
final String userNameIn = params.getImportUserName();
|
||||
final long userIdIn = params.getImportUserId();
|
||||
final boolean importSupervisors = params.isImportSupervisors();
|
||||
final long projectIdIn = params.getImportProjectId();
|
||||
final String projectTitleIn = params.getImportProjectTitle();
|
||||
final long projectIdOut = params.getExportProjectId();
|
||||
|
||||
if(userNameIn != null && !userNameIn.equals("")){
|
||||
logger.debug("Attempting remote import of user: "+userNameIn);
|
||||
try{
|
||||
externalImporter.importUser(userNameIn,params.isIncludeLinkedProjects());
|
||||
setMessage("Succesfully imported user with username: "+userNameIn + " from "+getRemoteUrl());
|
||||
}catch(final ExternalImportException eie){
|
||||
logger.warn("Caught error while importing user from remote system: "+eie.getMessage());
|
||||
setMessage("Failed to import user with username: "+userNameIn+ " from "+getRemoteUrl()+", error: "+eie.getWrappedErrorCode());
|
||||
}
|
||||
}
|
||||
if(userIdIn > 0){
|
||||
logger.debug("Attempting remote import of id: "+userIdIn);
|
||||
try{
|
||||
externalImporter.importUser(userIdIn,params.isIncludeLinkedProjects());
|
||||
setMessage("Succesfully imported user with id: "+userIdIn + " from "+getRemoteUrl());
|
||||
}catch(final ExternalImportException eie){
|
||||
logger.warn("Caught error while importing user from remote system: "+eie.getMessage());
|
||||
setMessage("Failed to import user with id: "+userIdIn+ " from "+getRemoteUrl()+", error: "+eie.getWrappedErrorCode());
|
||||
}
|
||||
}
|
||||
if(importSupervisors){
|
||||
logger.debug("Importing all listed supervisors");
|
||||
try{
|
||||
externalImporter.importUsersOfRole(Roles.EMPLOYEE,params.isIncludeLinkedProjects());
|
||||
setMessage("Successfully imported supervisors from " + getRemoteUrl());
|
||||
}catch(final ExternalImportException eie){
|
||||
logger.warn("Caught error while importing supervisors from remote system: "+eie.getMessage());
|
||||
setMessage("Failed to import supervisors from "+getRemoteUrl()+", error: "+eie.getWrappedErrorCode());
|
||||
}
|
||||
}
|
||||
if(projectIdIn > 0){
|
||||
logger.debug("Attempting remote import of project: "+projectIdIn);
|
||||
try{
|
||||
externalImporter.importProject(projectIdIn);
|
||||
setMessage("Successfully imported project with id "+projectIdIn+" from " + getRemoteUrl());
|
||||
}catch (final ExternalImportException eie){
|
||||
logger.warn("Caught error while importing project from remote system: "+eie.getMessage());
|
||||
setMessage("Failed to import project with id "+projectIdIn+" from "+getRemoteUrl()+", error: "+eie.getWrappedErrorCode());
|
||||
}
|
||||
}
|
||||
if(projectTitleIn != null && !projectTitleIn.equals((""))){
|
||||
logger.debug("Attempting remote import of projects matching: '"+projectTitleIn+"'");
|
||||
try{
|
||||
externalImporter.importProjects(projectTitleIn);
|
||||
setMessage("Successfully imported all projects matching title '"+projectTitleIn+"' from " + getRemoteUrl());
|
||||
}catch (final ExternalImportException eie){
|
||||
logger.warn("Caught error while importing project from remote system: "+eie.getMessage());
|
||||
setMessage("Failed to import projects matching title '"+projectTitleIn+"' from "+getRemoteUrl()+", error: "+eie.getWrappedErrorCode());
|
||||
}
|
||||
}
|
||||
if(projectIdOut > 0){
|
||||
logger.debug("Attempting remote export of project: "+projectIdOut);
|
||||
throw new UnsupportedOperationException("Not implemented yet");
|
||||
}
|
||||
}
|
||||
};
|
||||
add(importExportForm);
|
||||
importExportForm.add(new TextField<String>("importUserName"));
|
||||
importExportForm.add(new TextField<Long>("importUserId"));
|
||||
importExportForm.add(new TextField<Long>("importProjectId"));
|
||||
importExportForm.add(new TextField<String>("importProjectTitle"));
|
||||
importExportForm.add(new TextField<Long>("exportProjectId"));
|
||||
importExportForm.add(new CheckBox("includeLinkedProjects"));
|
||||
importExportForm.add(new CheckBox("importSupervisors"));
|
||||
importExportForm.setVisible(hasRemote());
|
||||
}
|
||||
private boolean hasRemote(){
|
||||
return externalImporter.supportsRemoteOperations();
|
||||
}
|
||||
private String getRemoteUrl(){
|
||||
return applicationSettings.getRemoteLookupUrl();
|
||||
}
|
||||
private void setMessage(final String message){
|
||||
statusMessage.setDefaultModelObject(message);
|
||||
}
|
||||
//Utility model-class
|
||||
private class ImportExportParams implements Serializable{
|
||||
private static final long serialVersionUID = 5961088002006031317L;
|
||||
private String importUserName;
|
||||
private long importUserId;
|
||||
private boolean importSupervisors;
|
||||
private long importProjectId;
|
||||
private String importProjectTitle;
|
||||
private long exportProjectId;
|
||||
private boolean includeLinkedProjects=false;
|
||||
public String getImportUserName() {
|
||||
return importUserName;
|
||||
}
|
||||
public void setImportUserName(String importUserName) {
|
||||
this.importUserName = importUserName;
|
||||
}
|
||||
public long getImportProjectId() {
|
||||
return importProjectId;
|
||||
}
|
||||
public void setImportProjectId(long importProjectId) {
|
||||
this.importProjectId = importProjectId;
|
||||
}
|
||||
public String getImportProjectTitle() {
|
||||
return importProjectTitle;
|
||||
}
|
||||
public void setImportProjectTitle(String importProjectTitle) {
|
||||
this.importProjectTitle = importProjectTitle;
|
||||
}
|
||||
public long getExportProjectId() {
|
||||
return exportProjectId;
|
||||
}
|
||||
public void setExportProjectId(long exportProjectId) {
|
||||
this.exportProjectId = exportProjectId;
|
||||
}
|
||||
public boolean isImportSupervisors() {
|
||||
return importSupervisors;
|
||||
}
|
||||
public void setImportSupervisors(boolean importSupervisors) {
|
||||
this.importSupervisors = importSupervisors;
|
||||
}
|
||||
public long getImportUserId() {
|
||||
return importUserId;
|
||||
}
|
||||
public void setImportUserId(long importUserId) {
|
||||
this.importUserId = importUserId;
|
||||
}
|
||||
public boolean isIncludeLinkedProjects() {
|
||||
return includeLinkedProjects;
|
||||
}
|
||||
public void setIncludeLinkedProjects(boolean includeLinkedProjects) {
|
||||
this.includeLinkedProjects = includeLinkedProjects;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div wicket:id="main"></div>
|
||||
<wicket:fragment wicket:id="buttonFragment">
|
||||
<button wicket:id="manualMatchButton">Match manually</button>
|
||||
</wicket:fragment>
|
||||
<wicket:fragment wicket:id="matchFragment">
|
||||
<form wicket:id="matchForm">
|
||||
Supervisor: <div wicket:id="supervisorTextField"></div>
|
||||
<p>
|
||||
<button type="submit" style="float: right;">Save</button>
|
||||
<button wicket:id="cancelButton" style="float: right;">Cancel</button>
|
||||
</form>
|
||||
</wicket:fragment>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,181 @@
|
||||
package se.su.dsv.scipro.admin.panels;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
|
||||
import org.apache.wicket.markup.html.form.ChoiceRenderer;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.panel.Fragment;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.apache.wicket.util.string.Strings;
|
||||
import org.odlabs.wiquery.ui.autocomplete.AutocompleteComponent;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.SupervisorDao;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
|
||||
public class ManualMatchPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SpringBean
|
||||
SupervisorDao supervisorDao;
|
||||
|
||||
@SpringBean
|
||||
UserDao userDao;
|
||||
|
||||
private Fragment currentFragment;
|
||||
private Fragment alternateFragment;
|
||||
private Form<Employee> matchForm;
|
||||
private AutocompleteComponent<Employee> autocompleteSupervisorField;
|
||||
private Long supervisorId;
|
||||
|
||||
public ManualMatchPanel(String id, IModel<Match> matchModel) {
|
||||
super(id);
|
||||
|
||||
supervisorId = matchModel.getObject().getSupervisor().getId();
|
||||
|
||||
setOutputMarkupPlaceholderTag(true);
|
||||
|
||||
currentFragment = createButtonFragment();
|
||||
alternateFragment = createMatchFragment(matchModel);
|
||||
|
||||
add(currentFragment);
|
||||
}
|
||||
|
||||
private Fragment createButtonFragment() {
|
||||
Fragment buttonFragment = new Fragment("main", "buttonFragment", this) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void onBeforeRender() {
|
||||
matchForm.setEnabled(false);
|
||||
super.onBeforeRender();
|
||||
}
|
||||
};
|
||||
buttonFragment.add(new AjaxFallbackLink<Object>("manualMatchButton") {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
swapFragment();
|
||||
if (target != null) {
|
||||
target.addComponent(currentFragment);
|
||||
}
|
||||
}
|
||||
});
|
||||
buttonFragment.setOutputMarkupPlaceholderTag(true);
|
||||
return buttonFragment;
|
||||
}
|
||||
|
||||
private Fragment createMatchFragment(final IModel<Match> matchModel) {
|
||||
Fragment matchFragment = new Fragment("main", "matchFragment", this) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void onBeforeRender() {
|
||||
matchForm.setEnabled(true);
|
||||
super.onBeforeRender();
|
||||
}
|
||||
};
|
||||
autocompleteSupervisorField = createAutocompleteComponent();
|
||||
|
||||
matchForm = new Form<Employee>("matchForm") {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onSubmit() {
|
||||
matchModel.getObject().setSupervisor(autocompleteSupervisorField.getModelObject());
|
||||
}
|
||||
};
|
||||
|
||||
matchForm.add(autocompleteSupervisorField);
|
||||
matchForm.add(new AjaxFallbackLink<Object>("cancelButton") {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
swapFragment();
|
||||
if (target != null) {
|
||||
target.addComponent(currentFragment);
|
||||
}
|
||||
}
|
||||
});
|
||||
matchFragment.add(matchForm);
|
||||
matchFragment.setOutputMarkupPlaceholderTag(true);
|
||||
return matchFragment;
|
||||
}
|
||||
|
||||
private AutocompleteComponent<Employee> createAutocompleteComponent() {
|
||||
LoadableDetachableModel<List<Employee>> supervisorListModel = new LoadableDetachableModel<List<Employee>>() {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected List<Employee> load() {
|
||||
return supervisorDao.findAll();
|
||||
}
|
||||
};
|
||||
|
||||
LoadableDetachableModel<Employee> supervisorModel = new LoadableDetachableModel<Employee>() {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected Employee load() {
|
||||
return supervisorDao.load(supervisorId);
|
||||
}
|
||||
};
|
||||
|
||||
ChoiceRenderer<Employee> choiceRenderer = new ChoiceRenderer<Employee>() {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getDisplayValue(Employee supervisor) {
|
||||
return supervisor.getUser().getFullName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdValue(Employee supervisor, int index) {
|
||||
return supervisor.getId().toString();
|
||||
}
|
||||
};
|
||||
|
||||
return new AutocompleteComponent<Employee>("supervisorTextField",
|
||||
supervisorModel, supervisorListModel, choiceRenderer) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Employee getValueOnSearchFail(String input) {
|
||||
if (Strings.isEmpty(input)) {
|
||||
return null;
|
||||
} else {
|
||||
User tempUser = new User();
|
||||
tempUser.setFirstName(input);
|
||||
Employee supervisor = new Employee();
|
||||
supervisor.setUser(tempUser);
|
||||
return supervisor;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void swapFragment() {
|
||||
Fragment tempFragment = currentFragment;
|
||||
currentFragment.replaceWith(alternateFragment);
|
||||
currentFragment = alternateFragment;
|
||||
alternateFragment = tempFragment;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<form wicket:id="form">
|
||||
<div>
|
||||
If you want to match and suggest this idea to a supervisor or reviewer manually, you can do so.
|
||||
</div>
|
||||
<div wicket:id="manualMatchPanel"></div>
|
||||
<div>
|
||||
If this project idea is poorly written, it should be sent back to the authors for rewriting.
|
||||
</div>
|
||||
<button wicket:id="sendBackButton">Send back to author(s)</button>
|
||||
<div>
|
||||
If this project idea has been suggested to a supervisor that has not answered for very long, it can be rematched and suggested to some other supervisor.
|
||||
</div>
|
||||
<button wicket:id="rematchButton">Rematch project idea</button>
|
||||
<div>
|
||||
If this project idea will not be carried out for whatever reason, it can be canceled.
|
||||
</div>
|
||||
<button wicket:id="cancelButton">Cancel the project idea</button>
|
||||
</form>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,74 @@
|
||||
package se.su.dsv.scipro.admin.panels;
|
||||
|
||||
import org.apache.wicket.markup.html.form.Button;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.MatchDao;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
import se.su.dsv.scipro.match.dataobject.Match.Status;
|
||||
|
||||
public class ProjectIdeaActionPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SpringBean
|
||||
private MatchDao matchDao;
|
||||
|
||||
private Status status;
|
||||
|
||||
public ProjectIdeaActionPanel(String id, final IModel<Match> matchModel) {
|
||||
super(id);
|
||||
|
||||
Form<Match> form = new Form<Match>("form", matchModel) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void onSubmit() {
|
||||
getModelObject().setStatus(status);
|
||||
/*Match match = getModelObject();
|
||||
match.setStatus(status);
|
||||
matchDao.changeStatus(SciProSession.get().getUser(), match, status);*/
|
||||
}
|
||||
};
|
||||
form.add(new ManualMatchPanel("manualMatchPanel", matchModel));
|
||||
|
||||
form.add(new Button("sendBackButton") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onSubmit() {
|
||||
status = Status.REFUSED;
|
||||
}
|
||||
});
|
||||
|
||||
form.add(new Button("rematchButton") {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onSubmit() {
|
||||
status = Status.UNMATCHED;
|
||||
}
|
||||
});
|
||||
|
||||
form.add(new Button("cancelButton") {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onSubmit() {
|
||||
status = Status.REJECTED;
|
||||
}
|
||||
});
|
||||
add(form);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<a href="#" wicket:id="dialogLink">
|
||||
<img wicket:id="editIcon" />
|
||||
</a>
|
||||
<div wicket:id="dialog">
|
||||
<a href="#" wicket:id="watsonLink">Project idea details</a>
|
||||
|
|
||||
<a href="#" wicket:id="actionLink">Actions</a>
|
||||
<div wicket:id="mainPanel"></div>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,92 @@
|
||||
package se.su.dsv.scipro.admin.panels.match;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.match.dao.interfaces.MatchDao;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
|
||||
import se.su.dsv.scipro.supervisor.panels.WatsonInfoPanel;
|
||||
|
||||
public class AdminEditProjectIdeaPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SpringBean
|
||||
MatchDao matchDao;
|
||||
private Panel watsonPanel;
|
||||
private Panel actionPanel;
|
||||
private Panel currentPanel;
|
||||
private AjaxFallbackLink<Void> watsonLink;
|
||||
private AjaxFallbackLink<Void> actionLink;
|
||||
|
||||
public AdminEditProjectIdeaPanel(String id, IModel<ProjectIdea> model) {
|
||||
super(id, model);
|
||||
|
||||
Match match = model.getObject().getMatch();
|
||||
if (match != null) {
|
||||
|
||||
watsonPanel = new WatsonInfoPanel("mainPanel", match.getProjectIdea());
|
||||
actionPanel = new ProjectIdeaActionPanel("mainPanel",
|
||||
new PropertyModel<Match>(model, "match"));
|
||||
currentPanel = watsonPanel;
|
||||
currentPanel.setOutputMarkupId(true);
|
||||
watsonPanel.setOutputMarkupId(true);
|
||||
actionPanel.setOutputMarkupId(true);
|
||||
watsonLink = new AjaxFallbackLink<Void>("watsonLink") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return currentPanel != watsonPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
currentPanel.replaceWith(watsonPanel);
|
||||
currentPanel = watsonPanel;
|
||||
|
||||
if (target != null) {
|
||||
target.addComponent(currentPanel);
|
||||
target.addComponent(actionLink);
|
||||
target.addComponent(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
watsonLink.setOutputMarkupId(true);
|
||||
add(watsonLink);
|
||||
|
||||
actionLink = new AjaxFallbackLink<Void>("actionLink") {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return currentPanel != actionPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
currentPanel.replaceWith(actionPanel);
|
||||
currentPanel = actionPanel;
|
||||
|
||||
if (target != null) {
|
||||
target.addComponent(currentPanel);
|
||||
target.addComponent(watsonLink);
|
||||
target.addComponent(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
actionLink.setOutputMarkupId(true);
|
||||
add(actionLink);
|
||||
|
||||
add(currentPanel);
|
||||
} else {
|
||||
this.setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package se.su.dsv.scipro.admin.panels.match;
|
||||
|
||||
import org.apache.wicket.markup.html.form.Button;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
|
||||
public class AdminManageProjectIdeaPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public AdminManageProjectIdeaPanel(String id) {
|
||||
super(id);
|
||||
add(new MatchProjectIdeaManuallyPanel("matchManuallyPanel"));
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<form wicket:id="editKeywordForm">
|
||||
<div><b>Name: </b><input type="text" wicket:id="name"></input></div>
|
||||
<div><b>Type: </b><select wicket:id="keywordTypeSelector"></select></div>
|
||||
<div><b>Active: </b><input type="checkbox" wicket:id="activeCheckbox" /></div>
|
||||
<div><input wicket:id="saveButton" type="submit" value="Save" /></div>
|
||||
</form>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,71 @@
|
||||
package se.su.dsv.scipro.admin.panels.match;
|
||||
|
||||
import org.apache.wicket.markup.html.form.Button;
|
||||
import org.apache.wicket.markup.html.form.CheckBox;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.TextField;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.components.InverseBooleanModel;
|
||||
import se.su.dsv.scipro.components.KeywordTypeSelector;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.KeywordDao;
|
||||
import se.su.dsv.scipro.match.dataobject.Keyword;
|
||||
import se.su.dsv.scipro.match.dataobject.KeywordType;
|
||||
|
||||
public class CreateKeywordPanel extends Panel {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SpringBean
|
||||
private KeywordDao keywordDao;
|
||||
|
||||
public CreateKeywordPanel(String str, KeywordType keywordType) {
|
||||
super(str);
|
||||
Keyword keyword = new Keyword();
|
||||
keyword.setType(keywordType);
|
||||
add(new EditKeywordForm("editKeywordForm", new Model<Keyword>(keyword)));
|
||||
}
|
||||
|
||||
private class EditKeywordForm extends Form<Keyword>{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private KeywordTypeSelector keywordTypeSelector;
|
||||
private TextField<String> name;
|
||||
private CheckBox activeCheckbox;
|
||||
|
||||
public EditKeywordForm(String id, final IModel<Keyword> model) {
|
||||
super(id, model);
|
||||
this.setOutputMarkupId(true);
|
||||
|
||||
name = new TextField<String>("name",
|
||||
new PropertyModel<String>(model, "keyword"));
|
||||
|
||||
keywordTypeSelector = new KeywordTypeSelector("keywordTypeSelector",
|
||||
new PropertyModel<KeywordType>(model, "type"));
|
||||
|
||||
activeCheckbox = new CheckBox("activeCheckbox",
|
||||
new InverseBooleanModel(new PropertyModel<Boolean>(model, "deleted")));
|
||||
|
||||
activeCheckbox.setOutputMarkupId(true);
|
||||
|
||||
Button saveButton = new Button("saveButton");
|
||||
|
||||
add(saveButton);
|
||||
add(name);
|
||||
add(keywordTypeSelector);
|
||||
add(activeCheckbox);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSubmit() {
|
||||
IModel<Keyword> model = getModel();
|
||||
model.setObject(keywordDao.save(model.getObject()));
|
||||
super.onSubmit();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<form wicket:id="editKeywordForm">
|
||||
<div><b>Name: </b><input type="text" wicket:id="name"></input></div>
|
||||
<div><b>Type: </b><select wicket:id="keywordTypeSelector"></select></div>
|
||||
<div><b>Active: </b><input type="checkbox" wicket:id="activeCheckbox" /></div>
|
||||
<div><input wicket:id="saveButton" type="submit" value="Save" /></div>
|
||||
</form>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,68 @@
|
||||
package se.su.dsv.scipro.admin.panels.match;
|
||||
|
||||
import org.apache.wicket.markup.html.form.Button;
|
||||
import org.apache.wicket.markup.html.form.CheckBox;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.TextField;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.components.InverseBooleanModel;
|
||||
import se.su.dsv.scipro.components.KeywordTypeSelector;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.KeywordDao;
|
||||
import se.su.dsv.scipro.match.dataobject.Keyword;
|
||||
import se.su.dsv.scipro.match.dataobject.KeywordType;
|
||||
|
||||
public class EditKeywordPanel extends Panel {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SpringBean
|
||||
private KeywordDao keywordDao;
|
||||
|
||||
public EditKeywordPanel(String str, IModel<Keyword> model) {
|
||||
super(str, model);
|
||||
add(new EditKeywordForm("editKeywordForm", model));
|
||||
}
|
||||
|
||||
private class EditKeywordForm extends Form<Keyword>{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private KeywordTypeSelector keywordTypeSelector;
|
||||
private TextField<String> name;
|
||||
private CheckBox activeCheckbox;
|
||||
|
||||
public EditKeywordForm(String id, final IModel<Keyword> model) {
|
||||
super(id, model);
|
||||
this.setOutputMarkupId(true);
|
||||
|
||||
name = new TextField<String>("name",
|
||||
new PropertyModel<String>(model, "keyword"));
|
||||
|
||||
keywordTypeSelector = new KeywordTypeSelector("keywordTypeSelector",
|
||||
new PropertyModel<KeywordType>(model, "type"));
|
||||
|
||||
activeCheckbox = new CheckBox("activeCheckbox",
|
||||
new InverseBooleanModel(new PropertyModel<Boolean>(model, "deleted")));
|
||||
|
||||
activeCheckbox.setOutputMarkupId(true);
|
||||
|
||||
Button saveButton = new Button("saveButton");
|
||||
|
||||
add(saveButton);
|
||||
add(name);
|
||||
add(keywordTypeSelector);
|
||||
add(activeCheckbox);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSubmit() {
|
||||
IModel<Keyword> model = getModel();
|
||||
model.setObject(keywordDao.save(model.getObject()));
|
||||
super.onSubmit();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div wicket:id="editDialog">
|
||||
<div wicket:id="dialogContent"></div>
|
||||
</div>
|
||||
<a href=# wicket:id="createLink"><img
|
||||
wicket:id="addIcon" alt="" />Create Keyword</a>
|
||||
<form>
|
||||
<table wicket:id="table" class="rounded-corner">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rounded-left-top">Name</th><th>Type</th><th>Active</th><th class="rounded-right-top">Edit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr wicket:id="keywordsDataView">
|
||||
<td wicket:id="name"></td>
|
||||
<td wicket:id="type"></td>
|
||||
<td><a href="#" wicket:id="activeLink">
|
||||
<img wicket:id="activeIcon" /></a></td>
|
||||
<td><a href="#" wicket:id="editLink">
|
||||
<img wicket:id="editIcon" /></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5" class="rounded-foot"> </td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,126 @@
|
||||
package se.su.dsv.scipro.admin.panels.match;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||
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.model.IModel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
import se.su.dsv.scipro.components.LazyDeleteAjaxLink;
|
||||
import se.su.dsv.scipro.icons.ImageObject;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.KeywordDao;
|
||||
import se.su.dsv.scipro.match.dataobject.Keyword;
|
||||
import se.su.dsv.scipro.match.dataobject.KeywordType;
|
||||
import se.su.dsv.scipro.match.dataprovider.KeywordsDataProvider;
|
||||
|
||||
public class ManageKeywordPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SpringBean
|
||||
private KeywordDao keywordDao;
|
||||
|
||||
private KeywordsDataProvider keywordsDataProvider;
|
||||
|
||||
private Dialog dialog;
|
||||
private final WebMarkupContainer tableContainer;
|
||||
private final DataView<Keyword> keywordsDataView;
|
||||
|
||||
public ManageKeywordPanel(String str, final KeywordType keywordType) {
|
||||
super(str);
|
||||
|
||||
AjaxLink<Void> createLink = new AjaxLink<Void>("createLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
dialog.replace(new CreateKeywordPanel("dialogContent", keywordType));
|
||||
target.addComponent(dialog);
|
||||
dialog.setTitle("Add Keyword...");
|
||||
dialog.open(target);
|
||||
}
|
||||
};
|
||||
createLink.add(new ImageObject("addIcon", ImageObject.SIXTEEN + ImageObject.ADD));
|
||||
|
||||
dialog = new Dialog("editDialog");
|
||||
dialog.setModal(true);
|
||||
dialog.setAutoOpen(false);
|
||||
dialog.setWidth(500);
|
||||
dialog.setHeight(500);
|
||||
dialog.add(new EmptyPanel("dialogContent"));
|
||||
dialog.setOutputMarkupId(true);
|
||||
|
||||
keywordsDataProvider = new KeywordsDataProvider(null, keywordType);
|
||||
|
||||
tableContainer = new WebMarkupContainer("table");
|
||||
tableContainer.setOutputMarkupId(true);
|
||||
|
||||
keywordsDataView = new DataView<Keyword>("keywordsDataView", keywordsDataProvider) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(final Item<Keyword> item) {
|
||||
item.setOutputMarkupId(true);
|
||||
Keyword keyword = item.getModelObject();
|
||||
|
||||
final ImageObject editIcon = new ImageObject("editIcon", ImageObject.SIXTEEN + ImageObject.EDIT);
|
||||
|
||||
final AjaxLink<Void> editLink = new AjaxLink<Void>("editLink") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void onInitialize() {
|
||||
super.onInitialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
target.addComponent(dialog);
|
||||
dialog.setTitle("Edit keyword...");
|
||||
dialog.replace(new EditKeywordPanel("dialogContent", new Model<Keyword>(item.getModelObject())));
|
||||
dialog.open(target);
|
||||
}
|
||||
};
|
||||
editLink.add(editIcon);
|
||||
|
||||
LazyDeleteAjaxLink activeLink = new LazyDeleteAjaxLink("activeLink",
|
||||
new PropertyModel<Boolean>(item.getModel(), "deleted")) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
super.onClick(target);
|
||||
IModel<Keyword> model = item.getModel();
|
||||
model.setObject(keywordDao.save(model.getObject()));
|
||||
target.addComponent(tableContainer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconId() {
|
||||
return "activeIcon";
|
||||
}
|
||||
};
|
||||
|
||||
item.add(new Label("name", new Model<String>(keyword.getKeyword())));
|
||||
item.add(new Label("type", new Model<String>(keyword.getType().getName())));
|
||||
item.add(editLink);
|
||||
item.add(activeLink);
|
||||
}
|
||||
|
||||
};
|
||||
tableContainer.add(keywordsDataView);
|
||||
add(createLink);
|
||||
add(dialog);
|
||||
add(tableContainer);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package se.su.dsv.scipro.admin.panels.match;
|
||||
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
|
||||
public class MatchProjectIdeaManuallyPanel extends Panel {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MatchProjectIdeaManuallyPanel(String id) {
|
||||
super(id);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<form wicket:id="form">
|
||||
<div>
|
||||
If you want to match and suggest this idea to a supervisor or reviewer manually, you can do so.
|
||||
</div>
|
||||
<div wicket:id="manualMatchPanel"></div>
|
||||
<div>
|
||||
If this project idea is poorly written, it should be sent back to the authors for rewriting.
|
||||
</div>
|
||||
<button wicket:id="sendBackButton">Send back to author(s)</button>
|
||||
<div>
|
||||
If this project idea has been suggested to a supervisor that has not answered for very long, it can be rematched and suggested to some other supervisor.
|
||||
</div>
|
||||
<button wicket:id="rematchButton">Rematch project idea</button>
|
||||
<div>
|
||||
If this project idea will not be carried out for whatever reason, it can be canceled.
|
||||
</div>
|
||||
<button wicket:id="cancelButton">Cancel the project idea</button>
|
||||
</form>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,72 @@
|
||||
package se.su.dsv.scipro.admin.panels.match;
|
||||
|
||||
import org.apache.wicket.markup.html.form.Button;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.admin.panels.ManualMatchPanel;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.MatchDao;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
import se.su.dsv.scipro.match.dataobject.Match.Status;
|
||||
|
||||
public class ProjectIdeaActionPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SpringBean
|
||||
private MatchDao matchDao;
|
||||
|
||||
private Status status;
|
||||
|
||||
public ProjectIdeaActionPanel(String id, final IModel<Match> matchModel) {
|
||||
super(id);
|
||||
|
||||
Form<Match> form = new Form<Match>("form", matchModel) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void onSubmit() {
|
||||
matchDao.changeStatus(SciProSession.get().getUser(), getModelObject(), status);
|
||||
}
|
||||
};
|
||||
form.add(new ManualMatchPanel("manualMatchPanel", matchModel));
|
||||
|
||||
form.add(new Button("sendBackButton") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onSubmit() {
|
||||
status = Status.REFUSED;
|
||||
}
|
||||
});
|
||||
|
||||
form.add(new Button("rematchButton") {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onSubmit() {
|
||||
status = Status.UNMATCHED;
|
||||
}
|
||||
});
|
||||
|
||||
form.add(new Button("cancelButton") {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onSubmit() {
|
||||
status = Status.REJECTED;
|
||||
}
|
||||
});
|
||||
add(form);
|
||||
}
|
||||
}
|
@ -2,14 +2,17 @@ package se.su.dsv.scipro.basepages;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.basepanels.FooterPanel;
|
||||
import se.su.dsv.scipro.basepanels.HeaderPanel;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
/**
|
||||
*
|
||||
* @author Martin Peters - mpeters@dsv.su.se
|
||||
*
|
||||
*/
|
||||
public abstract class MenuPage extends BasePage {
|
||||
private User user;
|
||||
|
||||
public MenuPage(){
|
||||
super();
|
||||
@ -22,7 +25,7 @@ public abstract class MenuPage extends BasePage {
|
||||
}
|
||||
|
||||
private void setUp(){
|
||||
|
||||
user = SciProSession.get().getUser();
|
||||
// mainMenu = new MainMenu("mainMenu", this.getClass());
|
||||
// add(mainMenu);
|
||||
|
||||
@ -32,5 +35,11 @@ public abstract class MenuPage extends BasePage {
|
||||
add(footerPanel);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes current user to subclasses.
|
||||
* @return
|
||||
*/
|
||||
protected User getUser(){
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
@ -4,20 +4,28 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.Page;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.basepages.MenuPage;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.WebNotificationDao;
|
||||
import se.su.dsv.scipro.message.pages.PrivateMessagesPage;
|
||||
import se.su.dsv.scipro.notifications.NotificationsPage;
|
||||
|
||||
public class ServiceMenuPanel extends AbstractBaseMenuPanel {
|
||||
private static final long serialVersionUID = 3738086567246191811L;
|
||||
|
||||
@SpringBean
|
||||
private WebNotificationDao webNotificationDao;
|
||||
|
||||
public ServiceMenuPanel(String id, Class<? extends Page> containerClass) {
|
||||
super(id,MenuPage.class,containerClass);
|
||||
}
|
||||
@Override
|
||||
protected List<MenuItem> getItemList(){
|
||||
List<MenuItem> list = new ArrayList<MenuItem>();
|
||||
list.add(new MenuItem("Notifications",NotificationsPage.class));
|
||||
|
||||
list.add(new MenuItem("Notifications " + "(" + Integer.toString(webNotificationDao.getCountOfWebNotifications(SciProSession.get().getUser())) + ")" ,NotificationsPage.class));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
@ -6,18 +6,22 @@
|
||||
<form wicket:id="userSettingsForm">
|
||||
|
||||
<div class="span-10 last">
|
||||
<div class="span-10 last append-bottom prepend-top">
|
||||
<wicket:enclosure child="activeProject">
|
||||
<label for="activeProject">Selected project for author section</label> <select
|
||||
name="Active project" wicket:id="activeProject" id="activeProject"></select>
|
||||
</wicket:enclosure>
|
||||
<div class="span-10 last"></div>
|
||||
<div class="span-10 last">
|
||||
</wicket:enclosure>
|
||||
<i><span wicket:id="noProjectLabel">No projects available..</span></i>
|
||||
</div>
|
||||
<div class="span-10 last append-bottom">
|
||||
<div>What mail do you want mail notifications for?</div>
|
||||
<div wicket:id="notificationPriority"><input type="radio" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="span-10 last">
|
||||
<button type="submit" > Save changes</button>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.form.DropDownChoice;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.IChoiceRenderer;
|
||||
@ -41,8 +42,10 @@ public class UserSettingsPanel extends Panel {
|
||||
public UserSettingsPanel(String id) {
|
||||
super(id);
|
||||
UserSettings userSettings = userSettingsDao.getUserSettings(SciProSession.get().getUser());
|
||||
if(userSettings == null)
|
||||
if(userSettings == null){
|
||||
userSettings = new UserSettings(SciProSession.get().getUser());
|
||||
userSettings = userSettingsDao.save(userSettings);
|
||||
}
|
||||
add(new UserSettingsForm("userSettingsForm", new CompoundPropertyModel<UserSettings>(userSettings)));
|
||||
}
|
||||
|
||||
@ -80,17 +83,26 @@ public class UserSettingsPanel extends Panel {
|
||||
add(projectChoice);
|
||||
projectChoice.setVisible(!userProjects.isEmpty());
|
||||
|
||||
Label noProjectLabel = new Label("noProjectLabel","You are not registered as an author on any projects");
|
||||
add(noProjectLabel);
|
||||
noProjectLabel.setVisible(userProjects.isEmpty());
|
||||
|
||||
NotificationPriority[] array = NotificationPriority.values();
|
||||
List<NotificationPriority> notificationPriorities = new ArrayList<NotificationPriority>(Arrays.asList(array));
|
||||
|
||||
final RadioChoice<NotificationPriority> radioChoice = new RadioChoice<NotificationPriority>("notificationPriority", new PropertyModel(userSettings, "notificationPriority"), notificationPriorities );
|
||||
final RadioChoice<NotificationPriority> radioChoice = new RadioChoice<NotificationPriority>("notificationPriority", new PropertyModel<NotificationPriority>(userSettings, "notificationPriority"), notificationPriorities );
|
||||
radioChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected void onUpdate(AjaxRequestTarget target) {
|
||||
// UserSettings userSettings = userSettingsDao.getUserSettings(SciProSession.get().getUser());
|
||||
if(userSettings == null)
|
||||
if(userSettings == null){
|
||||
userSettings = new UserSettings(SciProSession.get().getUser());
|
||||
userSettings.setNotificationPriority(radioChoice.getModelObject());
|
||||
userSettings.setNotificationPriority(NotificationPriority.LOW);
|
||||
}
|
||||
else{
|
||||
userSettings.setNotificationPriority(radioChoice.getModelObject());
|
||||
}
|
||||
|
||||
// userSettings = userSettingsDao.save(userSettings);
|
||||
}
|
||||
});
|
||||
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div class="span-22 last"><a href="#" wicket:id="switchViewLink"><span wicket:id="switchViewLabel">[Change view]</span></a></div>
|
||||
<div wicket:id="alternativePanel"></div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,53 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import org.apache.wicket.Component;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.link.Link;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.Model;
|
||||
|
||||
public class AlternateVariationPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String[] variations = new String[] { "by_questions",
|
||||
"by_respondent" };
|
||||
private int variationIndex = 0;
|
||||
private String variation = variations[0];
|
||||
|
||||
public AlternateVariationPanel(String id, Component component) {
|
||||
super(id);
|
||||
|
||||
this.setOutputMarkupId(true);
|
||||
|
||||
add(component);
|
||||
|
||||
// And a way to activate it
|
||||
final Label switchViewLabel =
|
||||
new Label("switchViewLabel", new Model<String>(
|
||||
"View by respondent>>"));
|
||||
Link<Void> switchViewLink = new Link<Void>("switchViewLink") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick() {
|
||||
switchVariation();
|
||||
switchViewLabel
|
||||
.setDefaultModelObject(getVariation().equals("by_respondent") ? "View by question>>"
|
||||
: "View by respondent>>");
|
||||
}
|
||||
};
|
||||
switchViewLink.add(switchViewLabel);
|
||||
add(switchViewLink);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVariation() {
|
||||
return variation;
|
||||
}
|
||||
|
||||
public void switchVariation() {
|
||||
variationIndex = (variationIndex + 1) % variations.length;
|
||||
variation = variations[variationIndex];
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div wicket:id="answerDialog">
|
||||
<form wicket:id="answerForm">
|
||||
<div>Select:</div>
|
||||
<div wicket:id="trafficLights"></div>
|
||||
<div>Comment:</div>
|
||||
<div>
|
||||
<textarea wicket:id="commentArea" rows="27" cols="20"></textarea>
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" value="Save" name="save" />
|
||||
</div>
|
||||
<!--<span><input type="button" value="Save answer" wicket:id="saveAnswer" /></span>-->
|
||||
</form>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,109 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.TextArea;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
import se.su.dsv.scipro.checklists.panels.AnswerDialogPanel.AnswerDialog;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListAnswerDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
|
||||
|
||||
public class AnswerDialogPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private AnswerDialog dialog;
|
||||
|
||||
public AnswerDialogPanel(String id, User currentUser) {
|
||||
super(id);
|
||||
dialog = new AnswerDialog("answerDialog", currentUser);
|
||||
add(dialog);
|
||||
}
|
||||
|
||||
public static class AnswerDialog extends Dialog {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@SpringBean
|
||||
private CheckListAnswerDao checkListAnswerDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListQuestionDao checkListQuestionDao;
|
||||
private final User currentUser;
|
||||
|
||||
public AnswerDialog(String id, User currentUser) {
|
||||
super(id);
|
||||
this.currentUser = currentUser;
|
||||
setModal(true);
|
||||
setAutoOpen(false);
|
||||
setWidth(400);
|
||||
setHeight(400);
|
||||
add(new AnswerForm("answerForm"));
|
||||
}
|
||||
|
||||
public void dialogContent(CheckListQuestion clq) {
|
||||
setTitle(clq.getQuestion());
|
||||
replace(new AnswerForm("answerForm", clq));
|
||||
}
|
||||
|
||||
private class AnswerForm extends Form<Void> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private TrafficLightPanel trafficLights;
|
||||
private CheckListQuestion clq;
|
||||
private CheckListAnswer answer;
|
||||
private TextArea<String> commentArea;
|
||||
private String comment;
|
||||
|
||||
public AnswerForm(String id, CheckListQuestion clq) {
|
||||
super(id);
|
||||
setMultiPart(true);
|
||||
answer = clq.getAnswerFromUser(currentUser);
|
||||
if (answer != null) {
|
||||
comment = answer.getComment();
|
||||
trafficLights =
|
||||
new TrafficLightPanel("trafficLights",
|
||||
new Model<CheckListQuestionAnswer>(answer.getAnswer()));
|
||||
} else {
|
||||
trafficLights = new TrafficLightPanel("trafficLights");
|
||||
}
|
||||
|
||||
this.commentArea =
|
||||
new TextArea<String>("commentArea", new PropertyModel<String>(
|
||||
this, "comment"));
|
||||
this.clq = checkListQuestionDao.reLoad(clq);
|
||||
add(trafficLights);
|
||||
add(commentArea);
|
||||
}
|
||||
|
||||
public AnswerForm(String id) {
|
||||
super(id);
|
||||
add(new TrafficLightPanel("trafficLights"));
|
||||
add(new TextArea<String>("commentArea"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSubmit() {
|
||||
comment = commentArea.getInput();
|
||||
CheckListQuestionAnswer answer = trafficLights.getSelected();
|
||||
CheckListAnswer clAnswer = new CheckListAnswer(currentUser, answer);
|
||||
clAnswer.setComment(comment);
|
||||
clq = checkListQuestionDao.reLoad(clq);
|
||||
clq.addAnswer(checkListAnswerDao.save(clAnswer));
|
||||
checkListQuestionDao.save(clq);
|
||||
setResponsePage(getPage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public AnswerDialog getDialog() {
|
||||
return dialog;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
import se.su.dsv.scipro.data.dataobjects.Member;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
|
||||
import se.su.dsv.scipro.data.enums.CheckListRole;
|
||||
|
||||
public class CheckListModel {
|
||||
|
||||
final CheckList checkList;
|
||||
private final User currentUser;
|
||||
private final CheckListRole currentRole;
|
||||
private final List<Member> members;
|
||||
@SuppressWarnings("unchecked")
|
||||
private static final List<Member.Type> mustHaveAnswers = Arrays
|
||||
.asList(new Member.Type[] { Member.Type.CO_SUPERVISOR,
|
||||
Member.Type.REVIEWER });
|
||||
|
||||
public CheckListModel(CheckList checkList, Project project,
|
||||
User currentUser, CheckListRole currentRole) {
|
||||
this.checkList = checkList;
|
||||
this.currentUser = currentUser;
|
||||
this.currentRole = currentRole;
|
||||
this.members = filterNoAnswers(moveUserFirst(project.getMembers()));
|
||||
}
|
||||
|
||||
private List<Member> filterNoAnswers(List<Member> members) {
|
||||
for (Iterator<Member> iterator = members.iterator(); iterator.hasNext();) {
|
||||
Member member = iterator.next();
|
||||
if (!memberIsCurrentUser(member)
|
||||
&& mustHaveAnswers.contains(member.getType())) {
|
||||
if (!hasAnsweredAQuestion(member)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
return members;
|
||||
}
|
||||
|
||||
private boolean hasAnsweredAQuestion(Member member) {
|
||||
for (CheckListQuestion question : checkList.getQuestions()) {
|
||||
CheckListAnswer answerFromUser =
|
||||
question.getAnswerFromUser(member.getUser());
|
||||
if (!answerFromUser.getAnswer().equals(
|
||||
CheckListQuestionAnswer.NO_ANSWER)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<Member> getMembers() {
|
||||
return members;
|
||||
}
|
||||
|
||||
private List<Member> moveUserFirst(List<Member> members) {
|
||||
for (Iterator<Member> iterator = members.iterator(); iterator.hasNext();) {
|
||||
Member member = iterator.next();
|
||||
if (memberIsCurrentUser(member)) {
|
||||
iterator.remove();
|
||||
members.add(0, member);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return members;
|
||||
}
|
||||
|
||||
private boolean memberIsCurrentUser(Member member) {
|
||||
return member.getUser().equals(currentUser);
|
||||
}
|
||||
|
||||
public List<CheckListQuestion> getQuestions() {
|
||||
return new ArrayList<CheckListQuestion>(checkList.getQuestions());
|
||||
}
|
||||
|
||||
public User getCurrentUser() {
|
||||
return currentUser;
|
||||
}
|
||||
|
||||
public CheckListRole getCurrentRole() {
|
||||
return currentRole;
|
||||
}
|
||||
|
||||
}
|
16
src/main/java/se/su/dsv/scipro/checklists/panels/FunctionalEditChecklistTemplatePanel.html
Normal file
16
src/main/java/se/su/dsv/scipro/checklists/panels/FunctionalEditChecklistTemplatePanel.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<form wicket:id="checklistTemplateForm">
|
||||
<input type="text" wicket:id="nameTextField" placeholder="Checklisttemplate name" style="width:500px;"/>
|
||||
<div wicket:id="categoryPanel"></div>
|
||||
<div wicket:id="avcltp"></div>
|
||||
<input type="button" wicket:id="saveButton" value="Save"/>
|
||||
</form>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
73
src/main/java/se/su/dsv/scipro/checklists/panels/FunctionalEditChecklistTemplatePanel.java
Normal file
73
src/main/java/se/su/dsv/scipro/checklists/panels/FunctionalEditChecklistTemplatePanel.java
Normal file
@ -0,0 +1,73 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.TextField;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
import se.su.dsv.scipro.admin.pages.AdminCheckListPage;
|
||||
import se.su.dsv.scipro.admin.panels.AdminViewCheckListTemplatePanel;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ChecklistCategoryDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectScheduleEvent;
|
||||
|
||||
public abstract class FunctionalEditChecklistTemplatePanel extends Panel{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SpringBean
|
||||
private ChecklistCategoryDao checklistCategoryDao;
|
||||
@SpringBean
|
||||
private CheckListTemplateDao checklistTemplateDao;
|
||||
private ChecklistTemplateForm form;
|
||||
|
||||
public FunctionalEditChecklistTemplatePanel(String id, CheckListTemplate clt) {
|
||||
super(id);
|
||||
if (clt==null)
|
||||
throw new IllegalArgumentException("Sorry, FunctionalEditChecklistTemplatePanel constructor cannot take null as an argument, must recieve a CheckListTemplate object.");
|
||||
if (clt.getId()!=null)
|
||||
clt = checklistTemplateDao.reLoad(clt);
|
||||
|
||||
form = new ChecklistTemplateForm("checklistTemplateForm", clt);
|
||||
add(form);
|
||||
}
|
||||
|
||||
/**
|
||||
*For developers to implement in class that contains the correct references to params and facade objects, dataviews etc.
|
||||
*e.g. they could do params.setFilter(<reference to an instance of this class>.getFilterString()) and/or AJAX stuff too.
|
||||
*/
|
||||
public abstract void onUpdate(AjaxRequestTarget target);
|
||||
|
||||
public class ChecklistTemplateForm extends Form{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private transient String name; //no need to serialize this
|
||||
private CheckListTemplate clt;
|
||||
|
||||
public ChecklistTemplateForm(String id, final CheckListTemplate clt) {
|
||||
super(id);
|
||||
|
||||
this.clt = clt;
|
||||
name = clt.getName();
|
||||
add(new TextField<String>("nameTextField", new PropertyModel<String>(this, "name")));
|
||||
add(new ChecklistCategoryPanel("categoryPanel", clt.getCategories()));
|
||||
add(new AdminViewCheckListTemplatePanel("avcltp", clt));
|
||||
|
||||
add(new AjaxButton("saveButton") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||
clt.setName(name);
|
||||
checklistTemplateDao.save(clt);
|
||||
onUpdate(target);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
72
src/main/java/se/su/dsv/scipro/checklists/panels/FunctionalListCheckListTemplatePanel.html
Normal file
72
src/main/java/se/su/dsv/scipro/checklists/panels/FunctionalListCheckListTemplatePanel.html
Normal file
@ -0,0 +1,72 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div class="span-22 append-bottom last" wicket:id="settingsContainer">
|
||||
<div wicket:id="filterStringPanel"></div>
|
||||
<div wicket:id="listView">
|
||||
<div wicket:id="filterCategoryPanel"></div>
|
||||
</div>
|
||||
<!-- <div wicket:id="filterSupervisorPanel"></div> -->
|
||||
<!-- <div wicket:id="filterPeerPanel"></div> -->
|
||||
<!-- <div wicket:id="filterBachelorPanel"></div> -->
|
||||
<!-- <div wicket:id="filterMasterPanel"></div> -->
|
||||
<div wicket:id="filterMinePanel"></div>
|
||||
</div>
|
||||
|
||||
<div><button wicket:id="newLink">Create new checklist template</button></div>
|
||||
<div wicket:id="dialog">
|
||||
<div wicket:id="panel"></div>
|
||||
</div>
|
||||
|
||||
<div class="span-22 last" wicket:id="dataViewContainer">
|
||||
<table class="rounded-corner" >
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th><a href="#" wicket:id="nameSort">Title</a></th>
|
||||
<!-- <th><a href="#" wicket:id="creatorSort">Creator</a></th> -->
|
||||
<th>Creator</th>
|
||||
<th>Category</th>
|
||||
<th><a href="#" wicket:id="numberOfQuestionsSort">Questions</a></th>
|
||||
<th>Delete</th>
|
||||
|
||||
<!-- <th class="rounded-left-top"><a href="#" wicket:id="nameSort"><span wicket:id="nameLabel">Title</span></a></th> -->
|
||||
<!-- <th><a href="#" wicket:id="creatorSort"><span wicket:id="creatorLabel">Title</span></a></th> -->
|
||||
<!-- <th class="rounded-right-top"><a href="#" wicket:id="numberOfQuestionsSort"><span wicket:id="numberOfQuestionsLabel">Title</span></a></th> -->
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5" class="rounded-foot"> </td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody wicket:id="checklistTemplateDataView">
|
||||
<tr>
|
||||
<!-- <td wicket:id="nameLabel"></td> -->
|
||||
<td><a href="#" wicket:id="testLink"><span wicket:id="nameLabel"></span></a></td>
|
||||
<!-- <td><a href="#" wicket:id="superLink"><span wicket:id="nameLabel"></span></a></td> -->
|
||||
<td wicket:id="userLabel">Other role</td>
|
||||
<td wicket:id="categoryLabel">Other role</td>
|
||||
<td wicket:id="questionLabel">Other role</td>
|
||||
<td><a href="#" wicket:id="delete"><img wicket:id="deleteIcon" alt="Delete" title="Delete" /></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td wicket:id="emptyLabel" colspan="5"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div wicket:id="nav"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
357
src/main/java/se/su/dsv/scipro/checklists/panels/FunctionalListCheckListTemplatePanel.java
Normal file
357
src/main/java/se/su/dsv/scipro/checklists/panels/FunctionalListCheckListTemplatePanel.java
Normal file
@ -0,0 +1,357 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.IAjaxCallDecorator;
|
||||
import org.apache.wicket.ajax.calldecorator.AjaxCallDecorator;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.link.Link;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
|
||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||
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.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.admin.pages.AdminCheckListPage;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CategoryDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ChecklistCategoryDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.Dao.SortableParams.Sort;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||
import se.su.dsv.scipro.data.dataobjects.ChecklistCategory;
|
||||
import se.su.dsv.scipro.dataproviders.CheckListTemplateDataProvider;
|
||||
import se.su.dsv.scipro.icons.ImageObject;
|
||||
import se.su.dsv.scipro.reusable.FilterBooleanPanel;
|
||||
import se.su.dsv.scipro.reusable.FilterStringPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fred
|
||||
*/
|
||||
|
||||
public class FunctionalListCheckListTemplatePanel extends Panel{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@SpringBean
|
||||
private CheckListTemplateDao checklistTemplateDao;
|
||||
@SpringBean
|
||||
private ChecklistCategoryDao checklistCategoryDao;
|
||||
|
||||
//settings stuff
|
||||
private WebMarkupContainer settingsContainer; //contains settings for the dataview (e.g. filtering and such)
|
||||
private HashSet<ChecklistCategory> filterSet; //needed for filtering on different categories
|
||||
|
||||
//dataview stuff
|
||||
private CheckListTemplateDao.Params params; //controls what the dataview should display
|
||||
private CheckListTemplateDataProvider dataProvider; //provides data to the dataview.
|
||||
private DataView<CheckListTemplate> checklistTemplateDataView;
|
||||
private Label emptyLabel; //informs user that there are no templates to show
|
||||
private WebMarkupContainer dataViewContainer; //the container for the list (dataview)
|
||||
private PagingNavigator nav;
|
||||
|
||||
//create new stuff.
|
||||
private AjaxLink<Void> newLink;
|
||||
private Dialog dialog;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param id
|
||||
*/
|
||||
public FunctionalListCheckListTemplatePanel(String id) {
|
||||
super(id);
|
||||
setOutputMarkupId(true); //make the whole panel AJAX-targetable
|
||||
|
||||
settingsSetup(); //setup and add panel with settings
|
||||
listSetup(); //setup and add panel with dataview
|
||||
|
||||
sortSetup();
|
||||
createSetup();
|
||||
}
|
||||
|
||||
private void ajaxRefresh(AjaxRequestTarget target){
|
||||
target.addComponent(dataViewContainer); //refresh the container containing the list
|
||||
nav.setVisible(dataProvider.size()!=0);
|
||||
target.addComponent(nav);
|
||||
emptyLabel.setVisible(dataProvider.size()==0);
|
||||
target.addComponent(emptyLabel);
|
||||
}
|
||||
|
||||
private void settingsSetup(){
|
||||
|
||||
settingsContainer = new WebMarkupContainer("settingsContainer"); //container for the settings stuff
|
||||
settingsContainer.setOutputMarkupId(true); //make it ajax targetable
|
||||
add(settingsContainer); //add it
|
||||
|
||||
filterSet = new HashSet<ChecklistCategory>();
|
||||
|
||||
params = new CheckListTemplateDao.Params();
|
||||
params.setSortOn("name", Sort.DESCENDING);
|
||||
params.setCategories(filterSet);
|
||||
|
||||
dataProvider = new CheckListTemplateDataProvider(params);
|
||||
|
||||
//under here are the filtering components: beginning with the filter on string
|
||||
settingsContainer.add(new FilterStringPanel("filterStringPanel"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onUpdateFilter(AjaxRequestTarget target) {
|
||||
params.setFilterString(getFilterString());
|
||||
ajaxRefresh(target);
|
||||
}
|
||||
});
|
||||
|
||||
//the listview below adds checkboxes for categories that would otherwise have been added one by one like this:
|
||||
|
||||
// settingsContainer.add(new FilterBooleanPanel("filterSupervisorPanel", "Supervisor"){
|
||||
// private static final long serialVersionUID = 1L;
|
||||
// @Override
|
||||
// public void onUpdateFilter(AjaxRequestTarget target) {
|
||||
// if (isFilter()){
|
||||
// filterSet.add(checklistCategoryDao.findCategoryByName("Supervisor"));
|
||||
// }
|
||||
// else if (!isFilter()){
|
||||
// filterSet.remove(checklistCategoryDao.findCategoryByName("Supervisor"));
|
||||
// }
|
||||
// params.setCategories(filterSet);
|
||||
// ajaxRefresh(target);
|
||||
// }
|
||||
// });
|
||||
|
||||
settingsContainer.add(new ListView<ChecklistCategory>("listView", checklistCategoryDao.findAll()){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
protected void populateItem(ListItem<ChecklistCategory> item) {
|
||||
final ChecklistCategory clc = item.getModelObject();
|
||||
item.add(new FilterBooleanPanel("filterCategoryPanel", clc.getCategoryName()){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onUpdateFilter(AjaxRequestTarget target) {
|
||||
if (isFilter()){
|
||||
filterSet.add(clc);
|
||||
}
|
||||
else if (!isFilter()){
|
||||
filterSet.remove(clc);
|
||||
}
|
||||
params.setCategories(filterSet);
|
||||
ajaxRefresh(target);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
settingsContainer.add(new FilterBooleanPanel("filterMinePanel", "Show only my checklist templates"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onUpdateFilter(AjaxRequestTarget target) {
|
||||
if (isFilter()){
|
||||
params.setCreator(SciProSession.get().getUser());
|
||||
}
|
||||
else if (!isFilter()){
|
||||
params.setCreator(null);
|
||||
}
|
||||
target.addComponent(dataViewContainer); //refresh the container containing the list
|
||||
ajaxRefresh(target);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void listSetup(){//as in, dataview setup
|
||||
dataViewContainer = new WebMarkupContainer("dataViewContainer"); //container for the dataview
|
||||
dataViewContainer.setOutputMarkupId(true); //make it ajax-targetable
|
||||
add(dataViewContainer); //add the container
|
||||
|
||||
checklistTemplateDataView = new DataView<CheckListTemplate>("checklistTemplateDataView", dataProvider, 20) { //add stuff to it
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
protected void populateItem(final Item item) {
|
||||
final CheckListTemplate clt = (CheckListTemplate) item.getModelObject();
|
||||
// item.add(new Label("nameLabel", clt.getName())); replaced by testlink
|
||||
item.add(new Label("userLabel", clt.getCreator().toString()));
|
||||
|
||||
String categoryString = new String("");
|
||||
for (ChecklistCategory cc : clt.getCategories()){
|
||||
categoryString += cc.getCategoryName();
|
||||
categoryString += " ";
|
||||
}
|
||||
|
||||
item.add(new Label("categoryLabel", categoryString));
|
||||
item.add(new Label("questionLabel", Integer.toString(clt.getNumberOfQuestions())));
|
||||
|
||||
//edit link. this is ugly and is taken straight out of the old panel. should be done using facades.
|
||||
AjaxLink testLink = new AjaxLink<Void>("testLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
System.out.println(clt.getName());
|
||||
|
||||
|
||||
dialog.replace(new FunctionalEditChecklistTemplatePanel("panel", clt){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onUpdate(AjaxRequestTarget target) {
|
||||
// dialog.close();
|
||||
// ajaxRefresh(target);
|
||||
setResponsePage(AdminCheckListPage.class);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// dialog.replace(new FunctionalEditChecklistTemplatePanel("panel", clt));
|
||||
target.addComponent(dialog);
|
||||
dialog.open(target);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
item.add(testLink);
|
||||
testLink.add(new Label("nameLabel", clt.getName()));
|
||||
|
||||
//delete link. this is ugly and is taken straight out of the old panel. should be done using facades.
|
||||
AjaxLink<Void> deleteLink = new AjaxLink<Void>("delete") {
|
||||
private static final long serialVersionUID = 1529565679210978293L;
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
CheckListTemplate clt2 = checklistTemplateDao.reLoad(clt);
|
||||
checklistTemplateDao.delete(clt2);
|
||||
ajaxRefresh(target);
|
||||
}
|
||||
@Override
|
||||
protected IAjaxCallDecorator getAjaxCallDecorator() {
|
||||
return new AjaxCallDecorator() {
|
||||
private static final long serialVersionUID = 8989126586010432130L;
|
||||
@Override
|
||||
public CharSequence decorateScript(CharSequence script) {
|
||||
String ret = "if(!confirm('Are you sure you want to remove the template?')) return false; "
|
||||
+ script;
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
item.add(deleteLink);
|
||||
deleteLink.add(new ImageObject("deleteIcon", ImageObject.TWENTYFOUR + ImageObject.DELETE));
|
||||
item.setOutputMarkupId(true);
|
||||
}
|
||||
}; //finish adding stuff to the rows inside the list
|
||||
dataViewContainer.add(checklistTemplateDataView); //add the dataview to the container
|
||||
|
||||
// checklistTemplateDataView.setOutputMarkupId(true); dont target repeaters
|
||||
|
||||
nav = new PagingNavigator("nav", checklistTemplateDataView); //we need a navigator
|
||||
nav.setOutputMarkupId(true); //make it ajax-targetable
|
||||
nav.setVisible(dataProvider.size()!=0);
|
||||
dataViewContainer.add(nav); //add it
|
||||
|
||||
emptyLabel = new Label("emptyLabel", "No templates to show"); //informs the user that the list is emty
|
||||
emptyLabel.setOutputMarkupId(true); //make it ajax-targetable
|
||||
emptyLabel.setVisible(dataProvider.size()==0);
|
||||
dataViewContainer.add(emptyLabel); //add it
|
||||
}
|
||||
|
||||
private void sortSetup(){
|
||||
// Robins sortmetod om man använder en dataprovider som extendar hans SortableDataProviderklass
|
||||
// final Set<String> sortFields = new HashSet<String>(); //begin setting up sorting
|
||||
// sortFields.add("name");
|
||||
// sortFields.add("creator");
|
||||
// sortFields.add("numberOfQuestions");
|
||||
// final HashMap<String, String> headerMap = new HashMap<String,String>();
|
||||
// headerMap.put("name", "Name");
|
||||
// headerMap.put("creator","Creator");
|
||||
// headerMap.put("numberOfQuestions", "Questions");
|
||||
// for(final SortSpecifier spec : dataProvider.getAvailableSortSpecifiers(sortFields)){
|
||||
// final String fieldBaseName = spec.getFieldName();
|
||||
// final Link<Void> link = new Link<Void>(fieldBaseName+"Sort"){
|
||||
// private static final long serialVersionUID = 1L;
|
||||
// @Override
|
||||
// public void onClick(){
|
||||
// SortSpecifier current = dataProvider.getSortSpecifier();
|
||||
// if(!spec.equals(current)){
|
||||
// dataProvider.setSortSpecifier(spec);
|
||||
// dataProvider.setAscendingOrder(false);
|
||||
// }else{
|
||||
// dataProvider.setAscendingOrder(!dataProvider.isAscendingOrder());
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
// link.add(new Label(fieldBaseName+"Label",headerMap.get(fieldBaseName)));
|
||||
// dataViewContainer.add(link); //add sorting
|
||||
// }
|
||||
|
||||
//min lite imiterande metod. lite tokigt är att ints i ascending visar lägst värden högst och vice versa fast det oftast är tvärtom.
|
||||
//och sorterar man på creator (ett "främmande fält" för checklisttemplateentityn) så sorterar den på creators (users) id och inte namn.
|
||||
final Set<String> sortString = new HashSet<String>(); //make a set with columns you want to be sortable
|
||||
sortString.add(new String("name"));
|
||||
// sortString.add(new String("creator")); //this doesnt work because it sorts on user id, not name
|
||||
sortString.add(new String("numberOfQuestions"));
|
||||
|
||||
for (final String s : sortString){ //create links for sorting using the set
|
||||
Link<Void> link = new Link<Void>(s + "Sort"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onClick() {
|
||||
if (params.getSortField().equals(s) && params.getDirection().equals(Sort.ASCENDING))
|
||||
params.setSortOn(s, Sort.DESCENDING);
|
||||
else params.setSortOn(s, Sort.ASCENDING);
|
||||
}
|
||||
};
|
||||
dataViewContainer.add(link); //add the links
|
||||
}
|
||||
}
|
||||
|
||||
private void createSetup(){
|
||||
dialog = new Dialog("dialog");
|
||||
dialog.setModal(true);
|
||||
dialog.setAutoOpen(false);
|
||||
dialog.setWidth(550);
|
||||
dialog.setHeight(700);
|
||||
add(dialog);
|
||||
dialog.add(new EmptyPanel("panel"));
|
||||
//create new link.
|
||||
newLink = new AjaxLink<Void>("newLink") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
CheckListTemplate dummy = new CheckListTemplate();
|
||||
dummy.setCategories(new ArrayList<ChecklistCategory>());
|
||||
dummy.setCreator(SciProSession.get().getUser());
|
||||
dummy.setName("New checklisttemplate (change this to a real name)");
|
||||
dummy.setQuestions(new ArrayList<String>());
|
||||
dummy.setTemplateNumber(checklistTemplateDao.findTemplates().size()-1);
|
||||
|
||||
// dialog.replace(new FunctionalEditChecklistTemplatePanel("panel", dummy));
|
||||
|
||||
dialog.replace(new FunctionalEditChecklistTemplatePanel("panel", dummy){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onUpdate(AjaxRequestTarget target) {
|
||||
// target.addComponent(dialog);
|
||||
// dialog.close();
|
||||
// ajaxRefresh(target);
|
||||
setResponsePage(AdminCheckListPage.class);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
target.addComponent(dialog);
|
||||
dialog.open(target);
|
||||
}
|
||||
};
|
||||
add(newLink);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,8 @@
|
||||
<table class="rounded-corner">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rounded-left-top">Name</th>
|
||||
<th class="rounded-left-top"></th>
|
||||
<th>Name</th>
|
||||
<th class="rounded-right-top"><wicket:container wicket:id="removeHeader">Remove</wicket:container></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -24,9 +25,10 @@
|
||||
<td wicket:id="emptyLabel" colspan="2"></td>
|
||||
</tr>
|
||||
<tr wicket:id="checkLists">
|
||||
<td><img wicket:id="image"/></td>
|
||||
<td><a href="#" wicket:id="checkListLink"><span
|
||||
wicket:id="listName"></span></a></td>
|
||||
<td><a href="#" wicket:id="deleteLink">Remove</a></td>
|
||||
<td><a href="#" wicket:id="deleteLink">Remove</a><span wicket:id="deleteLabel"></span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -10,20 +10,26 @@ import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.data.controllers.CheckListController;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListUploadDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ChecklistCategoryDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectScheduleEvent;
|
||||
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
|
||||
import se.su.dsv.scipro.data.enums.CheckListRole;
|
||||
import se.su.dsv.scipro.icons.ImageObject;
|
||||
import se.su.dsv.scipro.project.pages.ProjectViewCheckListPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorChecklistPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorViewCheckListPage;
|
||||
@ -37,9 +43,12 @@ public class ListCheckListPanel extends Panel {
|
||||
@SpringBean
|
||||
private CheckListDao checkListDao;
|
||||
@SpringBean
|
||||
private CheckListUploadDao checkListUploadDao;
|
||||
@SpringBean
|
||||
private ProjectDao projectDao;
|
||||
@SpringBean
|
||||
private ChecklistCategoryDao categoryDao;
|
||||
@SpringBean
|
||||
private RoleDao roleDao;
|
||||
|
||||
@SpringBean
|
||||
CheckListController checkListController;
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -60,12 +69,12 @@ public class ListCheckListPanel extends Panel {
|
||||
};
|
||||
final WebMarkupContainer container = new WebMarkupContainer("container");
|
||||
container.setOutputMarkupId(true);
|
||||
|
||||
|
||||
emptyLabel = new Label("emptyLabel", "No checklists has been added to this project yet.");
|
||||
emptyLabel.setOutputMarkupId(true);
|
||||
emptyLabel.setVisible(project.getCheckLists().isEmpty());
|
||||
container.add(emptyLabel);
|
||||
|
||||
|
||||
container.add(new WebMarkupContainer("removeHeader"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
@ -102,13 +111,13 @@ public class ListCheckListPanel extends Panel {
|
||||
}
|
||||
//Final value of calculations
|
||||
final boolean checklistCanBeRemoved = !(isAnswered||isLinked);
|
||||
|
||||
|
||||
AjaxLink<Void> deleteLink = new AjaxLink<Void>("deleteLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
assert(canDeleteChecklist(role));
|
||||
if(checklistCanBeRemoved){
|
||||
if(checklistCanBeRemoved){
|
||||
checkListDao.reLoad(item.getModel().getObject());
|
||||
project.removeCheckList(item.getModelObject());
|
||||
projectDao.save(project);
|
||||
@ -117,17 +126,61 @@ public class ListCheckListPanel extends Panel {
|
||||
}
|
||||
};
|
||||
BookmarkablePageLink<Void> checkListLink = null;
|
||||
|
||||
item.add(new EmptyPanel("deleteLabel"));
|
||||
|
||||
if(canDeleteChecklist(role)){
|
||||
checkListLink = new BookmarkablePageLink<Void>("checkListLink", SupervisorViewCheckListPage.class, pp);
|
||||
if(!checklistCanBeRemoved)
|
||||
|
||||
if(!checklistCanBeRemoved){
|
||||
deleteLink.setVisible(false);
|
||||
item.replace(new Label("deleteLabel", "Already active"));
|
||||
}
|
||||
}else{
|
||||
checkListLink = new BookmarkablePageLink<Void>("checkListLink", ProjectViewCheckListPage.class, pp);
|
||||
item.replace(new Label("deleteLabel", "Not owner"));
|
||||
deleteLink.setVisible(false);
|
||||
}
|
||||
checkListLink.add(listName);
|
||||
item.add(checkListLink);
|
||||
item.add(deleteLink);
|
||||
|
||||
boolean green = false;
|
||||
boolean yellow = false;
|
||||
boolean red = false;
|
||||
|
||||
|
||||
if (cl.getCategories().contains(categoryDao.findCategoryByName("Supervisor")) && !roleDao.isEmployee(SciProSession.get().getUser())){
|
||||
item.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
item.add(new EmptyPanel("image"));
|
||||
|
||||
for (CheckListQuestion clq : cl.getQuestions()){
|
||||
for (CheckListAnswer cla : clq.getAnswers()){
|
||||
if (cla.getAnswer() == CheckListQuestionAnswer.GREEN){
|
||||
green = true;
|
||||
}
|
||||
else if (cla.getAnswer() == CheckListQuestionAnswer.YELLOW){
|
||||
yellow = true;
|
||||
}
|
||||
else if (cla.getAnswer() == CheckListQuestionAnswer.RED){
|
||||
red = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (red){
|
||||
item.replace(new ImageObject("image", ImageObject.TWENTYFOUR + ImageObject.LIGHT_RED));
|
||||
}
|
||||
else if (!red && yellow){
|
||||
item.replace(new ImageObject("image", ImageObject.TWENTYFOUR + ImageObject.LIGHT_YELLOW));
|
||||
}
|
||||
else if (!red && !yellow && green){
|
||||
item.replace(new ImageObject("image", ImageObject.TWENTYFOUR + ImageObject.LIGHT_GREEN));
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
container.add(checkLists);
|
||||
|
@ -19,9 +19,11 @@ import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ChecklistCategoryDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||
import se.su.dsv.scipro.data.dataobjects.ChecklistCategory;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.enums.CheckListRole;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorChecklistPage;
|
||||
@ -40,6 +42,9 @@ public class ListCheckListTemplatePanel extends Panel{
|
||||
@SpringBean
|
||||
private CheckListDao checkListDao;
|
||||
|
||||
@SpringBean
|
||||
private ChecklistCategoryDao checklistCategoryDao;
|
||||
|
||||
@SpringBean
|
||||
ProjectDao projectDao;
|
||||
|
||||
@ -135,6 +140,12 @@ public class ListCheckListTemplatePanel extends Panel{
|
||||
item.add(templateOuestion);
|
||||
item.add(templateLink);
|
||||
|
||||
ChecklistCategory peer = checklistCategoryDao.findCategoryByName("Peer");
|
||||
|
||||
if (item.getModelObject().getCategories().size()==1 && item.getModelObject().getCategories().contains(peer)){
|
||||
item.setVisible(false);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div><span wicket:id="label"></span><span wicket:id="panel"></span></div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,35 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectScheduleEvent;
|
||||
import se.su.dsv.scipro.project.panels.ProjectLatestUploadPanel;
|
||||
import se.su.dsv.scipro.repository.panels.FileViewPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fred
|
||||
* Panel that serves the latest uploaded file OR the file that is connected to a checklist via an activity plan event.
|
||||
*/
|
||||
public class ShowChecklistFilePanel extends Panel{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ShowChecklistFilePanel(String id, Project project, long checklistId) {
|
||||
super(id);
|
||||
|
||||
add(new Label("label", "Latest file upload in this project: "));
|
||||
add(new ProjectLatestUploadPanel("panel", project, false));
|
||||
|
||||
if (project.getProjectSchedule()!=null){
|
||||
for (ProjectScheduleEvent pe : project.getProjectSchedule().getEvents()){
|
||||
if (pe.getCheckList()!=null && pe.getCheckList().getId().equals(checklistId) && pe.getFileUpload()!=null){
|
||||
replace(new Label("label", "File connected to this checklist: "));
|
||||
replace(new FileViewPanel("panel", pe.getFileUpload()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
|
||||
import se.su.dsv.scipro.icons.ImageObject;
|
||||
|
||||
/**
|
||||
* A panel that displays a more readable summary of checklist questions
|
||||
* and their respondents and answers.
|
||||
* @author fred-fri@dsv.su.se
|
||||
*
|
||||
*/
|
||||
public class SummaryPanel extends Panel{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private List<CheckListQuestion> questionList;
|
||||
|
||||
/**
|
||||
* Default and only constructor takes an id and page parameters.
|
||||
*
|
||||
* @param id
|
||||
* @param pp
|
||||
*/
|
||||
public SummaryPanel(final String id, final CheckList cl) {
|
||||
super(id);
|
||||
/*
|
||||
* Create a list with the questions in this checklist so they can be used in a wicket listview
|
||||
*/
|
||||
questionList = cl.getQuestions();
|
||||
/*
|
||||
* Create a set will all users who have answered at least one question in the checklist
|
||||
*/
|
||||
final HashSet<User> answereeSet = new HashSet<User>();
|
||||
for (CheckListQuestion q : questionList){
|
||||
List<CheckListAnswer> answerList = new ArrayList<CheckListAnswer>(q.getAnswers());
|
||||
for (CheckListAnswer cla : answerList){
|
||||
answereeSet.add(cla.getUser());
|
||||
}
|
||||
}
|
||||
final ArrayList<User> answereeList = new ArrayList<User>(answereeSet); //Make a list out of the set so it can be used in a wicket listview
|
||||
/*
|
||||
* Add a repeater containing the questions
|
||||
*/
|
||||
add(new ListView<CheckListQuestion>("questionListView", questionList) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected void populateItem(ListItem<CheckListQuestion> item) {
|
||||
final CheckListQuestion clq = (CheckListQuestion) item.getModelObject();
|
||||
item.add(new Label("question", clq.getQuestion()));
|
||||
/*
|
||||
* For each user that has answered at least one question
|
||||
*/
|
||||
item.add(new ListView<User>("answereeListView", answereeList) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected void populateItem(final ListItem<User> item) {
|
||||
final User user = (User) item.getModelObject();
|
||||
final CheckListAnswer cla = clq.getAnswerFromUser(user);
|
||||
/*
|
||||
* Check if they have answered this question too
|
||||
*/
|
||||
if (cla==null){ //if not, inform the user
|
||||
item.add(new Label("respondent", user.toString()));
|
||||
item.add(new Label("answer", "No answer from respondent yet"));
|
||||
item.add(new ImageObject("answerLight", ImageObject.PATH + ImageObject.LIGHT_GREY).setVisible(false));
|
||||
}
|
||||
else{ //if they have, display the users details
|
||||
item.add(new Label("respondent", user.toString()));
|
||||
item.add(new Label("answer", cla.getComment()));
|
||||
/*
|
||||
* Add the correct trafficlight
|
||||
*/
|
||||
if (cla.getAnswer()==CheckListQuestionAnswer.GREEN){
|
||||
item.add(new ImageObject("answerLight", ImageObject.PATH + ImageObject.LIGHT_GREEN));
|
||||
}
|
||||
else if (cla.getAnswer()==CheckListQuestionAnswer.YELLOW){
|
||||
item.add(new ImageObject("answerLight", ImageObject.PATH + ImageObject.LIGHT_YELLOW));
|
||||
}
|
||||
else if (cla.getAnswer()==CheckListQuestionAnswer.RED){
|
||||
item.add(new ImageObject("answerLight", ImageObject.PATH + ImageObject.LIGHT_RED));
|
||||
}
|
||||
else if (cla.getAnswer()==CheckListQuestionAnswer.NOT_APLICABLE){
|
||||
item.add(new ImageObject("answerLight", ImageObject.PATH + ImageObject.LIGHT_GREY));
|
||||
}
|
||||
else if (cla.getAnswer()==CheckListQuestionAnswer.NO_ANSWER){
|
||||
item.add(new ImageObject("answerLight", ImageObject.PATH + ImageObject.LIGHT_GREY).setVisible(false));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,8 +3,13 @@
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<a href=# wicket:id="addAllLink">Add all available checklist templates as checklists for this project</a>
|
||||
<a href="#" wicket:id="infoLink"><img src="images/icons/24/help2.png" alt="Partner info"/></a>
|
||||
<div wicket:id="listTemplatePanel"></div>
|
||||
<a href=# wicket:id="addAllLink">Add all</a>
|
||||
<div wicket:id="dialog">
|
||||
<div class="info-box rounded-box last span-10" wicket:id="info"></div>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
|
@ -1,27 +1,14 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.enums.CheckListRole;
|
||||
import se.su.dsv.scipro.data.facade.ProjectFacade;
|
||||
@ -40,8 +27,11 @@ public class SupervisorAddChecklistPanel extends Panel{
|
||||
@SpringBean
|
||||
private ProjectFacade facade;
|
||||
|
||||
private Dialog dialog;
|
||||
|
||||
public SupervisorAddChecklistPanel(String id, final PageParameters pp, final Project project) {
|
||||
super(id);
|
||||
dialogSetup();
|
||||
|
||||
AjaxLink<Void> addAllLink = new AjaxLink<Void>("addAllLink"){
|
||||
|
||||
@ -60,7 +50,32 @@ public class SupervisorAddChecklistPanel extends Panel{
|
||||
|
||||
add(new ListCheckListTemplatePanel("listTemplatePanel", pp, CheckListRole.SUPERVISOR));
|
||||
add(addAllLink);
|
||||
}
|
||||
}
|
||||
|
||||
private void dialogSetup(){
|
||||
dialog = new Dialog("dialog");
|
||||
dialog.setModal(true);
|
||||
dialog.setAutoOpen(false);
|
||||
dialog.setWidth(500);
|
||||
dialog.setHeight(300);
|
||||
dialog.add(new Label("info", new Model<String>("test")));
|
||||
add(dialog);
|
||||
|
||||
AjaxLink<Void> infoLink = new AjaxLink<Void>("infoLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
dialog.replace(new Label("info", new Model<String>("Delete those checklists wich are not relevant for your thesis project.\n" +
|
||||
"If you want other checklists then those avalible you can suggest them to thesissupport@dsv.su.se and they will be added to the pool. "+
|
||||
"You can add checklists manually from the templates avalible on the right side by clicking the link.")));
|
||||
|
||||
target.addComponent(dialog);
|
||||
dialog.setTitle("Checklist info");
|
||||
dialog.open(target);
|
||||
}
|
||||
};
|
||||
add(infoLink);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div wicket:id="infoLabel"></div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,34 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ChecklistCategoryDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
|
||||
public class SupervisorCategoryInfoPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SpringBean
|
||||
private CheckListDao checklistDao;
|
||||
@SpringBean
|
||||
private ChecklistCategoryDao categoryDao;
|
||||
|
||||
public SupervisorCategoryInfoPanel(String id, long checklistId) {
|
||||
super(id);
|
||||
|
||||
CheckList checklist = checklistDao.load(checklistId);
|
||||
|
||||
add(new EmptyPanel("infoLabel"));
|
||||
|
||||
if (checklist.getCategories().contains(categoryDao.findCategoryByName("Supervisor"))){
|
||||
replace(new Label("infoLabel", "This is a supervisor checklist, so students can't see it or answer questions in it."));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div wicket:id="dialog">
|
||||
<form wicket:id="answerForm">
|
||||
<div>Select:</div>
|
||||
<div wicket:id="trafficLights"></div>
|
||||
<div>Comment:</div>
|
||||
<div>
|
||||
<textarea wicket:id="commentArea" rows="27" cols="20"></textarea>
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" value="Save" name="save" />
|
||||
</div>
|
||||
<!--<span><input type="button" value="Save answer" wicket:id="saveAnswer" /></span>-->
|
||||
</form>
|
||||
</div>
|
||||
<div class="span-22 last"><a href="#" wicket:id="switchViewLink"><span wicket:id="switchViewLabel">[Change view]</span></a></div>
|
||||
<div class="span-22 last">
|
||||
<div wicket:id="container">
|
||||
<!-- <table class="rounded-table seminar-table even-rows"> -->
|
||||
<table class="rounded-corner">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span-11 rounded-left-top">Question</th>
|
||||
<th><div wicket:id="author1Label"></div>
|
||||
<div wicket:id="author1RoleLabel"></div></th>
|
||||
<th><div wicket:id="author2Label"></div>
|
||||
<div wicket:id="author2RoleLabel"></div></th>
|
||||
<th><div wicket:id="supervisorLabel"></div>
|
||||
<div wicket:id="supervisorRoleLabel"></div></th>
|
||||
<th class="rounded-right-top"><div wicket:id="reviewerLabel"></div>
|
||||
<div wicket:id="reviewerRoleLabel"></div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5" class="rounded-foot"> </td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr wicket:id="checkListQuestions">
|
||||
<td><span wicket:id="checkListQuestion"></span></td>
|
||||
<td><a href="#" wicket:id="author1Link"><img
|
||||
wicket:id="image" /></a></td>
|
||||
<td><a href="#" wicket:id="author2Link"><img
|
||||
wicket:id="image" /></a></td>
|
||||
<td><a href="#" wicket:id="supervisorLink"><img
|
||||
wicket:id="image" /></a></td>
|
||||
<td><a href="#" wicket:id="reviewerLink"><img
|
||||
wicket:id="image" /></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span-22">
|
||||
<div wicket:id="summaryPanel"></div>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -1,478 +1,277 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.behavior.AttributeAppender;
|
||||
import org.apache.wicket.markup.ComponentTag;
|
||||
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.image.ContextImage;
|
||||
import org.apache.wicket.markup.html.link.Link;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.CompoundPropertyModel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.components.SciProTooltipBehavior;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListAnswerDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
import se.su.dsv.scipro.data.dataobjects.Member;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
|
||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
|
||||
import se.su.dsv.scipro.data.enums.CheckListRole;
|
||||
import se.su.dsv.scipro.data.enums.ProjectTeamMemberRoles;
|
||||
import se.su.dsv.scipro.project.pages.ProjectViewCheckListPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorViewCheckListPage;
|
||||
|
||||
public class ViewCheckListPanel extends Panel {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SpringBean
|
||||
private CheckListDao checkListDao;
|
||||
|
||||
@SpringBean
|
||||
private ProjectDao projectDao;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SpringBean
|
||||
private CheckListAnswerDao checkListAnswerDao;
|
||||
private AnswerDialogPanel answerDialog;
|
||||
|
||||
@SpringBean
|
||||
private CheckListQuestionDao checkListQuestionDao;
|
||||
@SpringBean
|
||||
private CheckListDao checkListDao;
|
||||
|
||||
private CheckList cl;
|
||||
private List<CheckListQuestion> questions;
|
||||
private List<User> respondents = null, authors = null;
|
||||
private User author1 = null, author2 = null, supervisor = null, reviewer = null;
|
||||
private AjaxLink<Void> author1Link, author2Link, supervisorLink, reviewerLink;
|
||||
private CheckListAnswer author1Answer, author2Answer, supervisorAnswer, reviewerAnswer;
|
||||
private ContextImage author1Image, author2Image, supervisorImage, reviewerImage;
|
||||
private String author1Comment, author2Comment, supervisorComment, reviewerComment;
|
||||
@SpringBean
|
||||
private ProjectDao projectDao;
|
||||
|
||||
private Label author1Label, author2Label, supervisorLabel, reviewerLabel,
|
||||
author1RoleLabel, author2RoleLabel, supervisorRoleLabel, reviewerRoleLabel;
|
||||
private Dialog dialog;
|
||||
private CheckListRole role;
|
||||
private PageParameters pp;
|
||||
private AnswerForm answerForm;
|
||||
private Project project;
|
||||
final WebMarkupContainer container;
|
||||
|
||||
|
||||
public ViewCheckListPanel(String id, CheckListRole role, PageParameters pp){
|
||||
super(id);
|
||||
Long clId = pp.getAsLong("checklist");
|
||||
this.cl = checkListDao.load(clId);
|
||||
this.project = projectDao.reLoad(cl.getProject());
|
||||
this.questions = new ArrayList<CheckListQuestion>();
|
||||
this.role = role;
|
||||
this.pp = pp;
|
||||
respondents = new ArrayList<User>();
|
||||
authors = new ArrayList<User>();
|
||||
getRespondents(new TreeSet<CheckListQuestion>(cl.getQuestions()));
|
||||
if (!respondents.contains(SciProSession.get().getUser())){
|
||||
respondents.add(SciProSession.get().getUser());
|
||||
}
|
||||
|
||||
for(Student s : project.getProjectParticipants()){
|
||||
authors.add(s.getUser());
|
||||
}
|
||||
|
||||
final List<User> coSupervisors = new ArrayList<User>();
|
||||
final List<User> reviewers = new ArrayList<User>();
|
||||
public ViewCheckListPanel(final String id, final Long checkListId) {
|
||||
super(id);
|
||||
LoadableDetachableModel<CheckListModel> checkListModel =
|
||||
new LoadableDetachableModel<CheckListModel>() {
|
||||
|
||||
for (ProjectFollower tm : project.getProjectFollowers()) {
|
||||
if (tm.getProjectRole() == ProjectTeamMemberRoles.REVIEWER) {
|
||||
reviewers.add(tm.getFollower().getUser());
|
||||
} else if (tm.getProjectRole() == ProjectTeamMemberRoles.CO_SUPERVISOR) {
|
||||
coSupervisors.add(tm.getFollower().getUser());
|
||||
}
|
||||
}
|
||||
if(!authors.isEmpty()){
|
||||
if(respondents.contains(authors.get(0))){
|
||||
author1 = authors.get(0);
|
||||
}
|
||||
if(authors.size() == 2){
|
||||
if(respondents.contains(authors.get(1))){
|
||||
author2 = authors.get(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(respondents.contains(project.getHeadSupervisor().getUser())){
|
||||
supervisor = project.getHeadSupervisor().getUser();
|
||||
}
|
||||
|
||||
if(!reviewers.isEmpty()){
|
||||
if(respondents.contains(reviewers.get(0))){
|
||||
reviewer = reviewers.get(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dialogSetup();
|
||||
add(dialog);
|
||||
|
||||
CompoundPropertyModel<List<CheckListQuestion>> checkListQuestionModel = new CompoundPropertyModel<List<CheckListQuestion>>(this.questions);
|
||||
|
||||
container = new WebMarkupContainer("container");
|
||||
container.setOutputMarkupId(true);
|
||||
ListView<CheckListQuestion> checkListQuestions = new ListView<CheckListQuestion>(
|
||||
"checkListQuestions", checkListQuestionModel) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
protected CheckListModel load() {
|
||||
CheckList checkList = checkListDao.load(checkListId);
|
||||
Project project = projectDao.reLoad(checkList.getProject());
|
||||
User currentUser = SciProSession.get().getUser();
|
||||
CheckListRole currentRole = CheckListRole.AUTHOR;
|
||||
return new CheckListModel(checkList, project, currentUser,
|
||||
currentRole);
|
||||
}
|
||||
};
|
||||
setDefaultModel(checkListModel);
|
||||
initComponents(checkListModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void populateItem(final ListItem<CheckListQuestion> item) {
|
||||
final CheckListQuestion clq = item.getModelObject();
|
||||
Label checkListQuestion = new Label("checkListQuestion", new PropertyModel<String>(item.getModel(),"question"));
|
||||
|
||||
item.add(checkListQuestion);
|
||||
setUpRespondents(clq);
|
||||
setUpLinks(clq);
|
||||
setLinkVisibility();
|
||||
|
||||
item.add(author1Link);
|
||||
item.add(author2Link);
|
||||
item.add(supervisorLink);
|
||||
item.add(reviewerLink);
|
||||
}
|
||||
};
|
||||
//Add the summary panel
|
||||
final SummaryPanel summaryPanel = new SummaryPanel("summaryPanel",cl);
|
||||
summaryPanel.setOutputMarkupId(true);
|
||||
summaryPanel.setVisible(false);
|
||||
add(summaryPanel);
|
||||
//And a way to activate it
|
||||
final Label switchViewLabel = new Label("switchViewLabel",new Model<String>("View by respondent>>"));
|
||||
Link<Void> switchViewLink = new Link<Void>("switchViewLink"){
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void onClick() {
|
||||
summaryPanel.setVisible(!summaryPanel.isVisible());
|
||||
container.setVisible(!container.isVisible());
|
||||
switchViewLabel.setDefaultModelObject((summaryPanel.isVisible()?"View by question>>":"View by respondent>>"));
|
||||
}
|
||||
};
|
||||
switchViewLink.add(switchViewLabel);
|
||||
add(switchViewLink);
|
||||
//Add component hierarchy
|
||||
container.add(checkListQuestions);
|
||||
addLabels();
|
||||
setLabelVisibility();
|
||||
add(container);
|
||||
}
|
||||
|
||||
private ContextImage getAnswerImage(CheckListAnswer answer){
|
||||
ContextImage image = new ContextImage("image", new Model<String>(
|
||||
"images/icons/bullet_ball_glass_click.png"));
|
||||
if(answer != null){
|
||||
CheckListQuestionAnswer clqAnswer = answer.getAnswer();
|
||||
if (clqAnswer.equals(CheckListQuestionAnswer.YELLOW)) {
|
||||
image = new ContextImage("image", new Model<String>(
|
||||
"images/icons/bullet_ball_glass_yellow.png"));
|
||||
} else if (clqAnswer.equals(CheckListQuestionAnswer.RED)) {
|
||||
image = new ContextImage("image", new Model<String>(
|
||||
"images/icons/bullet_ball_glass_red.png"));
|
||||
}
|
||||
else if (clqAnswer.equals(CheckListQuestionAnswer.GREEN)) {
|
||||
image = new ContextImage("image", new Model<String>(
|
||||
"images/icons/bullet_ball_glass_green.png"));
|
||||
}
|
||||
else if (clqAnswer.equals(CheckListQuestionAnswer.NOT_APLICABLE)){
|
||||
image = new ContextImage("image", new Model<String>(
|
||||
"images/icons/bullet_ball_glass_grey.png"));
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
private void addRespondent(User user){
|
||||
if(!respondents.contains(user)){
|
||||
respondents.add(user);
|
||||
}
|
||||
}
|
||||
|
||||
private void dialogSetup(){
|
||||
dialog = new Dialog("dialog");
|
||||
dialog.setModal(true);
|
||||
dialog.setAutoOpen(false);
|
||||
dialog.setWidth(400);
|
||||
dialog.setHeight(400);
|
||||
dialog.add(new AnswerForm("answerForm"));
|
||||
}
|
||||
|
||||
private void addLabels(){
|
||||
author1Label = new Label("author1Label");
|
||||
author2Label = new Label("author2Label");
|
||||
supervisorLabel = new Label("supervisorLabel");
|
||||
reviewerLabel = new Label("reviewerLabel");
|
||||
author1RoleLabel = new Label("author1RoleLabel", "(Author)");
|
||||
author2RoleLabel = new Label("author2RoleLabel", "(Author)");
|
||||
supervisorRoleLabel = new Label("supervisorRoleLabel", "(Supervisor)");
|
||||
reviewerRoleLabel = new Label("reviewerRoleLabel", "(Reviewer)");
|
||||
container.add(author1Label);
|
||||
container.add(author2Label);
|
||||
container.add(supervisorLabel);
|
||||
container.add(reviewerLabel);
|
||||
container.add(author1RoleLabel);
|
||||
container.add(author2RoleLabel);
|
||||
container.add(supervisorRoleLabel);
|
||||
container.add(reviewerRoleLabel);
|
||||
}
|
||||
|
||||
private void getRespondents(Set<CheckListQuestion> questions){
|
||||
for(CheckListQuestion clq : questions){
|
||||
this.questions.add(clq);
|
||||
for(CheckListAnswer cla : clq.getAnswers()){
|
||||
addRespondent(cla.getUser());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setUpRespondents(CheckListQuestion clq){
|
||||
clearAnswers();
|
||||
author1Answer = clq.getAnswerFromUser(author1);
|
||||
author1Comment = "";
|
||||
if(author1Answer != null){
|
||||
author1Comment = author1Answer.getComment();
|
||||
}
|
||||
author1Image = getAnswerImage(author1Answer);
|
||||
|
||||
if(clq.getAnswerFromUser(author2) != null){
|
||||
author2Answer = clq.getAnswerFromUser(author2);
|
||||
author2Comment = "";
|
||||
if(author2Answer != null){
|
||||
author2Comment = author2Answer.getComment();
|
||||
}
|
||||
}
|
||||
author2Image = getAnswerImage(author2Answer);
|
||||
|
||||
supervisorAnswer = clq.getAnswerFromUser(supervisor);
|
||||
supervisorComment = "";
|
||||
if(supervisorAnswer != null){
|
||||
supervisorComment = supervisorAnswer.getComment();
|
||||
}
|
||||
supervisorImage = getAnswerImage(supervisorAnswer);
|
||||
|
||||
reviewerAnswer = clq.getAnswerFromUser(reviewer);
|
||||
reviewerComment = "";
|
||||
if(reviewerAnswer != null){
|
||||
reviewerComment = reviewerAnswer.getComment();
|
||||
}
|
||||
reviewerImage = getAnswerImage(reviewerAnswer);
|
||||
}
|
||||
|
||||
private void setUpLinks( final CheckListQuestion clq){
|
||||
author1Link = new AjaxLink<Void>("author1Link"){
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public ViewCheckListPanel(final String id,
|
||||
final IModel<CheckListModel> checkListModel) {
|
||||
super(id, checkListModel);
|
||||
initComponents(checkListModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
if(SciProSession.get().getUser().compareTo(author1) == 0){
|
||||
dialogContent(clq);
|
||||
target.addComponent(dialog);
|
||||
dialog.open(target);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
author1Link.add(author1Image);
|
||||
if(author1Comment != null && !author1Comment.equals("")){
|
||||
author1Link.add(new SciProTooltipBehavior(author1Comment));
|
||||
}
|
||||
|
||||
author2Link = new AjaxLink<Void>("author2Link"){
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
if(SciProSession.get().getUser().compareTo(author2) == 0){
|
||||
dialogContent(clq);
|
||||
target.addComponent(dialog);
|
||||
dialog.open(target);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
author2Link.add(author2Image);
|
||||
if(author2Comment != null && !author2Comment.equals("")){
|
||||
author2Link.add(new SciProTooltipBehavior(author2Comment));
|
||||
}
|
||||
|
||||
supervisorLink = new AjaxLink<Void>("supervisorLink"){
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
if(SciProSession.get().getUser().compareTo(supervisor) == 0){
|
||||
dialogContent(clq);
|
||||
target.addComponent(dialog);
|
||||
dialog.open(target);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
supervisorLink.add(supervisorImage);
|
||||
if(supervisorComment != null && !supervisorComment.equals("")){
|
||||
supervisorLink.add(new SciProTooltipBehavior(supervisorComment));
|
||||
}
|
||||
|
||||
reviewerLink = new AjaxLink<Void>("reviewerLink"){
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
if(SciProSession.get().getUser().compareTo(reviewer) == 0){
|
||||
dialogContent(clq);
|
||||
target.addComponent(dialog);
|
||||
dialog.open(target);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
reviewerLink.add(reviewerImage);
|
||||
if(reviewerComment != null && !reviewerComment.equals("")){
|
||||
reviewerLink.add(new SciProTooltipBehavior(reviewerComment));
|
||||
}
|
||||
}
|
||||
|
||||
private void dialogContent(CheckListQuestion clq){
|
||||
answerForm = new AnswerForm("answerForm", clq);
|
||||
dialog.setTitle(clq.getQuestion());
|
||||
dialog.replace(answerForm);
|
||||
}
|
||||
|
||||
private void setLinkVisibility(){
|
||||
if(author1 == null){
|
||||
author1Link.setVisible(false);
|
||||
}
|
||||
if(author2 == null){
|
||||
author2Link.setVisible(false);
|
||||
}
|
||||
if(supervisor == null){
|
||||
supervisorLink.setVisible(false);
|
||||
}
|
||||
if(reviewer == null){
|
||||
reviewerLink.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void setLabelVisibility(){
|
||||
if(author1 == null){
|
||||
author1Label.setVisible(false);
|
||||
author1RoleLabel.setVisible(false);
|
||||
}else{
|
||||
author1Label = new Label("author1Label", author1.toString());
|
||||
container.replace(author1Label);
|
||||
}
|
||||
if(author2 == null){
|
||||
author2Label.setVisible(false);
|
||||
author2RoleLabel.setVisible(false);
|
||||
}else{
|
||||
author2Label = new Label("author2Label", author2.toString());
|
||||
container.replace(author2Label);
|
||||
}
|
||||
if(supervisor == null){
|
||||
supervisorLabel.setVisible(false);
|
||||
supervisorRoleLabel.setVisible(false);
|
||||
}else{
|
||||
supervisorLabel = new Label("supervisorLabel", supervisor.toString());
|
||||
container.replace(supervisorLabel);
|
||||
}
|
||||
if(reviewer == null){
|
||||
reviewerLabel.setVisible(false);
|
||||
reviewerRoleLabel.setVisible(false);
|
||||
}else{
|
||||
reviewerLabel = new Label("reviewerLabel", reviewer.toString());
|
||||
container.replace(reviewerLabel);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearAnswers(){
|
||||
author1Answer = null;
|
||||
author2Answer = null;
|
||||
supervisorAnswer = null;
|
||||
reviewerAnswer = null;
|
||||
author1Comment = null;
|
||||
author2Comment = null;
|
||||
supervisorComment = null;
|
||||
reviewerComment = null;
|
||||
}
|
||||
|
||||
private class AnswerForm extends Form<Void> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private TrafficLightPanel trafficLights;
|
||||
private CheckListQuestion clq;
|
||||
private CheckListAnswer answer;
|
||||
private TextArea<String> commentArea;
|
||||
private String comment;
|
||||
private void initComponents(final IModel<CheckListModel> checkListModel) {
|
||||
answerDialog = new AnswerDialogPanel("answerDialog", getCurrentUser());
|
||||
add(answerDialog);
|
||||
|
||||
|
||||
public AnswerForm(String id, CheckListQuestion clq) {
|
||||
super(id);
|
||||
setMultiPart(true);
|
||||
answer = clq.getAnswerFromUser(SciProSession.get().getUser());
|
||||
if(answer != null){
|
||||
comment = answer.getComment();
|
||||
trafficLights = new TrafficLightPanel("trafficLights", new Model<CheckListQuestionAnswer>(answer.getAnswer()));
|
||||
}else{
|
||||
trafficLights = new TrafficLightPanel("trafficLights");
|
||||
}
|
||||
|
||||
this.commentArea = new TextArea<String>("commentArea", new PropertyModel<String>(this,"comment"));
|
||||
this.clq = checkListQuestionDao.reLoad(clq);
|
||||
add(trafficLights);
|
||||
add(commentArea);
|
||||
}
|
||||
|
||||
public AnswerForm(String id){
|
||||
super(id);
|
||||
add(new TrafficLightPanel("trafficLights"));
|
||||
add(new TextArea<String>("commentArea"));
|
||||
}
|
||||
ListView<CheckListQuestion> checkListQuestions =
|
||||
new ListView<CheckListQuestion>("checkListQuestions",
|
||||
new PropertyModel<List<CheckListQuestion>>(checkListModel,
|
||||
"questions")) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(
|
||||
final ListItem<CheckListQuestion> item) {
|
||||
final CheckListQuestion clq = item.getModelObject();
|
||||
Label checkListQuestion =
|
||||
new Label("checkListQuestion",
|
||||
new PropertyModel<String>(item.getModel(),
|
||||
"question"));
|
||||
|
||||
item.add(checkListQuestion);
|
||||
item.add(createAnswerList(clq, checkListModel.getObject()
|
||||
.getMembers()));
|
||||
}
|
||||
|
||||
};
|
||||
checkListQuestions.setOutputMarkupId(true);
|
||||
add(checkListQuestions);
|
||||
add(createMemberList(new PropertyModel<List<Member>>(checkListModel,
|
||||
"members")));
|
||||
}
|
||||
|
||||
private ListView<MemberAnswer> createAnswerList(
|
||||
final CheckListQuestion clq, Collection<Member> members) {
|
||||
List<MemberAnswer> answers = new ArrayList<MemberAnswer>();
|
||||
|
||||
for (Member member : members) {
|
||||
CheckListAnswer answer = clq.getAnswerFromUser(member.getUser());
|
||||
if (answer.getAnswer().equals(CheckListQuestionAnswer.NO_ANSWER)) {
|
||||
answer.setComment("No answer from respondent yet.");
|
||||
}
|
||||
|
||||
answers.add(new MemberAnswer(member, answer));
|
||||
}
|
||||
|
||||
return new ListView<MemberAnswer>("answerList", answers) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<MemberAnswer> item) {
|
||||
final MemberAnswer answer = item.getModelObject();
|
||||
|
||||
item.add(new AttributeAppender("class", new Model<String>(
|
||||
answer.getMember().getType().name().toLowerCase()
|
||||
+ "-answer"), " "));
|
||||
|
||||
item.add(new MemberPanel("member", answer.getMember()));
|
||||
|
||||
AjaxLink<Void> answerLink = new AjaxLink<Void>("answerLink") {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
if (getCurrentUser().compareTo(
|
||||
answer.getMember().getUser()) == 0) {
|
||||
answerDialog.getDialog().dialogContent(clq);
|
||||
target.addComponent(answerDialog.getDialog());
|
||||
answerDialog.getDialog().open(target);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onComponentTag(ComponentTag tag) {
|
||||
super.onComponentTag(tag);
|
||||
if (!answer.getMember().getUser().equals(
|
||||
getCurrentUser())) {
|
||||
this.disableLink(tag);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
answerLink.add(getAnswerImage(answer.getAnswer()));
|
||||
|
||||
String comment = answer.getAnswer().getComment();
|
||||
if (comment != null && !comment.equals("")) {
|
||||
answerLink.add(new SciProTooltipBehavior(comment));
|
||||
}
|
||||
item.add(answerLink);
|
||||
item.add(new Label("comment", comment));
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private ContextImage getAnswerImage(CheckListAnswer answer) {
|
||||
ContextImage image = null;
|
||||
CheckListQuestionAnswer clqAnswer = answer.getAnswer();
|
||||
if (clqAnswer.equals(CheckListQuestionAnswer.YELLOW)) {
|
||||
image =
|
||||
new ContextImage("image", new Model<String>(
|
||||
"images/icons/bullet_ball_glass_yellow.png"));
|
||||
} else if (clqAnswer.equals(CheckListQuestionAnswer.RED)) {
|
||||
image =
|
||||
new ContextImage("image", new Model<String>(
|
||||
"images/icons/bullet_ball_glass_red.png"));
|
||||
} else if (clqAnswer.equals(CheckListQuestionAnswer.GREEN)) {
|
||||
image =
|
||||
new ContextImage("image", new Model<String>(
|
||||
"images/icons/bullet_ball_glass_green.png"));
|
||||
} else if (clqAnswer.equals(CheckListQuestionAnswer.NOT_APLICABLE)) {
|
||||
image =
|
||||
new ContextImage("image", new Model<String>(
|
||||
"images/icons/bullet_ball_glass_grey.png"));
|
||||
} else if (clqAnswer.equals(CheckListQuestionAnswer.NO_ANSWER)) {
|
||||
|
||||
if (getCurrentUser().equals(answer.getUser())) {
|
||||
image =
|
||||
new ContextImage("image", new Model<String>(
|
||||
"images/icons/bullet_ball_glass_click.png"));
|
||||
} else {
|
||||
image =
|
||||
new ContextImage("image", new Model<String>(
|
||||
"images/icons/bullet_ball_glass_no_answer.png"));
|
||||
;
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
private ListView<Member> createMemberList(
|
||||
PropertyModel<List<Member>> members) {
|
||||
|
||||
final int memberSize = members.getObject().size();
|
||||
return new ListView<Member>("memberList", members) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<Member> item) {
|
||||
Member member = item.getModelObject();
|
||||
item.add(new MemberPanel("member", member));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ListItem<Member> newItem(int index) {
|
||||
ListItem<Member> item = super.newItem(index);
|
||||
if (index == memberSize - 1) {
|
||||
item.add(new AttributeAppender("class", new Model<String>(
|
||||
"rounded-right-top"), " "));
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
private User getCurrentUser() {
|
||||
return ((CheckListModel) getDefaultModelObject()).getCurrentUser();
|
||||
}
|
||||
|
||||
private static class MemberPanel extends WebMarkupContainer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MemberPanel(String id, Member member) {
|
||||
super(id);
|
||||
add(new Label("nameLabel", member.getUser().getFullName()));
|
||||
add(new Label("roleLabel", "(" + member.getType() + ")"));
|
||||
add(new AttributeAppender("class", new Model<String>(member
|
||||
.getType().name().toLowerCase()), " "));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class MemberAnswer implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Member member;
|
||||
private final CheckListAnswer answer;
|
||||
|
||||
public MemberAnswer(Member member, CheckListAnswer answer) {
|
||||
this.member = member;
|
||||
this.answer = answer;
|
||||
|
||||
}
|
||||
|
||||
public Member getMember() {
|
||||
return member;
|
||||
}
|
||||
|
||||
public CheckListAnswer getAnswer() {
|
||||
return answer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSubmit() {
|
||||
|
||||
comment = commentArea.getInput();
|
||||
User tempUser = SciProSession.get().getUser();
|
||||
CheckListQuestionAnswer answer = trafficLights.getSelected();
|
||||
CheckListAnswer clAnswer = new CheckListAnswer(tempUser, answer);
|
||||
clAnswer.setComment(comment);
|
||||
clq = checkListQuestionDao.reLoad(clq);
|
||||
clq.addAnswer(checkListAnswerDao.save(clAnswer));
|
||||
checkListQuestionDao.save(clq);
|
||||
|
||||
if(role == CheckListRole.AUTHOR){
|
||||
setResponsePage(ProjectViewCheckListPage.class, pp);
|
||||
}else if(role == CheckListRole.SUPERVISOR){
|
||||
setResponsePage(SupervisorViewCheckListPage.class, pp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
38
src/main/java/se/su/dsv/scipro/checklists/panels/ViewCheckListPanel_by_questions.html
Normal file
38
src/main/java/se/su/dsv/scipro/checklists/panels/ViewCheckListPanel_by_questions.html
Normal file
@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div wicket:id="answerDialog"></div>
|
||||
<div class="span-22 last">
|
||||
<!-- <table class="rounded-table seminar-table even-rows"> -->
|
||||
<table class="rounded-corner">
|
||||
<thead class="member-container">
|
||||
<tr>
|
||||
<th class="span-11 rounded-left-top">Question</th>
|
||||
<th wicket:id="memberList"><div wicket:id="member"><div wicket:id="nameLabel"></div>
|
||||
<div wicket:id="roleLabel"></div>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="100" class="rounded-foot"> </td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr wicket:id="checkListQuestions" class="questions">
|
||||
<td><span wicket:id="checkListQuestion" class="question"></span></td>
|
||||
<td wicket:id="answerList"><a href="#" wicket:id="answerLink"><img
|
||||
wicket:id="image" /></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
37
src/main/java/se/su/dsv/scipro/checklists/panels/ViewCheckListPanel_by_respondent.html
Normal file
37
src/main/java/se/su/dsv/scipro/checklists/panels/ViewCheckListPanel_by_respondent.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div wicket:id="answerDialog"></div>
|
||||
<div class="span-22 last">
|
||||
<table wicket:id="checkListQuestions" class="rounded-corner questions member-container">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span-2 rounded-left-top rounded-right-top centered question" colspan="3" wicket:id="checkListQuestion"></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3" class="rounded-foot"> </td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<!-- And another repeater inside it with the respondents and their answers -->
|
||||
<tr wicket:id="answerList">
|
||||
<td class="span-2" wicket:id="member"><div wicket:id="nameLabel"></div>
|
||||
<div wicket:id="roleLabel"></div></td>
|
||||
<td><a href="#" wicket:id="answerLink"><img
|
||||
wicket:id="image" /></a></td>
|
||||
<td class="comment" wicket:id="comment">A little comment</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -1,5 +1,6 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
@ -10,11 +11,15 @@ import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.CompoundPropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ChecklistCategoryDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||
import se.su.dsv.scipro.data.dataobjects.ChecklistCategory;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
|
||||
public class ViewCheckListTemplatePanel extends Panel {
|
||||
@ -26,6 +31,12 @@ public class ViewCheckListTemplatePanel extends Panel {
|
||||
|
||||
@SpringBean
|
||||
private CheckListQuestionDao checkListQuestionDao;
|
||||
@SpringBean
|
||||
private ChecklistCategoryDao categoryDao;
|
||||
@SpringBean
|
||||
private CheckListDao checklistDao;
|
||||
@SpringBean
|
||||
private CheckListTemplateDao checklistTemplateDao;
|
||||
|
||||
private CheckListTemplate clt;
|
||||
private Project project;
|
||||
@ -62,11 +73,20 @@ public class ViewCheckListTemplatePanel extends Panel {
|
||||
}
|
||||
|
||||
public CheckList getCheckList(){
|
||||
CheckList cl = new CheckList(clt.getName(), project);
|
||||
clt = checklistTemplateDao.reLoad(clt);
|
||||
List<ChecklistCategory> categoryList = new ArrayList<ChecklistCategory>();
|
||||
for(ChecklistCategory cc : clt.getCategories()){
|
||||
categoryList.add(cc);
|
||||
}
|
||||
CheckList cl = new CheckList(clt.getName(), project, categoryList);
|
||||
for(String question : clt.getQuestions()){
|
||||
CheckListQuestion clQuestion = new CheckListQuestion(question, cl.getNumberOfQuestions());
|
||||
cl.addQuestion(checkListQuestionDao.save(clQuestion));
|
||||
}
|
||||
// cl.setCategories(clt.getCategories());
|
||||
// cl.setCategories(categoryDao.findAll());
|
||||
// checklistDao.save(cl);
|
||||
|
||||
return cl;
|
||||
}
|
||||
|
||||
|
@ -28,11 +28,11 @@
|
||||
</div>
|
||||
<!-- <div wicket:id="navigator" class="comment-pager last"></div> -->
|
||||
</div>
|
||||
<div class="last comment-form">
|
||||
<div class="last">
|
||||
<div wicket:id="feedbackPanel"></div>
|
||||
<form wicket:id="commentForm">
|
||||
<div class="last">
|
||||
<textarea wicket:id="textMessage" placeholder='Enter new comment'></textarea>
|
||||
<textarea class="span-21 commentform" wicket:id="textMessage" placeholder='Enter new comment'></textarea>
|
||||
</div>
|
||||
<div class="last">
|
||||
<button wicket:id="submitButton" class="button append-bottom">Submit comment
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user