--- loncom/interface/loncommon.pm	2009/05/27 14:59:49	1.827
+++ loncom/interface/loncommon.pm	2009/08/05 23:44:52	1.879
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.827 2009/05/27 14:59:49 bisitz Exp $
+# $Id: loncommon.pm,v 1.879 2009/08/05 23:44:52 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -483,27 +483,17 @@ ENDAUTHORBRW
 
 sub coursebrowser_javascript {
     my ($domainfilter,$sec_element,$formname)=@_;
-    my $crs_or_grp_alert = &mt('Please select the type of LON-CAPA entity - Course or Group - for which you wish to add/modify a user role');
-   my $output = '
+    my $crs_or_grp_alert = &mt('Please select the type of LON-CAPA entity - Course or Community - for which you wish to add/modify a user role');
+    my $id_functions = &javascript_index_functions();
+    my $output = '
 <script type="text/javascript" language="JavaScript">
 // <![CDATA[
     var stdeditbrowser;'."\n";
-   $output .= <<"ENDSTDBRW";
+
+    $output .= <<"ENDSTDBRW";
     function opencrsbrowser(formname,uname,udom,desc,extra_element,multflag,crstype) {
         var url = '/adm/pickcourse?';
-        var domainfilter = '';
-        var formid = getFormIdByName(formname);
-        if (formid > -1) {
-            var domid = getIndexByName(formid,udom);
-            if (domid > -1) {
-                if (document.forms[formid].elements[domid].type == 'select-one') {
-                    domainfilter=document.forms[formid].elements[domid].options[document.forms[formid].elements[domid].selectedIndex].value;
-                }
-                if (document.forms[formid].elements[domid].type == 'hidden') {
-                    domainfilter=document.forms[formid].elements[domid].value;
-                }
-            }
-        }
+        var domainfilter = getDomainFromSelectbox(formname,udom);
         if (domainfilter != null) {
            if (domainfilter != '') {
                url += 'domainfilter='+domainfilter+'&';
@@ -529,10 +519,15 @@ sub coursebrowser_javascript {
                 }
             }     
         }
+        if (formname == 'ccrs') {
+            var ownername = document.forms[formid].ccuname.value;
+            var ownerdom =  document.forms[formid].ccdomain.options[document.forms[formid].ccdomain.selectedIndex].value;
+            url += '&cloner='+ownername+':'+ownerdom;
+        }
         if (multflag !=null && multflag != '') {
             url += '&multiple='+multflag;
         }
-        if (crstype == 'Course/Group') {
+        if (crstype == 'Course/Community') {
             if (formname == 'cu') {
                 crstype = document.cu.crstype.options[document.cu.crstype.selectedIndex].value; 
                 if (crstype == "") {
@@ -550,24 +545,7 @@ sub coursebrowser_javascript {
         stdeditbrowser = open(url,title,options,'1');
         stdeditbrowser.focus();
     }
-
-    function getFormIdByName(formname) {
-        for (var i=0;i<document.forms.length;i++) {
-            if (document.forms[i].name == formname) {
-                return i;
-            }
-        }
-        return -1; 
-    }
-
-    function getIndexByName(formid,item) {
-        for (var i=0;i<document.forms[formid].elements.length;i++) {
-            if (document.forms[formid].elements[i].name == item) {
-                return i;
-            }
-        }
-        return -1;
-    }
+$id_functions
 ENDSTDBRW
     if ($sec_element ne '') {
         $output .= &setsec_javascript($sec_element,$formname);
@@ -578,6 +556,101 @@ ENDSTDBRW
     return $output;
 }
 
+sub javascript_index_functions {
+    return <<"ENDJS";
+
+function getFormIdByName(formname) {
+    for (var i=0;i<document.forms.length;i++) {
+        if (document.forms[i].name == formname) {
+            return i;
+        }
+    }
+    return -1;
+}
+
+function getIndexByName(formid,item) {
+    for (var i=0;i<document.forms[formid].elements.length;i++) {
+        if (document.forms[formid].elements[i].name == item) {
+            return i;
+        }
+    }
+    return -1;
+}
+
+function getDomainFromSelectbox(formname,udom) {
+    var userdom;
+    var formid = getFormIdByName(formname);
+    if (formid > -1) {
+        var domid = getIndexByName(formid,udom);
+        if (domid > -1) {
+            if (document.forms[formid].elements[domid].type == 'select-one') {
+                userdom=document.forms[formid].elements[domid].options[document.forms[formid].elements[domid].selectedIndex].value;
+            }
+            if (document.forms[formid].elements[domid].type == 'hidden') {
+                userdom=document.forms[formid].elements[domid].value;
+            }
+        }
+    }
+    return userdom;
+}
+
+ENDJS
+
+}
+
+sub userbrowser_javascript {
+    my $id_functions = &javascript_index_functions();
+    return <<"ENDUSERBRW";
+
+function openuserbrowser(formname,uname,udom,ulast,ufirst,uemail,hideudom) {
+    var url = '/adm/pickuser?';
+    var userdom = getDomainFromSelectbox(formname,udom);
+    if (userdom != null) {
+       if (userdom != '') {
+           url += 'srchdom='+userdom+'&';
+       }
+    }
+    url += 'form=' + formname + '&unameelement='+uname+
+                                '&udomelement='+udom+
+                                '&ulastelement='+ulast+
+                                '&ufirstelement='+ufirst+
+                                '&uemailelement='+uemail+
+                                '&hideudomelement='+hideudom;
+    var title = 'User_Browser';
+    var options = 'scrollbars=1,resizable=1,menubar=0';
+    options += ',width=700,height=600';
+    var stdeditbrowser = open(url,title,options,'1');
+    stdeditbrowser.focus();
+}
+
+function fix_domain (formname,udom,origdom) {
+    var formid = getFormIdByName(formname);
+    if (formid > -1) {
+        var domid = getIndexByName(formid,udom);
+        var hidedomid = getIndexByName(formid,origdom);
+        if (hidedomid > -1) {
+            var fixeddom = document.forms[formid].elements[hidedomid].value;
+            if (domid > -1) {
+                var slct = document.forms[formid].elements[domid];
+                if (slct.type == 'select-one') {
+                    var i;
+                    for (i=0;i<slct.length;i++) {
+                        if (slct.options[i].value==fixeddom) { slct.selectedIndex=i; }
+                    }
+                }
+                if (slct.type == 'hidden') {
+                    slct.value = fixeddom;
+                }
+            }
+        }
+    }
+    return;
+}
+
+$id_functions
+ENDUSERBRW
+}
+
 sub setsec_javascript {
     my ($sec_element,$formname) = @_;
     my $setsections = qq|
@@ -620,12 +693,16 @@ function setSect(sectionlist) {
 
 sub selectcourse_link {
    my ($form,$unameele,$udomele,$desc,$extra_element,$multflag,$selecttype)=@_;
+   my $linktext = &mt('Select Course');
+   if ($selecttype eq 'Community') {
+       $linktext = &mt('Select Community'); 
+   }
    return '<span class="LC_nobreak">'
          ."<a href='"
          .'javascript:opencrsbrowser("'.$form.'","'.$unameele
          .'","'.$udomele.'","'.$desc.'","'.$extra_element
          .'","'.$multflag.'","'.$selecttype.'");'
-         ."'>".&mt('Select Course').'</a>'
+         ."'>".$linktext.'</a>'
          .'</span>';
 }
 
@@ -635,6 +712,12 @@ sub selectauthor_link {
           &mt('Select Author').'</a>';
 }
 
+sub selectuser_link {
+    my ($form,$unameelem,$domelem,$lastelem,$firstelem,$emailelem,$hdomelem,$linktext) = @_;
+    return '<a href="javascript:openuserbrowser('."'$form','$unameelem','$domelem',".
+           "'$lastelem','$firstelem','$emailelem','$hdomelem'".');">'.$linktext.'</a>';
+}
+
 sub check_uncheck_jscript {
     my $jscript = <<"ENDSCRT";
 function checkAll(field) {
@@ -1111,8 +1194,8 @@ sub help_menu_js {
 
     my $template .= <<"ENDTEMPLATE";
 <script type="text/javascript">
-// <!-- BEGIN LON-CAPA Internal
 // <![CDATA[
+// <!-- BEGIN LON-CAPA Internal
 var banner_link = '';
 function helpMenu(target) {
     var caller = this;
@@ -1137,8 +1220,8 @@ function writeHelp(caller) {
     caller.document.close()
     caller.focus()
 }
-// ]]>
 // END LON-CAPA Internal -->
+// ]]>
 </script>
 ENDTEMPLATE
     return $template;
@@ -1787,7 +1870,7 @@ sub select_level_form {
 
 =pod
 
-=item * &select_dom_form($defdom,$name,$includeempty,$showdomdesc,$autosubmit)
+=item * &select_dom_form($defdom,$name,$includeempty,$showdomdesc,$onchange)
 
 Returns a string containing a <select name='$name' size='1'> form to 
 allow a user to select the domain to preform an operation in.  
@@ -1798,16 +1881,15 @@ selected");
 
 If the $showdomdesc flag is set, the domain name is followed by the domain description.
 
-If the $autosubmit flag is set, the form containing the domain selector will be auto-submitted by an onchange action.  
+The optional $onchange argumnet specifies what should occur if the domain selector is changed, e.g., 'this.form.submit()' if the form is to be automatically submitted.  
 
 =cut
 
 #-------------------------------------------
 sub select_dom_form {
-    my ($defdom,$name,$includeempty,$showdomdesc,$autosubmit) = @_;
-    my $onchange;
-    if ($autosubmit) {
-        $onchange = ' onchange="this.form.submit()"';
+    my ($defdom,$name,$includeempty,$showdomdesc,$onchange) = @_;
+    if ($onchange) {
+        $onchange = ' onchange="'.$onchange.'"';
     }
     my @domains = sort {lc($a) cmp lc($b)} (&Apache::lonnet::all_domains());
     if ($includeempty) { @domains=('',@domains); }
@@ -3766,7 +3848,7 @@ sub blockcheck {
                  ($env{'request.role'} !~ m{^st\./\Q$cdom\E/\Q$cnum\E}));
         next if ($no_userblock);
 
-        # Retrieve blocking times and identity of blocker for course
+        # Retrieve blocking times and identity of locker for course
         # of specified user, unless user has 'evb' privilege.
         
         my ($start,$end)=&get_blocks($setters,$activity,$cdom,$cnum);
@@ -3831,103 +3913,48 @@ sub parse_block_record {
     return ($setuname,$setudom,$title,$blocks);
 }
 
-sub build_block_table {
-    my ($startblock,$endblock,$setters) = @_;
-    my %lt = &Apache::lonlocal::texthash(
-        'cacb' => 'Currently active communication blocks',
-        'cour' => 'Course',
-        'dura' => 'Duration',
-        'blse' => 'Block set by'
-    );
-    my $output;
-    $output = '<br />'.$lt{'cacb'}.':<br />';
-    $output .= &start_data_table();
-    $output .= '
-<tr>
- <th>'.$lt{'cour'}.'</th>
- <th>'.$lt{'dura'}.'</th>
- <th>'.$lt{'blse'}.'</th>
-</tr>
-';
-    foreach my $course (keys(%{$setters})) {
-        my %courseinfo=&Apache::lonnet::coursedescription($course);
-        for (my $i=0; $i<@{$$setters{$course}{staff}}; $i++) {
-            my ($uname,$udom) = @{$$setters{$course}{staff}[$i]};
-            my $fullname = &plainname($uname,$udom);
-            if (defined($env{'user.name'}) && defined($env{'user.domain'})
-                && $env{'user.name'} ne 'public' 
-                && $env{'user.domain'} ne 'public') {
-                $fullname = &aboutmewrapper($fullname,$uname,$udom);
-            }
-            my ($openblock,$closeblock) = @{$$setters{$course}{times}[$i]};
-            $openblock = &Apache::lonlocal::locallocaltime($openblock);
-            $closeblock= &Apache::lonlocal::locallocaltime($closeblock);
-            $output .= &Apache::loncommon::start_data_table_row().
-                       '<td>'.$courseinfo{'description'}.'</td>'.
-                       '<td>'.$openblock.' to '.$closeblock.'</td>'.
-                       '<td>'.$fullname.'</td>'.
-                        &Apache::loncommon::end_data_table_row();
-        }
-    }
-    $output .= &end_data_table();
-}
-
 sub blocking_status {
-    my ($activity,$uname,$udom) = @_;
-    my %setters;
-    my ($blocked,$output,$ownitem,$is_course);
-    my ($startblock,$endblock)=&blockcheck(\%setters,$activity,$uname,$udom);
-    if ($startblock && $endblock) {
-        $blocked = 1;
-        if (wantarray) {
-            my $category;
-            if ($activity eq 'boards') {
-                $category = 'Discussion posts in this course';
-            } elsif ($activity eq 'blogs') {
-                $category = 'Blogs';
-            } elsif ($activity eq 'port') {
-                if (defined($uname) && defined($udom)) {
-                    if ($uname eq $env{'user.name'} &&
-                        $udom eq $env{'user.domain'}) {
-                        $ownitem = 1;
-                    }
-                }
-                $is_course = &Apache::lonnet::is_course($udom,$uname);
-                if ($ownitem) { 
-                    $category = 'Your portfolio files';  
-                } elsif ($is_course) {
-                    my $coursedesc;
-                    foreach my $course (keys(%setters)) {
-                        my %courseinfo =
-                             &Apache::lonnet::coursedescription($course);
-                        $coursedesc = $courseinfo{'description'};
-                    }
-                    $category = "Group portfolio in the course '$coursedesc'";
-                } else {
-                    $category = 'Portfolio files belonging to ';
-                    if ($env{'user.name'} eq 'public' && 
-                        $env{'user.domain'} eq 'public') {
-                        $category .= &plainname($uname,$udom);
-                    } else {
-                        $category .= &aboutmewrapper(&plainname($uname,$udom),$uname,$udom);  
-                    }
-                }
-            } elsif ($activity eq 'groups') {
-                $category = 'Groups in this course';
-            }
-            my $showstart = &Apache::lonlocal::locallocaltime($startblock);
-            my $showend = &Apache::lonlocal::locallocaltime($endblock);
-            $output = '<br />'.&mt('[_1] will be inaccessible between [_2] and [_3] because communication is being blocked.',$category,$showstart,$showend).'<br />';
-            if (!($activity eq 'port' && !($ownitem) && !($is_course))) { 
-                $output .= &build_block_table($startblock,$endblock,\%setters);
-            }
-        }
-    }
-    if (wantarray) {
-        return ($blocked,$output);
-    } else {
-        return $blocked;
+  my $blocked;
+  my ($activity,$uname,$udom) = @_;
+  my %setters;
+  my ($startblock,$endblock)=&blockcheck(\%setters,$activity,$uname,$udom);
+  if ($startblock && $endblock) {
+    $blocked = 1;
+  }
+  if(!wantarray) {
+    return $blocked;
+  }
+  my $output;
+  my $querystring;
+  $querystring = "?activity=$activity";
+
+      $output .= <<"END_MYBLOCK";
+<script type="text/javascript">
+// <![CDATA[
+    function openWindow(url, wdwName, w, h, toolbar,scrollbar) {
+        var options = "width=" + w + ",height=" + h + ",";
+        options += "resizable=yes,scrollbars="+scrollbar+",status=no,";
+        options += "menubar=no,toolbar="+toolbar+",location=no,directories=no";
+        var newWin = window.open(url, wdwName, options);
+        newWin.focus();
     }
+
+// ]]>
+</script>
+END_MYBLOCK
+  my $popupUrl = "/adm/blockingstatus/$querystring";
+  $output .= <<"END_BLOCK";
+<div class='LC_comblock'>
+  <a onclick='openWindow("$popupUrl","Blocking Table",600,300,"no","no");return false;' href='/adm/blockingstatus/$querystring'
+  title='Communication Blocked'>
+  <img class='LC_noBorder LC_middle' title='Communication Blocked' src='/res/adm/pages/comblock.png' alt='Communication Blocked'/></a>
+  <a onclick='openWindow("$popupUrl","Blocking Table",600,300,"no","no");return false;' href='/adm/blockingstatus/$querystring' 
+  title='Communication Blocked'>Communication Blocked</a>
+</div>
+
+END_BLOCK
+
+  return ($blocked, $output);
 }
 
 ###############################################
@@ -4183,6 +4210,34 @@ sub designparm {
 ##############################################
 =pod
 
+=item * &authorspace()
+
+Inputs: ./.
+
+Returns: Path to the Construction Space of the current user's
+         accessed author space
+         The author space will be that of the current user
+         when accessing the own author space
+         and that of the co-author/assistent co-author
+         when accessing the co-author's/assistent co-author's
+         space
+
+=cut
+
+sub authorspace {
+    my $caname = '';
+    if ($env{'request.role'} =~ /^ca|^aa/) {
+        (undef,$caname) =
+            ($env{'request.role'}=~/($match_domain)\/($match_username)$/);
+    } else {
+        $caname = $env{'user.name'};
+    }
+    return '/priv/'.$caname.'/';
+}
+
+##############################################
+=pod
+
 =item * &head_subbox()
 
 Inputs: $content (contains HTML code with page functions, etc.)
@@ -4195,7 +4250,7 @@ Returns: HTML div with $content
 sub head_subbox {
     my ($content)=@_;
     my $output =
-        '<div id="LC_head_subbox2">' #FIXME: solve conflicts with lonhtmlcommon:breadcrumbs LC_head_subbox
+        '<div id="LC_head_subbox">'
        .$content
        .'</div>'
 }
@@ -4274,10 +4329,6 @@ Inputs:
 =item * $forcereg, if page should register as content page (relevant for 
             text interface only)
 
-=item * $customtitle, alternate text to use instead of $title
-                      in the title box that appears, this text
-                      is not auto translated like the $title is
-
 =item * $no_nav_bar, if true, keep the 'what is this' info but remove the
                      navigational links
 
@@ -4302,7 +4353,7 @@ other decorations will be returned.
 =cut
 
 sub bodytag {
-    my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,$customtitle,
+    my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,
         $no_nav_bar,$bgcolor,$no_inline_link,$args)=@_;
 
     if (!$args->{'no_auto_mt_title'}) { $title = &mt($title); }
@@ -4357,25 +4408,7 @@ sub bodytag {
 	$name = &aboutmewrapper($name,$env{'user.name'},$env{'user.domain'});
     }
     
-    my $roleinfo=(<<ENDROLE);
-<td class="LC_title_bar_who">
-<div class="LC_title_bar_name">
-    $name
-    &nbsp;
-</div>
-<div class="LC_title_bar_role">
-$role&nbsp;
-</div>
-<div class="LC_title_bar_realm">
-$realm&nbsp;
-</div>
-</td>
-ENDROLE
-
     my $titleinfo = '<h1>'.$title.'</h1>';
-    if ($customtitle) {
-        $titleinfo = $customtitle;
-    }
     #
     # Extra info if you are the DC
     my $dc_info = '';
@@ -4388,31 +4421,33 @@ ENDROLE
         $dc_info = '('.$dc_info.')';
     }
 
-    if (($env{'environment.remote'} eq 'off') || ($args->{'suppress_header_logos'})) {
+    $role = "($role)" if $role;
+    &get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']);
+
+    if ($env{'environment.remote'} eq 'off') {
         # No Remote
 	if ($env{'request.state'} eq 'construct') {
 	    $forcereg=1;
 	}
 
-    if (!$customtitle && $env{'request.state'} eq 'construct') {
-        $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls
-    }
+#    if ($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
+                        ."<tr><td> $titleinfo $dc_info</td>"
                         .'</tr></table>';
 
 	if ($no_nav_bar) {
 	    $bodytag .= $titletable;
 	} else {
-        $bodytag .= qq|<div id="LC_nav_bar">$name ($role)<br />
-            <em>$realm</em> $dc_info</div>|;
+        $bodytag .= qq|<div id="LC_nav_bar">$name $role<br />
+            <em>$realm</em> $dc_info</div>| unless $env{'form.inhibitmenu'};
+
 	    if ($env{'request.state'} eq 'construct') {
-                $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$forcereg,
-							  $titletable);
+                $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$titletable);
             } else {
-                $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$forcereg).
-		    $titletable;
+                $bodytag .= &Apache::lonmenu::menubuttons($forcereg).$titletable;
             }
         }
         return $bodytag;
@@ -4430,7 +4465,12 @@ ENDROLE
 
     # Explicit link to get inline menu
     my $menu= ($no_inline_link?''
-	       :'<br /><a href="/adm/remote?action=collapse">'.&mt('Switch to Inline Menu Mode').'</a>');
+	       :'<a href="/adm/remote?action=collapse">'.&mt('Switch to Inline Menu Mode').'</a>');
+    $bodytag .= qq|<div id="LC_nav_bar">$name $role
+            <em>$realm</em> $dc_info </div>
+            <ol class="LC_smallMenu LC_right">
+                <li>$menu</li>
+            </ol>| unless $env{'form.inhibitmenu'};
     #
     return(<<ENDBODY);
 $bodytag
@@ -4439,7 +4479,6 @@ $bodytag
     <td>$messages&nbsp;</td>
 </tr>
 <tr><td>$titleinfo $dc_info $menu</td>
-$roleinfo
 </tr>
 </table>
 ENDBODY
@@ -4561,9 +4600,9 @@ sub standard_css {
 
     my $sans                 = 'Verdana,Arial,Helvetica,sans-serif';
     my $mono                 = 'monospace';
-    my $data_table_head      = $tabbg;
-    my $data_table_light     = '#EEEEEE';
-    my $data_table_dark      = '#DDDDDD';
+    my $data_table_head      = $sidebg;
+    my $data_table_light     = '#FAFAFA';
+    my $data_table_dark      = '#F0F0F0';
     my $data_table_darker    = '#CCCCCC';
     my $data_table_highlight = '#FFFF00';
     my $mail_new             = '#FFBB77';
@@ -4600,6 +4639,14 @@ a:focus {
   background: yellow 
 }
 
+hr {
+  clear: both;
+  color: $tabbg;
+  background-color: $tabbg;
+  height: 3px;
+  border: none;
+}
+
 form, .inline { 
    display: inline; 
 }
@@ -4722,10 +4769,10 @@ table#LC_nav_location {
 table#LC_title_bar a {
   color: $fontmenu;
 }
-    
+
 table#LC_title_bar {
   clear: both;
-  /*display: none;*/
+  display: none;
 }
 
 table#LC_title_bar,
@@ -4742,38 +4789,10 @@ table#LC_title_bar.LC_with_remote {
   margin: 0;
 }
 
-table.LC_docs_path {
-  width: 100%;
-  border: 0;
-  background: $pgbg;
-  border-collapse: collapse;
-  padding: 0;
-}
-
 table#LC_title_bar td {
   background: $tabbg;
 }
 
-table#LC_title_bar .LC_title_bar_who {
-  background: $tabbg;
-  color: $fontmenu;
-  font: small;
-  text-align: right;
-  margin: 0;
-}
-
-table#LC_title_bar div.LC_title_bar_name {
-  margin: 0;
-}
-
-table#LC_title_bar div.LC_title_bar_role {
-  margin: 0;
-}
-
-table#LC_title_bar div.LC_title_bar_realm {
-  margin: 0;
-}
-
 table#LC_menubuttons img{
   border: none;
 }
@@ -4813,19 +4832,12 @@ table#LC_top_nav td.LC_top_nav_login {
   text-align: center;
 }
 
-table.LC_breadcrumbs td,
-table.LC_docs_path td  {
-  background: $tabbg;
-  color: $fontmenu;
-  font-size: smaller;
+.LC_breadcrumbs_component {
+    float: right;
+    margin: 0 1em;
 }
-
-table.LC_breadcrumbs td.LC_breadcrumbs_component,
-table.LC_docs_path td.LC_docs_path_component {
-  background: $tabbg;
-  color: $fontmenu;
-  font-size: larger;
-  text-align: right;
+.LC_breadcrumbs_component img {
+    vertical-align: middle;
 }
 
 td.LC_table_cell_checkbox {
@@ -4840,17 +4852,21 @@ table#LC_mainmenu td.LC_mainmenu_column
  font-size: 70%;
 }
 
-#LC_head_subbox {
+#LC_breadcrumbs {
  clear:both;
  background: $sidebg;
  border-bottom: 1px solid $lg_border_color;
- height: 32px;
  line-height: 32px; 
  margin: 0;
  padding: 0;
 }
 
-#LC_head_subbox2 { /* FIXME: replace by LC_head_subbox once lonhtmlcommon::breadcrumbs has been fixed */
+/* Preliminary fix to hide breadcrumbs inside remote control window */
+#LC_remote #LC_breadcrumbs {
+    display:none;
+}
+
+#LC_head_subbox {
  clear:both;
  background: #F8F8F8; /* $sidebg; */
  border-bottom: 1px solid $lg_border_color;
@@ -4896,18 +4912,6 @@ td.LC_menubuttons_text {
   font-weight: bold;
 }
 
-.LC_preferences_labeltext {
-  text-align: right;
-}
-
-.LC_roleslog_note {
-  font-size: small;
-}
-
-.LC_mail_functions {
-    font-weight: bold;
-}
-
 table.LC_data_table,
 table.LC_mail_list {
   border: 1px solid #000000;
@@ -4927,6 +4931,7 @@ table.LC_nested_outer {
   width: 100%;
 }
 
+table.LC_innerpickbox,
 table.LC_nested {
   border: none;
   border-collapse: collapse;
@@ -4937,13 +4942,19 @@ table.LC_nested {
 table.LC_data_table tr th, 
 table.LC_calendar tr th, 
 table.LC_mail_list tr th,
-table.LC_prior_tries tr th {
+table.LC_prior_tries tr th,
+table.LC_innerpickbox tr th {
   font-weight: bold;
   background-color: $data_table_head;
   color:$fontmenu;
   font-size:90%;
 }
 
+table.LC_innerpickbox tr th,
+table.LC_innerpickbox tr td {
+  vertical-align: top;
+}
+
 table.LC_data_table tr.LC_info_row > td {
   background-color: #CCCCCC;
   font-weight: bold;
@@ -5209,7 +5220,6 @@ table#LC_helpmenu {
 
 table#LC_helpmenu fieldset legend {
   font-size: larger;
-  font-weight: bold;
 }
 
 table#LC_helpmenu_links {
@@ -5262,7 +5272,7 @@ table.LC_pick_box {
 }
 
 table.LC_pick_box td.LC_pick_box_title {
-  background: $tabbg;
+  background: $sidebg;
   font-weight: bold;
   text-align: right;
   vertical-align: top;
@@ -5270,14 +5280,6 @@ table.LC_pick_box td.LC_pick_box_title {
   padding: 8px;
 }
 
-table.LC_pick_box td.LC_selfenroll_pick_box_title {
-  background: $tabbg;
-  font-weight: bold;
-  text-align: right;
-  width: 350px;
-  padding: 8px;
-}
-
 table.LC_pick_box td.LC_pick_box_value {
   text-align: left;
   padding: 8px;
@@ -5425,17 +5427,45 @@ table.LC_status_selector td {
 
 div.LC_feedback_link {
   clear: both;
-  background: white;
+  background: $sidebg;
   width: 100%;
+  padding-bottom: 10px;
+  border: 1px $tabbg solid;
+  height: 22px;
+  line-height: 22px;
+  padding-top: 5px;
+}
+
+div.LC_feedback_link img {
+  height: 22px;
+  vertical-align:middle;
+}
+
+div.LC_feedback_link a{
+  text-decoration: none;
+}
+
+div.LC_comblock {
+  display:inline; 
+  color:$font;
+  font-size:90%;
+}
+
+div.LC_feedback_link div.LC_comblock {
+  padding-left:5px;
+}
+
+div.LC_feedback_link div.LC_comblock a {
+  color:$font;
 }
 
 span.LC_feedback_link {
-  background: $feedback_link_bg;
+  /* background: $feedback_link_bg; */
   font-size: larger;
 }
 
 span.LC_message_link {
-  background: $feedback_link_bg;
+  /* background: $feedback_link_bg; */
   font-size: larger;
   position: absolute;
   right: 1em;
@@ -5519,8 +5549,7 @@ table.LC_prior_match tr td {
   border: 1px solid #000000;
 }
 
-td.LC_nobreak,
-span.LC_nobreak {
+.LC_nobreak {
   white-space: nowrap;
 }
 
@@ -5544,21 +5573,24 @@ table.LC_docs_documents td.LC_docs_docum
   padding: 4px;
 }
 
-.LC_docs_entry_move {
-  border: none;
-  border-collapse: collapse;
-}
-
-.LC_docs_entry_move td {
-  border: 2px solid #BBBBBB;
+div.LC_docs_entry_move {
+  border: 1px solid #BBBBBB;
   background: #DDDDDD;
+  width: 22px;
+  padding: 1px;
+  margin: 0;
 }
 
-.LC_docs_editor td.LC_docs_entry_commands {
+table.LC_data_table tr > td.LC_docs_entry_commands,
+table.LC_data_table tr > td.LC_docs_entry_parameter {
   background: #DDDDDD;
   font-size: x-small;
 }
 
+.LC_docs_entry_parameter {
+  white-space: nowrap;
+}
+
 .LC_docs_copy {
   color: #000099;
 }
@@ -5580,17 +5612,6 @@ table.LC_docs_documents td.LC_docs_docum
   font-size: x-small;
 }
 
-.LC_docs_editor td.LC_docs_entry_title,
-.LC_docs_editor td.LC_docs_entry_icon {
-  background: #FFFFBB;
-}
-
-.LC_docs_editor td.LC_docs_entry_parameter {
-  background: #BBBBFF;
-  font-size: x-small;
-  white-space: nowrap;
-}
-
 table.LC_docs_adddocs td,
 table.LC_docs_adddocs th {
   border: 1px solid #BBBBBB;
@@ -5627,10 +5648,6 @@ table.LC_double_column tr td.LC_right_co
   vertical-align: top;
 }
 
-span.LC_role_level {
-  font-weight: bold;
-}
-
 div.LC_left_float {
   float: left;
   padding-right: 5%;
@@ -5722,12 +5739,6 @@ div.LC_edit_problem_editxml_header div {
   margin-top: 5px;
 }
 
-div.LC_edit_problem_header_edit_row {
-  background: $tabbg;
-  padding: 3px;
-  margin-bottom: 5px;
-}
-
 div.LC_edit_problem_header_title {
   font-weight: bold;
   font-size: larger;
@@ -5757,14 +5768,6 @@ div.LC_edit_problem_saves {
   padding-bottom: 5px;
 }
 
-hr.LC_edit_problem_divide {
-  clear: both;
-  color: $tabbg;
-  background-color: $tabbg;
-  height: 3px;
-  border: none;
-}
-
 img.stift{
   border-width: 0;
   vertical-align: middle;
@@ -5828,13 +5831,14 @@ h2,h3,h4,h5,h6 {
 	border-bottom:solid 1px $lg_border_color;
 }
 
+.LC_Box > .LC_hcell {
+    margin: 0 -10px 10px -10px;
+}
+
 .LC_noBorder {
         border: 0;
 }
 
-
-/* Main Header with discription of Person, Course, etc. */
-
 .LC_Right {
         float: right;
         margin: 0;
@@ -5863,9 +5867,14 @@ dl,ul,div,fieldset {
 /*	overflow: hidden; */
 }
 
+fieldset > legend {
+    font-weight: bold;
+    padding: 0 5px 0 5px;
+}
+
 #LC_nav_bar {
     float: left;
-    margin: 0;
+    margin: 0.2em 0 0 0;
 }
 
 #LC_nav_bar em{
@@ -5875,9 +5884,10 @@ dl,ul,div,fieldset {
 
 ol.LC_smallMenu {
     float: right;
+    margin: 0.2em 0 0 0;
 }
 
-ol.LC_smallMenu, ol#LC_PathBreadcrumbs {
+ol#LC_PathBreadcrumbs {
 	margin: 0;
 }
 
@@ -5904,12 +5914,10 @@ ul#LC_TabMainMenuContent {
     list-style: none;
     padding: 0;
     margin: 0;
-    float:left;
     width: 100%;
 }
 
 ul#LC_TabMainMenuContent li {
-    float: left;
     font-weight: bold;
     line-height: 1.8em;
     padding: 0 0.8em; 
@@ -5918,21 +5926,18 @@ ul#LC_TabMainMenuContent li {
     vertical-align: middle;
 }
 
-ul.LC_TabContent ,
-ul.LC_TabContentBigger {
+ul.LC_TabContent {
 	display:block;
+	background: $sidebg;
+	border-bottom: solid 1px $lg_border_color;
 	list-style:none;
-	margin: 0;
+	margin: 0 -10px;
 	padding: 0;
 }
 
 ul.LC_TabContent li,
 ul.LC_TabContentBigger li {
-	display: inline;
-	border-right: solid 1px $lg_border_color;
 	float:left;
-	line-height:140%;
-	white-space:nowrap;
 }
 
 ul#LC_TabMainMenuContent li a {
@@ -5941,7 +5946,7 @@ ul#LC_TabMainMenuContent li a {
 }
 
 ul.LC_TabContent {
-	min-height:1.6em;
+	min-height:1.5em;
 }
 
 ul.LC_TabContent li {
@@ -5951,6 +5956,10 @@ ul.LC_TabContent li {
 	border-bottom:solid 1px $lg_border_color;
 }
 
+ul.LC_TabContent .right {
+	float:right;
+}
+
 ul.LC_TabContent li a, ul.LC_TabContent li {
 	color:rgb(47,47,47);
 	text-decoration:none;
@@ -5961,33 +5970,72 @@ ul.LC_TabContent li a, ul.LC_TabContent
 
 ul.LC_TabContent li:hover, ul.LC_TabContent li.active {
         background:#FFFFFF url(/adm/lonIcons/open.gif) no-repeat scroll right center;
-	border-bottom:solid 1px #FFFFFF;
+	border-bottom:solid 2px #FFFFFF;
 	padding-right: 16px;
 }
 
-ul.LC_TabContentBigger li {
-	vertical-align:bottom;
-	border-top:solid 1px $lg_border_color;
-	border-left:solid 1px $lg_border_color;
-	padding:5px 10px 5px 10px;
-	margin-left:2px;
-	background:url(/adm/lonIcons/lightGreyBG.png) repeat-x left top;
+#maincoursedoc {
+	clear:both;
 }
 
-ul.LC_TabContentBigger li:hover, 
-ul.LC_TabContentBigger li.active {
-	background:url(/adm/lonIcons/lightGreyBG.png) repeat-x right bottom;
+ul.LC_TabContentBigger {
+        display:block;
+        list-style:none;
+        padding: 0;
+}
+
+ul.LC_TabContentBigger li {
+        vertical-align:bottom;
+        height: 30px;
+        font-size:110%;
+        font-weight:bold;
+        color: #737373;
 }
 
-ul.LC_TabContentBigger li, 
+
 ul.LC_TabContentBigger li a {
-	font-size:110%;
-	font-weight:bold;
+        background:url('/adm/lonIcons/tabbgleft.gif') left bottom no-repeat;
+	height: 30px;
+	line-height: 30px;
+	text-align: center;
+	display: block;
+	text-decoration: none;
+}
+
+ul.LC_TabContentBigger li:hover a, 
+ul.LC_TabContentBigger li.active a {
+	background:url('/adm/lonIcons/tabbgleft.gif') left top no-repeat;
+	color:$font;
+	text-decoration: underline;
+}
+
+
+ul.LC_TabContentBigger li b {
+	background: url('/adm/lonIcons/tabbgright.gif') no-repeat right bottom;
+	display: block;
+	float: left;
+	padding: 0 30px;
+}
+
+ul.LC_TabContentBigger li:hover b,
+ul.LC_TabContentBigger li.active b {
+        background:url('/adm/lonIcons/tabbgright.gif') right top no-repeat;
+        color:$font;
+	border-bottom: 1px solid #FFFFFF;
+}
+
+
+ul.LC_CourseBreadcrumbs {
+  background: $sidebg;
+  line-height: 32px;
+  padding-left: 10px;
+  margin: 0 0 10px 0;
+  list-style-position: inside;
+
 }
 
 ol#LC_MenuBreadcrumbs, 
-ol#LC_PathBreadcrumbs, 
-ul#LC_CourseBreadcrumbs {
+ol#LC_PathBreadcrumbs {
 	padding-left: 10px;
 	margin: 0;
 	list-style-position: inside;
@@ -5995,14 +6043,13 @@ ul#LC_CourseBreadcrumbs {
 
 ol#LC_MenuBreadcrumbs li, 
 ol#LC_PathBreadcrumbs li, 
-ul#LC_CourseBreadcrumbs li {
-	display: inline;
-	padding: 0 0 0 10px;
-	overflow:hidden;
+ul.LC_CourseBreadcrumbs li {
+    display: inline;
+    white-space: nowrap;
 }
 
 ol#LC_MenuBreadcrumbs li a,
-ul#LC_CourseBreadcrumbs li a {
+ul.LC_CourseBreadcrumbs li a {
 	text-decoration: none;
 	font-size:90%;
 }
@@ -6013,18 +6060,9 @@ ol#LC_PathBreadcrumbs li a {
 	font-weight:bold;
 }
 
-.LC_BoxPadding {
-	padding: 10px;
-}
-
-.LC_ContentBoxSpecial {
-	border: solid 1px $lg_border_color;
-}
-
-.LC_ContentBoxSpecialContactInfo {
-	border: solid 1px $lg_border_color;
-	max-width:25%;
-	min-width:25%;
+.LC_Box {
+    border: solid 1px $lg_border_color;
+    padding: 0 10px 10px 10px;
 }
 
 .LC_AboutMe_Image {
@@ -6113,26 +6151,6 @@ div.LC_columnSection>* {
 	overflow:hidden;
 }
 
-.ContentBoxSpecialTemplate {
-        border: solid 1px $lg_border_color;
-}
-
-.ContentBoxTemplate {
-        padding:10px;
-}
-
-div.LC_columnSection > .ContentBoxTemplate,
-div.LC_columnSection > .ContentBoxSpecialTemplate {
-        width: 600px;
-}
-
-.clear {
-	clear: both;
-	line-height: 0;
-	font-size: 0;
-	height: 0;
-}
-
 .LC_loginpage_container {
 	text-align:left;
 	margin : 0 auto;
@@ -6187,7 +6205,7 @@ table em {
 table.LC_tableBrowseRes,
 table.LC_tableOfContent {
         border:none;
-	border-spacing: 1;
+	border-spacing: 1px;
 	padding: 3px;
 	background-color: #FFFFFF;
 	font-size: 90%;
@@ -6281,7 +6299,7 @@ a.LC_toolbarItem {
 	background-color:transparent;
 }
 
-ul.LC_functionslist li {
+ul.LC_funclist li {
   float: left;
   white-space: nowrap;
   height: 35px; /* at least as high as heighest list item */
@@ -6416,7 +6434,8 @@ sub xml_begin {
             .'<html xmlns:math="http://www.w3.org/1998/Math/MathML" ' 
 	    .'xmlns="http://www.w3.org/1999/xhtml">';
     } else {
-	$output='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>';
+	$output='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
+           .'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">';
     }
     return $output;
 }
@@ -6492,9 +6511,6 @@ $args - additional optional args support
                                     a html attribute
              force_register -> if is true will turn on the &bodytag()
                                     $forcereg arg
-             body_title     -> alternate text to use instead of $title
-                                    in the title box that appears, this text
-                                    is not auto translated like the $title is
              frameset       -> if true will start with a <frameset>
                                     rather than <body>
              skip_phases    -> hash ref of 
@@ -6506,6 +6522,8 @@ $args - additional optional args support
              inherit_jsmath -> when creating popup window in a page,
                                     should it have jsmath forced on by the
                                     current page
+             bread_crumbs ->             Array containing breadcrumbs
+             bread_crumbs_components ->  if exists show it as headline else show only the breadcrumbs
 
 =back
 
@@ -6538,16 +6556,15 @@ sub start_page {
 	    my $attr_string = &make_attr_string($args->{'force_register'},
 						$args->{'add_entries'});
 	    $result .= "\n<frameset $attr_string>\n";
-	} else {
-	    $result .=
-		&bodytag($title, 
-			 $args->{'function'},       $args->{'add_entries'},
-			 $args->{'only_body'},      $args->{'domain'},
-			 $args->{'force_register'}, $args->{'body_title'},
-			 $args->{'no_nav_bar'},     $args->{'bgcolor'},
-			 $args->{'no_inline_link'},
-			 $args);
-	}
+        } else {
+            $result .=
+                &bodytag($title, 
+                         $args->{'function'},       $args->{'add_entries'},
+                         $args->{'only_body'},      $args->{'domain'},
+                         $args->{'force_register'}, $args->{'no_nav_bar'},
+                         $args->{'bgcolor'},        $args->{'no_inline_link'},
+                         $args);
+        }
     }
 
     if ($args->{'js_ready'}) {
@@ -7679,24 +7696,20 @@ $newuserscript
 
 $new_user_create
 
-<table>
- <tr>
-  <td>$lt{'doma'}:</td>
-  <td>$domform</td>
-  </td>
- </tr>
- <tr>
-  <td>$lt{'usr'}:</td>
-  <td>$srchbysel
-      $srchtypesel 
-      <input type="text" size="15" name="srchterm" value="$srchterm" />
-      $srchinsel 
-  </td>
- </tr>
-</table>
-<br />
 END_BLOCK
 
+    $output .= &Apache::lonhtmlcommon::start_pick_box().
+               &Apache::lonhtmlcommon::row_title($lt{'doma'}).
+               $domform.
+               &Apache::lonhtmlcommon::row_closure().
+               &Apache::lonhtmlcommon::row_title($lt{'usr'}).
+               $srchbysel.
+               $srchtypesel. 
+               '<input type="text" size="15" name="srchterm" value="'.$srchterm.'" />'.
+               $srchinsel.
+               &Apache::lonhtmlcommon::row_closure(1). 
+               &Apache::lonhtmlcommon::end_pick_box().
+               '<br />';
     return $output;
 }
 
@@ -8569,7 +8582,7 @@ sub csv_print_samples {
     $r->print(&mt('Samples').'<br />'.&start_data_table().
               &start_data_table_header_row());
     foreach my $sample (sort({$a <=> $b} keys(%{ $samples->[0] }))) { 
-        $r->print('<th>'.&mt('Column&nbsp;[_1]',($sample+1)).'</th>'); }
+        $r->print('<th>'.&mt('Column [_1]',($sample+1)).'</th>'); }
     $r->print(&end_data_table_header_row());
     foreach my $hash (@$samples) {
 	$r->print(&start_data_table_row());
@@ -8613,7 +8626,7 @@ sub csv_print_select_table {
 	my ($value,$display,$defaultcol)=@{ $array_ref };
 	$r->print(&start_data_table_row().'<td>'.$display.'</td>');
 
-	$r->print('<td><select name=f'.$i.
+	$r->print('<td><select name="f'.$i.'"'.
 		  ' onchange="javascript:flip(this.form,'.$i.');">');
 	$r->print('<option value="none"></option>');
 	foreach my $sample (sort({$a <=> $b} keys(%{ $samples->[0] }))) {
@@ -10218,7 +10231,7 @@ sub group_term {
     my $crstype = &course_type();
     my %names = (
                   'Course' => 'group',
-                  'Group' => 'team',
+                  'Community' => 'group',
                 );
     return $names{$crstype};
 }
@@ -10411,7 +10424,7 @@ sub init_user_environment {
                 &Apache::lonnet::usertools_access($username,$domain,$tool,'reload');
         }
 
-        foreach my $crstype ('official','unofficial') {
+        foreach my $crstype ('official','unofficial','community') {
             $userenv{'canrequest.'.$crstype} =
                 &Apache::lonnet::usertools_access($username,$domain,$crstype,
                                                   'reload','requestcourses');