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

raeburn raeburn at source.lon-capa.org
Sun Mar 10 22:04:36 EDT 2013


raeburn		Mon Mar 11 02:04:36 2013 EDT

  Modified files:              
    /loncom/interface	lonsimplepage.pm 
  Log:
  - &get_db_name() takes additional args: $url,$marker,$cdom,$cnum
    when called in londocs::dbcopy() when copying simplepage in Course Editor.
  
  
Index: loncom/interface/lonsimplepage.pm
diff -u loncom/interface/lonsimplepage.pm:1.101 loncom/interface/lonsimplepage.pm:1.102
--- loncom/interface/lonsimplepage.pm:1.101	Fri Dec  7 17:15:56 2012
+++ loncom/interface/lonsimplepage.pm	Mon Mar 11 02:04:36 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Page Editor
 #
-# $Id: lonsimplepage.pm,v 1.101 2012/12/07 17:15:56 raeburn Exp $
+# $Id: lonsimplepage.pm,v 1.102 2013/03/11 02:04:36 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -44,14 +44,18 @@
 use LONCAPA;
 
 sub get_db_name {
-    my ($url) = @_;
-    my ($udom,$uname,$marker)=(split(m{/},$url))[2,3,4];
-    my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
-    my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
-
+    my ($url,$marker,$cdom,$cnum) = @_;
+    my ($udom,$uname,$timemark)=(split(m{/},$url))[2,3,4];
+    if ($marker eq '') {
+        $marker = $timemark;
+    }
+    if (($cdom eq '') || ($cnum eq '')) {
+        $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+        $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+    }
     my $db_name;
 
-    if ($dom && $crs && ($udom eq $dom) && ($uname eq $crs)) {
+    if ($cdom && $cnum && ($udom eq $cdom) && ($uname eq $cnum)) {
         $marker =~ s/\W//g;
         $db_name = 'grppage_'.$marker;
     } else {
@@ -59,7 +63,6 @@
         $db_name = 'smppage_'.$marker;
     }
     return if (!defined($marker));
-
     return $db_name;
 }
 
@@ -84,7 +87,8 @@
         return OK;
     }
 
-    my $db_name = &get_db_name($r->uri);
+    my $marker = (split(m{/},$r->uri))[4];
+    my $db_name = &get_db_name($r->uri,$marker);
 
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
@@ -93,7 +97,7 @@
     my %curr_group = ();
     my %groupinfo = ();
     if ($db_name =~ /^grppage_/) {
-        $group = (split(m{/},$r->uri))[4];
+        $group = $marker;
         $group =~ s/\W//g;
         my %curr_groups = &Apache::longroup::coursegroups($dom,$crs,$group);
         if (!%curr_groups) {
@@ -233,10 +237,12 @@
             }
             if ($group ne '') {
                 $syllabus{'uploaded.photourl'}=&Apache::lonnet::userfileupload(
-                                              'uploaddoc','coursedoc',"grouppage/$group");
+                                              'uploaddoc','coursedoc',
+                                              "grouppage/$group");
             } else {
                 $syllabus{'uploaded.photourl'}=
-                &Apache::lonnet::userfileupload('uploaddoc','coursedoc','simplepage');
+                &Apache::lonnet::userfileupload('uploaddoc','coursedoc',
+                                                "simplepage/$marker");
             }
         }
         $syllabus{'uploaded.lastmodified'}=time;




More information about the LON-CAPA-cvs mailing list