) refData.get("data");
+ if (data != null) {
+ String date = extractField(refData, "date");
+ if (!date.isEmpty()) {
+ String[] parts = date.split("-");
+ if (parts.length > 0 && parts[0].matches("\\d{4}")) {
+ return parts[0];
+ }
+ }
+
+ String accessDate = extractField(refData, "accessDate");
+ if (!accessDate.isEmpty()) {
+ String[] parts = accessDate.split("-");
+ if (parts.length > 0 && parts[0].matches("\\d{4}")) {
+ return parts[0];
+ }
+ }
+ }
+ } catch (Exception e) {
+ logger.warn("Error extracting year: {}", e.getMessage());
+ }
+ return "";
+ }
+}
diff --git a/vspace/src/main/resources/app.properties b/vspace/src/main/resources/app.properties
index bebd58784..48e5ebf0e 100644
--- a/vspace/src/main/resources/app.properties
+++ b/vspace/src/main/resources/app.properties
@@ -15,3 +15,7 @@ file_uploads_directory=${files.directory.path}
hibernate_show_sql=${hibernate.show_sql}
admin_username=${admin.username}
+
+citesphere.api.url=${citesphere_api_url}
+citesphere.client.id=${citesphere_client_id}
+citesphere.client.secret=${citesphere_client_secret}
\ No newline at end of file
diff --git a/vspace/src/main/webapp/WEB-INF/views/staff/modules/slides/slide.html b/vspace/src/main/webapp/WEB-INF/views/staff/modules/slides/slide.html
index d1708279e..482236481 100644
--- a/vspace/src/main/webapp/WEB-INF/views/staff/modules/slides/slide.html
+++ b/vspace/src/main/webapp/WEB-INF/views/staff/modules/slides/slide.html
@@ -2668,6 +2668,777 @@
$("#addVideoAlert").show();
}
});
+
+
+ var citesphereData = {
+ selectedReferences: [],
+ groups: [],
+ collections: {},
+ currentStep: 'connection',
+ currentGroup: null,
+ currentCollection: null
+ };
+
+ // Initialize Citesphere functionality when modal is shown
+ $('#addReferenceAlert').on('shown.bs.modal', function () {
+ // Show/hide appropriate tab content and buttons based on active tab
+ updateReferenceModalButtons();
+
+ // If Citesphere tab is active, initialize step-by-step flow
+ if ($('#citesphereRefTab').hasClass('active')) {
+ initializeCitesphereSteps();
+ }
+ });
+
+ // Tab switching handlers
+ $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
+ updateReferenceModalButtons();
+
+ // Initialize Citesphere step-by-step flow when switching to tab
+ if ($(e.target).attr('href') === '#citesphereRefTab') {
+ initializeCitesphereSteps();
+ }
+ });
+
+ // Also trigger when tab link is clicked
+ $(document).on('click', 'a[href="#citesphereRefTab"]', function() {
+ setTimeout(function() {
+ updateReferenceModalButtons();
+ initializeCitesphereSteps();
+ }, 100);
+ });
+
+ // Handle manual tab click to update buttons
+ $(document).on('click', 'a[href="#manualRefTab"]', function() {
+ setTimeout(function() {
+ updateReferenceModalButtons();
+ }, 100);
+ });
+
+ function updateReferenceModalButtons() {
+ var isCitesphereTab = $('#citesphereRefTab').hasClass('active');
+
+ if (isCitesphereTab) {
+ $('#submitReference').hide();
+ $('#submitCitesphereReferences').show();
+ } else {
+ $('#submitReference').show();
+ $('#submitCitesphereReferences').hide();
+ }
+ }
+
+ // Initialize the step-by-step Citesphere flow
+ function initializeCitesphereSteps() {
+
+ // Reset step data
+ citesphereData.currentStep = 'connection';
+ citesphereData.currentGroup = null;
+ citesphereData.currentCollection = null;
+ citesphereData.selectedReferences = [];
+
+ // Hide success message and all steps initially
+ hideImportSuccessMessage();
+ $('.citesphere-step').hide();
+
+ // Show a loading message first
+ $('#connectionStatusContent').html(
+ '' +
+ ' Checking Citesphere connection...' +
+ '
'
+ );
+
+ // Check connection status and show appropriate step
+ checkCitesphereConnection();
+ }
+
+ // Check if user is connected to Citesphere
+ function checkCitesphereConnection() {
+ var token = $('input[name="_csrf"]').attr('value');
+
+ $.ajax({
+ url: '/vspace/staff/citesphere/groups',
+ type: 'GET',
+ headers: {
+ 'X-CSRF-Token': token
+ },
+ success: function(data) {
+ // Connected successfully
+ showConnectionStatus(true);
+ citesphereData.groups = data;
+ citesphereData.currentStep = 'groups';
+ showStep1Groups(data);
+ },
+ error: function(xhr, status, error) {
+ // Not connected or error
+ showConnectionStatus(false);
+ citesphereData.currentStep = 'connection';
+ }
+ });
+ }
+
+ // Show import success message
+ function showImportSuccessMessage(message) {
+ var successContainer = $('#importSuccessStatus');
+
+ successContainer.html(
+ '' +
+ ' ' + message + '' +
+ '
'
+ );
+
+ successContainer.show();
+
+ // Auto-hide after 5 seconds
+ setTimeout(function() {
+ successContainer.fadeOut();
+ }, 5000);
+ }
+
+ // Function to hide success message
+ function hideImportSuccessMessage() {
+ $('#importSuccessStatus').hide();
+ }
+
+ // Show connection status at the top
+ function showConnectionStatus(isConnected) {
+ var statusContainer = $('#connectionStatusContent');
+
+ if (isConnected) {
+ statusContainer.html(
+ '' +
+ ' Connected to Citesphere' +
+ '
'
+ );
+ } else {
+ statusContainer.html(
+ ''
+ );
+ }
+ }
+
+ // Show Step 1: Groups
+ function showStep1Groups(groupsData) {
+ $('#step1-groups').show();
+ displayCitesphereGroups(groupsData);
+ }
+
+ // Display groups in Step 1
+ function displayCitesphereGroups(groupsData) {
+ var groupsContainer = $('#citesphereGroups');
+ groupsContainer.empty();
+
+ if (!groupsData || !groupsData.data || !Array.isArray(groupsData.data)) {
+ groupsContainer.html('No groups found.
');
+ return;
+ }
+
+ groupsData.data.forEach(function(group) {
+
+ var groupElement = $('' +
+ '
' +
+ '
' +
+ '
' + (group.name || 'Unnamed Group') + '
' +
+ 'Click to view collections' +
+ '' +
+ '
' +
+ '
' +
+ '
');
+
+ // Hover effect
+ groupElement.hover(
+ function() { $(this).css('background', '#e3f2fd'); },
+ function() { $(this).css('background', '#f8f9fa'); }
+ );
+
+ groupElement.click(function() {
+ citesphereData.currentGroup = group;
+ showStep2Collections(group);
+ });
+
+ groupsContainer.append(groupElement);
+ });
+ }
+
+ // Show Step 2: Collections
+ function showStep2Collections(group) {
+ $('#step1-groups').hide();
+ $('#step2-collections').show();
+ $('#currentGroupName').text('Group: ' + (group.name || 'Unnamed Group'));
+ citesphereData.currentStep = 'collections';
+
+ // Show loading message
+ $('#citesphereCollections').html(' Loading collections...
');
+
+ // Extract group ID - try multiple possible fields
+ var groupId = group.zoteroGroupId || group.id || group.groupId || group.key;
+
+ loadGroupCollections(groupId, group.name);
+ }
+
+ // Load collections for a specific group
+ function loadGroupCollections(groupId, groupName) {
+ var token = $('input[name="_csrf"]').attr('value');
+
+ $.ajax({
+ url: '/vspace/staff/citesphere/groups/' + groupId + '/collections',
+ type: 'GET',
+ headers: {
+ 'X-CSRF-Token': token
+ },
+ success: function(data) {
+ displayCollections(data, groupId, groupName);
+ },
+ error: function(xhr, status, error) {
+ $('#citesphereCollections').html('Error loading collections: ' + error + ' (Status: ' + xhr.status + ')
');
+ }
+ });
+ }
+
+ // Display collections for a group in Step 2
+ function displayCollections(collectionsData, groupId, groupName) {
+ var collectionsContainer = $('#citesphereCollections');
+ collectionsContainer.empty();
+
+ // Handle both possible response structures: {data: []} or {collections: []}
+ var collections = collectionsData.collections || collectionsData.data || [];
+
+ if (!collections || !Array.isArray(collections) || collections.length === 0) {
+ collectionsContainer.html('No collections found in this group.
');
+ return;
+ }
+
+ collections.forEach(function(collection) {
+
+ // Extract collection name and key from different possible structures
+ var collectionName = collection.name || (collection.data && collection.data.name) || 'Unnamed Collection';
+ var collectionKey = collection.key || (collection.data && collection.data.key) || collection.id;
+
+ var collectionElement = $('' +
+ '
' +
+ '
' +
+ '
' + collectionName + '
' +
+ '
Click to view references' +
+ '
' +
+ '
' +
+ '
' +
+ '
');
+
+ // Hover effect
+ collectionElement.hover(
+ function() { $(this).css('background', '#e3f2fd'); },
+ function() { $(this).css('background', '#f8f9fa'); }
+ );
+
+ collectionElement.click(function() {
+ citesphereData.currentCollection = collection;
+ showStep3References(groupId, collectionKey, collectionName);
+ });
+
+ collectionsContainer.append(collectionElement);
+ });
+ }
+
+ // Show Step 3: References
+ function showStep3References(groupId, collectionId, collectionName) {
+ $('#step2-collections').hide();
+ $('#step3-references').show();
+ $('#currentCollectionName').text('Collection: ' + (collectionName || 'Unnamed Collection'));
+ citesphereData.currentStep = 'references';
+
+ // Show loading message
+ $('#citesphereReferences').html(' Loading references...
');
+
+ loadCollectionItems(groupId, collectionId, collectionName);
+ }
+
+ // Navigation handlers
+ $(document).on('click', '#backToGroups', function() {
+ $('#step2-collections').hide();
+ $('#step1-groups').show();
+ citesphereData.currentStep = 'groups';
+ citesphereData.currentGroup = null;
+ });
+
+ $(document).on('click', '#backToCollections', function() {
+ $('#step3-references').hide();
+ $('#step2-collections').show();
+ citesphereData.currentStep = 'collections';
+ citesphereData.currentCollection = null;
+ citesphereData.selectedReferences = [];
+ updateSelectedCount();
+ });
+
+ // Load items from a specific collection
+ function loadCollectionItems(groupId, collectionId, collectionName) {
+ var token = $('input[name="_csrf"]').attr('value');
+
+ $.ajax({
+ url: '/vspace/staff/citesphere/groups/' + groupId + '/collections/' + collectionId + '/items',
+ type: 'GET',
+ headers: {
+ 'X-CSRF-Token': token
+ },
+ success: function(data) {
+ displayIndividualItems(data, 'Items in ' + collectionName);
+ },
+ error: function(xhr, status, error) {
+ $('#citesphereReferences').html('Error loading references: ' + error + ' (Status: ' + xhr.status + ')
');
+ }
+ });
+ }
+
+ // Display individual references/items
+ function displayIndividualItems(itemsData, title) {
+ var referencesContainer = $('#citesphereReferences');
+ referencesContainer.empty();
+
+ var titleElement = $(' ' + title + '
');
+ referencesContainer.append(titleElement);
+
+ // Handle both possible response structures: {data: []} or direct array or {items: []}
+ var items = itemsData.items || itemsData.data || itemsData || [];
+
+ // If itemsData is directly an array, use it
+ if (Array.isArray(itemsData)) {
+ items = itemsData;
+ }
+
+ if (!items || !Array.isArray(items) || items.length === 0) {
+ referencesContainer.append('No items found.
');
+ return;
+ }
+
+ items.forEach(function(item, index) {
+
+ // Extract item data - try both direct properties and nested data structure
+ var itemData = item.data || item;
+
+ // Better title extraction - handle empty or missing titles
+ var title = item.title || itemData.title || item.referenceString || 'Untitled Reference';
+ if (title.trim() === '') {
+ title = 'Untitled Reference';
+ }
+
+ // Better author extraction - handle the complex authors array structure
+ var author = '';
+ if (item.authors && Array.isArray(item.authors) && item.authors.length > 0) {
+ // Take the first few authors and format them properly
+ var displayAuthors = item.authors.slice(0, 3).map(function(auth) {
+ var firstName = (auth.firstName || '').trim();
+ var lastName = (auth.lastName || '').trim();
+
+ if (firstName && lastName) {
+ return firstName + ' ' + lastName;
+ } else if (lastName) {
+ return lastName;
+ } else if (firstName) {
+ return firstName;
+ } else if (auth.name) {
+ return auth.name.trim();
+ }
+ return '';
+ }).filter(function(name) { return name !== ''; });
+
+ if (displayAuthors.length > 0) {
+ author = displayAuthors.join(', ');
+ if (item.authors.length > 3) {
+ author += ' et al.';
+ }
+ }
+ }
+
+ // Fallback to other author fields if authors array didn't work
+ if (!author) {
+ author = item.authorString || extractAuthorsFromItem(itemData) || item.author || 'Unknown Author';
+ }
+
+ // Better year extraction
+ var year = '';
+ if (item.date) {
+ var match = item.date.match(/(\d{4})/);
+ year = match ? match[1] : '';
+ }
+ if (!year && item.dateFreetext) {
+ var match = item.dateFreetext.match(/(\d{4})/);
+ year = match ? match[1] : '';
+ }
+ if (!year) {
+ year = item.year || extractYearFromItem(itemData) || '';
+ }
+
+ // Better type extraction
+ var type = 'Reference';
+ if (item.itemType) {
+ switch(item.itemType) {
+ case 'JOURNAL_ARTICLE': type = 'Journal Article'; break;
+ case 'BOOK': type = 'Book'; break;
+ case 'BOOK_SECTION': type = 'Book Section'; break;
+ case 'CONFERENCE_PAPER': type = 'Conference Paper'; break;
+ default: type = item.itemType.replace(/_/g, ' ');
+ }
+ } else if (item['@type']) {
+ type = item['@type'];
+ } else if (itemData.itemType) {
+ type = itemData.itemType;
+ }
+
+ // Use radio button instead of checkbox for single selection
+ var radioButton = $('');
+ radioButton.data('item', item);
+ radioButton.attr('value', item.key || item.id || index);
+
+ var itemElement = $('' +
+ '
' +
+ '
' +
+ '
' +
+ '
' + title + '
' +
+ '
' + author + (year ? ' (' + year + ')' : '') + '
' +
+ '
Type: ' + type + '
' +
+ '
' +
+ '
' +
+ '
');
+
+ itemElement.find('div').first().prepend(radioButton);
+
+ // Add hover effects
+ itemElement.hover(
+ function() { $(this).css('background-color', '#f8f9fa'); },
+ function() {
+ if (!radioButton.prop('checked')) {
+ $(this).css('background-color', 'white');
+ }
+ }
+ );
+
+ // Handle selection - allow clicking on the whole item div
+ itemElement.click(function(e) {
+ if (e.target.type !== 'radio') {
+ radioButton.prop('checked', true);
+ radioButton.trigger('change');
+ }
+ });
+
+ // Handle radio button selection
+ radioButton.change(function() {
+ // Clear visual selection from all items
+ $('.reference-item').css({
+ 'background-color': 'white',
+ 'border-color': '#ddd'
+ });
+
+ // Clear previous selection and set new one
+ citesphereData.selectedReferences = [];
+ if (this.checked) {
+ citesphereData.selectedReferences.push(item);
+ // Highlight selected item
+ itemElement.css({
+ 'background-color': '#e3f2fd',
+ 'border-color': '#2196f3'
+ });
+ }
+ updateSelectedCount();
+ });
+
+ referencesContainer.append(itemElement);
+ });
+ }
+
+ // Helper function to extract authors from Citesphere item
+ function extractAuthorsFromItem(itemData) {
+ // Handle different author field structures
+ if (itemData.authorString) {
+ return itemData.authorString;
+ }
+
+ if (itemData.creators && Array.isArray(itemData.creators)) {
+ var authors = itemData.creators.map(function(creator) {
+ var firstName = creator.firstName || '';
+ var lastName = creator.lastName || '';
+
+ if (lastName && firstName) {
+ return lastName + ', ' + firstName;
+ } else if (lastName) {
+ return lastName;
+ } else if (firstName) {
+ return firstName;
+ }
+ return '';
+ }).filter(Boolean);
+
+ return authors.length > 0 ? authors.join('; ') : 'Unknown Author';
+ }
+
+ return 'Unknown Author';
+ }
+
+ // Helper function to extract year from Citesphere item
+ function extractYearFromItem(itemData) {
+ // Handle different year field structures
+ if (itemData.year) {
+ return itemData.year;
+ }
+
+ var date = itemData.date || itemData.accessDate || '';
+ if (date) {
+ var match = date.match(/(\d{4})/);
+ return match ? match[1] : '';
+ }
+ return '';
+ }
+
+ // Update selected count display
+ function updateSelectedCount() {
+ var count = citesphereData.selectedReferences.length;
+ if (count === 0) {
+ $('#selectedCountText').text('No reference selected');
+ } else {
+ $('#selectedCountText').text('1 reference selected');
+ }
+ }
+
+ // Handle search functionality
+ $('#searchCitesphereBtn').click(function() {
+ var searchTerm = $('#citesphereSearch').val().trim();
+ if (searchTerm) {
+ // For now, just show an informative message since Citesphere API doesn't have search endpoint yet
+ $('#citesphereReferences').html(
+ '' +
+ '
Search Not Available
' +
+ '
Search functionality is not yet available in the Citesphere API. Please browse through your groups and collections above to find references.
' +
+ '
'
+ );
+ } else {
+ // Reload current view
+ loadCitesphereGroups();
+ }
+ });
+
+ // Allow search on Enter key
+ $('#citesphereSearch').keypress(function(e) {
+ if (e.which === 13) {
+ $('#searchCitesphereBtn').click();
+ }
+ });
+
+ // Dedicated function to handle Citesphere import
+ function handleCitesphereImport() {
+
+ if (citesphereData.selectedReferences.length === 0) {
+ alert('Please select a reference to import.');
+ return;
+ }
+
+ if (citesphereData.selectedReferences.length > 1) {
+ alert('Please select only one reference at a time.');
+ return;
+ }
+
+ // Continue with the import process
+ performCitesphereImport();
+ }
+
+ // Function to perform the actual import
+ function performCitesphereImport() {
+ var biblioId = $('#addReferenceTarget').val();
+ if (!biblioId) {
+ alert('Error: Could not determine bibliography block.');
+ return;
+ }
+
+
+ // Transform the data to match the expected backend format
+ var transformedReferences = citesphereData.selectedReferences.map(function(item) {
+
+ // Extract creators from the authors array or fallback to authorString
+ var creators = [];
+
+ if (item.authors && Array.isArray(item.authors)) {
+ creators = item.authors.map(function(author) {
+ return {
+ firstName: author.firstName || '',
+ lastName: author.lastName || author.name || '',
+ creatorType: 'author'
+ };
+ });
+ } else if (item.authorString) {
+ // Fallback to authorString parsing
+ var authors = item.authorString.split(';');
+ creators = authors.map(function(author) {
+ var trimmedAuthor = author.trim();
+ if (trimmedAuthor.includes(',')) {
+ var parts = trimmedAuthor.split(',');
+ return {
+ lastName: parts[0].trim(),
+ firstName: parts[1] ? parts[1].trim() : '',
+ creatorType: 'author'
+ };
+ } else {
+ return {
+ lastName: trimmedAuthor,
+ firstName: '',
+ creatorType: 'author'
+ };
+ }
+ });
+ }
+
+ // Extract date from various possible fields
+ var dateValue = '';
+ if (item.date) {
+ dateValue = item.date;
+ } else if (item.dateFreetext) {
+ dateValue = item.dateFreetext;
+ } else if (item.year) {
+ dateValue = item.year;
+ }
+
+ // Map itemType from Citesphere to Zotero format
+ var itemType = 'journalArticle'; // default
+ if (item.itemType) {
+ switch(item.itemType) {
+ case 'JOURNAL_ARTICLE': itemType = 'journalArticle'; break;
+ case 'BOOK': itemType = 'book'; break;
+ case 'BOOK_SECTION': itemType = 'bookSection'; break;
+ case 'CONFERENCE_PAPER': itemType = 'conferencePaper'; break;
+ default: itemType = 'journalArticle';
+ }
+ } else if (item['@type']) {
+ itemType = item['@type'];
+ }
+
+ // Create the nested data structure expected by the backend
+
+ var transformedItem = {
+ data: {
+ title: item.title || 'Untitled',
+ itemType: itemType,
+ date: dateValue,
+ publicationTitle: item.publicationTitle || item.source || '',
+ url: item.url || '',
+ volume: item.volume || '',
+ issue: item.issue || '',
+ pages: item.pages || (item.firstPage && item.endPage ? item.firstPage + '-' + item.endPage : (item.firstPage || '')),
+ DOI: item.doi || (item.identifier && item.identifierType === 'doi' ? item.identifier : ''),
+ abstractNote: item.abstractNote || '',
+ language: item.language || '',
+ ISSN: item.issn || '',
+ journalAbbreviation: item.journalAbbreviation || '',
+ series: item.series || '',
+ seriesTitle: item.seriesTitle || '',
+ archive: item.archive || '',
+ archiveLocation: item.archiveLocation || '',
+ callNumber: item.callNumber || '',
+ rights: item.rights || '',
+ shortTitle: item.shortTitle || '',
+ note: item.note || item.referenceString || '',
+ extra: 'Imported from Citesphere - Key: ' + (item.key || item.id || ''),
+ creators: creators
+ }
+ };
+
+ return transformedItem;
+ });
+
+ var moduleId = '[[${module.id}]]';
+ var slideId = '[[${slide.id}]]';
+ var token = $('input[name="_csrf"]').attr('value');
+
+
+ $.ajax({
+ url: '/vspace/staff/module/' + moduleId + '/slide/' + slideId + '/bibliography/' + biblioId + '/citesphere/import',
+ type: 'POST',
+ contentType: 'application/json',
+ headers: {
+ 'X-CSRF-Token': token
+ },
+ data: JSON.stringify(transformedReferences),
+ success: function(response) {
+
+ if (response.success) {
+ // Show success message instead of alert
+ showImportSuccessMessage('Bibliography imported successfully!');
+
+ // Add the imported references to the bibliography block
+ var biblioBlock = $('[data-biblio-id="' + biblioId + '"]').closest('[data-biblio-block]');
+ var referenceSpace = biblioBlock.find('#referenceSpace');
+
+ if (response.references && Array.isArray(response.references)) {
+ response.references.forEach(function(ref, index) {
+
+ // Use the same format as existing references in the application
+ var referenceHtml = '' +
+ '
' +
+ 'Reference Title: ' + (ref.title || 'NO TITLE') + ', ' +
+ 'Author: ' + (ref.author || 'NO AUTHOR') + ', ' +
+ 'Year: ' + (ref.year || 'NO YEAR') + ', ' +
+ 'Journal: ' + (ref.journal || 'NO JOURNAL') + ', ' +
+ 'Url: ' + (ref.url || '') + ', ' +
+ 'Volume: ' + (ref.volume || '') + ', ' +
+ 'Issue: ' + (ref.issue || '') + ', ' +
+ 'Pages: ' + (ref.pages || '') + ', ' +
+ 'Editors: ' + (ref.editors || '') + ', ' +
+ 'Type: ' + (ref.type || '') + ', ' +
+ 'Note: ' + (ref.note || '') + '' +
+ '
' +
+ '
' +
+ '
' +
+ '' +
+ '' +
+ '
';
+
+ var refElement = $(referenceHtml);
+ refElement.mouseenter(onMouseEnter).mouseleave(onMouseLeave).dblclick(referenceBlockDoubleClick);
+ referenceSpace.append(refElement);
+ });
+ }
+
+ // Reset and close modal
+ citesphereData.selectedReferences = [];
+ updateSelectedCount();
+ $('#addReferenceAlert').modal('hide');
+ } else {
+ alert('Error importing references: ' + (response.error || 'Unknown error'));
+ }
+ },
+ error: function(xhr, status, error) {
+ alert('Error importing references: ' + error + ' (Status: ' + xhr.status + ')');
+ }
+ });
+ }
+
+ // Handle importing selected reference (jQuery event handler for compatibility)
+ $('#submitCitesphereReferences').click(function() {
+ handleCitesphereImport();
+ });
+
+ // Clear Citesphere data when modal is hidden
+ $('#addReferenceAlert').on('hidden.bs.modal', function () {
+ // Reset Citesphere data
+ citesphereData.selectedReferences = [];
+ citesphereData.currentStep = 'connection';
+ citesphereData.currentGroup = null;
+ citesphereData.currentCollection = null;
+ updateSelectedCount();
+
+ // Hide success message
+ hideImportSuccessMessage();
+
+ // Clear all containers
+ $('#citesphereGroups').empty();
+ $('#citesphereCollections').empty();
+ $('#citesphereReferences').empty();
+ $('#connectionStatusContent').empty();
+
+ // Hide all steps
+ $('.citesphere-step').hide();
+ });
+
@@ -3133,145 +3904,249 @@ Add new Bibliography Block
+