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

raeburn raeburn at source.lon-capa.org
Mon Apr 16 15:25:00 EDT 2012


raeburn		Mon Apr 16 19:25:00 2012 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  - Fix POD; more consistency in display of subroutine names in POD.
  - Bug 6448 - Manage dependencies for HTML files uploaded to course.
    - Add &dependencies_button() and &dependencycheck_js() to provide
      "Manage Dependencies" button to open pop-up window.
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.308 loncom/interface/lonhtmlcommon.pm:1.309
--- loncom/interface/lonhtmlcommon.pm:1.308	Thu Apr  5 15:56:13 2012
+++ loncom/interface/lonhtmlcommon.pm	Mon Apr 16 19:24:59 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.308 2012/04/05 15:56:13 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.309 2012/04/16 19:24:59 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -103,7 +103,7 @@
 ##############################################
 ##############################################
 
-=item confirm_success
+=item &confirm_success()
 
 Successful completion of an operation message
 
@@ -129,7 +129,7 @@
 
 =pod
 
-=item dragmath_button
+=item &dragmath_button()
 
 Creates a button that launches a dragmath popup-window, in which an 
 expression can be edited and pasted as LaTeX into a specified textarea. 
@@ -155,10 +155,11 @@
 
 =pod
 
-=item dragmath_js
+=item &dragmath_js()
 
 Javascript used to open pop-up window containing dragmath applet which 
 can be used to paste LaTeX into a textarea.
+
 =cut
 
 sub dragmath_js {
@@ -177,13 +178,57 @@
 ENDDRAGMATHJS
 }
 
+##############################################
+##############################################
+
+=pod
+
+=item &dependencies_button()
+
+Creates a button that launches a popup-window, in which dependencies  
+for the web page in the main window can be added to, replaced or deleted.  
+
+=cut
+
+sub dependencies_button {
+    my $buttontext=&mt('Manage Dependencies');
+    return <<"END";
+                <input type="button" value="$buttontext" onclick="javascript:dependencycheck();" />
+END
+}
+
+##############################################
+
+=pod
+
+=item &dependencycheck_js()
+
+Javascript used to open pop-up window containing interface to manage 
+dependencies for a web page uploaded diretcly to a course.
+
+=cut
+
+sub dependencycheck_js {
+    my ($symb,$title) = @_;
+    my $link = '/adm/dependencies?symb='.&HTML::Entities::encode($symb,'<>&"').
+               '&title='.&HTML::Entities::encode($title,'<>&"');
+    return <<ENDJS;
+                <script type="text/javascript">
+                // <![CDATA[
+                  function dependencycheck() {
+                     depwin  = window.open("$link","","width=750,height=500,resizable,scrollbars=yes");
+                  }
+                // ]]>
+                </script>
+ENDJS
+}
 
 ##############################################
 ##############################################
 
 =pod
 
-=item authorbombs
+=item &authorbombs()
 
 =cut
 
@@ -317,7 +362,7 @@
 
 =pod
 
-=item textbox
+=item &textbox()
 
 =cut
 
@@ -337,7 +382,7 @@
 
 =pod
 
-=item checkbox
+=item &checkbox()
 
 =cut
 
@@ -359,7 +404,7 @@
 
 =pod
 
-=item radiobutton
+=item &radiobutton()
 
 =cut
 
@@ -383,10 +428,10 @@
 
 =pod
 
-=item &date_setter
+=item &date_setter()
 
 &date_setter returns html and javascript for a compact date-setting form.
-To retrieve values from it, use &get_date_from_form().
+To retrieve values from it, use &get_date_from_form.
 
 Inputs
 
@@ -636,7 +681,7 @@
 
 =pod
 
-=item &get_date_from_form
+=item &get_date_from_form()
 
 get_date_from_form retrieves the date specified in an &date_setter form.
 
@@ -895,7 +940,7 @@
 =over 4
 
 
-=item &Create_PrgWin
+=item &Create_PrgWin()
 
 Writes javascript to the client to open a progress window and returns a
 data structure used for bookkeeping.
