./iSyl0228/ 000755 000000 000024 00000000000 12113677663 012567 5 ustar 00root staff 000000 000000 ./iSyl0228/assignment.patch 000644 000000 000024 00000001612 12113677664 015761 0 ustar 00root staff 000000 000000 Index: assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/BaseAssignmentService.java
===================================================================
--- assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/BaseAssignmentService.java (revision 120509)
+++ assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/BaseAssignmentService.java (working copy)
@@ -13319,9 +13319,7 @@
{
String msgBody = assignment.getContent().getInstructions();
StringBuffer msgBodyPreMigrate = new StringBuffer(msgBody);
- msgBody = LinkMigrationHelper.editLinks(msgBody, "sam_pub");
- msgBody = LinkMigrationHelper.editLinks(msgBody, "/posts/");
- msgBody = LinkMigrationHelper.miagrateAllLinks(entrySet, msgBody);
+ msgBody = LinkMigrationHelper.migrateAllLinks(entrySet, msgBody);
try
{
if(!msgBody.equals(msgBodyPreMigrate.toString())){
./iSyl0228/calendar.patch 000644 000000 000024 00000001644 12113677545 015365 0 ustar 00root staff 000000 000000 Index: calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/BaseCalendarService.java
===================================================================
--- calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/BaseCalendarService.java (revision 120504)
+++ calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/BaseCalendarService.java (working copy)
@@ -2302,9 +2302,7 @@
}
*/
StringBuffer msgBodyPreMigrate = new StringBuffer(msgBodyFormatted);
- msgBodyFormatted = LinkMigrationHelper.editLinks(msgBodyFormatted, "sam_pub");
- msgBodyFormatted = LinkMigrationHelper.editLinks(msgBodyFormatted, "/posts/");
- msgBodyFormatted = LinkMigrationHelper.miagrateAllLinks(entrySet, msgBodyFormatted);
+ msgBodyFormatted = LinkMigrationHelper.migrateAllLinks(entrySet, msgBodyFormatted);
if(!msgBodyFormatted.equals(msgBodyPreMigrate.toString())){
// if(updated){
./iSyl0228/kernel.patch 000644 000000 000024 00000021346 12113677514 015071 0 ustar 00root staff 000000 000000 Index: kernel-impl/src/main/java/org/sakaiproject/content/impl/BaseContentService.java
===================================================================
--- kernel-impl/src/main/java/org/sakaiproject/content/impl/BaseContentService.java (revision 120502)
+++ kernel-impl/src/main/java/org/sakaiproject/content/impl/BaseContentService.java (working copy)
@@ -7467,35 +7467,16 @@
newValue = (String) transversalMap.get(oldValue);
targetId = (String) transversalMap.get(oldValue);
if(newValue.length()>0){
- try {
- rContent = LinkMigrationHelper.editLinks(rContent, "sam_pub");
- rContent = LinkMigrationHelper.editLinks(rContent, "/posts/");
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-/*
- oldValue = oldValue.replace(" ",ESCAPED_SPACE);
- newValue = newValue.replace(" ",ESCAPED_SPACE);
- rContent = rContent.replaceAll(oldValue, newValue);
-*/
- rContent = LinkMigrationHelper.miagrateOneLink(oldValue, newValue, rContent);
-
-/*
- if(!saveOldEntity.toString().equals(rContent)){
- contentChanged=true;
- }
-*/
+ rContent = LinkMigrationHelper.migrateOneLink(oldValue, newValue, rContent);
}
}
}
try {
- rContent = LinkMigrationHelper.bracketLinks(rContent, "assignment");
- rContent = LinkMigrationHelper.bracketLinks(rContent, "forum");
+ rContent = LinkMigrationHelper.bracketAndNullifySelectedLinks(rContent);
} catch (Exception e) {
// TODO Auto-generated catch block
M_log.debug ("Forums LinkMigrationHelper.editLinks failed" + e);
- }
+ }
try {
if(!saveOldEntity.toString().equals(rContent)){
ContentResourceEdit edit = editResource(tId);
Index: kernel-component/src/main/webapp/WEB-INF/util-components.xml
===================================================================
--- kernel-component/src/main/webapp/WEB-INF/util-components.xml (revision 120502)
+++ kernel-component/src/main/webapp/WEB-INF/util-components.xml (working copy)
@@ -82,4 +82,9 @@
+
+
+
Index: api/src/main/java/org/sakaiproject/util/LinkMigrationHelper.java
===================================================================
--- api/src/main/java/org/sakaiproject/util/LinkMigrationHelper.java (revision 120502)
+++ api/src/main/java/org/sakaiproject/util/LinkMigrationHelper.java (working copy)
@@ -5,148 +5,44 @@
import java.util.Set;
import java.util.Vector;
import java.util.Map.Entry;
+
+import org.sakaiproject.component.cover.ComponentManager;
+import org.sakaiproject.component.cover.ServerConfigurationService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
public class LinkMigrationHelper {
- private final static String ESCAPED_SPACE= "%"+"20";
- private final static String ASSIGNMENT_LINK_SIG = "assignment";
- private final static String FORUM_LINK_SIG = "forum";
+
+ private static org.sakaiproject.util.api.LinkMigrationHelper thisLinkMigrationHelper=null;
private static final Log LOG = LogFactory.getLog(LinkMigrationHelper.class);
-
- public static String editLinks(String m, String linksToEdit) throws Exception {
-// String m = msg.toLowerCase();
- List existingLinks = findLinks(m);
- Iterator l = existingLinks.iterator();
- while(l.hasNext()){
- String nextLink = (String) l.next();
- if(nextLink.indexOf(linksToEdit)>=0){
- String replacementForLink = findLinkContent(nextLink);
- int li = m.indexOf(nextLink);
- String before = m.substring(0, li);
- String after = m.substring(li+nextLink.length());
- StringBuffer replacementBuffer = new StringBuffer();
- replacementBuffer.append(before);
- replacementBuffer.append(" [");
- replacementBuffer.append(replacementForLink);
- replacementBuffer.append("] ");
- replacementBuffer.append(after);
- m=replacementBuffer.toString();
- }
+
+ private static org.sakaiproject.util.api.LinkMigrationHelper getLinkMigrationHelper(){
+ if(thisLinkMigrationHelper==null){
+ thisLinkMigrationHelper = (org.sakaiproject.util.api.LinkMigrationHelper) ComponentManager.get(org.sakaiproject.util.api.LinkMigrationHelper.class);
}
- return m;
+ return thisLinkMigrationHelper;
}
- public static String bracketLinks(String m, String linksToEdit) throws Exception {
-// String m = msg.toLowerCase();
- List existingLinks = findLinks(m);
- Iterator l = existingLinks.iterator();
- while(l.hasNext()){
- String nextLink = (String) l.next();
- if(nextLink.indexOf(linksToEdit)>=0){
- String replacementForLink = nextLink;
- int li = m.indexOf(nextLink);
- String before = m.substring(0, li);
- String after = m.substring(li+nextLink.length());
- StringBuffer replacementBuffer = new StringBuffer();
- replacementBuffer.append(before);
- replacementBuffer.append(" [");
- replacementBuffer.append(replacementForLink);
- replacementBuffer.append("] ");
- replacementBuffer.append(after);
- m=replacementBuffer.toString();
- }
- }
- return m;
- }
-
- public static String miagrateAllLinks(Set entrySet, String msgBody){
- Iterator> entryItr = entrySet.iterator();
- while(entryItr.hasNext()) {
- Entry entry = (Entry) entryItr.next();
-// String fromContextRef = entry.getKey().toLowerCase();
-// String targetContextRef = entry.getValue().toLowerCase();
- String fromContextRef = entry.getKey();
- String targetContextRef = entry.getValue();
-/*
- fromContextRef=fromContextRef.replace(" ",ESCAPED_SPACE);
- targetContextRef = targetContextRef.replace(" ",ESCAPED_SPACE);
-// logger.debug("fromContextRef:"+fromContextRef+"="+entry.getValue());
-// logger.debug("entry.getValue="+entry.getValue());
- if(msgBody.contains(fromContextRef)){
-// logger.debug("found a match");
- msgBody = msgBody.replace(fromContextRef, targetContextRef);
- }
-*/
- msgBody = LinkMigrationHelper.miagrateOneLink(fromContextRef, targetContextRef, msgBody);
- }
- try {
- msgBody = bracketLinks(msgBody, "assignment");
- msgBody = bracketLinks(msgBody, "forum");
- } catch (Exception e) {
- // TODO Auto-generated catch block
- LOG.debug ("Forums LinkMigrationHelper.editLinks failed" + e);
- }
+ public static String bracketAndNullifySelectedLinks(String m) throws Exception {
-
- return msgBody;
+ return getLinkMigrationHelper().bracketAndNullifySelectedLinks(m);
}
- public static String miagrateOneLink(String fromContextRef, String targetContextRef, String msgBody){
-
-
- fromContextRef=fromContextRef.replace(" ",ESCAPED_SPACE);
- targetContextRef = targetContextRef.replace(" ",ESCAPED_SPACE);
-// logger.debug("fromContextRef:"+fromContextRef+"="+entry.getValue());
-// logger.debug("entry.getValue="+entry.getValue());
- if(msgBody.contains(fromContextRef)){
-// logger.debug("found a match");
- msgBody = msgBody.replace(fromContextRef, targetContextRef);
- }
- return msgBody;
+
+ public static String migrateAllLinks(Set entrySet, String msgBody){
+ return getLinkMigrationHelper().migrateAllLinks(entrySet, msgBody);
}
- public static List findLinks(String msgBody) throws Exception {
+ public static String migrateOneLink(String fromContextRef, String targetContextRef, String msgBody){
- Vector links = new Vector();
- int nextLinkAt = 0;
- nextLinkAt = msgBody.indexOf("", nextLinkAt);
- if(closingTagLocation<0){
- throw new Exception("unbalanced anchor tag");
- }else{
- String thisAnchor = msgBody.substring(nextLinkAt, closingTagLocation+4);
- links.add(thisAnchor);
- }
- nextLinkAt = msgBody.indexOf("");
- int contentEnd = link.indexOf("", contentStart);
- return link.substring(contentStart+1, contentEnd);
- }
-
- public static String findLinkEntire(String link) throws Exception {
- int contentStart = link.indexOf("<");
- int contentEnd = link.indexOf("", contentStart);
- return link.substring(contentStart+1, contentEnd);
- }
}
./iSyl0228/lessonbuilder.patch 000644 000000 000024 00000011452 12113677636 016465 0 ustar 00root staff 000000 000000 Index: pom.xml
===================================================================
--- pom.xml (revision 120506)
+++ pom.xml (working copy)
@@ -5,8 +5,8 @@
org.sakaiproject
master
- 2.9.0-b02
-
+
+ 2.10-SNAPSHOT
../master/pom.xml
Index: tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonBuilderEntityProducer.java
===================================================================
--- tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonBuilderEntityProducer.java (revision 120506)
+++ tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonBuilderEntityProducer.java (working copy)
@@ -99,6 +99,7 @@
import org.sakaiproject.tool.api.ToolManager;
import org.sakaiproject.entity.api.ResourceProperties;
import org.sakaiproject.entity.api.ResourcePropertiesEdit;
+import org.sakaiproject.exception.IdUnusedException;
import org.sakaiproject.util.ResourceLoader;
import org.sakaiproject.util.Xml;
import uk.org.ponder.messageutil.MessageLocator;
@@ -109,6 +110,7 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.springframework.context.MessageSource;
+import org.sakaiproject.util.LinkMigrationHelper;
/**
* @author hedrick
@@ -1254,6 +1256,7 @@
// this is mapping from LB item id to underlying object in old site.
// find the object in the new site and fix up the item id
public void updateEntityReferences(String toContext, Map transversalMap) {
+ migrateEmbeddedLinks(toContext, transversalMap);
for (Map.Entry entry: transversalMap.entrySet()) {
String entityid = entry.getKey();
String objectid = entry.getValue();
@@ -1287,7 +1290,62 @@
}
}
}
+
+ private void migrateEmbeddedLinks(String toContext, Map transversalMap){
+ Set entrySet = (Set) transversalMap.entrySet();
+ Site toSite;
+ try {
+ toSite = siteService.getSite(toContext);
+ } catch (IdUnusedException e) {
+ logger.warn("bad site Id in lessonbuilder link migration:"+toContext);
+ return;
+ }
+ List thisSitePages = simplePageToolDao.getSitePages(toContext);
+ logger.info("LessonBuilderEntityProducer - number of pages"+String.valueOf(thisSitePages.size()));
+ Iterator thisSitePagesIterator = thisSitePages.iterator();
+ while(thisSitePagesIterator.hasNext()){
+ SimplePage thisSimplePage = (SimplePage) thisSitePagesIterator.next();
+ String thisSimplePageSitePageId = thisSimplePage.getToolId();
+ SitePage thisLessonBuilderSitePage = toSite.getPage(thisSimplePageSitePageId);
+ if(thisLessonBuilderSitePage!=null){
+ logger.info("Found active LB Page:"+thisSimplePage.getPageId());
+ updateLbPage(thisSimplePage.getPageId(), entrySet);
+ }else if(thisSimplePage.getToolId().equals("0") && thisSimplePage.getTopParent()==0 && thisSimplePage.getParent()==0 && thisSimplePage.getSiteId().equals(toContext)){
+ logger.info("Found a sub Page:"+thisSimplePage.getPageId());
+ updateLbPage(thisSimplePage.getPageId(), entrySet);
+ }
+ }
+ }
+
+ private void updateLbPage(long simplePageId, Set entrySet){
+
+ List pageItemList = simplePageToolDao.findItemsOnPage(simplePageId);
+ Iterator pageItemIterator = pageItemList.iterator();
+ while(pageItemIterator.hasNext()){
+ SimplePageItem thisSimplePageItem = (SimplePageItem) pageItemIterator.next();
+ logger.info("LessonBuilderEntityProducer - SimplePageItem - type:"+String.valueOf(thisSimplePageItem.getType()));
+ if(thisSimplePageItem.getHtml()!=null){
+ logger.info("LessonBuilderEntityProducer - html:"+thisSimplePageItem.getHtml());
+ String msgBody = thisSimplePageItem.getHtml();
+ try {
+ msgBody = LinkMigrationHelper.migrateAllLinks(entrySet, msgBody);
+ thisSimplePageItem.setHtml(msgBody);
+ logger.info("html - (post mod):"+msgBody);
+ simplePageToolDao.deleteItem(thisSimplePageItem);
+ simplePageToolDao.quickSaveItem(thisSimplePageItem);
+ logger.info("saving SimplePageItem:"+thisSimplePageItem.getId());
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ logger.warn("Problem migrating links in Lessonbuilder"+e.getMessage());
+ }
+
+ }
+// logger.info("LessonBuilderEntityProducer - SimplePageItem - url:"+thisSimplePageItem.getURL());
+ }
+ }
+
+
// called from tool, to fix up all dummy references in site toContext if possible
public void updateEntityReferences(String toContext) {
List dummyItems = simplePageToolDao.findDummyItemsInSite(toContext);
./iSyl0228/msgcntr.patch 000644 000000 000024 00000001766 12113677613 015272 0 ustar 00root staff 000000 000000 Index: messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DiscussionForumServiceImpl.java
===================================================================
--- messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DiscussionForumServiceImpl.java (revision 120505)
+++ messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DiscussionForumServiceImpl.java (working copy)
@@ -1350,13 +1350,7 @@
private String replaceAllRefs(String msgBody, Set> entrySet){
if(msgBody != null){
- try {
- msgBody = LinkMigrationHelper.editLinks(msgBody, "sam_pub");
- msgBody = LinkMigrationHelper.editLinks(msgBody, "/posts/");
- } catch (Exception e) {
- LOG.debug ("Forums LinkMigrationHelper.editLinks failed" + e);
- }
- msgBody = LinkMigrationHelper.miagrateAllLinks(entrySet, msgBody);
+ msgBody = LinkMigrationHelper.migrateAllLinks(entrySet, msgBody);
}
return msgBody;
}
./iSyl0228/samigo.patch 000644 000000 000024 00000002266 12113677440 015066 0 ustar 00root staff 000000 000000 Index: samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/AssessmentEntityProducer.java
===================================================================
--- samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/AssessmentEntityProducer.java (revision 120500)
+++ samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/AssessmentEntityProducer.java (working copy)
@@ -217,15 +217,7 @@
ItemText itemText = (ItemText) itemTextList.get(k);
String text = itemText.getText();
if(text != null){
- try {
- text = LinkMigrationHelper.editLinks(text, "sam_pub");
- text = LinkMigrationHelper.editLinks(text, "/posts/");
- } catch (Exception e) {
- // TODO Auto-generated catch block
- log.debug("link neuterer failed");
- }
- text = LinkMigrationHelper.miagrateAllLinks(entrySet, text);
-// text = replaceAllRefs(text, entrySet);
+ text = LinkMigrationHelper.migrateAllLinks(entrySet, text);
if(!text.equals(itemText.getText())){
//need to save since a ref has been updated:
needToUpdate = true;
./iSyl0228/syllabus.patch 000644 000000 000024 00000002664 12113677466 015457 0 ustar 00root staff 000000 000000 Index: syllabus-impl/src/java/org/sakaiproject/component/app/syllabus/SyllabusServiceImpl.java
===================================================================
--- syllabus-impl/src/java/org/sakaiproject/component/app/syllabus/SyllabusServiceImpl.java (revision 120501)
+++ syllabus-impl/src/java/org/sakaiproject/component/app/syllabus/SyllabusServiceImpl.java (working copy)
@@ -1401,23 +1401,8 @@
String msgBody = fromSyllabusData.getAsset();
StringBuffer msgBodyPreMigrate = new StringBuffer(msgBody);
boolean updated = false;
-/*
- Iterator> entryItr = entrySet.iterator();
- while(entryItr.hasNext()) {
- Entry entry = (Entry) entryItr.next();
- String fromContextRef = entry.getKey();
- if(msgBody.contains(fromContextRef)){
- msgBody = msgBody.replace(fromContextRef, entry.getValue());
- updated = true;
- }
- }
-*/
- msgBody = LinkMigrationHelper.editLinks(msgBody, "sam_pub");
- msgBody = LinkMigrationHelper.editLinks(msgBody, "/posts/");
- msgBody = LinkMigrationHelper.miagrateAllLinks(entrySet, msgBody);
+ msgBody = LinkMigrationHelper.migrateAllLinks(entrySet, msgBody);
if(!msgBody.equals(msgBodyPreMigrate.toString())){
-
-// if(updated){
fromSyllabusData.setAsset(msgBody);
syllabusManager.saveSyllabus(fromSyllabusData);
}