[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm structuretags.pm /interface loncommon.pm /publisher lonpubdir.pm

bisitz bisitz@source.lon-capa.org
Tue, 19 May 2009 22:52:30 -0000


This is a MIME encoded message

--bisitz1242773550
Content-Type: text/plain

bisitz		Tue May 19 22:52:30 2009 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
    /loncom/homework	lonhomework.pm structuretags.pm 
    /loncom/publisher	lonpubdir.pm 
  Log:
  To get rid of the title_bar, customized titles aren't allowed anymore.
  
  Moved special title for Construction Space pages from &start_page() to new routine &CSTR_pageheader(). Since &start_page() isn't the only routine called to create the page header, the centralized creation of the CSTR page header code can't be currently called in &start_page(). This needs to be done at each place where &start_page() is called.
  
  First changes to get rid of customized page titles:
  - Moved CSTR page header code from start_page to new sub routine &CSTR_pageheader()
  - Currently keep old header but use &CSTR_pageheader()
  - Directly call &CSTR_pageheader() in CSTR related scripts (lonpubdir.pm, lonhomework.pm, structuretags.pm)
    (More scripts need to call this routine)
  - Added new sub routine &head_subbox() to create head_subbox which contains page related links and functions, etc.
  - Added styles for &head_subbox()
    (Currently implemented as LC_head_subbox2 to avoid conflicts with code created by lonhtmlcommon::breadcrumbs - will be changed)
  
  Other but related changes:
  - Added some breadcrumbs to CSTR
    (Only basic calls - links and structure has to be added/revisited)
  - Adjusted styles used for breadcrumbs:
      - Replaced hardcoded border color by dynamical standard border color
      - Removed margin to allow direct concatination with head_subbox
  
  - Added some FIXME comments to mark work in progress
  
  
--bisitz1242773550
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20090519225230.txt"

Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.821 loncom/interface/loncommon.pm:1.822
--- loncom/interface/loncommon.pm:1.821	Mon May 18 16:29:55 2009
+++ loncom/interface/loncommon.pm	Tue May 19 22:52:10 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.821 2009/05/18 16:29:55 raeburn Exp $
+# $Id: loncommon.pm,v 1.822 2009/05/19 22:52:10 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4168,6 +4168,68 @@
     return $output;
 }
 
+##############################################
+=pod
+
+=item * &head_subbox()
+
+Inputs: $content (contains HTML code with page functions, etc.)
+
+Returns: HTML div with $content
+         To be included in page header
+
+=cut
+
+sub head_subbox {
+    my ($content)=@_;
+    my $output =
+        '<div id="LC_head_subbox2">' #FIXME: solve conflicts with lonhtmlcommon:breadcrumbs LC_head_subbox
+       .$content
+       .'</div>'
+}
+
+##############################################
+=pod
+
+=item * &CSTR_pageheader()
+
+Inputs: ./.
+
+Returns: HTML div with CSTR path and recent box
+         To be included on Construction Space pages
+
+=cut
+
+sub CSTR_pageheader {
+    # this is for resources; directories have customtitle, and crumbs
+            # and select recent are created in lonpubdir.pm  
+    my ($uname,$thisdisfn)=
+        ($env{'request.filename'} =~ m|^/home/([^/]+)/public_html/(.*)|);
+    my $formaction='/priv/'.$uname.'/'.$thisdisfn;
+    $formaction=~s/\/+/\//g;
+
+    my $parentpath = '';
+    my $lastitem = '';
+    if ($thisdisfn =~ m-(.+/)([^/]*)$-) {
+        $parentpath = $1;
+        $lastitem = $2;
+    } else {
+        $lastitem = $thisdisfn;
+    }
+    return
+         '<div>'
+        .&Apache::loncommon::help_open_menu('','',3,'Authoring') #FIXME: Broken? Where is it?
+        .'<b>'.&mt('Construction Space:').'</b> '
+        .'<form name="dirs" method="post" action="'.$formaction
+        .'" target="_top"><tt><b>' #FIXME lonpubdir: target="_parent"
+        .&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv','','+1',1)."$lastitem</b></tt><br />"
+        #FIXME lonpubdir: &Apache::lonhtmlcommon::crumbs($uname.$thisdisfn.'/','_top','/priv','','+1',1)."</b></tt><br />"
+        .&Apache::lonhtmlcommon::select_recent('construct','recent','this.form.action=this.form.recent.value;this.form.submit()')
+        .'</form>'
+        .&Apache::lonmenu::constspaceform()
+        .'</div>';
+}
+
 ###############################################
 ###############################################
 
@@ -4320,32 +4382,9 @@
 	    $forcereg=1;
 	}
 
