Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed jquery issues on issues tab ERM-107 #755

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion organizations/ajax_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@
<tr>
<td><label><?php echo _("Contact:");?>&nbsp;&nbsp;<span class='bigDarkRedText'>*</span></label></td>
<td>
<select multiple style="min-height: 60px;" type='text' id='contactIDs' name='contactIDs[]'>
<select multiple style="min-height: 60px;width: 100%" type='text' id='contactIDs' name='contactIDs[]'>
<?php

foreach ($organizationContactsArray as $contact) {
Expand Down
12 changes: 6 additions & 6 deletions organizations/ajax_htmldata.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

//shared html template for organization and resource issues
function generateIssueHTML($issue,$associatedEntities=null) {
$html = "
$html = "<div id='openIssues'>
<div class=\"issue\">";
if (!$issue->dateClosed) {
$html .= "
Expand Down Expand Up @@ -75,7 +75,7 @@ function generateIssueHTML($issue,$associatedEntities=null) {
<dt class=\"block\">Body:</dt>
<dd>{$issue->bodyText}</dd>
</dl>
</div>";
</div></div>";
return $html;
}

Expand Down Expand Up @@ -670,14 +670,14 @@ function generateDowntimeHTML($downtime) {
</tr>
<tr>
<td>
<a href="<?php echo $getIssuesFormData; ?>" class="issuesBtn" id="openIssuesBtn"><?php echo _("view open issues");?></a>
<a href='javascript:void(0);' onclick='javascript:myDialog("ajax_htmldata.php?<?php echo $getIssuesFormData; ?>",500,500)'><?php echo _("view open issues");?></a>
<a target="_blank" href="<?php echo $exportIssueUrl;?>"><img src="images/xls.gif" /></a>
<div class="issueList" id="openIssues" style="display:none;"></div>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $getIssuesFormData."&archived=1"; ?>" class="issuesBtn" id="archivedIssuesBtn"><?php echo _("view archived issues");?></a>
<a href='javascript:void(0);' onclick='javascript:myDialog("ajax_htmldata.php?<?php echo $getIssuesFormData; ?>&archived=1",500,500)'><?php echo _("view archived issues");?></a>
<a target="_blank" href="<?php echo $exportIssueUrl;?>&archived=1"><img src="images/xls.gif" /></a>
<div class="issueList" id="archivedIssues"></div>
</td>
Expand All @@ -693,14 +693,14 @@ function generateDowntimeHTML($downtime) {
</tr>
<tr>
<td>
<a href="<?php echo $getDowntimeFormData; ?>" class="downtimeBtn" id="openDowntimeBtn"><?php echo _("view current/upcoming downtime");?></a>
<a href='javascript:void(0);' onclick='javascript:myDialog("ajax_htmldata.php?<?php echo $getDowntimeFormData; ?>",500,500)'><?php echo _("view current/upcoming downtime");?></a>
<a target="_blank" href="<?php echo $exportDowntimeUrl;?>"><img src="images/xls.gif" /></a>
<div class="downtimeList" id="currentDowntime" style="display:none;"></div>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $getDowntimeFormData."&archived=1"; ?>" class="downtimeBtn" id="archiveddowntimeBtn"><?php echo _("view archived downtime");?></a>
<a href='javascript:void(0);' onclick='javascript:myDialog("ajax_htmldata.php?<?php echo $getDowntimeFormData; ?>&archived=1",500,500)'><?php echo _("view archived downtime");?></a>
<a target="_blank" href="<?php echo $exportDowntimeUrl;?>&archived=1"><img src="images/xls.gif" /></a>
<div class="downtimeList" id="archivedDowntime"></div>
</td>
Expand Down
1 change: 1 addition & 0 deletions organizations/ajax_processing.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@
}
break;
case 'insertDowntime':
global $user;
$newDowntime = new Downtime();
$newDowntime->entityID = $_POST['sourceOrganizationID'];
$newDowntime->creatorID = $user->loginID;
Expand Down
9 changes: 9 additions & 0 deletions organizations/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1589,6 +1589,7 @@ a.showResourceIssues:before {

div#openIssues {
margin: 8px;
text-align: left;
}

div#archivedIssues {
Expand Down Expand Up @@ -2072,3 +2073,11 @@ div.downtime, div.issue {
.max-with-100 {
max-width: 100%;
}

.my-dialog {
top: 100px !important;
}

.my-dialog .issue {
border-bottom: 1px solid #eee;
}
40 changes: 24 additions & 16 deletions organizations/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,23 +283,31 @@ function postwith (to,p) {
}

function myDialog(loadForm, h,w){
if (w < 800) w = w * 1.2;

$('<div/>').dialog({
modal: true,
open: function ()
{
if ($(this).is(':empty')) {
$(this).load(loadForm);
setTimeout(() => {
$('.date-pick').datePicker({startDate:'01/01/1996'});
}, 100)
}
},
height: h,
width: w,
dialogClass: "no-titlebar"
if (h < 800) h = 'auto';
if (w < 800) w = w * 1.2;
const el = $('<div/>');
el.dialog({
modal: true,
position: {my: "center top", at: "center top"},
classes: {
"ui-dialog": "my-dialog"
},
open: function () {
if ($(this).is(':empty')) {
$(this).load(loadForm, function () {
$('.date-pick').datePicker({startDate: '01/01/1996'});
});
}
$('.ui-widget-overlay').bind('click', function()
{
el.dialog('close');
});
},
height: h,
width: w,
// title:"JQuery Dialog"
dialogClass: "no-titlebar"
});
}

function myCloseDialog(formName){
Expand Down
56 changes: 25 additions & 31 deletions organizations/js/orgDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,12 @@
return false;
});

$(document).on('click', '#createDowntimeBtn', function () {
$(".downtimeList").slideUp(250);
});

$("#createIssueBtn").click(function() {
$(".issueList").slideUp(250);
});

$("#createDowntimeBtn").click(function() {
$(".downtimeList").slideUp(250);
});

$(".showResourceIssues").click(function () {
if (viewAll == 0){
$(document).on('click', '.showResourceIssues', function () {
if (viewAll === 0){
$('#div_organization').hide();
$('#div_aliases').hide();
$('#div_contacts').hide();
Expand Down Expand Up @@ -145,7 +140,7 @@
$('.date-pick').datePicker({startDate:'01/01/1996'});
});

$("#submitCloseResourceIssue").click(function() {
$(document).on('click', '#submitCloseResourceIssue', function () {
submitCloseResourceIssue();
});

Expand Down Expand Up @@ -178,31 +173,30 @@
}
});

$("#submitUpdatedDowntime").click(function(e) {
e.preventDefault();

var errors = [];
$(document).on('click', '#submitUpdatedDowntime', function (e) {
e.preventDefault();

if($("#endDate").val()=="") {
errors.push({
message: _("Must set an end date."),
target: '#span_error_endDate'
});
}
var errors = [];

if(errors.length == 0) {
submitUpdatedDowntime();
} else {
if($("#endDate").val()=="") {
errors.push({
message: _("Must set an end date."),
target: '#span_error_endDate'
});
}

$(".updateDowntimeError").html("");
if(errors.length == 0) {
submitUpdatedDowntime();
} else {

for(var index in errors) {
error = errors[index];
$(error.target).html(error.message);
}
}
$(".updateDowntimeError").html("");

});
for(var index in errors) {
error = errors[index];
$(error.target).html(error.message);
}
}
});

$(document).on('click' , '.issuesBtn', function(e) {
e.preventDefault();
Expand Down
7 changes: 1 addition & 6 deletions resources/ajax_forms/getNewIssueForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
$organizationArray = $resource->getOrganizationArray();
$organizationData = $organizationArray[0];

$config = new Configuration();
//the issues feature currently support org or resource contacts, but not both
$moduleFilter = ($config->settings->organizationsModule == 'Y') ? 'organizations':'resources';
$contactsArray = $resourceAcquisition->getUnarchivedContacts($moduleFilter);
Expand Down Expand Up @@ -148,12 +149,6 @@
<td style='text-align:right'><input type='button' value='<?php echo _("cancel");?>' onclick="myCloseDialog()" class='cancel-button'></td>
</tr>
</table>
<script>
$("#submitNewIssue").on("click", function(e) {
e.preventDefault();
submitNewIssue();
});
</script>

</form>

Expand Down
8 changes: 4 additions & 4 deletions resources/ajax_htmldata/getIssues.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
</tr>
<tr>
<td>
<a href='javascript:void(0);' onclick='javascript:myDialog("ajax_htmldata.php?<?php echo $getIssuesFormData; ?>",500,500)' class="issuesBtn" id="openIssuesBtn"><?php echo _("view open issues");?></a>
<a href='javascript:void(0);' onclick='javascript:myDialog("ajax_htmldata.php?<?php echo $getIssuesFormData; ?>",500,500)' id="openIssuesBtn"><?php echo _("view open issues");?></a>
<a target="_blank" href="<?php echo $exportIssuesUrl;?>"><img src="images/xls.gif" /></a>
<div class="issueList" id="openIssues" style="display:none;"></div>
</td>
</tr>
<tr>
<td>
<a href='javascript:void(0);' onclick='javascript:myDialog("ajax_htmldata.php?archived=1&<?php echo $getIssuesFormData; ?>",500,500)' class="issuesBtn" id="archivedIssuesBtn"><?php echo _("view archived issues");?></a>
<a href='javascript:void(0);' onclick='javascript:myDialog("ajax_htmldata.php?archived=1&<?php echo $getIssuesFormData; ?>",500,500)' id="archivedIssuesBtn"><?php echo _("view archived issues");?></a>
<a target="_blank" href="<?php echo $exportIssuesUrl;?>&archived=1"><img src="images/xls.gif" /></a>
<div class="issueList" id="archivedIssues"></div>
</td>
Expand All @@ -45,14 +45,14 @@
</tr>
<tr>
<td>
<a href='javascript:void(0);' onclick='javascript:myDialog("ajax_htmldata.php?<?php echo $getDowntimeFormData; ?>",500,500)' class="downtimeBtn" id="openDowntimeBtn"><?php echo _("view current/upcoming downtime");?></a>
<a href='javascript:void(0);' onclick='javascript:myDialog("ajax_htmldata.php?<?php echo $getDowntimeFormData; ?>",500,500)' id="openDowntimeBtn"><?php echo _("view current/upcoming downtime");?></a>
<a target="_blank" href="<?php echo $exportDowntimesUrl;?>"><img src="images/xls.gif" /></a>
<div class="downtimeList" id="currentDowntime" style="display:none;"></div>
</td>
</tr>
<tr>
<td>
<a href='javascript:void(0);' onclick='javascript:myDialog("ajax_htmldata.php?archived=1&<?php echo $getDowntimeFormData; ?>",500,500)' class="downtimeBtn" id="archiveddowntimeBtn"><?php echo _("view archived downtime");?></a>
<a href='javascript:void(0);' onclick='javascript:myDialog("ajax_htmldata.php?archived=1&<?php echo $getDowntimeFormData; ?>",500,500)' id="archiveddowntimeBtn"><?php echo _("view archived downtime");?></a>
<a target="_blank" href="<?php echo $exportDowntimesUrl;?>&archived=1"><img src="images/xls.gif" /></a>
<div class="downtimeList" id="archivedDowntime"></div>
</td>
Expand Down
8 changes: 4 additions & 4 deletions resources/ajax_htmldata/getIssuesList.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

//shared html template for organization and resource issues
function generateIssueHTML($issue,$associatedEntities=null) {
$html = "
$html = "<div id='openIssues'>
<div class=\"issue\">";
if (!$issue->dateClosed) {
$html .= "
Expand Down Expand Up @@ -49,8 +49,8 @@ function generateIssueHTML($issue,$associatedEntities=null) {
}


$html .= " </dd>
<dt>" . _("Applies to:") . "</dt>
$html .= " </dd>
<dt>" . _("Applies to:") . "</dt>
<dd>";
if ($associatedEntities) {
$temp ='';
Expand All @@ -66,7 +66,7 @@ function generateIssueHTML($issue,$associatedEntities=null) {
<dt class=\"block\">" . _("Body:") . "</dt>
<dd>{$issue->bodyText}</dd>
</dl>
</div>";
</div></div>";
return $html;
}

Expand Down
9 changes: 9 additions & 0 deletions resources/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2354,6 +2354,7 @@ a.showIssues:before {

div#openIssues {
margin: 8px;
text-align: left;
}

div#archivedIssues {
Expand Down Expand Up @@ -3331,3 +3332,11 @@ div.downtime, div.issue {
.no-titlebar .ui-dialog-titlebar {
display: none;
}

.my-dialog {
top: 100px !important;
}

.my-dialog .issue {
border-bottom: 1px solid #eee;
}
Loading