Skip to content

Commit

Permalink
SAK-12433 - Import/Add ability to delete existing content prior to im…
Browse files Browse the repository at this point in the history
…porting new content to support import for gradebook.

git-svn-id: https://source.sakaiproject.org/svn/web/trunk@39226 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
Tan Nguyen committed Dec 13, 2007
1 parent 7ea394c commit c9c8a1a
Showing 1 changed file with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -465,5 +465,52 @@ public Collection getEntityAuthzGroups(Reference ref, String userId)
return null;
}

public void transferCopyEntities(String fromContext, String toContext, List ids, boolean cleanup)
{
try
{
if(cleanup == true)
{
Site toSite = SiteService.getSite(toContext);

List toSitePages = toSite.getPages();
if (toSitePages != null && !toSitePages.isEmpty()) {
Iterator pageIter = toSitePages.iterator();
while (pageIter.hasNext()) {
SitePage currPage = (SitePage) pageIter.next();

List toolList = currPage.getTools();
Iterator toolIter = toolList.iterator();
while (toolIter.hasNext()) {
ToolConfiguration toolConfig = (ToolConfiguration)toolIter.next();

// we do not want to import "special" uses of sakai.iframe, such as worksite info
String special = toolConfig.getPlacementConfig().getProperty(SPECIAL_PROP);

if (toolConfig.getToolId().equals(TOOL_ID) && special == null) {

toolConfig.getPlacementConfig().setProperty(WEB_CONTENT_URL_PROP, null);
toolConfig.setTitle(null);
currPage.setTitle(null);
toolConfig.getPlacementConfig().setProperty(HEIGHT_PROP, null);
}
}
}
SiteService.save(toSite);
ToolSession session = SessionManager.getCurrentToolSession();

if (session.getAttribute(ATTR_TOP_REFRESH) == null)
{
session.setAttribute(ATTR_TOP_REFRESH, Boolean.TRUE);
}
}
}
transferCopyEntities(fromContext, toContext, ids);
}
catch (Exception e)
{
M_log.info("WebContent transferCopyEntities Error" + e);
}
}

}

0 comments on commit c9c8a1a

Please sign in to comment.