Skip to content
This repository has been archived by the owner on Mar 30, 2024. It is now read-only.

Commit

Permalink
fix#35
Browse files Browse the repository at this point in the history
  • Loading branch information
kimbtech committed Jan 30, 2020
1 parent 1ca7d98 commit 110cf72
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 16 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
latest
1.2.4
1.2.5
1.2
1
7 changes: 5 additions & 2 deletions core/PollAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ private function showInfo(){
if( $this->pollsub->isValue( [$id] ) ){
foreach( $this->pollsub->getValue( [$id] ) as $sub){
$i++;
$submiss[] = Utilities::optimizeOutputString( $sub['name'] . ' (' . $sub['mail'] . ') ' );
$submiss[] = Utilities::optimizeOutputString(
$sub['name'] . ' (' . $sub['mail'] . ') '
) . (!empty($sub['editcode']) ? '<span class="ui-icon ui-icon-trash delsinglesub" subcode="'.$id.','.$sub['editcode'].'"></span>' : '' );
$submissempty = false;
}
}
Expand Down Expand Up @@ -177,7 +179,8 @@ private function showInfo(){
"terminmeta" => $terminmeta,
"editurl" => URL::generateAPILink( 'editpoll', array( 'admin' => $this->polldata->getValue(['code', 'admin']) ) ),
"polltype" => $type,
"submissempty" => $submissempty
"submissempty" => $submissempty,
"delsinglesub" => URL::generateAPILink( 'delsubmission', array( 'poll' => $this->polldata->getValue(['code', 'poll']) ) )
)
)));
}
Expand Down
2 changes: 1 addition & 1 deletion core/Utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Utilities {
/**
* The system's Version
*/
const SYS_VERSION = 'v1.2.4';
const SYS_VERSION = 'v1.2.5';

/**
* Possible chars for:
Expand Down
6 changes: 6 additions & 0 deletions core/templates/admin_de.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ <h4>Eingabefelder hinzufügen</h4>
Konnte den Tausch nicht durchführen!
</div>
</div>
<div id="delsingle" class="d-none" title="Eintrag löschen?">
<span class="ui-icon ui-icon-alert" style="float:left; margin:12px 12px 20px 0;"></span>
Wollen Sie wirklich den Eintrag löschen?<br />
Dies lässt sich nicht rückgängig machen!
</div>
</div>

<script>
localStorage.removeItem('newPollData');
Expand Down
30 changes: 18 additions & 12 deletions core/templates/admin_en.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,27 +240,33 @@ <h4>Add custom field</h4>
<div id="deletepoll" class="d-none" title="Delete?">
<div class="pollsubm" class="d-none">
<span class="ui-icon ui-icon-alert" style="float:left; margin:12px 12px 20px 0;"></span>
Do your really want to delete all submissions?<br />
Do you really want to delete all submissions?<br />
This can't be undone!
</div>
<div class="pollentire" class="d-none">
<span class="ui-icon ui-icon-alert" style="float:left; margin:12px 12px 20px 0;"></span>
Do your really want to delete the entire poll?<br />
Do you really want to delete the entire poll?<br />
This can't be undone!
</div>
</div>
<div id="swapdate" class="d-none" title="Swap two dates.">
<div class="form-group">
<select class="form-control" id="swapA">
</select>
<span class="ui-icon ui-icon-arrowthick-2-e-w"></span>
<select class="form-control" id="swapB">
</select>
</div>
<div class="alert alert-danger d-none" role="alert">
Unable to save changes.
</div>
<div class="form-group">
<select class="form-control" id="swapA">
</select>
<span class="ui-icon ui-icon-arrowthick-2-e-w"></span>
<select class="form-control" id="swapB">
</select>
</div>
<div class="alert alert-danger d-none" role="alert">
Unable to save changes.
</div>
</div>
<div id="delsingle" class="d-none" title="Delete this entry?">
<span class="ui-icon ui-icon-alert" style="float:left; margin:12px 12px 20px 0;"></span>
Do you really want to delete this entry?<br />
This can't be undone!
</div>
</div>

<script>
localStorage.removeItem('newPollData');
Expand Down
42 changes: 42 additions & 0 deletions load/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,48 @@ function template_admin(){
$("ul#listofadditionals li span.additionals-delete").click(removeAdditionalInput);
$( "ul#listofadditionals" ).sortable({ items: "> li.additionals-element" });
}

function deleteSingleEntry(){
var codes = $(this).attr('subcode').split(',');
const changecolor = (newcol) => $(this).css('background-image').replace(/^(url\(".*\/ui\-icons_)[0-9a-f]{6}(_256x240\.png"\))$/, '$1' + newcol + '$2');

$( "div#delsingle" ).removeClass('d-none');
$( "div#delsingle" ).dialog({
resizable: true,
height: "auto",
width: Math.min($(window).width(), 600),
modal: true,
buttons: [
{
text: "OK",
icon: "ui-icon-check",
class: "delsingle-buttons",
click: () => {
$("button.delsingle-buttons").button({disabled: true});
$.post( template_data.delsinglesub, { terminid : parseInt(codes[0]), code : codes[1] }, (data) => {
$("button.delsingle-buttons").button({disabled: false});
if( data == 'ok' ){
$(this).parent().remove();
}
else{
$(this).css('background-image', changecolor('cc0000') );
}
$( "div#delsingle" ).dialog( "close" );
});
},
},
{
text: "Cancel",
icon: "ui-icon-close",
class: "delsingle-buttons",
click: function() {
$( this ).dialog( "close" );
},
}
]
});
}
$("span.delsinglesub").click(deleteSingleEntry);
}

function template_submissionquery(){
Expand Down

0 comments on commit 110cf72

Please sign in to comment.