nightly commit
This commit is contained in:
@@ -299,7 +299,7 @@ Collection类下的为日历集合请求接口
|
|||||||
|:---|:---|:---|
|
|:---|:---|:---|
|
||||||
|token|string|用于用户鉴权的字符串|
|
|token|string|用于用户鉴权的字符串|
|
||||||
|
|
||||||
返回参数:一个json,返回collection数据表中符合条件的条目组合成的数组
|
返回参数:一个json,返回collection数据表中除去ccn_user字段的符合条件的条目组合成的数组
|
||||||
|
|
||||||
#### getListOwn
|
#### getListOwn
|
||||||
|
|
||||||
@@ -324,7 +324,7 @@ Collection类下的为日历集合请求接口
|
|||||||
|token|string|用于用户鉴权的字符串|
|
|token|string|用于用户鉴权的字符串|
|
||||||
|uuid|string|需要获取集合的uuid|
|
|uuid|string|需要获取集合的uuid|
|
||||||
|
|
||||||
返回参数:一个json,返回collection数据表中对应uuid的条目。没有符合条件的则返回null。
|
返回参数:一个json,返回collection数据表中对应uuid的除去ccn_user字段的条目。没有符合条件的则返回null。
|
||||||
|
|
||||||
#### addOwn
|
#### addOwn
|
||||||
|
|
||||||
|
|||||||
@@ -44,15 +44,21 @@ $(document).ready(function() {
|
|||||||
// apply i18n
|
// apply i18n
|
||||||
ccn_i18n_LoadLanguage();
|
ccn_i18n_LoadLanguage();
|
||||||
ccn_i18n_ApplyLanguage();
|
ccn_i18n_ApplyLanguage();
|
||||||
|
|
||||||
|
// bind event
|
||||||
|
$('#ccn-calendar-shared-btnRefresh').click(ccn_calendar_shared_Refresh);
|
||||||
|
$('#ccn-calendar-sharing-btnAdd').click(ccn_calendar_sharingList_Add);
|
||||||
|
$('#ccn-calendar-sharing-btnRefresh').click(ccn_calendar_sharing_Refresh);
|
||||||
|
$('#ccn-calendar-sharingTarget-btnAdd').click(ccn_calendar_sharingTargetList_Add);
|
||||||
|
$('#ccn-calendar-sharingTarget-btnRefresh').click(ccn_calendar_sharingTarget_Refresh);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ================== calendar
|
||||||
|
|
||||||
function ccn_calendar_LoadCalendarBody() {
|
function ccn_calendar_LoadCalendarBody() {
|
||||||
$('#ccn-calendar-calendarBbody').append(ccn_template_calendarItem.render());
|
$('#ccn-calendar-calendarBbody').append(ccn_template_calendarItem.render());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================== calendar
|
|
||||||
|
|
||||||
|
|
||||||
// ================== collection
|
// ================== collection
|
||||||
|
|
||||||
function ccn_calendar_sharing_Refresh() {
|
function ccn_calendar_sharing_Refresh() {
|
||||||
@@ -152,6 +158,9 @@ function ccn_calendar_sharingTarget_Refresh() {
|
|||||||
// also, sharingTarget don't have uuid, use index instead
|
// also, sharingTarget don't have uuid, use index instead
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update editing text
|
||||||
|
$('#ccn-calendar-sharing-sharingEditing').text(ccn_calendar_sharingListCache[uuid][1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
var listDOM = $('#ccn-calendar-sharingTargetList');
|
var listDOM = $('#ccn-calendar-sharingTargetList');
|
||||||
@@ -230,43 +239,135 @@ function ccn_calendar_shared_ChangeDisplayMode(uuid, isShow) {
|
|||||||
// ========================= input operation
|
// ========================= input operation
|
||||||
|
|
||||||
function ccn_calendar_sharingList_Add() {
|
function ccn_calendar_sharingList_Add() {
|
||||||
|
var newname = $('#ccn-calendar-sharing-inputAdd').val();
|
||||||
|
if (newname == "") return;
|
||||||
|
|
||||||
|
var result = ccn_api_collection_addOwn(newname);
|
||||||
|
if (typeof(result) == 'undefined') ccn_messagebox_Show($.i18n.prop("ccn-js-fail-add"));
|
||||||
|
else {
|
||||||
|
// second get. get detail
|
||||||
|
result = ccn_api_collection_getDetailOwn(result);
|
||||||
|
|
||||||
|
if (typeof(result) == 'undefined') ccn_messagebox_Show($.i18n.prop("ccn-js-fail-get"));
|
||||||
|
else {
|
||||||
|
// render
|
||||||
|
ccn_admin_userListCache[result[0]] = result;
|
||||||
|
var listDOM = $('#ccn-calendar-sharingList');
|
||||||
|
ccn_calendar_sharing_RenderItem(result, listDOM);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ccn_calendar_sharingList_ItemEdit() {
|
function ccn_calendar_sharingList_ItemEdit() {
|
||||||
|
var uuid = $(this).attr("uuid");
|
||||||
|
|
||||||
|
// preset inputbox
|
||||||
|
$('#ccn-admin-userItem-inputName-' + uuid).val(
|
||||||
|
ccn_calendar_sharingListCache[uuid][1]
|
||||||
|
);
|
||||||
|
|
||||||
|
// switch to edit mode
|
||||||
|
ccn_calendar_sharing_ChangeDisplayMode(uuid, undefined, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ccn_calendar_sharingList_ItemDelete() {
|
function ccn_calendar_sharingList_ItemDelete() {
|
||||||
|
var uuid = $(this).attr("uuid");
|
||||||
|
|
||||||
|
var result = ccn_api_collection_deleteOwn(
|
||||||
|
uuid,
|
||||||
|
ccn_calendar_sharingListCache[uuid][2]
|
||||||
|
);
|
||||||
|
if (!result) ccn_messagebox_Show($.i18n.prop("ccn-js-fail-delete"));
|
||||||
|
else {
|
||||||
|
$('#ccn-calendar-sharingItem-' + uuid).remove();
|
||||||
|
|
||||||
|
// also, we should notice sharing target, and try clean it
|
||||||
|
if (ccn_calendar_editingSharing == uuid) {
|
||||||
|
ccn_calendar_editingSharing = undefined;
|
||||||
|
ccn_calendar_sharingTarget_Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ccn_calendar_sharingList_ItemUpdate() {
|
function ccn_calendar_sharingList_ItemUpdate() {
|
||||||
|
var uuid = $(this).attr("uuid");
|
||||||
|
var newname = $('#ccn-admin-userItem-inputName-' + uuid).val();
|
||||||
|
|
||||||
|
var result = ccn_api_collection_updateOwn(uuid, newname, ccn_calendar_sharingListCache[uuid][2]);
|
||||||
|
if (typeof(result) == 'undefined') ccn_messagebox_Show($.i18n.prop("ccn-js-fail-update"));
|
||||||
|
else {
|
||||||
|
// update last change
|
||||||
|
ccn_calendar_sharingListCache[uuid][2] = result;
|
||||||
|
ccn_calendar_sharingListCache[uuid][1] = newname;
|
||||||
|
// update elements
|
||||||
|
$('#ccn-admin-userItem-textName-' + uuid).text(newname);
|
||||||
|
// if editing, update sharing target
|
||||||
|
if (ccn_calendar_editingSharing == uuid)
|
||||||
|
ccn_calendar_sharingTarget_Refresh();
|
||||||
|
// back to normal mode
|
||||||
|
ccn_calendar_sharing_ChangeDisplayMode(uuid, undefined, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ccn_calendar_sharingList_ItemCancelUpdate() {
|
function ccn_calendar_sharingList_ItemCancelUpdate() {
|
||||||
|
var uuid = $(this).attr("uuid");
|
||||||
|
ccn_calendar_sharing_ChangeDisplayMode(uuid, undefined, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ccn_calendar_sharingList_ItemSwitchDisplay() {
|
function ccn_calendar_sharingList_ItemSwitchDisplay() {
|
||||||
|
var uuid = $(this).attr("uuid");
|
||||||
|
ccn_calendar_sharing_displayCache[uuid] = !(ccn_calendar_sharing_displayCache[uuid]);
|
||||||
|
ccn_calendar_sharing_ChangeDisplayMode(uuid, ccn_calendar_sharing_displayCache[uuid], undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ccn_calendar_sharingList_ItemShare() {
|
function ccn_calendar_sharingList_ItemShare() {
|
||||||
|
var uuid = $(this).attr("uuid");
|
||||||
|
ccn_calendar_editingSharing = uuid;
|
||||||
|
ccn_calendar_sharingTarget_Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function ccn_calendar_sharingTargetList_Add() {
|
function ccn_calendar_sharingTargetList_Add() {
|
||||||
|
var newusername = $('#ccn-calendar-sharingTarget-inputAdd').val();
|
||||||
|
if (newusername == "" || typeof(ccn_calendar_editingSharing) == 'undefined') return;
|
||||||
|
|
||||||
|
var result = ccn_api_collection_addSharing(
|
||||||
|
ccn_calendar_editingSharing,
|
||||||
|
newusername,
|
||||||
|
ccn_calendar_sharingListCache[ccn_calendar_editingSharing][2]
|
||||||
|
);
|
||||||
|
if (typeof(result) == 'undefined') ccn_messagebox_Show($.i18n.prop("ccn-js-fail-add"));
|
||||||
|
else {
|
||||||
|
// add new item
|
||||||
|
var index = ccn_calendar_sharingTargetListCache.push(newusername) - 1;
|
||||||
|
var listDOM = $('#ccn-calendar-sharingTargetList');
|
||||||
|
ccn_calendar_sharingTarget_RenderItem(newusername, index, listDOM);
|
||||||
|
// update last change
|
||||||
|
ccn_calendar_sharingListCache[ccn_calendar_editingSharing][2] = result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ccn_calendar_sharingTargetList_ItemDelete() {
|
function ccn_calendar_sharingTargetList_ItemDelete() {
|
||||||
|
var uuid = $(this).attr("uuid");
|
||||||
|
var username = ccn_calendar_sharingTargetListCache[uuid];
|
||||||
|
|
||||||
|
var result = ccn_api_collection_deleteSharing(
|
||||||
|
ccn_calendar_editingSharing,
|
||||||
|
username,
|
||||||
|
ccn_calendar_sharingListCache[ccn_calendar_editingSharing][2]
|
||||||
|
);
|
||||||
|
if (typeof(result) == 'undefined') ccn_messagebox_Show($.i18n.prop("ccn-js-fail-delete"));
|
||||||
|
else {
|
||||||
|
// remove item in ui
|
||||||
|
$('#ccn-calendar-sharingTargetItem-' + uuid).remove();
|
||||||
|
// update last change
|
||||||
|
ccn_calendar_sharingListCache[ccn_calendar_editingSharing][2] = result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function ccn_calendar_sharedList_ItemSwitchDisplay() {
|
function ccn_calendar_sharedList_ItemSwitchDisplay() {
|
||||||
|
var uuid = $(this).attr("uuid");
|
||||||
|
ccn_calendar_shared_displayCache[uuid] = !(ccn_calendar_shared_displayCache[uuid]);
|
||||||
|
ccn_calendar_shared_ChangeDisplayMode(uuid, ccn_calendar_shared_displayCache[uuid]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,7 +186,7 @@
|
|||||||
<div class="container" style="display: flex; flex-flow: column;">
|
<div class="container" style="display: flex; flex-flow: column;">
|
||||||
<h1 i18n-name="ccn-calendar-shared-list" class="title"></h1>
|
<h1 i18n-name="ccn-calendar-shared-list" class="title"></h1>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<div class="control">
|
<div id="ccn-calendar-shared-btnRefresh" class="control">
|
||||||
<a class="button is-primary">
|
<a class="button is-primary">
|
||||||
<span class="icon is-small"><i class="fas fa-sync"></i></span>
|
<span class="icon is-small"><i class="fas fa-sync"></i></span>
|
||||||
</a>
|
</a>
|
||||||
@@ -207,15 +207,15 @@
|
|||||||
<div class="control-list">
|
<div class="control-list">
|
||||||
<div class="field has-addons">
|
<div class="field has-addons">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<input class="input" type="text">
|
<input id="ccn-calendar-sharing-inputAdd" class="input" type="text">
|
||||||
</div>
|
</div>
|
||||||
<div class="control">
|
<div id="ccn-calendar-sharing-btnAdd" class="control">
|
||||||
<a class="button is-primary">
|
<a class="button is-primary">
|
||||||
<span class="icon is-small"><i class="fas fa-plus"></i></span>
|
<span class="icon is-small"><i class="fas fa-plus"></i></span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control">
|
<div id="ccn-calendar-sharing-btnRefresh" class="control">
|
||||||
<a class="button is-primary">
|
<a class="button is-primary">
|
||||||
<span class="icon is-small"><i class="fas fa-sync"></i></span>
|
<span class="icon is-small"><i class="fas fa-sync"></i></span>
|
||||||
</a>
|
</a>
|
||||||
@@ -229,20 +229,22 @@
|
|||||||
<div class="container" style="display: flex; flex-flow: column;">
|
<div class="container" style="display: flex; flex-flow: column;">
|
||||||
<h1 i18n-name="ccn-calendar-sharing-sharingTargetList" class="title"></h1>
|
<h1 i18n-name="ccn-calendar-sharing-sharingTargetList" class="title"></h1>
|
||||||
<label class="label"><span
|
<label class="label"><span
|
||||||
i18n-name="ccn-calendar-sharing-sharingTargetEditing"></span><span>xxx</span></label>
|
i18n-name="ccn-calendar-sharing-sharingTargetEditing"></span>
|
||||||
|
<span id="ccn-calendar-sharing-sharingEditing"></span>
|
||||||
|
</label>
|
||||||
|
|
||||||
<div class="control-list">
|
<div class="control-list">
|
||||||
<div class="field has-addons">
|
<div class="field has-addons">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<input class="input" type="text">
|
<input id="ccn-calendar-sharingTarget-inputAdd" class="input" type="text">
|
||||||
</div>
|
</div>
|
||||||
<div class="control">
|
<div id="ccn-calendar-sharingTarget-btnAdd" class="control">
|
||||||
<a class="button is-primary">
|
<a class="button is-primary">
|
||||||
<span class="icon is-small"><i class="fas fa-plus"></i></span>
|
<span class="icon is-small"><i class="fas fa-plus"></i></span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control">
|
<div id="ccn-calendar-sharingTarget-btnRefresh" class="control">
|
||||||
<a class="button is-primary">
|
<a class="button is-primary">
|
||||||
<span class="icon is-small"><i class="fas fa-sync"></i></span>
|
<span class="icon is-small"><i class="fas fa-sync"></i></span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user