Doclist Webscript - main document list now separate ajax panel. New PortletActionsBean to perform server-side actions from portlets. DeleteItem moved out of MySpacesBean into PortletActionsBean. TemplateNode addition of downloadUrl method for non-inline document downloads.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6044 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mike Hatfield
2007-06-20 21:23:51 +00:00
parent f7dfae61e2
commit e7eb98194c
13 changed files with 418 additions and 87 deletions

View File

@@ -5,15 +5,56 @@ var MyDocs = {
DETAIL_MARGIN: 56,
TITLE_FONT_SIZE: 18,
RESOURCE_PANEL_HEIGHT: 150,
ServiceContext: null,
Filter: null,
Home: null,
Query: null,
start: function()
{
if ($('docPanel'))
{
MyDocs.parseDocPanels();
$('docPanel').setStyle('visibility', 'visible');
// show AJAX loading overlay
$('docPanelOverlay').setStyle('visibility', 'visible');
$('docPanel').setStyle('visibility', 'hidden');
// fire off the ajax request to populate the doc list - the 'doclistpanel' webscript
// is responsible for rendering just the contents of the main panel div
YAHOO.util.Connect.asyncRequest(
"GET",
MyDocs.ServiceContext + '/doclistpanel?f='+MyDocs.Filter+'&h='+MyDocs.Home+'&q='+MyDocs.Query,
{
success: function(response)
{
// push the response into the doc panel div
$('docPanel').setHTML(response.responseText);
// extract the count value from a hidden div and display it
$('docCount').setHTML($('docCountValue').innerHTML);
// wire up all the events and animations
MyDocs.init();
},
failure: function(response)
{
// display the error
$('docPanel').setHTML("Sorry, data currently unavailable.");
// hide the ajax wait panel and show the main doc panel
$('docPanelOverlay').setStyle('visibility', 'hidden');
$('docPanel').setStyle('visibility', 'visible');
}
}
);
}
},
init: function()
{
MyDocs.parseDocPanels();
// hide the ajax wait panel and show the main doc panel
$('docPanel').setStyle('visibility', 'visible');
$('docPanelOverlay').setStyle('visibility', 'hidden');
},
parseDocPanels: function()
{
@@ -404,6 +445,119 @@ var MyDocs = {
fxInfo.start(animInfo);
fxImage.start(animImage);
});
},
/**
* Update the view filter
*/
filter: function(filter)
{
$$('.docfilterLink').each(function(filterLink, i)
{
if (i == filter)
{
filterLink.addClass("docfilterLinkSelected");
}
else
{
filterLink.removeClass("docfilterLinkSelected");
}
});
MyDocs.Filter = filter;
MyDocs.start();
},
/**
* Delete a document item
*/
deleteItem: function(name, noderef)
{
if (confirm("Are you sure you want to delete: " + name))
{
// ajax call to delete item
YAHOO.util.Connect.asyncRequest(
"POST",
getContextPath() + '/ajax/invoke/PortletActionsBean.deleteItem',
{
success: function(response)
{
if (response.responseText.indexOf("OK:") == 0)
{
MyDocs.start();
}
else
{
alert("Error during delete of item: " + response.responseText);
}
},
failure: function(response)
{
alert("Error during delete of item: " + response.responseText);
}
},
"noderef=" + noderef
);
}
},
/**
* Check Out a document item
*/
checkoutItem: function(name, noderef)
{
// ajax call to delete item
YAHOO.util.Connect.asyncRequest(
"POST",
getContextPath() + '/ajax/invoke/PortletActionsBean.checkoutItem',
{
success: function(response)
{
if (response.responseText.indexOf("OK:") == 0)
{
MyDocs.start();
}
else
{
alert("Error during check out of item: " + response.responseText);
}
},
failure: function(response)
{
alert("Error during check out of item: " + response.responseText);
}
},
"noderef=" + noderef
);
},
/**
* Check In a document item
*/
checkinItem: function(name, noderef)
{
// ajax call to delete item
YAHOO.util.Connect.asyncRequest(
"POST",
getContextPath() + '/ajax/invoke/PortletActionsBean.checkinItem',
{
success: function(response)
{
if (response.responseText.indexOf("OK:") == 0)
{
MyDocs.start();
}
else
{
alert("Error during check in of item: " + response.responseText);
}
},
failure: function(response)
{
alert("Error during check in of item: " + response.responseText);
}
},
"noderef=" + noderef
);
}
};

View File

@@ -17,6 +17,9 @@ var MySpaces = {
{
if ($('spacePanel'))
{
// show AJAX loading overlay
$('spacePanelOverlay').setStyle('visibility', 'visible');
$('spacePanel').setStyle('visibility', 'hidden');
// fire off the ajax request to populate the spaces list - the 'myspacespanel' webscript
// is responsible for rendering just the contents of the main panel div
YAHOO.util.Connect.asyncRequest(
@@ -613,10 +616,10 @@ var MySpaces = {
{
if (confirm("Are you sure you want to delete: " + name))
{
// ajax call to create space
// ajax call to delete item
YAHOO.util.Connect.asyncRequest(
"POST",
getContextPath() + '/ajax/invoke/MySpacesBean.deleteItem',
getContextPath() + '/ajax/invoke/PortletActionsBean.deleteItem',
{
success: function(response)
{