Skip to content

Commit

Permalink
Merge pull request #6581 from ChurchCRM/ui/cleanup-oct-28
Browse files Browse the repository at this point in the history
Bug fixes - User Setting / View Person / CVS Import
  • Loading branch information
DawoudIO authored Oct 28, 2023
2 parents 47ff276 + 425c45a commit f63f91c
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 302 deletions.
16 changes: 4 additions & 12 deletions src/CSVImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -811,20 +811,12 @@ public function AssignRoles()

if ($iStage == 1) {
// Display the select file form?>
<p style="color: red"> <?= $csvError ?></p>
<p style="color: red"> <?= $csvError ?></p>
<form method="post" action="CSVImport.php" enctype="multipart/form-data">
<input class="icTinyButton" type="file" name="CSVfile"><br/>
<input type="submit" class="btn btn-default" value=" <?= gettext('Upload CSV File') ?> "
name="UploadCSV">
<input class="icTinyButton" type="file" name="CSVfile">
<p></p>
<input type="submit" class="btn btn-success" value=" <?= gettext('Upload CSV File') ?> " name="UploadCSV">
</form>
</div>
</div>
<div class="card">
<div class="card-header">
<h3 class="card-title"><?= gettext('Clear Data')?></h3>
</div>
<div class="card-body">
<button type="button" class="btn btn-danger" id="clear-people"><?= gettext('Clear Persons and Families') ?></button>
</p>
<?php
echo $sClear;
Expand Down
1 change: 0 additions & 1 deletion src/Include/Footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@

<script src="<?= SystemURLs::getRootPath() ?>/skin/js/IssueReporter.js"></script>
<script src="<?= SystemURLs::getRootPath() ?>/skin/js/DataTables.js"></script>
<script src="<?= SystemURLs::getRootPath() ?>/skin/js/Tooltips.js"></script>
<script src="<?= SystemURLs::getRootPath() ?>/skin/js/Events.js"></script>
<script src="<?= SystemURLs::getRootPath() ?>/skin/js/Footer.js"></script>

Expand Down
74 changes: 36 additions & 38 deletions src/PersonView.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,52 +389,50 @@
</div>
</div>
<div class="col-lg-9 col-md-9 col-sm-9">
<div class="card card-primary box-body">
<div class="row">
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/PrintView.php?PersonID=<?= $iPersonID ?>"><i class="fa fa-print"></i> <?= gettext("Printable Page") ?></a>
<a class="btn btn-app AddToPeopleCart" id="AddPersonToCart" data-cartpersonid="<?= $iPersonID ?>"><i class="fa fa-cart-plus"></i><span class="cartActionDescription"><?= gettext("Add to Cart") ?></span></a>
<?php if (AuthenticationManager::GetCurrentUser()->isNotesEnabled()) {
?>
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/WhyCameEditor.php?PersonID=<?= $iPersonID ?>"><i class="fa fa-question-circle"></i> <?= gettext("Edit \"Why Came\" Notes") ?></a>
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/NoteEditor.php?PersonID=<?= $iPersonID ?>"><i class="fa fa-sticky-note"></i> <?= gettext("Add a Note") ?></a>
<?php
}
if (AuthenticationManager::GetCurrentUser()->isManageGroupsEnabled()) {
?>
<a class="btn btn-app" id="addGroup"><i class="fa fa-users"></i> <?= gettext("Assign New Group") ?></a>
<?php
} ?>
<a class="btn btn-app" role="button" href="<?= SystemURLs::getRootPath() ?>/v2/people"><i class="fa fa-list"></i> <?= gettext("List Members") ?></span></a>
<?php
if (AuthenticationManager::GetCurrentUser()->isDeleteRecordsEnabled()) {
<div class="row">
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/PrintView.php?PersonID=<?= $iPersonID ?>"><i class="fa fa-print"></i> <?= gettext("Printable Page") ?></a>
<a class="btn btn-app AddToPeopleCart" id="AddPersonToCart" data-cartpersonid="<?= $iPersonID ?>"><i class="fa fa-cart-plus"></i><span class="cartActionDescription"><?= gettext("Add to Cart") ?></span></a>
<?php if (AuthenticationManager::GetCurrentUser()->isNotesEnabled()) {
?>
<a id="deletePersonBtn" class="btn btn-app bg-maroon delete-person" data-person_name="<?= $person->getFullName() ?>" data-person_id="<?= $iPersonID ?>"><i class="fa fa-trash-can"></i> <?= gettext("Delete this Record") ?></a>
<?php
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/WhyCameEditor.php?PersonID=<?= $iPersonID ?>"><i class="fa fa-question-circle"></i> <?= gettext("Edit \"Why Came\" Notes") ?></a>
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/NoteEditor.php?PersonID=<?= $iPersonID ?>"><i class="fa fa-sticky-note"></i> <?= gettext("Add a Note") ?></a>
<?php
}
if (AuthenticationManager::GetCurrentUser()->isManageGroupsEnabled()) {
?>
<br />
<a class="btn btn-app" id="addGroup"><i class="fa fa-users"></i> <?= gettext("Assign New Group") ?></a>
<?php
} ?>
<a class="btn btn-app" role="button" href="<?= SystemURLs::getRootPath() ?>/v2/people"><i class="fa fa-list"></i> <?= gettext("List Members") ?></span></a>
<?php
if (AuthenticationManager::GetCurrentUser()->isDeleteRecordsEnabled()) {
?>
<a id="deletePersonBtn" class="btn btn-app bg-maroon delete-person" data-person_name="<?= $person->getFullName() ?>" data-person_id="<?= $iPersonID ?>"><i class="fa fa-trash-can"></i> <?= gettext("Delete this Record") ?></a>
<?php
}
?>
<br />
<?php
if (AuthenticationManager::GetCurrentUser()->isAdmin()) {
if (!$person->isUser()) {
?>
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/UserEditor.php?NewPersonID=<?= $iPersonID ?>"><i class="fa fa-person-chalkboard"></i> <?= gettext('Make User') ?></a>
<?php
if (AuthenticationManager::GetCurrentUser()->isAdmin()) {
if (!$person->isUser()) {
?>
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/UserEditor.php?NewPersonID=<?= $iPersonID ?>"><i class="fa fa-person-chalkboard"></i> <?= gettext('Make User') ?></a>
<?php
} else {
?>
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/UserEditor.php?PersonID=<?= $iPersonID ?>"><i class="fa fa-user-secret"></i> <?= gettext('Edit User') ?></a>
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/v2/user/<?= $iPersonID ?>"><i class="fa fa-eye"></i> <?= gettext('View User') ?></a>
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/v2/user/<?= $iPersonID ?>/changePassword"><i class="fa fa-key"></i> <?= gettext("Change Password") ?></a>
<?php
}
} elseif ($person->isUser() && $person->getId() == AuthenticationManager::GetCurrentUser()->getId()) {
} else {
?>
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/UserEditor.php?PersonID=<?= $iPersonID ?>"><i class="fa fa-user-secret"></i> <?= gettext('Edit User') ?></a>
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/v2/user/<?= $iPersonID ?>"><i class="fa fa-eye"></i> <?= gettext('View User') ?></a>
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/v2/user/current/changepassword"><i class="fa fa-key"></i> <?= gettext("Change Password") ?></a>
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/v2/user/<?= $iPersonID ?>/changePassword"><i class="fa fa-key"></i> <?= gettext("Change Password") ?></a>
<?php
} ?>

</div>
}
} elseif ($person->isUser() && $person->getId() == AuthenticationManager::GetCurrentUser()->getId()) {
?>
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/v2/user/<?= $iPersonID ?>"><i class="fa fa-eye"></i> <?= gettext('View User') ?></a>
<a class="btn btn-app" href="<?= SystemURLs::getRootPath() ?>/v2/user/current/changepassword"><i class="fa fa-key"></i> <?= gettext("Change Password") ?></a>
<?php
} ?>
</div>

