mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-05 07:03:24 +01:00
Start working on a folders support.
This commit is contained in:
parent
9bc4504aea
commit
b21fd642a5
@ -41,15 +41,19 @@ public class MindmapController extends BaseController {
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/maps", produces = {"application/json", "text/html", "application/xml"})
|
||||
public ModelAndView getMindmaps() throws IOException {
|
||||
public ModelAndView getMindmaps(@RequestParam(required = false) String q) throws IOException {
|
||||
final User user = com.wisemapping.security.Utils.getUser();
|
||||
|
||||
final MindmapFilter filter = MindmapFilter.parse(q);
|
||||
|
||||
final List<MindmapUser> mapsByUser = mindmapService.getMindmapUserByUser(user);
|
||||
final List<MindMap> mindmaps = new ArrayList<MindMap>();
|
||||
for (MindmapUser mindmapUser : mapsByUser) {
|
||||
mindmaps.add(mindmapUser.getMindMap());
|
||||
final MindMap mindmap = mindmapUser.getMindMap();
|
||||
if (filter.accept(mindmap, user)) {
|
||||
mindmaps.add(mindmap);
|
||||
}
|
||||
}
|
||||
|
||||
final RestMindmapList restMindmapList = new RestMindmapList(mindmaps);
|
||||
return new ModelAndView("mapsView", "list", restMindmapList);
|
||||
}
|
||||
|
@ -0,0 +1,56 @@
|
||||
package com.wisemapping.rest;
|
||||
|
||||
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.User;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public enum MindmapFilter {
|
||||
ALL("all") {
|
||||
@Override
|
||||
public boolean accept(@NotNull MindMap mindmap, @NotNull User user) {
|
||||
return true;
|
||||
}
|
||||
|
||||
},
|
||||
MY_MAPS("my_maps") {
|
||||
@Override
|
||||
boolean accept(@NotNull MindMap mindmap, @NotNull User user) {
|
||||
return mindmap.getOwner().equals(user);
|
||||
}
|
||||
},
|
||||
SHARED_WITH_ME("shared_with_me") {
|
||||
@Override
|
||||
boolean accept(@NotNull MindMap mindmap, @NotNull User user) {
|
||||
return !MY_MAPS.accept(mindmap, user);
|
||||
}
|
||||
},
|
||||
PUBLIC("public") {
|
||||
@Override
|
||||
boolean accept(@NotNull MindMap mindmap, @NotNull User user) {
|
||||
return mindmap.isPublic();
|
||||
}
|
||||
};
|
||||
|
||||
private String id;
|
||||
|
||||
MindmapFilter(@NotNull String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
static public MindmapFilter parse(@Nullable String valueStr) {
|
||||
MindmapFilter result = ALL;
|
||||
final MindmapFilter[] values = MindmapFilter.values();
|
||||
for (MindmapFilter value : values) {
|
||||
if (value.id.equals(valueStr)) {
|
||||
result = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
abstract boolean accept(@NotNull MindMap mindmap, @NotNull User user);
|
||||
|
||||
}
|
@ -85,6 +85,11 @@ input#selectAll {
|
||||
.dataTables_filter {
|
||||
float:right;
|
||||
}
|
||||
|
||||
#mindmapListTable th {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
/* Pagination Styles */
|
||||
#paginateContainer {
|
||||
height:40px;
|
||||
@ -162,3 +167,10 @@ input#selectAll {
|
||||
height:50px;
|
||||
white-space:nowrap;
|
||||
}
|
||||
|
||||
#foldersContainer {
|
||||
width: 15%;
|
||||
float: left;
|
||||
margin-right: 2%;
|
||||
margin-top: 80px
|
||||
}
|
||||
|
@ -18,6 +18,46 @@ jQuery.fn.dataTableExt.oSort['es_date-desc'] = function(a, b) {
|
||||
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
|
||||
};
|
||||
|
||||
$.fn.dataTableExt.oApi.fnReloadAjax = function (oSettings, sNewSource, fnCallback, bStandingRedraw) {
|
||||
if (typeof sNewSource != 'undefined' && sNewSource != null) {
|
||||
oSettings.sAjaxSource = sNewSource;
|
||||
}
|
||||
this.oApi._fnProcessingDisplay(oSettings, true);
|
||||
var that = this;
|
||||
var iStart = oSettings._iDisplayStart;
|
||||
var aData = [];
|
||||
|
||||
this.oApi._fnServerParams(oSettings, aData);
|
||||
|
||||
oSettings.fnServerData(oSettings.sAjaxSource, aData, function(json) {
|
||||
/* Clear the old information from the table */
|
||||
that.oApi._fnClearTable(oSettings);
|
||||
|
||||
/* Got the data - add it to the table */
|
||||
var aData = (oSettings.sAjaxDataProp !== "") ?
|
||||
that.oApi._fnGetObjectDataFn(oSettings.sAjaxDataProp)(json) : json;
|
||||
|
||||
for (var i = 0; i < aData.length; i++) {
|
||||
that.oApi._fnAddData(oSettings, aData[i]);
|
||||
}
|
||||
|
||||
oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
|
||||
that.fnDraw();
|
||||
|
||||
if (typeof bStandingRedraw != 'undefined' && bStandingRedraw === true) {
|
||||
oSettings._iDisplayStart = iStart;
|
||||
that.fnDraw(false);
|
||||
}
|
||||
|
||||
that.oApi._fnProcessingDisplay(oSettings, false);
|
||||
|
||||
/* Callback user function - for event handlers etc */
|
||||
if (typeof fnCallback == 'function' && fnCallback != null) {
|
||||
fnCallback(oSettings);
|
||||
}
|
||||
}, oSettings);
|
||||
}
|
||||
|
||||
jQuery.fn.dataTableExt.selectAllMaps = function() {
|
||||
var total = $('.select input:checkbox[id!="selectAll"]').size();
|
||||
var selected = $('.select input:checked[id!="selectAll"]').size();
|
||||
|
@ -52,12 +52,6 @@
|
||||
return '<a href="c/map/' + obj.aData.id + '/edit.htm">' + obj.aData.title + '</a>';
|
||||
}
|
||||
},
|
||||
{
|
||||
bVisible: false,
|
||||
bSearchable : false,
|
||||
sTitle : "Owner Email",
|
||||
mDataProp: "ownerEmail"
|
||||
},
|
||||
{
|
||||
sTitle : "Owner",
|
||||
mDataProp :"owner"
|
||||
@ -78,7 +72,7 @@
|
||||
oLanguage : {
|
||||
"sSearch" : "",
|
||||
"sInfo" : "_START_-_END_ of _TOTAL_",
|
||||
"sEmptyTable": "Hey, you don't have any mindmap. Go ahead and create one clicking on the 'New' button !!!"
|
||||
"sEmptyTable": "No mindmap available for the selected filter criteria."
|
||||
},
|
||||
bStateSave:true
|
||||
});
|
||||
@ -233,12 +227,24 @@
|
||||
$("#actionButtons .tagMap").click(function() {
|
||||
});
|
||||
|
||||
$("#actionButtons .share").click(function() {
|
||||
});
|
||||
|
||||
$("#actionButtons .tags").click(function() {
|
||||
});
|
||||
|
||||
|
||||
$('#foldersContainer li').click(function(event) {
|
||||
// Deselect previous option ...
|
||||
$('#foldersContainer li').removeClass('active');
|
||||
$('#foldersContainer i').removeClass('icon-white');
|
||||
|
||||
// Select the new item ...
|
||||
var dataTable = $('#mindmapListTable').dataTable();
|
||||
$(this).addClass('active').filter('i').addClass('icon-white');
|
||||
|
||||
// Reload the table data ...
|
||||
dataTable.fnReloadAjax("../service/maps?q=" + $(this).attr('data-filter'));
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
|
||||
// Register time update functions ....
|
||||
@ -265,13 +271,13 @@
|
||||
</div>
|
||||
|
||||
<div id="mindmapListContainer">
|
||||
<div style="width: 15%;float: left;margin-right: 2%;margin-top: 80px">
|
||||
<div id="foldersContainer">
|
||||
<ul class="nav nav-list">
|
||||
<li class="nav-header">Folders</li>
|
||||
|
||||
<li class="active"><a href="#"><i class="icon-inbox"></i> All</a></li>
|
||||
<li><a href="#"><i class="icon-share"></i> Shared With Me</a></li>
|
||||
<li><a href="#"><i class="icon-globe"></i> Public Maps</a></li>
|
||||
<li data-filter="all" class="active"><a href="#"><i class="icon-inbox"></i> All</a></li>
|
||||
<li data-filter="my_maps" ><a href="#"><i class="icon-user"></i> My Maps</a></li>
|
||||
<li data-filter="shared_with_me"><a href="#"><i class="icon-share"></i> Shared With Me</a></li>
|
||||
<li data-filter="public"><a href="#"><i class="icon-globe"></i> Public Maps</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user