--- loncom/interface/lonhtmlcommon.pm 2011/10/23 00:27:10 1.294 +++ loncom/interface/lonhtmlcommon.pm 2012/02/22 10:18:26 1.301 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.294 2011/10/23 00:27:10 raeburn Exp $ +# $Id: lonhtmlcommon.pm,v 1.301 2012/02/22 10:18:26 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -72,7 +72,7 @@ sub java_not_enabled { sub coursepreflink { my ($text,$category)=@_; if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { - return '<a href="'.&HTML::Entities::encode("/adm/courseprefs?phase=display&actions=$category",'<>&"').'"><span class="LC_setting">'.$text.'</span></a>'; + return '<a target="_top" href="'.&HTML::Entities::encode("/adm/courseprefs?phase=display&actions=$category",'<>&"').'"><span class="LC_setting">'.$text.'</span></a>'; } else { return ''; } @@ -95,7 +95,7 @@ sub direct_parm_link { $filter=&entity_encode($filter); $part=&entity_encode($part); if (($symb) && (&Apache::lonnet::allowed('opa')) && ($target ne 'tex')) { - return "<a href='/adm/parmset?symb=$symb&filter=$filter&part=$part'><span class='LC_setting'>$linktext</span></a>"; + return "<a target='_top' href='/adm/parmset?symb=$symb&filter=$filter&part=$part'><span class='LC_setting'>$linktext</span></a>"; } else { return $linktext; } @@ -748,13 +748,12 @@ parameter setting wizard. sub pjump_javascript_definition { my $Str = <<END; function pjump(type,dis,value,marker,ret,call,hour,min,sec) { - parmwin=window.open("/adm/rat/parameter.html?type="+escape(type) + openMyModal("/adm/rat/parameter.html?type="+escape(type) +"&value="+escape(value)+"&marker="+escape(marker) +"&return="+escape(ret) +"&call="+escape(call)+"&name="+escape(dis) +"&defhour="+escape(hour)+"&defmin="+escape(min) - +"&defsec="+escape(sec),"LONCAPAparms", - "height=350,width=350,scrollbars=no,menubar=no"); + +"&defsec="+escape(sec)+"&modal=1",350,350,'no'); } END return $Str; @@ -992,82 +991,23 @@ Returns: none ######################################################## ######################################################## -my $uniq=0; -sub get_uniq_name { - $uniq++; - return 'uniquename'.$uniq; -} # Create progress sub Create_PrgWin { - my ($r, $title, $heading, $number_to_do,$type,$width,$formname, - $inputname)=@_; - if (!defined($type)) { $type='popup'; } - if (!defined($width)) { $width=55; } + my ($r,$number_to_do)=@_; my %prog_state; - $prog_state{'type'}=$type; - if ($type eq 'popup') { - $prog_state{'window'}='popwin'; - my $start_page = - &Apache::loncommon::start_page($title,undef, - {'only_body' => 1, - 'bgcolor' => '#88DDFF', - 'js_ready' => 1}); - my $end_page = &Apache::loncommon::end_page({'js_ready' => 1}); - - #the whole function called through timeout is due to issues - #in mozilla Read BUG #2665 if you want to know the whole story - &r_print($r,&Apache::lonhtmlcommon::scripttag( - "var popwin; - function openpopwin () { - popwin=open(\'\',\'popwin\',\'width=400,height=100\');". - "popwin.document.writeln(\'".$start_page. - "<h4>".&mt("$heading")."<\/h4>". - "<form action=\"\" name=\"popremain\" method=\"post\">". - '<input type="text" size="'.$width.'" name="remaining" value="'. - &mt('Starting').'" /><\\/form>'.$end_page. - "\');". - "popwin.document.close();}". - "\nwindow.setTimeout(openpopwin,0)" - )); - $prog_state{'formname'}='popremain'; - $prog_state{'inputname'}="remaining"; - } elsif ($type eq 'inline') { - $prog_state{'window'}='window'; - if (!$formname) { - $prog_state{'formname'}=&get_uniq_name(); - &r_print($r,'<form action="" name="'.$prog_state{'formname'}.'">'); - } else { - $prog_state{'formname'}=$formname; - } - if (!$inputname) { - $prog_state{'inputname'}=&get_uniq_name(); - &r_print($r,&mt("$heading [_1]",' <input type="text" name="'.$prog_state{'inputname'}.'" size="'.$width.'" />')); - } else { - $prog_state{'inputname'}=$inputname; - - } - if (!$formname) { &r_print($r,'</form>'); } - &Update_PrgWin($r,\%prog_state,&mt('Starting')); - } - $prog_state{'done'}=0; $prog_state{'firststart'}=&Time::HiRes::time(); $prog_state{'laststart'}=&Time::HiRes::time(); $prog_state{'max'}=$number_to_do; - + &Apache::loncommon::LCprogressbar($r); return %prog_state; } # update progress sub Update_PrgWin { my ($r,$prog_state,$displayString)=@_; - &r_print($r,&Apache::lonhtmlcommon::scripttag( - $$prog_state{'window'}.'.document.'. - $$prog_state{'formname'}.'.'. - $$prog_state{'inputname'}.'.value="'. - $displayString.'";' - )); + &Apache::loncommon::LCprogressbarUpdate($r,undef,$displayString); $$prog_state{'laststart'}=&Time::HiRes::time(); } @@ -1113,38 +1053,21 @@ sub Increment_PrgWin { $min, $sec, $lasttime); - - &r_print($r,&Apache::lonhtmlcommon::scripttag( - $$prog_state{'window'}.'.document.'. - $$prog_state{'formname'}.'.'. - $$prog_state{'inputname'}.'.value="'.$timeinfo.'";' - )); + my $percent=0; + if ($$prog_state{'max'}) { + $percent=int(100.*$current/$$prog_state{'max'}); + } + &Apache::loncommon::LCprogressbarUpdate($r,$percent,$timeinfo); $$prog_state{'laststart'}=&Time::HiRes::time(); } # close Progress Line sub Close_PrgWin { my ($r,$prog_state)=@_; - if ($$prog_state{'type'} eq 'popup') { - &r_print($r,&Apache::lonhtmlcommon::scripttag( - 'popwin.close()' - )); - } elsif ($$prog_state{'type'} eq 'inline') { - &Update_PrgWin($r,$prog_state,&mt('Done')); - } + &Apache::loncommon::LCprogressbarClose($r); undef(%$prog_state); } -sub r_print { - my ($r,$to_print)=@_; - if ($r) { - $r->print($to_print); - $r->rflush(); - } else { - print($to_print); - } -} - # ------------------------------------------------------- Puts directory header sub crumbs { @@ -1247,6 +1170,9 @@ ENDEDITOR <script type="text/javascript" src="/adm/jQuery/js/jquery-1.6.2.min.js"></script> <script type="text/javascript" src="/adm/jQuery/js/jquery-ui-1.8.16.custom.min.js"></script> <link rel="stylesheet" type="text/css" href="/adm/jQuery/css/smoothness/jquery-ui-1.8.16.custom.css" /> +<script type="text/javascript" src="/adm/jpicker/js/jpicker-1.1.6.min.js" > +</script> +<link rel="stylesheet" type="text/css" href="/adm/jpicker/css/jPicker-1.1.6.min.css" /> ENDJQUERY return $s; } @@ -1375,7 +1301,10 @@ sub htmlareaselectactive { $(this).before("<div><a href=\"#\" id=\"LC_rt_"+id+"\" title=\"Enable rich text formatting (bold, italic, etc.)\" class=\"LC_enable_rt\"><b>Rich formatting »</b></a></div>"); $("#LC_rt_"+id).click(editorHandler); }); - }); + $.fn.jPicker.defaults.images.clientPath="/adm/jpicker/images/"; + $(".colorchooser").jPicker(); + +c }); '; if ($dragmath_prefix ne '') { $output .= ' @@ -1539,9 +1468,11 @@ returns: nothing } my $links; if ((&show_return_link) && (!$CourseBreadcrumbs)) { - $links=&htmltag( 'a',"<img src='/res/adm/pages/reload.png' border='0' style='vertical-align:middle;' />", + my $alttext = &mt('Go Back'); + $links=&htmltag( 'a',"<img src='/res/adm/pages/reload.png' border='0' style='vertical-align:middle;' alt='$alttext' />", { href => '/adm/flip?postdata=return:', title => &mt("Back to most recent content resource") }); + $links=&htmltag('li',$links); } $links.= join "", map { @@ -2078,26 +2009,41 @@ sub course_custom_roles { sub resource_info_box { - my ($symb,$onlyfolderflag)=@_; + my ($symb,$onlyfolderflag,$stuvcurrent,$stuvdisp)=@_; my $return=''; + if ($stuvcurrent ne '') { + $return = '<div class="LC_left_float">'; + } if ($symb) { - $return=&Apache::loncommon::start_data_table(); + $return.=&Apache::loncommon::start_data_table(); my ($map,$id,$resource)=&Apache::lonnet::decode_symb($symb); my $folder=&Apache::lonnet::gettitle($map); $return.=&Apache::loncommon::start_data_table_row(). - '<th>'.&mt('Folder:').'</th><td>'.$folder.'</td>'. + '<th align="left">'.&mt('Folder:').'</th><td>'.$folder.'</td>'. &Apache::loncommon::end_data_table_row(); unless ($onlyfolderflag) { $return.=&Apache::loncommon::start_data_table_row(). - '<th>'.&mt('Resource:').'</th><td>'.&Apache::lonnet::gettitle($symb).'</td>'. + '<th align="left">'.&mt('Resource:').'</th><td>'.&Apache::lonnet::gettitle($symb).'</td>'. + &Apache::loncommon::end_data_table_row(); + } + if ($stuvcurrent ne '') { + $return .= &Apache::loncommon::start_data_table_row(). + '<th align="left">'.&mt("Student's current version:").'</th><td>'.$stuvcurrent.'</td>'. + &Apache::loncommon::end_data_table_row(); + } + if ($stuvdisp ne '') { + $return .= &Apache::loncommon::start_data_table_row(). + '<th align="left">'.&mt("Student's version displayed:").'</th><td>'.$stuvdisp.'</td>'. &Apache::loncommon::end_data_table_row(); } $return.=&Apache::loncommon::end_data_table(); } else { $return='<p><span class="LC_error">'.&mt('No context provided.').'</span></p>'; } + if ($stuvcurrent ne '') { + $return .= '</div>'; + } return $return; - } ##############################################