[LON-CAPA-cvs] cvs: loncom /interface londocs.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 30 Jun 2006 03:44:06 -0000


albertel		Thu Jun 29 23:44:06 2006 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - Need to esacpe the title might have special chracters (BUG#4886)
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.235 loncom/interface/londocs.pm:1.236
--- loncom/interface/londocs.pm:1.235	Thu Jun 29 20:59:00 2006
+++ loncom/interface/londocs.pm	Thu Jun 29 23:44:03 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.235 2006/06/30 00:59:00 albertel Exp $
+# $Id: londocs.pm,v 1.236 2006/06/30 03:44:03 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1175,6 +1175,7 @@
 # Group import/search
 	    if ($env{'form.importdetail'}) {
 		my @imports;
+		&Apache::lonnet::logthis("imp detail ".$env{'form.importdetail'});
 		foreach (split(/\&/,$env{'form.importdetail'})) {
 		    if (defined($_)) {
 			my ($name,$url)=split(/\=/,$_);
@@ -2726,7 +2727,7 @@
 function makenewfolder(targetform,folderseq) {
     var foldername=prompt('Name of New Folder','New Folder');
     if (foldername) {
-       targetform.importdetail.value=foldername+"="+folderseq;
+       targetform.importdetail.value=escape(foldername)+"="+folderseq;
         targetform.submit();
     }
 }
@@ -2734,7 +2735,7 @@
 function makenewpage(targetform,folderseq) {
     var pagename=prompt('Name of New Page','New Page');
     if (pagename) {
-        targetform.importdetail.value=pagename+"="+folderseq;
+        targetform.importdetail.value=escape(pagename)+"="+folderseq;
         targetform.submit();
     }
 }
@@ -2748,7 +2749,7 @@
    var title=prompt('Listed Title for the Uploaded Score');
    if (title) { 
     this.document.forms.newexamupload.importdetail.value=
-	title+'=/res/lib/templates/examupload.problem';
+	escape(title)+'=/res/lib/templates/examupload.problem';
     this.document.forms.newexamupload.submit();
    }
 }
@@ -2757,7 +2758,7 @@
    var title=prompt('Listed Title for the Page');
    if (title) { 
     this.document.forms.newsmppg.importdetail.value=
-	title+'=/adm/$udom/$uname/$now/smppg';
+	escape(title)+'=/adm/$udom/$uname/$now/smppg';
     this.document.forms.newsmppg.submit();
    }
 }
@@ -2766,7 +2767,7 @@
    var title=prompt('Listed Title for the Problem');
    if (title) { 
     this.document.forms.newsmpproblem.importdetail.value=
-	title+'=/res/lib/templates/simpleproblem.problem';
+	escape(title)+'=/res/lib/templates/simpleproblem.problem';
     this.document.forms.newsmpproblem.submit();
    }
 }
@@ -2775,7 +2776,7 @@
    var title=prompt('Listed Title for the Drop Box');
    if (title) { 
     this.document.forms.newdropbox.importdetail.value=
-        title+'=/res/lib/templates/DropBox.problem';
+        escape(title)+'=/res/lib/templates/DropBox.problem';
     this.document.forms.newdropbox.submit();
    }
 }
@@ -2784,26 +2785,26 @@
    var title=prompt('Listed Title for the Bulletin Board');
    if (title) {
     this.document.forms.newbul.importdetail.value=
-	title+'=/adm/$udom/$uname/$now/bulletinboard';
+	escape(title)+'=/adm/$udom/$uname/$now/bulletinboard';
     this.document.forms.newbul.submit();
    }
 }
 
 function makeabout() {
-   var user=prompt("Enter user\@domain for User's 'About Me' Page");
+   var user=prompt("Enter user:domain for User's 'About Me' Page");
    if (user) {
        var comp=new Array();
-       comp=user.split('\@');
+       comp=user.split(':');
        if ((typeof(comp[0])!=undefined) && (typeof(comp[1])!=undefined)) {
 	   if ((comp[0]) && (comp[1])) {
 	       this.document.forms.newaboutsomeone.importdetail.value=
-		   'About '+user+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';
+		   'About '+escape(user)+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';
 	       this.document.forms.newaboutsomeone.submit();
 	   } else {
-               alert("Not a valid user\@domain");
+               alert("Not a valid user:domain");
            }
        } else {
-           alert("Please enter both user and domain in the format user\@domain"); 
+           alert("Please enter both user and domain in the format user:domain"); 
        }
    }
 }