diff --git a/radicale/web/internal_data/css/main.css b/radicale/web/internal_data/css/main.css
index 8746417ca..0504018d3 100644
--- a/radicale/web/internal_data/css/main.css
+++ b/radicale/web/internal_data/css/main.css
@@ -196,6 +196,11 @@ main{
text-align: center;
}
+#collectionsscene article small[data-name=contentcount]{
+ font-weight: bold;
+ font-style: normal;
+}
+
#editcollectionscene p span{
word-wrap:break-word;
font-weight: bold;
@@ -228,6 +233,12 @@ main{
margin-top: 15px;
}
+.deleteconfirmationtxt{
+ text-align: center;
+ font-size: 1em;
+ font-weight: bold;
+}
+
.fabcontainer{
display: flex;
flex-direction: column-reverse;
diff --git a/radicale/web/internal_data/fn.js b/radicale/web/internal_data/fn.js
index 4ced63dcf..482eed752 100644
--- a/radicale/web/internal_data/fn.js
+++ b/radicale/web/internal_data/fn.js
@@ -36,6 +36,13 @@ const ROOT_PATH = location.pathname.replace(new RegExp("/+[^/]+/*(/index\\.html?
*/
const COLOR_RE = new RegExp("^(#[0-9A-Fa-f]{6})(?:[0-9A-Fa-f]{2})?$");
+
+/**
+ * The text needed to confirm deleting a collection
+ * @const
+ */
+const DELETE_CONFIRMATION_TEXT = "DELETE";
+
/**
* Escape string for usage in XML
* @param {string} s
@@ -94,6 +101,23 @@ const CollectionType = {
union.push(this.WEBCAL);
}
return union.join("_");
+ },
+ valid_options_for_type: function(a){
+ a = a.trim().toUpperCase();
+ switch(a){
+ case CollectionType.CALENDAR_JOURNAL_TASKS:
+ case CollectionType.CALENDAR_JOURNAL:
+ case CollectionType.CALENDAR_TASKS:
+ case CollectionType.JOURNAL_TASKS:
+ case CollectionType.CALENDAR:
+ case CollectionType.JOURNAL:
+ case CollectionType.TASKS:
+ return [CollectionType.CALENDAR_JOURNAL_TASKS, CollectionType.CALENDAR_JOURNAL, CollectionType.CALENDAR_TASKS, CollectionType.JOURNAL_TASKS, CollectionType.CALENDAR, CollectionType.JOURNAL, CollectionType.TASKS];
+ case CollectionType.ADDRESSBOOK:
+ case CollectionType.WEBCAL:
+ default:
+ return [a];
+ }
}
};
@@ -106,13 +130,14 @@ const CollectionType = {
* @param {string} description
* @param {string} color
*/
-function Collection(href, type, displayname, description, color, source) {
+function Collection(href, type, displayname, description, color, contentcount, source) {
this.href = href;
this.type = type;
this.displayname = displayname;
this.color = color;
this.description = description;
this.source = source;
+ this.contentcount = contentcount;
}
/**
@@ -139,6 +164,7 @@ function get_principal(user, password, callback) {
CollectionType.PRINCIPAL,
displayname_element ? displayname_element.textContent : "",
"",
+ 0,
""), null);
} else {
callback(null, "Internal error");
@@ -188,6 +214,7 @@ function get_collections(user, password, collection, callback) {
let addressbookcolor_element = response.querySelector(response_query + " > *|propstat > *|prop > *|addressbook-color");
let calendardesc_element = response.querySelector(response_query + " > *|propstat > *|prop > *|calendar-description");
let addressbookdesc_element = response.querySelector(response_query + " > *|propstat > *|prop > *|addressbook-description");
+ let contentcount_element = response.querySelector(response_query + " > *|propstat > *|prop > *|getcontentcount");
let webcalsource_element = response.querySelector(response_query + " > *|propstat > *|prop > *|source");
let components_query = response_query + " > *|propstat > *|prop > *|supported-calendar-component-set";
let components_element = response.querySelector(components_query);
@@ -197,11 +224,13 @@ function get_collections(user, password, collection, callback) {
let color = "";
let description = "";
let source = "";
+ let count = 0;
if (resourcetype_element) {
if (resourcetype_element.querySelector(resourcetype_query + " > *|addressbook")) {
type = CollectionType.ADDRESSBOOK;
color = addressbookcolor_element ? addressbookcolor_element.textContent : "";
description = addressbookdesc_element ? addressbookdesc_element.textContent : "";
+ count = contentcount_element ? parseInt(contentcount_element.textContent) : 0;
} else if (resourcetype_element.querySelector(resourcetype_query + " > *|subscribed")) {
type = CollectionType.WEBCAL;
source = webcalsource_element ? webcalsource_element.textContent : "";
@@ -221,6 +250,7 @@ function get_collections(user, password, collection, callback) {
}
color = calendarcolor_element ? calendarcolor_element.textContent : "";
description = calendardesc_element ? calendardesc_element.textContent : "";
+ count = contentcount_element ? parseInt(contentcount_element.textContent) : 0;
}
}
let sane_color = color.trim();
@@ -233,7 +263,7 @@ function get_collections(user, password, collection, callback) {
}
}
if (href.substr(-1) === "/" && href !== collection.href && type) {
- collections.push(new Collection(href, type, displayname, description, sane_color, source));
+ collections.push(new Collection(href, type, displayname, description, sane_color, count, source));
}
}
collections.sort(function(a, b) {
@@ -265,6 +295,7 @@ function get_collections(user, password, collection, callback) {
'
Description