<div class="card">
<div class="card-header p-2">
<ul class="nav nav-pills">
Expand Down
1 change: 0 additions & 1 deletion src/UserList.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,5 @@
</div>
<!-- /.box -->

<script src="<?= SystemURLs::getRootPath() ?>/skin/js/Tooltips.js" ></script>
<script src="<?= SystemURLs::getRootPath() ?>/skin/js/users.js" ></script>
<?php require 'Include/Footer.php' ?>
28 changes: 0 additions & 28 deletions src/skin/js/MemberView.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,3 @@ $('.delete-person').click(function (event) {
}
});
});

$('#clear-people').click(function (event) {
event.preventDefault();
var thisLink = $(this);
bootbox.confirm({
title:i18next.t( "Clear Persons and Families"),
message: i18next.t("Warning! Do not select this option if you plan to add to an existing database.<br/>") + " <b>" + i18next.t('Use only if unsatisfied with initial import. All person and member data will be destroyed!'),
buttons: {
cancel: {
label: '<i class="fa fa-times"></i> ' + i18next.t("Cancel")
},
confirm: {
label: '<i class="fa fa-trash"></i> ' + i18next.t("Clear Persons and Families"),
className: 'btn-danger'
}
},
callback: function (result) {
if(result) {
window.CRM.APIRequest({
method: 'DELETE',
path: 'database/people/clear',
}).done(function (data) {
showGlobalMessage(i18next.t('Data Cleared Successfully!'), "success");
});
}
}
});
});
49 changes: 0 additions & 49 deletions src/skin/js/user.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,3 @@
/**
* List of all the available skins
*
* @type Array
*/
var mySkins = [
'skin-blue',
'skin-black',
'skin-red',
'skin-yellow',
'skin-purple',
'skin-green',
'skin-blue-light',
'skin-black-light',
'skin-red-light',
'skin-yellow-light',
'skin-purple-light',
'skin-green-light'
]

/**
* Replaces the old skin with the new skin
* @param String cls the new skin class
* @returns Boolean false to prevent link's default action
*/
function changeSkin(cls) {
$.each(mySkins, function (i) {
$('body').removeClass(mySkins[i])
})

$('body').addClass(cls)
return false
}

// Add the change skin listener
$('[data-skin]').on('click', function (e) {
$.ajax({
type: 'POST',
url: window.CRM.root + '/api/user/' + window.CRM.viewUserId + '/setting/ui.style',
data: {"value": $(this).data('skin')}
})
if (window.CRM.viewUserId == window.CRM.userId) {
if ($(this).hasClass('knob'))
return
e.preventDefault()
changeSkin($(this).data('skin'))
}
})

$("#regenApiKey").click(function () {
$.ajax({
type: 'POST',
Expand Down
Loading

0 comments on commit f63f91c

Please sign in to comment.