summaryrefslogtreecommitdiffstats
path: root/idrop-web/grails-app/views/common/_topToolbar.gsp
blob: 71ff6855140104acb747418e80d8938604f0f9d4 (plain)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<div id="topToolbar" >

	<div id="topToolbarMenu" class="btn-toolbar">
		
		<div id="menuFileDetails" class="btn-group">
			<button id="menuRefresh" onclick="refreshTree()"><i class="icon-refresh"></i><g:message
					code="text.refresh" /></button>
			<button id="menuNewFolderDetails"
					onclick="newFolderViaBrowseDetailsToolbar()"><i class="icon-plus-sign"></i><g:message
							code="text.new.folder" /></button>

		</div>
		
		<div id="menuView" class="btn-group">
				<g:if test="${grailsApplication.config.idrop.config.use.browse.view==true}">
					<button id="menuBrowseView"
						onclick="browseView()"><i class="icon-list"></i><g:message
								code="text.browse" /></button>
				</g:if>
				<button id="menuInfoView" onclick="infoView()"><i class="icon-info-sign"></i> <g:message code="text.info" /></button>
				<g:if test="${grailsApplication.config.idrop.config.use.gallery.view==true}">
					<button id="menuGalleryView"
						onclick="galleryView()"><i class="icon-picture"></i><g:message
								code="text.gallery" /></button>
				</g:if>
		</div>
</div>


<script type="text/javascript">
	var showLite = false;

	$(function() {
		$(".toolbarMenuItem").hide();
		$(".detailsToolbarMenuItem").hide();
		//$("ul.sf-menu").superfish();
	});

	function setDefaultView(view) {
		if (view == null) {
			return false;
		}

		browseOptionVal = view;

		//var state = {};

		//state["browseOptionVal"] = browseOptionVal;
		//$.bbq.pushState(state);

	}

	/**
	 * browse view selected
	 */
	function browseView() {
		setDefaultView("browse");
		showBrowseView(selectedPath);

	}

	/**
	 * Show the info view
	 */
	function infoView() {
		setDefaultView("info");
		showInfoView(selectedPath);
	}

	/**
	 * Show the gallery (photo) view
	 */
	function galleryView() {
		setDefaultView("gallery");
		showGalleryView(selectedPath);
	}

	// browse details toolbar

	/**
	 * Start a bulk action to add selected files to the shopping cart
	 */
	function addSelectedToCart() {
		answer = confirm("Add the selected files to the cart?"); //FIXME: i18n
		if (!answer) {
			return false;
		}

		addToCartBulkAction();
	}

	/**
	 * Start a bulk action to delete the selected files from the shopping cart
	 */
	function deleteSelected() {
		answer = confirm("Delete the selected files?"); //FIXME: i18n
		if (!answer) {
			return false;
		}
		deleteFilesBulkAction();
	}

	function sharingSelectedFromBrowseDetailsToolbar() {
		showSharingView(selectedPath);
	}

	// browse toolbar scripts

	function showInTreeClickedFromToolbar() {
		var path = $("#infoAbsPath").val();
		$(tabs).tabs('select', 0); // switch to home tab
		splitPathAndPerformOperationAtGivenTreePath(path, null, null, function(
				path, dataTree, currentNode) {

			$.jstree._reference(dataTree).open_node(currentNode);
			$.jstree._reference(dataTree).select_node(currentNode, true);
			// updateBrowseDetailsForPathBasedOnCurrentModel(data);

		});
	}

	function downloadAction() {
		var path = $("#infoAbsPath").val();
		downloadViaToolbar(path);
	}
	
</script>