mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Usability updates for MySpaces and Doclist portlets
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6249 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -506,3 +506,39 @@ function uploadCompleteHelper(id, args)
|
||||
upload.path.replace(/.*[\/\\]([^\/\\]+)/, "$1"),
|
||||
args.error != "${UPLOAD_ERROR}" ? args.error : null);
|
||||
}
|
||||
|
||||
var openWindowCallbackFn = null;
|
||||
|
||||
function openWindowCallback(url, callback)
|
||||
{
|
||||
// Store the callback function for later
|
||||
openWindowCallbackFn = callback;
|
||||
// Register our "well known" callback function
|
||||
window.alfrescoCallback = openWindowOnCallback;
|
||||
// Use a named window so that only one dialog is active at a time
|
||||
window.open(url, 'alfrescoDialog', 'width=1024,height=768');
|
||||
}
|
||||
|
||||
function openWindowOnCallback(fromTimeout)
|
||||
{
|
||||
if (typeof(fromTimeout)=='undefined')
|
||||
{
|
||||
window.setTimeout("openWindowOnCallback(true)", 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clear out the global callback function
|
||||
window.alfrescoCallback = null;
|
||||
// Try the callback function
|
||||
try
|
||||
{
|
||||
openWindowCallbackFn();
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
}
|
||||
openWindowCallbackFn = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -10,6 +10,7 @@ var MyDocs = {
|
||||
Filter: null,
|
||||
Home: null,
|
||||
Query: null,
|
||||
FxAll: null,
|
||||
|
||||
start: function()
|
||||
{
|
||||
@@ -56,10 +57,18 @@ var MyDocs = {
|
||||
// hide the ajax wait panel and show the main doc panel
|
||||
$('docPanel').setStyle('visibility', 'visible');
|
||||
$('docPanelOverlayAjax').setStyle('visibility', 'hidden');
|
||||
|
||||
if (MyDocs.postInit)
|
||||
{
|
||||
MyDocs.postInit();
|
||||
MyDocs.postInit = null;
|
||||
}
|
||||
},
|
||||
|
||||
parseDocPanels: function()
|
||||
{
|
||||
MyDocs.FxAll = [];
|
||||
|
||||
var docs = $$('#docPanel .docRow');
|
||||
var items = $$('#docPanel .docItem');
|
||||
var infos = $$('#docPanel .docInfo');
|
||||
@@ -115,6 +124,14 @@ var MyDocs = {
|
||||
}
|
||||
});
|
||||
|
||||
// Store all the effects so we can globally stop them later
|
||||
MyDocs.FxAll.push(fxItem);
|
||||
MyDocs.FxAll.push(fxDetail);
|
||||
MyDocs.FxAll.push(fxInfo);
|
||||
MyDocs.FxAll.push(fxIcon);
|
||||
MyDocs.FxAll.push(fxResource);
|
||||
MyDocs.FxAll.push(fxImage);
|
||||
|
||||
docs.each(function(doc, i)
|
||||
{
|
||||
var item = items[i],
|
||||
@@ -230,6 +247,9 @@ var MyDocs = {
|
||||
animResource = {},
|
||||
resourceHeight = resource.getStyle('height').toInt();
|
||||
|
||||
// make sure item title is highlighted
|
||||
doc.addClass('docItemSelected');
|
||||
|
||||
if (!doc.isOpen)
|
||||
{
|
||||
if (!resource.isLoaded)
|
||||
@@ -449,28 +469,6 @@ var MyDocs = {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the view filter
|
||||
*/
|
||||
filter: function(filter)
|
||||
{
|
||||
if (this.popupPanel != null) return;
|
||||
|
||||
$$('.docfilterLink').each(function(filterLink, i)
|
||||
{
|
||||
if (i == filter)
|
||||
{
|
||||
filterLink.addClass("docfilterLinkSelected");
|
||||
}
|
||||
else
|
||||
{
|
||||
filterLink.removeClass("docfilterLinkSelected");
|
||||
}
|
||||
});
|
||||
MyDocs.Filter = filter;
|
||||
MyDocs.start();
|
||||
},
|
||||
|
||||
/**
|
||||
* Delete a document item
|
||||
*/
|
||||
@@ -478,7 +476,7 @@ var MyDocs = {
|
||||
{
|
||||
if (confirm("Are you sure you want to delete: " + name))
|
||||
{
|
||||
$("docPanelOverlay").setStyle('opacity', MyDocs.OVERLAY_OPACITY);
|
||||
MyDocs.applyModal();
|
||||
|
||||
// ajax call to delete item
|
||||
YAHOO.util.Connect.asyncRequest(
|
||||
@@ -489,18 +487,18 @@ var MyDocs = {
|
||||
{
|
||||
if (response.responseText.indexOf("OK:") == 0)
|
||||
{
|
||||
MyDocs.start();
|
||||
MyDocs.refreshList();
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("Error during delete of item: " + response.responseText);
|
||||
$("docPanelOverlay").setStyle('opacity', 0);
|
||||
MyDocs.removeModal();
|
||||
}
|
||||
},
|
||||
failure: function(response)
|
||||
{
|
||||
alert("Error during delete of item: " + response.responseText);
|
||||
$("docPanelOverlay").setStyle('opacity', 0);
|
||||
MyDocs.removeModal();
|
||||
}
|
||||
},
|
||||
"noderef=" + noderef
|
||||
@@ -513,7 +511,7 @@ var MyDocs = {
|
||||
*/
|
||||
checkoutItem: function(name, noderef)
|
||||
{
|
||||
$("docPanelOverlay").setStyle('opacity', MyDocs.OVERLAY_OPACITY);
|
||||
MyDocs.applyModal();
|
||||
|
||||
// ajax call to delete item
|
||||
YAHOO.util.Connect.asyncRequest(
|
||||
@@ -524,18 +522,18 @@ var MyDocs = {
|
||||
{
|
||||
if (response.responseText.indexOf("OK:") == 0)
|
||||
{
|
||||
MyDocs.start();
|
||||
MyDocs.refreshList();
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("Error during check out of item: " + response.responseText);
|
||||
$("docPanelOverlay").setStyle('opacity', 0);
|
||||
MyDocs.removeModal();
|
||||
}
|
||||
},
|
||||
failure: function(response)
|
||||
{
|
||||
alert("Error during check out of item: " + response.responseText);
|
||||
$("docPanelOverlay").setStyle('opacity', 0);
|
||||
MyDocs.removeModal();
|
||||
}
|
||||
},
|
||||
"noderef=" + noderef
|
||||
@@ -547,7 +545,7 @@ var MyDocs = {
|
||||
*/
|
||||
checkinItem: function(name, noderef)
|
||||
{
|
||||
$("docPanelOverlay").setStyle('opacity', MyDocs.OVERLAY_OPACITY);
|
||||
MyDocs.applyModal();
|
||||
|
||||
// ajax call to delete item
|
||||
YAHOO.util.Connect.asyncRequest(
|
||||
@@ -558,18 +556,18 @@ var MyDocs = {
|
||||
{
|
||||
if (response.responseText.indexOf("OK:") == 0)
|
||||
{
|
||||
MyDocs.start();
|
||||
MyDocs.refreshList();
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("Error during check in of item: " + response.responseText);
|
||||
$("docPanelOverlay").setStyle('opacity', 0);
|
||||
MyDocs.removeModal();
|
||||
}
|
||||
},
|
||||
failure: function(response)
|
||||
{
|
||||
alert("Error during check in of item: " + response.responseText);
|
||||
$("docPanelOverlay").setStyle('opacity', 0);
|
||||
MyDocs.removeModal();
|
||||
}
|
||||
},
|
||||
"noderef=" + noderef
|
||||
@@ -643,7 +641,7 @@ var MyDocs = {
|
||||
{
|
||||
if (error == null)
|
||||
{
|
||||
MyDocs.start();
|
||||
MyDocs.refreshList();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -669,8 +667,104 @@ var MyDocs = {
|
||||
{
|
||||
this.fxOverlay.start(0);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the view filter
|
||||
*/
|
||||
filter: function(filter)
|
||||
{
|
||||
if (this.popupPanel != null) return;
|
||||
|
||||
$$('.docfilterLink').each(function(filterLink, i)
|
||||
{
|
||||
if (i == filter)
|
||||
{
|
||||
filterLink.addClass("docfilterLinkSelected");
|
||||
}
|
||||
else
|
||||
{
|
||||
filterLink.removeClass("docfilterLinkSelected");
|
||||
}
|
||||
});
|
||||
MyDocs.Filter = filter;
|
||||
MyDocs.refreshList(true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Refresh the main data list contents within the docPanel container
|
||||
*/
|
||||
refreshList: function(reopenActive)
|
||||
{
|
||||
// do we want to remember which panel was open?
|
||||
if (reopenActive)
|
||||
{
|
||||
// do we have an open panel?
|
||||
var openPanel = $E('#docPanel .docItemSelected');
|
||||
var openPanelId = null;
|
||||
if (openPanel != null)
|
||||
{
|
||||
openPanelId = openPanel.id;
|
||||
// Re-open the panel if the id still exists
|
||||
MyDocs.postInit = function()
|
||||
{
|
||||
if ($(openPanelId))
|
||||
{
|
||||
$(openPanelId).fireEvent("click");
|
||||
|
||||
// scroll the open panel into view
|
||||
var fxScroll = new Fx.Scroll($('docPanel'),
|
||||
{
|
||||
duration: MyDocs.ANIM_LENGTH,
|
||||
transition: Fx.Transitions.linear
|
||||
});
|
||||
fxScroll.toElement($(openPanelId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// empty the main panel div and restart by reloading the panel contents
|
||||
var docPanel = $('docPanel');
|
||||
docPanel.setStyle('visibility', 'hidden');
|
||||
// show the ajax wait panel
|
||||
$('docPanelOverlayAjax').setStyle('visibility', 'visible');
|
||||
|
||||
// Stop all the animation effects
|
||||
MyDocs.FxAll.each(function(fx, i)
|
||||
{
|
||||
fx.stop();
|
||||
});
|
||||
|
||||
docPanel.empty();
|
||||
docPanel.removeEvents('mouseleave');
|
||||
MyDocs.start();
|
||||
},
|
||||
|
||||
/**
|
||||
* Apply a semi-transparent modal overlay skin to the main panel area
|
||||
*/
|
||||
applyModal: function()
|
||||
{
|
||||
$("docPanelOverlay").setStyle('opacity', MyDocs.OVERLAY_OPACITY);
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove the modal overlay skin from the main panel area
|
||||
*/
|
||||
removeModal: function()
|
||||
{
|
||||
$("docPanelOverlay").setStyle('opacity', 0);
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the Edit Details dialog returns
|
||||
*/
|
||||
editDetailsCallback: function()
|
||||
{
|
||||
// Refresh the inner panel
|
||||
MyDocs.refreshList(true);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEvent('load', MyDocs.start);
|
@@ -13,6 +13,7 @@ var MySpaces = {
|
||||
ServiceContext: null,
|
||||
popupPanel: null,
|
||||
ScriptUrlEncoder: null,
|
||||
FxAll: null,
|
||||
|
||||
start: function()
|
||||
{
|
||||
@@ -77,6 +78,12 @@ var MySpaces = {
|
||||
// hide the ajax wait panel and show the main spaces panel
|
||||
$('spacePanelOverlayAjax').setStyle('visibility', 'hidden');
|
||||
$('spacePanel').setStyle('visibility', 'visible');
|
||||
|
||||
if (MySpaces.postInit)
|
||||
{
|
||||
MySpaces.postInit();
|
||||
MySpaces.postInit = null;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -85,6 +92,8 @@ var MySpaces = {
|
||||
*/
|
||||
parseSpacePanels: function()
|
||||
{
|
||||
MySpaces.FxAll = [];
|
||||
|
||||
var spaces = $$('#spacePanel .spaceRow');
|
||||
var items = $$('#spacePanel .spaceItem');
|
||||
var infos = $$('#spacePanel .spaceInfo');
|
||||
@@ -94,9 +103,13 @@ var MySpaces = {
|
||||
var imgs64 = $$('#spacePanel .spaceIconImage64');
|
||||
var resources = $$('#spacePanel .spaceResource');
|
||||
var fxItem = new Fx.Elements(items, {wait: false, duration: MySpaces.ANIM_LENGTH, transition: Fx.Transitions.linear});
|
||||
MySpaces.FxAll.push(fxItem);
|
||||
var fxDetail = new Fx.Elements(details, {wait: false, duration: MySpaces.ANIM_LENGTH, transition: Fx.Transitions.linear});
|
||||
MySpaces.FxAll.push(fxDetail);
|
||||
var fxInfo = new Fx.Elements(infos, {wait: false, duration: MySpaces.ANIM_LENGTH, transition: Fx.Transitions.linear});
|
||||
MySpaces.FxAll.push(fxInfo);
|
||||
var fxIcon = new Fx.Elements(icons, {wait: false, duration: MySpaces.ANIM_LENGTH, transition: Fx.Transitions.linear});
|
||||
MySpaces.FxAll.push(fxIcon);
|
||||
var fxResource = new Fx.Elements(resources,
|
||||
{
|
||||
wait: false,
|
||||
@@ -126,6 +139,7 @@ var MySpaces = {
|
||||
});
|
||||
}
|
||||
});
|
||||
MySpaces.FxAll.push(fxResource);
|
||||
var fxImage = new Fx.Elements(imgs,
|
||||
{
|
||||
wait: false,
|
||||
@@ -139,7 +153,8 @@ var MySpaces = {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
MySpaces.FxAll.push(fxImage);
|
||||
|
||||
spaces.each(function(space, i)
|
||||
{
|
||||
var item = items[i],
|
||||
@@ -255,6 +270,9 @@ var MySpaces = {
|
||||
animResource = {},
|
||||
resourceHeight = resource.getStyle('height').toInt();
|
||||
|
||||
// make sure item title is highlighted
|
||||
space.addClass('spaceItemSelected');
|
||||
|
||||
if (!space.isOpen)
|
||||
{
|
||||
if (!resource.isLoaded)
|
||||
@@ -295,12 +313,12 @@ var MySpaces = {
|
||||
// open up this space's resources
|
||||
// flag this space as open
|
||||
space.isOpen = true;
|
||||
|
||||
|
||||
// slide and fade in the resources panel
|
||||
animResource[i] = {
|
||||
'height': [resourceHeight, resource.defHeight + MySpaces.RESOURCE_PANEL_HEIGHT],
|
||||
'opacity': [resource.getStyle('opacity'), 1]};
|
||||
|
||||
|
||||
// close other open space and toggle this one if it's already open
|
||||
spaces.each(function(otherSpace, j)
|
||||
{
|
||||
@@ -836,19 +854,54 @@ var MySpaces = {
|
||||
}
|
||||
});
|
||||
MySpaces.Filter = filter;
|
||||
MySpaces.refreshList();
|
||||
MySpaces.refreshList(true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Refresh the main data list contents within the spacePanel container
|
||||
*/
|
||||
refreshList: function()
|
||||
refreshList: function(reopenActive)
|
||||
{
|
||||
// do we want to remember which panel was open?
|
||||
if (reopenActive)
|
||||
{
|
||||
// do we have an open panel?
|
||||
var openPanel = $E('#spacePanel .spaceItemSelected');
|
||||
var openPanelId = null;
|
||||
if (openPanel != null)
|
||||
{
|
||||
openPanelId = openPanel.id;
|
||||
// Re-open the panel if the id still exists
|
||||
MySpaces.postInit = function()
|
||||
{
|
||||
if ($(openPanelId))
|
||||
{
|
||||
$(openPanelId).fireEvent("click");
|
||||
|
||||
// scroll the open panel into view
|
||||
var fxScroll = new Fx.Scroll($('spacePanel'),
|
||||
{
|
||||
duration: MySpaces.ANIM_LENGTH,
|
||||
transition: Fx.Transitions.linear
|
||||
});
|
||||
fxScroll.toElement($(openPanelId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// empty the main panel div and restart by reloading the panel contents
|
||||
var spacePanel = $('spacePanel');
|
||||
spacePanel.setStyle('visibility', 'hidden');
|
||||
// show the ajax wait panel
|
||||
$('spacePanelOverlayAjax').setStyle('visibility', 'visible');
|
||||
|
||||
// Stop all the animation effects
|
||||
MySpaces.FxAll.each(function(fx, i)
|
||||
{
|
||||
fx.stop();
|
||||
});
|
||||
|
||||
spacePanel.empty();
|
||||
spacePanel.removeEvents('mouseleave');
|
||||
MySpaces.start();
|
||||
@@ -870,6 +923,15 @@ var MySpaces = {
|
||||
$("spacePanelOverlay").setStyle('opacity', 0);
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the Edit Details dialog returns
|
||||
*/
|
||||
editDetailsCallback: function()
|
||||
{
|
||||
// The edit details dialog window has closed
|
||||
MySpaces.refreshList(true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Display a message bubble of helpful info to the user. Calling this function in quick
|
||||
* succession will cause previous message to be lost as the new ones are displayed.
|
||||
|
Reference in New Issue
Block a user