-	if (!$customtitle && $env{'request.state'} eq 'construct') {
-	    # this is for resources; directories have customtitle, and crumbs
-            # and select recent are created in lonpubdir.pm  
-	    my ($uname,$thisdisfn)=
-		($env{'request.filename'} =~ m|^/home/([^/]+)/public_html/(.*)|);
-	    my $formaction='/priv/'.$uname.'/'.$thisdisfn;
-	    $formaction=~s/\/+/\//g;
-
-	    my $parentpath = '';
-	    my $lastitem = '';
-	    if ($thisdisfn =~ m-(.+/)([^/]*)$-) {
-		$parentpath = $1;
-		$lastitem = $2;
-	    } else {
-		$lastitem = $thisdisfn;
-	    }
-	    $titleinfo = 
-		&Apache::loncommon::help_open_menu('','',3,'Authoring')
-		.'<b>'.&mt('Construction Space').'</b>:&nbsp;'
-		.'<form name="dirs" method="post" action="'.$formaction
-		.'" target="_top"><tt><b>'
-		.&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv','','+1',1)."<span class=\"LC_fontsize_big\">$lastitem</span></b></tt><br />"
-		.&Apache::lonhtmlcommon::select_recent('construct','recent','this.form.action=this.form.recent.value;this.form.submit()')
-		.'</form>'
-		.&Apache::lonmenu::constspaceform();
-        }
+    if (!$customtitle && $env{'request.state'} eq 'construct') {
+        $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls
+    }
 
         my $titletable = '<table id="LC_title_bar">'
                         ."<tr><td> $titleinfo $dc_info</td>".$roleinfo
@@ -4802,13 +4841,21 @@
 #LC_head_subbox {
  clear:both;
  background: $sidebg;
- border-bottom: 1px solid #999999;
+ border-bottom: 1px solid $lg_border_color;
  height: 32px;
  line-height: 32px; 
- margin: 0 0 10px;
+ margin: 0;
  padding: 0;
 }
 
+#LC_head_subbox2 { /* FIXME: replace by LC_head_subbox once lonhtmlcommon::breadcrumbs has been fixed */
+ clear:both;
+ background: #F8F8F8; /* $sidebg; */
+ border-bottom: 1px solid $lg_border_color;
+ margin: 0 0 10px 0;
+ padding: 5px;
+}
+
 .LC_fontsize_medium {
  font-size: 85%;
 }
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.310 loncom/homework/lonhomework.pm:1.311
--- loncom/homework/lonhomework.pm:1.310	Mon May 11 16:51:22 2009
+++ loncom/homework/lonhomework.pm	Tue May 19 22:52:19 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.310 2009/05/11 16:51:22 bisitz Exp $
+# $Id: lonhomework.pm,v 1.311 2009/05/19 22:52:19 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -689,8 +689,10 @@
     my ($request) = @_;
     my $js = &Apache::structuretags::setmode_javascript();
     my $result =
-	&Apache::loncommon::start_page('Analyzing a problem',$js);
-
+        &Apache::loncommon::start_page('Analyzing a problem',$js)
+       .&Apache::lonhtmlcommon::breadcrumbs() # FIXME add breadcrumbs
+       .&Apache::loncommon::head_subbox(
+                &Apache::loncommon::CSTR_pageheader());
     $result .= 
 	&Apache::lonxml::message_location().'
             <form name="lonhomework" method="post" action="'.
@@ -922,8 +924,12 @@
 						'onresize' => q[resize_textarea('LC_editxmltext','LC_aftertextarea')],
 						'onload'   => q[resize_textarea('LC_editxmltext','LC_aftertextarea')],
 				    }});
-	$result.=$start_page.
-	    &renderpage($request,$file,['no_output_web'],1).
+
+    $result=$start_page
+           .&Apache::lonhtmlcommon::breadcrumbs() # FIXME add breadcrumbs
+           .&Apache::loncommon::head_subbox(
+                &Apache::loncommon::CSTR_pageheader());
+	$result.=&renderpage($request,$file,['no_output_web'],1).
             '<form '.&Apache::edit::form_change_detection().' name="lonhomework" method="post" action="'.
 	    &HTML::Entities::encode($env{'request.uri'},'<>&"').'">'.
 	    &Apache::structuretags::remember_problem_state().'
@@ -1136,9 +1142,13 @@
 	my $instructions;
 	my $start_page = 
 	    &Apache::loncommon::start_page("Create New $extension");
-	$request->print("
-$start_page
-<h1>".&mt("Creating a new $extension resource.")."</h1>
+
+	$request->print(
+        $start_page
+       .&Apache::lonhtmlcommon::breadcrumbs() # FIXME add breadcrumbs
+       .&Apache::loncommon::head_subbox(
+                &Apache::loncommon::CSTR_pageheader())
+       .'<h1>'.&mt("Creating a new $extension resource.")."</h1>
 $errormsg
 ".&mt("The requested file [_1] currently does not exist.",
       '<span class="LC_filename">'.$shownurl.'</span>')."
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.445 loncom/homework/structuretags.pm:1.446
--- loncom/homework/structuretags.pm:1.445	Fri May 15 14:48:35 2009
+++ loncom/homework/structuretags.pm	Tue May 19 22:52:19 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.445 2009/05/15 14:48:35 bisitz Exp $
+# $Id: structuretags.pm,v 1.446 2009/05/19 22:52:19 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -203,6 +203,7 @@
 	}
     }
 
