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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 19 May 2008 17:00:24 -0000


raeburn		Mon May 19 13:00:24 2008 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  - Link and javascript to pop-up "Select author" window for DC to select an author, when an ad hoc co-author role is being assumed.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.652 loncom/interface/loncommon.pm:1.653
--- loncom/interface/loncommon.pm:1.652	Wed Apr 30 19:36:56 2008
+++ loncom/interface/loncommon.pm	Mon May 19 13:00:22 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.652 2008/04/30 23:36:56 raeburn Exp $
+# $Id: loncommon.pm,v 1.653 2008/05/19 17:00:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -447,6 +447,25 @@
    return '';
 }
 
+sub authorbrowser_javascript {
+    return <<"ENDAUTHORBRW";
+<script type="text/javascript">
+var stdeditbrowser;
+
+function openauthorbrowser(formname,udom) {
+    var url = '/adm/pickauthor?';
+    url += 'form='+formname+'&roledom='+udom;
+    var title = 'Author_Browser';
+    var options = 'scrollbars=1,resizable=1,menubar=0';
+    options += ',width=700,height=600';
+    stdeditbrowser = open(url,title,options,'1');
+    stdeditbrowser.focus();
+}
+
+</script>
+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');
@@ -584,6 +603,12 @@
         '","'.$udomele.'","'.$desc.'","'.$extra_element.'","'.$multflag.'","'.$selecttype.'");'."'>".&mt('Select Course')."</a>";
 }
 
+sub selectauthor_link {
+   my ($form,$udom)=@_;
+   return '<a href="javascript:openauthorbrowser('."'$form','$udom'".');">'.
+          &mt('Select Author').'</a>';
+}
+
 sub check_uncheck_jscript {
     my $jscript = <<"ENDSCRT";
 function checkAll(field) {