@@ -926,7 +971,7 @@
 Returns a hash containing the progress state data structure.
 
 
-=item &Update_PrgWin
+=item &Update_PrgWin()
 
 Updates the text in the progress indicator.  Does not increment the count.
 See &Increment_PrgWin.
@@ -946,7 +991,7 @@
 Returns: none
 
 
-=item Increment_PrgWin
+=item Increment_PrgWin()
 
 Increment the count of items completed for the progress window by $step or 1 if no step is provided.
 
@@ -968,7 +1013,7 @@
 Returns: none
 
 
-=item Close_PrgWin
+=item &Close_PrgWin()
 
 Closes the progress window.
 
@@ -1494,7 +1539,7 @@
 
 =pod
 
-=item breadcrumbs
+=item &breadcrumbs()
 
 Compiles the previously registered breadcrumbs into an series of links.
 Additionally supports a 'component', which will be displayed on the
@@ -1512,11 +1557,11 @@
            when including the text on the right.
 Returns a string containing breadcrumbs for the current page.
 
-=item clear_breadcrumbs
+=item &clear_breadcrumbs()
 
 Clears the previously stored breadcrumbs.
 
-=item add_breadcrumb
+=item &add_breadcrumb()
 
 Pushes a breadcrumb on the stack of crumbs.
 
@@ -1675,7 +1720,7 @@
         push(@Crumbs, at _);
     }
     
-=item add_breadcrumb_tool($category, $html)
+=item &add_breadcrumb_tool($category, $html)
 
 Adds $html to $category of the breadcrumb toolbar container.
 
@@ -1718,7 +1763,7 @@
         push @{$tools{$category}}, @html;
     }
 
-=item clear_breadcrumb_tools()
+=item &clear_breadcrumb_tools()
 
 Clears the breadcrumb toolbar container.
 
@@ -1730,7 +1775,7 @@
         undef(%tools);
     }
 
-=item render_tools(\$breadcrumbs)
+=item &render_tools(\$breadcrumbs)
 
 Creates html for breadcrumb tools (categories navigation and tools) and inserts 
 \$breadcrumbs at the correct position.
@@ -1739,6 +1784,7 @@
 breadcrumbs.
 
 returns: nothing
+
 =cut
 
 #TODO might split this in separate functions for each category
@@ -1754,7 +1800,9 @@
                    { listattr => { class=>'LC_breadcrumb_tools_outerlist' } });
     }
 
-=item render_advtools(\$breadcrumbs)
+=pod
+
+=item &render_advtools(\$breadcrumbs)
 
 Creates html for advanced tools (category advtools) and inserts \$breadcrumbs 
 at the correct position.
@@ -1763,6 +1811,7 @@
 breadcrumbs (after render_tools call).
 
 returns: nothing
+
 =cut
 
     sub render_advtools {
@@ -2763,8 +2812,9 @@
     return htmltag('script', $content, {type => 'text/javascript'});
 };
 
+=pod
 
-=item list_from_array( \@array, { listattr =>{}, itemattr =>{} } )
+=item &list_from_array( \@array, { listattr =>{}, itemattr =>{} } )
 
 Constructs a XHTML list from \@array.
 
@@ -2890,7 +2940,7 @@
 
 =pod
 
-=item &start_funclist
+=item &start_funclist()
 
 Start list of available functions
 
@@ -2930,7 +2980,7 @@
 
 =pod
 
-=item &add_item_funclist
+=item &add_item_funclist()
 
 Adds an item to the list of available functions
 
@@ -2956,7 +3006,7 @@
 
 =pod
 
-=item &end_funclist
+=item &end_funclist()
 
 End list of available functions
 
@@ -2977,7 +3027,7 @@
 
 =pod
 
-=item funclist_from_array( \@array, {legend => 'text for legend'} )
+=item &funclist_from_array( \@array, {legend => 'text for legend'} )
 
 Constructs a XHTML list from \@array with the first item being visually
 highlighted and set to the value of legend or 'Functions' if legend is




More information about the LON-CAPA-cvs mailing list