Skip to content

Commit

Permalink
Merge pull request WildMeOrg#877 from WildMeOrg/projects-hide
Browse files Browse the repository at this point in the history
Projects hide
  • Loading branch information
naknomum authored Nov 7, 2024
2 parents 1d1e63e + d6bd1fd commit c4d16d4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@
#file system folder in which marked individual data will be stored (e.g. data files)
#markedIndividualDirectoryLocation=individuals

# default behaviors for Project object
loggedOutDefaultDesired = true
defaultProjectOrganizationParameter = IndoCet
defaultProjName = Indocet Opportunistic Sightings
defaultProjId = IndoCetOppS-

#file system folder in which adoption data will be stored (e.g. photos)
#adoptionLocation=adoptions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@
#file system folder in which marked individual data will be stored (e.g. data files)
#markedIndividualDirectoryLocation=individuals

# default behaviors for Project object
loggedOutDefaultDesired = true
defaultProjectOrganizationParameter = IndoCet
defaultProjName = Indocet Opportunistic Sightings
defaultProjId = IndoCetOppS-

#file system folder in which adoption data will be stored (e.g. photos)
#adoptionLocation=adoptions

Expand Down
16 changes: 0 additions & 16 deletions src/main/java/org/ecocean/CommonConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -385,22 +385,6 @@ public static String getNewSubmissionEmail(String context) {
return getProperty("newSubmissionEmail", context).trim();
}

public static String getDefaultSelectedProject(String context) {
return getProperty("defaultProjName", context).trim();
}

public static String getDefaultProjectOrganizationParameter(String context) {
return getProperty("defaultProjectOrganizationParameter", context).trim();
}

public static String getDefaultSelectedProjectId(String context) {
return getProperty("defaultProjId", context).trim();
}

public static boolean getLoggedOutDefaultDesired(String context) {
return parseBoolean(getProperty("loggedOutDefaultDesired", context), false);
}

public static String getR(String context) {
return getProperty("R", context).trim();
}
Expand Down
6 changes: 0 additions & 6 deletions src/main/resources/bundles/commonConfiguration.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
#file system folder in which marked individual data will be stored (e.g. data files)
#markedIndividualDirectoryLocation=individuals

# default behaviors for Project object
loggedOutDefaultDesired = true
defaultProjectOrganizationParameter = IndoCet
defaultProjName = Indocet Opportunistic Sightings
defaultProjId = IndoCetOppS-

dataDirectoryName = wildbook_data_dir

