Merge branch 'master' of https://git.1ka.si/git/1ka
This commit is contained in:
commit
f3fc33464d
@ -405,7 +405,7 @@ class Branching {
|
||||
$deleted_vrasanja_count = $vd->countDeletedVprasanja();
|
||||
if($deleted_vrasanja_count > 0){
|
||||
echo '<div class="toolbox_border"></div>';
|
||||
echo '<div class="toolbox_item open_deleted" onClick="displayDeletedVprasanjaPopup();"><span class="item_icon faicon delete"></span><span class="item_text">'.$lang['srv_deleted_vprasanja'].' ('.$deleted_vrasanja_count.')</span></div>';
|
||||
echo '<div class="toolbox_item open_deleted" onClick="displayVprasanjeDeletedPopup();"><span class="item_icon faicon delete"></span><span class="item_text">'.$lang['srv_deleted_vprasanja'].' ('.$deleted_vrasanja_count.')</span></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,6 +95,12 @@ elseif ($_GET['t'] == 'vprasanjeinline') {
|
||||
$v = new VprasanjeInline();
|
||||
$v->ajax();
|
||||
}
|
||||
elseif ($_GET['t'] == 'vprasanjeDeleted') {
|
||||
$tracking_status = 0;
|
||||
|
||||
$vd = new VprasanjeDeleted($anketa);
|
||||
$vd->ajax();
|
||||
}
|
||||
elseif ($_GET['t'] == 'prevajanje') {
|
||||
$tracking_status = 0;
|
||||
|
||||
|
@ -28,31 +28,58 @@ class VprasanjeDeleted {
|
||||
global $global_user_id;
|
||||
global $admin_type;
|
||||
|
||||
|
||||
// Naslov v oknu
|
||||
echo '<h2><span class="faicon delete"></span>'.$lang['srv_deleted_vprasanja'].'</h2>';
|
||||
echo '<div class="popup_close"><a href="#" onclick="popupClose();">✕</a></div>';
|
||||
|
||||
|
||||
// Vsebina
|
||||
echo '<div id="vprasanje_deleted_content" class="content">';
|
||||
|
||||
|
||||
// Seznam vseh pobrisanih vprasanj
|
||||
echo '<div class="question_list">';
|
||||
|
||||
// Loop po vseh pobrisanih vprasanjih v anketi
|
||||
$sql = sisplet_query("SELECT sd.*, s.naslov
|
||||
FROM srv_spremenljivka_deleted sd, srv_spremenljivka s
|
||||
WHERE sd.ank_id='".$this->ank_id."' AND sd.spr_id=s.id
|
||||
ORDER BY sd.delete_time DESC
|
||||
");
|
||||
if(mysqli_num_rows($sql) == 0){
|
||||
return;
|
||||
}
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
|
||||
echo '<div id="question_item_holder_'.$row['spr_id'].'" class="question_item_holder" onClick="selectLibraryItem(\''.$row['spr_id'].'\');">';
|
||||
echo '<div id="question_item_holder_'.$row['spr_id'].'" class="question_item_holder" onClick="selectVprasanjeDeletedItem(\''.$row['spr_id'].'\');">';
|
||||
|
||||
echo ' <input type="checkbox" id="question_item_check_'.$row['id'].'" item-type="1" item-subtype="1" class="question_item_check" onClick="selectLibraryItem(\''.$row['spr_id'].'\');"><label for="question_item_check_'.$row['spr_id'].'"></label>';
|
||||
echo ' <input type="checkbox" id="question_item_check_'.$row['spr_id'].'" class="question_item_check" onClick="selectVprasanjeDeletedItem(\''.$row['spr_id'].'\');"><label for="question_item_check_'.$row['spr_id'].'"></label>';
|
||||
|
||||
echo ' <div id="question_item_info_'.$row['spr_id'].'" item-type="1" item-subtype="1" item-id="'.$row['spr_id'].'" class="question_item_info">';
|
||||
echo ' <div id="question_item_info_'.$row['spr_id'].'" item-id="'.$row['spr_id'].'" class="question_item_info">';
|
||||
|
||||
echo ' <span class="faicon list"></span>';
|
||||
echo ' <span class="title">'.substr(strip_tags($row['naslov']), 0, 40).'</span>';
|
||||
echo ' <span class="date">('.date("G:i d.m.Y", strtotime($row['delete_time'])).')</span>';
|
||||
|
||||
echo ' </div>';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
|
||||
// Item counter
|
||||
echo '<div class="selected_items">'.$lang['srv_library_item_counter'].': <span id="selected_item_counter">0</span></div>';
|
||||
|
||||
|
||||
// Gumbi na dnu
|
||||
echo '<div class="button_holder">';
|
||||
echo ' <button class="medium white-blue" onClick="popupClose();">'.$lang['edit1338'].'</button>';
|
||||
echo ' <button id="insert_vprasanje_deleted_button" class="medium blue" disabled="disabled" onClick="insertVprasanjeDeletedItemsIntoSurvey();">'.$lang['srv_library_survey_add'].'</button>';
|
||||
echo '</div>';
|
||||
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
@ -76,6 +103,55 @@ class VprasanjeDeleted {
|
||||
|
||||
return $row['cnt'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @desc pohendla ajax klice
|
||||
*/
|
||||
public function ajax () {
|
||||
global $lang;
|
||||
global $global_user_id;
|
||||
|
||||
|
||||
// Odpremo popup s pobrisanimi vprasanji
|
||||
if ($_GET['a'] == 'displayVprasanjeDeletedPopup') {
|
||||
$this->displayDeletedVprasanja();
|
||||
}
|
||||
|
||||
// Dodajanje pobrisanega vprasanja nazaj v vprasalnik
|
||||
elseif ($_GET['a'] == 'addIntoSurvey') {
|
||||
|
||||
$items = $_POST['items'];
|
||||
|
||||
$b = new Branching($this->ank_id);
|
||||
$ba = new BranchingAjax($this->ank_id);
|
||||
|
||||
foreach(array_reverse($items) as $item_id){
|
||||
|
||||
$last_spr = $b->find_last_spr();
|
||||
|
||||
// Dodamo vprasanje v anketo
|
||||
$ba->spremenljivka_new($spremenljivka=$last_spr, $if=0, $endif=0, $copy=$item_id, $drop=0);
|
||||
}
|
||||
|
||||
Common::getInstance()->Init($this->ank_id);
|
||||
Common::getInstance()->prestevilci(0, $all=true);
|
||||
|
||||
$b->branching_struktura();
|
||||
}
|
||||
|
||||
|
||||
// Dokoncen izbris pobrisanega vprasanja
|
||||
elseif ($_GET['a'] == 'deleteItem') {
|
||||
|
||||
$item_id = $_POST['item_id'];
|
||||
|
||||
if($item_id != '' && $item_id > 0){
|
||||
sisplet_query("DELETE FROM srv_spremenljivka WHERE id='".$item_id."'AND folder!='0'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -47,6 +47,7 @@ return [
|
||||
dirname(__FILE__).'/../script/statistika.js',
|
||||
dirname(__FILE__).'/../script/vprasanje.js',
|
||||
dirname(__FILE__).'/../script/vprasanjeInline.js',
|
||||
dirname(__FILE__).'/../script/vprasanjeDeleted.js',
|
||||
dirname(__FILE__).'/../script/prevajanje.js',
|
||||
dirname(__FILE__).'/../script/missingValues.js',
|
||||
dirname(__FILE__).'/../script/missingProfiles.js',
|
||||
|
71
admin/survey/script/vprasanjeDeleted.js
Normal file
71
admin/survey/script/vprasanjeDeleted.js
Normal file
@ -0,0 +1,71 @@
|
||||
// Odpremo knjiznico v urejanju ankete
|
||||
function displayVprasanjeDeletedPopup(){
|
||||
|
||||
$('#fade').fadeTo('slow', 1);
|
||||
$('#general_popup').html('').addClass('vprasanje_deleted_popup').fadeIn('slow');
|
||||
|
||||
$("#general_popup").load('ajax.php?t=vprasanjeDeleted&a=displayVprasanjeDeletedPopup', {anketa: srv_meta_anketa_id});
|
||||
}
|
||||
|
||||
|
||||
// Klik na posamezen item na desni
|
||||
function selectVprasanjeDeletedItem(item_id){
|
||||
|
||||
if($('#question_item_holder_'+item_id).hasClass('active')){
|
||||
$('#question_item_holder_'+item_id).removeClass('active');
|
||||
$('#question_item_check_'+item_id).attr("checked", false);
|
||||
}
|
||||
else{
|
||||
$('#question_item_holder_'+item_id).addClass('active');
|
||||
$('#question_item_check_'+item_id).attr("checked", true);
|
||||
}
|
||||
|
||||
// Prestejemo oznacene iteme
|
||||
var count = $('.question_item_check:checkbox:checked').length;
|
||||
$('#selected_item_counter').html(count);
|
||||
|
||||
// Nastavimo gumb dodaj kot disabled glede na to ce imamo elemente ali ne
|
||||
if(count > 0){
|
||||
$("#insert_vprasanje_deleted_button").prop('disabled', false);
|
||||
}
|
||||
else{
|
||||
$("#insert_vprasanje_deleted_button").prop('disabled', true);
|
||||
}
|
||||
}
|
||||
|
||||
function deleteVprasanjeDeleted(item_id, item_type){
|
||||
|
||||
$.post('ajax.php?t=vprasanjeDeleted&a=deleteItem', {anketa: srv_meta_anketa_id, item_id: item_id, item_type: item_type}, function(){
|
||||
$('#question_item_holder_'+item_id).remove();
|
||||
});
|
||||
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
function insertVprasanjeDeletedItemsIntoSurvey(){
|
||||
|
||||
var items = [];
|
||||
|
||||
var prev = false;
|
||||
var note = '1';
|
||||
|
||||
$('.question_item_check:checkbox:checked').each(function(){
|
||||
var id_string = $(this).attr("id");
|
||||
var id = id_string.substring(20);
|
||||
|
||||
items.push(id);
|
||||
|
||||
// Preverimo za obvestilo, ce dodajamo vec elementov in ce so razlicni
|
||||
if(prev){
|
||||
note = '1m';
|
||||
}
|
||||
|
||||
prev = true;
|
||||
});
|
||||
|
||||
$("#branching").load('ajax.php?t=vprasanjeDeleted&a=addIntoSurvey', {anketa: srv_meta_anketa_id, items: items}, function(){
|
||||
|
||||
popupClose();
|
||||
actionNotePopup('lib_add_to_survey_'+note, 'success');
|
||||
});
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,7 @@
|
||||
@import "library";
|
||||
@import "jquery";
|
||||
@import "top_center_settings";
|
||||
@import "vprasanje_deleted";
|
||||
|
||||
|
||||
// Urejanje -> Nastavitve
|
||||
|
@ -0,0 +1,138 @@
|
||||
/*
|
||||
Knjiznica s pobrisanimi vprasanji v urejanju ankete
|
||||
*/
|
||||
|
||||
// Popup ima nestandarden padding
|
||||
.vprasanje_deleted_popup{
|
||||
padding: 0;
|
||||
|
||||
h2{
|
||||
padding: 16px 0 8px 0;
|
||||
|
||||
.faicon{
|
||||
padding-left: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
// Popup - vsebina
|
||||
.content{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
max-width: 840px;
|
||||
width: 100%;
|
||||
|
||||
|
||||
.question_list{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
height: 440px;
|
||||
max-height: 440px;
|
||||
overflow-y: auto;
|
||||
padding: 16px;
|
||||
|
||||
border-bottom: 1px $gray solid;
|
||||
|
||||
.spacer{
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
|
||||
.question_item_holder{
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
margin-bottom: 8px;
|
||||
|
||||
&.active{
|
||||
.question_item_info{
|
||||
background-color: $light-gray;
|
||||
}
|
||||
}
|
||||
|
||||
>label{
|
||||
margin-right: 8px;
|
||||
|
||||
&:before{
|
||||
letter-spacing: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.question_item_info{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
box-sizing: border-box;
|
||||
height: 36px;
|
||||
max-width: 100%;
|
||||
width: 705px;
|
||||
padding: 0 16px;
|
||||
|
||||
border: 1px $gray solid;
|
||||
border-radius: 2px;
|
||||
|
||||
&:hover{
|
||||
background-color: $light-gray;
|
||||
|
||||
.dots_ver{
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
span{
|
||||
margin-right: 8px;
|
||||
font-size: 14px;
|
||||
|
||||
&.faicon{
|
||||
color: $blue;
|
||||
}
|
||||
}
|
||||
|
||||
.date{
|
||||
color: $very-dark-gray2;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.item_type{
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.item_settings{
|
||||
@include hover_basic();
|
||||
|
||||
position: absolute;
|
||||
z-index: 9999;
|
||||
right: 0;
|
||||
top: 35px;
|
||||
|
||||
border-radius: 2px;
|
||||
|
||||
ul li{
|
||||
color: $blue;
|
||||
|
||||
transition: 0.2s;
|
||||
|
||||
&:hover{
|
||||
color: $dark-blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.selected_items{
|
||||
align-self: flex-end;
|
||||
margin: 16px 16px 8px 0;
|
||||
|
||||
color: $blue;
|
||||
}
|
||||
|
||||
.button_holder{
|
||||
margin: 0 16px 16px 0;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user