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

www www at source.lon-capa.org
Wed Dec 21 19:17:04 EST 2011


www		Thu Dec 22 00:17:04 2011 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  More than one progress bar on the same page
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1044 loncom/interface/loncommon.pm:1.1045
--- loncom/interface/loncommon.pm:1.1044	Wed Dec 21 21:25:40 2011
+++ loncom/interface/loncommon.pm	Thu Dec 22 00:17:04 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1044 2011/12/21 21:25:40 www Exp $
+# $Id: loncommon.pm,v 1.1045 2011/12/22 00:17:04 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7146,12 +7146,11 @@
 }
 
 sub LCprogressbar_script {
+   my ($id)=@_;
    return(<<ENDPROGRESS);
 <script type="text/javascript">
 // <![CDATA[
-var LCprogressTxt='---';
-
-\$('#progressbar').progressbar({
+\$('#progressbar$id').progressbar({
   value: 0,
   change: function(event, ui) {
     var newVal = \$(this).progressbar('option', 'value');
@@ -7171,9 +7170,11 @@
 </style>
 <script type="text/javascript">
 // <![CDATA[
-function LCupdateProgress(percent,progresstext) {
+var LCprogressTxt='---';
+
+function LCupdateProgress(percent,progresstext,id) {
    LCprogressTxt=progresstext;
-   \$('#progressbar').progressbar('value',percent);
+   \$('#progressbar'+id).progressbar('value',percent);
 }
 // ]]>
 </script>
@@ -7181,19 +7182,23 @@
 }
 
 my $LClastpercent;
+my $LCidcnt;
+my $LCcurrentid;
 
 sub LCprogressbar {
     my ($r)=(@_);
     $LClastpercent=0;
+    $LCidcnt++;
+    $LCcurrentid=$$.'_'.$LCidcnt;
     my $starting=&mt('Starting');
     my $content=(<<ENDPROGBAR);
 <p>
-  <div id="progressbar">
+  <div id="progressbar$LCcurrentid">
     <span class="pblabel">$starting</span>
   </div>
 </p>
 ENDPROGBAR
-    &r_print($r,$content.&LCprogressbar_script());
+    &r_print($r,$content.&LCprogressbar_script($LCcurrentid));
 }
 
 sub LCprogressbarUpdate {
@@ -7213,7 +7218,7 @@
     &r_print($r,<<ENDUPDATE);
 <script type="text/javascript">
 // <![CDATA[
-LCupdateProgress($val,'$text');
+LCupdateProgress($val,'$text','$LCcurrentid');
 // ]]>
 </script>
 ENDUPDATE
@@ -7225,7 +7230,7 @@
     &r_print($r,<<ENDCLOSE);
 <script type="text/javascript">
 // <![CDATA[
-\$("#progressbar").hide('slow'); 
+\$("#progressbar$LCcurrentid").hide('slow'); 
 // ]]>
 </script>
 ENDCLOSE




More information about the LON-CAPA-cvs mailing list