#URL to the graphic to be displayed at the top of every page through header.jsp
Expand Down
64 changes: 18 additions & 46 deletions src/main/webapp/submit.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ $(document).ready( function() {
$('#locationID').select2({width: '100%', height:'50px'});
$('#country').select2({width: '100%', height:'50px'});
populateProjectNameDropdown([],[],"", false, getDefaultSelectedProject(), getDefaultSelectedProjectId(), getLoggedOutDefaultDesired());
populateProjectNameDropdown([],[],"", false);
<%
if(user != null){
%>
Expand All @@ -115,43 +115,35 @@ $(document).ready( function() {
%>
});
function populateProjectNameDropdown(options, values, selectedOption, isVisible, defaultSelectItem, defaultSelectItemId, loggedOutDefaultDesired){
let useCustomStyle = '<%= ServletUtilities.useCustomStyle(request,CommonConfiguration.getDefaultProjectOrganizationParameter(context)) %>' == "true"?true: false;
if(useCustomStyle){
//do nothing unusual
}else{
defaultSelectItem = null;
defaultSelectItemId = null;
loggedOutDefaultDesired = false;
function populateProjectNameDropdown(options, values, selectedOption, isVisible, defaultSelectItem, defaultSelectItemId){
defaultSelectItem = null;
defaultSelectItemId = null;
if(options.length<1){
isVisible=false;
}
// if(options.length<1){
// isVisible=false;
// }
let projectNameHtml = '';
projectNameHtml += '<div class="col-xs-6 col-md-4">';
if(loggedOutDefaultDesired){
projectNameHtml += '<input type="hidden" name="defaultProject" id="defaultProject" value="' + getDefaultSelectedProjectId() + '" />';
// console.log("hidden default project selected with name: " + getDefaultSelectedProjectId());
}
if(isVisible){
projectNameHtml += '<label class="control-label "><%=props.getProperty("projectMultiSelectLabel") %></label>';
projectNameHtml += '<select name="proj-id-dropdown" id="proj-id-dropdown" class="form-control" multiple="multiple">';
}else{
projectNameHtml += '<select style="display: none;" name="proj-id-dropdown" id="proj-id-dropdown" class="form-control" multiple="multiple">';
projectNameHtml += '<div class="col-xs-6 col-md-4"><label class="control-label"><%=props.getProperty("projectMultiSelectLabel") %></label></div><div class="col-xs-6 col-lg-8"><select name="proj-id-dropdown" id="proj-id-dropdown" class="form-control" multiple="multiple">';
}
projectNameHtml += '<option value=""></option>';
if(defaultSelectItem){
//options
if(defaultSelectItem){
projectNameHtml += '<option value="' + defaultSelectItemId + '" selected>'+ defaultSelectItem +'</option>';
options = options.remove(defaultSelectItem);
}
projectNameHtml += '<option value=""></option>';
for(let i=0; i<options.length; i++){
if(options[i] === selectedOption){
projectNameHtml += '<option value="'+ values[i] +'" selected>'+ options[i] +'</option>';
}else{
projectNameHtml += '<option value="'+ values[i] + '">'+ options[i] +'</option>';
}
}
projectNameHtml += '</div>';
projectNameHtml += '</div></div>';
$("#proj-id-dropdown-container").empty();
$("#proj-id-dropdown-container").append(projectNameHtml);
}
Expand All @@ -167,26 +159,6 @@ Array.prototype.remove = function() {
return this;
};
function getDefaultSelectedProject(){
let defaultProject = '<%= CommonConfiguration.getDefaultSelectedProject(context) %>';
return defaultProject;
}
function getDefaultProjectOrganizationParameter(){
let defaultProjectOrganizationParameter = '<%= CommonConfiguration.getDefaultProjectOrganizationParameter(context) %>';
return defaultProjectOrganizationParameter;
}
function getDefaultSelectedProjectId(){
let defaultProjectId = '<%= CommonConfiguration.getDefaultSelectedProjectId(context) %>';
return defaultProjectId;
}
function getLoggedOutDefaultDesired(){
let loggedOutDefaultDesired = '<%= CommonConfiguration.getLoggedOutDefaultDesired(context) %>';
return loggedOutDefaultDesired;
}
function doAjaxForProject(requestJSON,userId){
$.ajax({
url: wildbookGlobals.baseUrl + '../ProjectGet',
Expand All @@ -200,7 +172,7 @@ function doAjaxForProject(requestJSON,userId){
if(projectNameResults){
projNameOptions = projectNameResults.map(entry =>{return entry.researchProjectName});
projNameIds = projectNameResults.map(entry =>{return entry.projectIdPrefix});
populateProjectNameDropdown(projNameOptions,projNameIds,"", true, getDefaultSelectedProject(), getDefaultSelectedProjectId(), getLoggedOutDefaultDesired());
populateProjectNameDropdown(projNameOptions,projNameIds,"", true);
}
},
error: function(x,y,z) {
Expand Down Expand Up @@ -988,7 +960,7 @@ if(CommonConfiguration.showProperty("maximumElevationInMeters",context)){

<fieldset>

<div class="form-group form-inline" id="proj-id-dropdown-container">
<div class="form-group" id="proj-id-dropdown-container">
</div>

<div class="form-group">
Expand Down

0 comments on commit c4d16d4

Please sign in to comment.