summaryrefslogtreecommitdiffstats
path: root/admin/survey/script/folders.js
blob: bafbac3915369323e618418785a0a8ca425a6102 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108


function folders () {
    
    $(function () {
        
        // nardimo ankete draggable
        $('.folder_container').draggable({revert: 'invalid', opacity:'0.7', zIndex:'1', handle:'.folder_left img', delay:100});
        
        // nardimo folderje draggable
        $('li .folder').draggable({revert: 'invalid', opacitiy:'0.7', zIndex:'1', handle:'.movable', delay:100});
        
        // nardimo folderje droppable
        $('.folderdrop').droppable({accept: '.folder_container, ul .folder', hoverClass: 'grupahover', tolerance: 'pointer', 
            drop: function (e, ui) {
                if ($(ui.draggable).attr('name') == 'folder') {
                    $('#folders').load('ajax.php?t=folders&a=folder_dropped', {drop: $(ui.draggable).attr('id'), folder: $(this).attr('id')});
                } else {
                    $('#folders').load('ajax.php?t=folders&a=anketa_dropped', {anketa: $(ui.draggable).attr('id'), folder: $(this).attr('id')});
                }
            }
        });
        
        // na folder damo click za spreminjanje imena in hover za nov folder
        $('.folderdrop strong').click(function () {
            $(this).parent().load('ajax.php?t=folders&a=folder_rename', {folder: $(this).parent().attr('id')},
                function () {
                    $('#naslov_'+$(this).parent().attr('id')).focus();
                }
            );
        })
        .hover(
            function () {
                $('#new_folder_'+$(this).parent().attr('id')).css({visibility: 'visible'});
                $('#delete_folder_'+$(this).parent().attr('id')).css({visibility: 'visible'});
            },
            function () {
                $('#new_folder_'+$(this).parent().attr('id')).css({visibility: 'hidden'});
                $('#delete_folder_'+$(this).parent().attr('id')).css({visibility: 'hidden'});
            }
        );

    });
           
}

function folder_newname (folder) {
    
    $('#folders').load('ajax.php?t=folders&a=folder_newname', {folder: folder, naslov: $('#naslov_'+folder).attr('value')});
    
}

function new_folder (folder) {
    
    $('#folders').load('ajax.php?t=folders&a=new_folder', {folder: folder});
    
}

function delete_folder (folder) {
    
    $('#folders').load('ajax.php?t=folders&a=delete_folder', {folder: folder});
    
}


function folders_plusminus (folder) {
    
    var sortable_if = document.getElementById('folder_'+folder).style;
    
    if (sortable_if.display != "none") {
    
        if ($.browser.msie)
            $('#folder_'+folder).hide();
        else
            $('#folder_'+folder).slideUp();
            
        //$('#f_pm_'+folder).html('<img src="img/plus.png" class="folder_plusminus" style="width:12px; height:12px">');
        
        $('#f_pm_'+folder).load('ajax.php?t=folders&a=folder_collapsed', {collapsed: 1, folder: folder});
        
    } else {
        
        if ($.browser.msie)
            $('#folder_'+folder).show();
        else
            $('#folder_'+folder).slideDown();
        
        //$('#f_pm_'+folder).html('<img src="img/minus.png" class="folder_plusminus" style="width:12px; height:12px">');
        
        $('#f_pm_'+folder).load('ajax.php?t=folders&a=folder_collapsed', {collapsed: 0, folder: folder});
    }
    
}

function folders_knjiznica (anketa) {
    $('#folders').load('ajax.php?t=folders&a=folders_knjiznica', {anketa: anketa});
}

function folders_myknjiznica (anketa) {
    $('#folders').load('ajax.php?t=folders&a=folders_myknjiznica', {anketa: anketa});
}

function language_change (lang) {
	$.post('ajax.php?t=surveyList&a=language_change', {lang: lang}, function () {
		/*window.location.reload();*/
		window.location = window.location.href.split("?")[0];
	});
}