Redesign - knjiznica

This commit is contained in:
pero1203 2022-03-01 15:00:52 +01:00
parent 79050e7d72
commit 56115f50d1
5 changed files with 79 additions and 12 deletions

View File

@ -3316,12 +3316,12 @@ class SurveyAdmin
echo '<li ' . ($get == A_KVIZ ? 'class="active"' : '') . '>';
echo '<a href="index.php?anketa=' . $this->anketa . '&amp;a='.A_KVIZ.'" title="' . $lang['srv_vrsta_survey_type_6'] . '" '.(!$userAccess->checkUserAccess($what='kviz') ? 'class="paid_locked"' : '').'>' . $lang['srv_vrsta_survey_type_6'] . '</a></li> ';
# Volitve
global $mysql_database_name;
if ($admin_type == 0 || $mysql_database_name == 'test1kasi') {
# Volitve - po novem za vse s paketom 3ka
//global $mysql_database_name;
//if ($admin_type == 0 || $mysql_database_name == 'test1kasi') {
echo '<li ' . ($get == A_VOTING ? 'class="active"' : '') . '>';
echo '<a href="index.php?anketa=' . $this->anketa . '&amp;a='.A_VOTING.'" title="' . $lang['srv_vrsta_survey_type_18'] . '" '.(!$userAccess->checkUserAccess($what='voting') ? 'class="paid_locked"' : '').'>' . $lang['srv_vrsta_survey_type_18'] . '</a></li> ';
}
//}
# Socialna omrezja
echo '<li ' . ($get == A_SOCIAL_NETWORK ? 'class="active"' : '') . '>';

View File

@ -223,7 +223,7 @@ class LibraryBranching {
$expanded = in_array($id, $this->expanded_folders) ? true : false;
echo '<li id="folder_item_'.$id.'" class="folder_item '.($this->folder_id == $id ? 'active' : '').' '.($expanded ? 'open' : 'close').'" onClick="openLibraryFolder(\''.$id.'\');">';
echo '<li id="folder_item_'.$id.'" class="folder_item '.($this->folder_id == $id ? 'active' : '').' '.($expanded ? 'open' : 'close').' '.($uid != 0 ? 'droppable_folder' : '').'" folder-id="'.$id.'" onClick="openLibraryFolder(\''.$id.'\');">';
// Ikoni puscice in mape
@ -350,6 +350,9 @@ class LibraryBranching {
$this->displayRightQuestionItem($rowFolderQuestions);
}
// Init drag/drop js
echo '<script>initDragLibraryItem();</script>';
}
}
@ -397,7 +400,7 @@ class LibraryBranching {
echo ' <input type="checkbox" id="question_item_check_'.$spremenljivka['id'].'" class="question_item_check" onClick="selectLibraryItem(\''.$spremenljivka['id'].'\');"><label for="question_item_check_'.$spremenljivka['id'].'"></label>';
echo ' <div class="question_item_info">';
echo ' <div id="question_item_info_'.$spremenljivka['id'].'" item-id="'.$spremenljivka['id'].'" class="question_item_info">';
echo ' <span class="faicon list"></span>';
echo ' <span class="title">'.substr(strip_tags($spremenljivka['naslov']), 0, 40).'</span>';
echo ' </div>';
@ -593,6 +596,25 @@ class LibraryBranching {
$b->branching_struktura();
}
// Drop itema v drug folder
elseif ($_GET['a'] == 'dropItem') {
$item_id = $_POST['item_id'];
$folder_id = $_POST['folder_id'];
if($item_id != '' && $item_id > 0){
// spremenljivka
if (true) {
sisplet_query("UPDATE srv_spremenljivka SET folder='".$folder_id."' WHERE id='".$item_id."'");
}
// if/blok
else {
sisplet_query("UPDATE srv_if SET folder='".$folder_id."' WHERE id='".$item_id."'");
}
}
}
// Odpremo popup za dodajanje itema v knjiznico
elseif ($_GET['a'] == 'displayAddIntoLibraryPopup') {

View File

@ -412,6 +412,40 @@ function selectLibraryItem(item_id){
$('#selected_item_counter').html(count);
}
// Funkcija za init drag drop vprasanj v knjiznici
function dropLibraryItem(item_id, folder_id){
console.log(item_id + '__' + folder_id);
$.post('ajax.php?t=libraryBranching&a=dropItem', {anketa: srv_meta_anketa_id, item_id: item_id, folder_id: folder_id}, function(){
$('#question_item_holder_'+item_id).remove();
});
}
// Funkcija za init drag drop
function initDragLibraryItem(){
$('.question_item_info').draggable({
containment: $('#general_popup'),
helper: 'clone',
//distance: 20,
//snap: theVoteBar,
//revert: true,
});
$(".droppable_folder").droppable({
accept: ".question_item_info",
tolerance: "pointer",
hoverClass: "drag-hover",
drop: function( event, ui ) {
var item_id = ui.draggable.attr('item-id');
var folder_id = $(this).attr("folder-id");
dropLibraryItem(item_id, folder_id);
}
});
}
function insertLibraryItemsIntoSurvey(){
var item_ids = [];

View File

@ -13257,6 +13257,9 @@ and open the template in the editor.
border-color: #1E88E5;
background-color: #F8F8F8;
}
.tab_content .content_left ul li.folder_item.droppable_folder.drag-hover {
background-color: #E5E5E5;
}
.tab_content .content_left ul li.folder_item:hover {
background-color: #F8F8F8;
}
@ -13375,11 +13378,11 @@ and open the template in the editor.
align-items: center;
box-sizing: border-box;
height: 36px;
width: 100%;
max-width: 100%;
width: 705px;
padding: 0 16px;
border: 1px #E5E5E5 solid;
border-radius: 2px;
transition: 0.2s;
}
.tab_content .content_right .question_list .question_item_holder .question_item_info:hover,
.tab_content .content_right .question_list .question_item_holder .folder_item_info:hover,

View File

@ -72,7 +72,12 @@
&.open{
}
&.droppable_folder.drag-hover{
//border-color: $blue;
background-color: $gray;
}
&:hover{
background-color: $light-gray;
@ -189,18 +194,21 @@
box-sizing: border-box;
height: 36px;
width: 100%;
max-width: 100%;
width: 705px;
padding: 0 16px;
border: 1px $gray solid;
border-radius: 2px;
transition: 0.2s;
&:hover{
background-color: $light-gray;
}
&.ui-draggable-dragging{
//width: 200px;
}
span{
margin-right: 8px;
font-size: 14px;