+    my $pageheader = '';
     if (defined($found{'body'})) {
 	$body_args{'skip_phases'}{'body'}=1;
     } elsif (!defined($found{'body'}) 
@@ -211,6 +212,9 @@
 	    if ($env{'environment.remote'} ne 'off') {
 		$body_args{'only_body'}  = 1;
 	    }
+        $pageheader = &Apache::lonhtmlcommon::breadcrumbs() # FIXME add breadcrumbs
+                     .&Apache::loncommon::head_subbox(
+                &Apache::loncommon::CSTR_pageheader());
 	}
     } elsif (!defined($found{'body'})) {
 	my %add_entries;
@@ -222,21 +226,21 @@
 
 	my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack,
 					       $safeeval);
-       	if ($bgcolor eq '' ) { $bgcolor = '#FFFFFF'; }
+        if ($bgcolor eq '' ) { $bgcolor = '#FFFFFF'; }
 
-	$body_args{'bgcolor'}        = $bgcolor;
-#	$body_args{'no_title'}       = 1;
-	$body_args{'force_register'} = 1;
-	$body_args{'add_entries'}    = \%add_entries;	
-	if ($env{'environment.remote'} eq 'off'
-	    && $env{'request.state'} eq   'construct') {
-	    $body_args{'only_body'}  = 1;
-	}
+        $body_args{'bgcolor'}        = $bgcolor;
+        # $body_args{'no_title'}       = 1;
+        $body_args{'force_register'} = 1;
+        $body_args{'add_entries'}    = \%add_entries;
+        if ($env{'environment.remote'} eq 'off'
+            && $env{'request.state'} eq   'construct') {
+            $body_args{'only_body'}  = 1;
+        }
     }
     $body_args{'no_auto_mt_title'} = 1;
     my $page_start = &Apache::loncommon::start_page($name,$extra_head,
 						    \%body_args);
-
+    $page_start .= $pageheader;
     if (!defined($found{'body'}) 
 	&& $env{'request.state'} ne 'construct'
 	&& ($target eq 'web' || $target eq 'webgrade')) {
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.120 loncom/publisher/lonpubdir.pm:1.121
--- loncom/publisher/lonpubdir.pm:1.120	Tue May 19 10:16:02 2009
+++ loncom/publisher/lonpubdir.pm	Tue May 19 22:52:29 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construction Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.120 2009/05/19 10:16:02 bisitz Exp $
+# $Id: lonpubdir.pm,v 1.121 2009/05/19 22:52:29 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -199,26 +199,21 @@
 
     my $formaction='/priv/'.$uname.$thisdisfn.'/';
     $formaction=~s|/+|/|g;
-    my $pagetitle .= &Apache::loncommon::help_open_menu('','',3,'Authoring').
-        '<font face="Arial, Helvetica, sans-serif" size="+1"><b>'.&mt('Construction Space').'</b>:</font>&nbsp;'.
-        '<form name="dirs" method="post" action="'.$formaction.
-        '" target="_parent"><tt><b>'.
-        &Apache::lonhtmlcommon::crumbs($uname.$thisdisfn.'/','_top','/priv','','+1',1)."</b></tt><br />".
-        &Apache::lonhtmlcommon::select_recent('construct','recent',
-                 'this.form.action=this.form.recent.value;this.form.submit()').
-              '</form>';
     &Apache::lonhtmlcommon::store_recent('construct',$formaction,$formaction);
+
     if ($env{'environment.remote'} eq 'off') {
-	$env{'request.noversionuri'}=$currdir.'/';
-	$r->print(&Apache::loncommon::start_page('Construction Space',undef,
-						 {'body_title' =>
-						      $pagetitle,}));
+        $env{'request.noversionuri'}=$currdir.'/';
+        $r->print(&Apache::loncommon::start_page('Construction Space',undef));
     } else {
-	$r->print(&Apache::loncommon::start_page('Construction Space',undef,
-						 { 'only_body' => 1,}));
-	$r->print($pagetitle);
+        $r->print(&Apache::loncommon::start_page('Construction Space',undef,
+                                                 { 'only_body' => 1,}));
     }
 
+    $r->print(&Apache::lonhtmlcommon::breadcrumbs()); # FIXME add breadcrumbs
+
+    $r->print(&Apache::loncommon::head_subbox(
+                &Apache::loncommon::CSTR_pageheader(1)));
+
     my $esc_thisdisfn = &Apache::loncommon::escape_single($thisdisfn);
     my $doctitle = 'LON-CAPA '.&mt('Construction Space');
     my $newname = &mt('New Name');

--bisitz1242773550--