[LON-CAPA-cvs] cvs: loncom /html/res/adm/pages process-stop.png /interface loncommon.pm doc/loncapafiles loncapafiles.lpml

www www at source.lon-capa.org
Wed Dec 7 20:16:15 EST 2011


www		Thu Dec  8 01:16:15 2011 EDT

  Added files:                 
    /loncom/html/res/adm/pages	process-stop.png 

  Modified files:              
    /doc/loncapafiles	loncapafiles.lpml 
    /loncom/interface	loncommon.pm 
  Log:
  Towards bugs 2359,4046,5590:
  Eliminate pop-up windows: framework for modal "window"
  
  
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.773 doc/loncapafiles/loncapafiles.lpml:1.774
--- doc/loncapafiles/loncapafiles.lpml:1.773	Tue Dec  6 16:32:24 2011
+++ doc/loncapafiles/loncapafiles.lpml	Thu Dec  8 01:16:08 2011
@@ -2,7 +2,7 @@
  "http://lpml.sourceforge.net/DTD/lpml.dtd">
 <!-- loncapafiles.lpml -->
 
-<!-- $Id: loncapafiles.lpml,v 1.773 2011/12/06 16:32:24 dseaton Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.774 2011/12/08 01:16:08 www Exp $ -->
 
 <!--
 
@@ -7097,6 +7097,7 @@
 feedback.png;
 mngcu.png;
 prob_ana.png;
+process-stop.png;
 role_hotlist.png;
 reload.png;
 self_enroll.png;
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1029 loncom/interface/loncommon.pm:1.1030
--- loncom/interface/loncommon.pm:1.1029	Sun Dec  4 16:27:05 2011
+++ loncom/interface/loncommon.pm	Thu Dec  8 01:16:14 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1029 2011/12/04 16:27:05 www Exp $
+# $Id: loncommon.pm,v 1.1030 2011/12/08 01:16:14 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6634,6 +6634,53 @@
   display: none;
 }
 
+.LCmodal-overlay {
+		position:fixed;
+		top:0;
+		right:0;
+		bottom:0;
+		left:0;
+		height:100%;
+		width:100%;
+		margin:0;
+		padding:0;
+		background:#999;
+		opacity:.75;
+		filter: alpha(opacity=75);
+		-moz-opacity: 0.75;
+		z-index:101;
+}
+
+* html .LCmodal-overlay {   
+		position: absolute;
+		height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
+}
+
+.LCmodal-window {
+		position:fixed;
+		top:50%;
+		left:50%;
+		margin:0;
+		padding:0;
+		z-index:102;
+	}
+
+* html .LCmodal-window {
+		position:absolute;
+}
+
+.LCclose-window {
+		position:absolute;
+		width:32px;
+		height:32px;
+		right:8px;
+		top:8px;
+		background:transparent url('/res/adm/pages/process-stop.png') no-repeat scroll right top;
+		text-indent:-99999px;
+		overflow:hidden;
+		cursor:pointer;
+}
+
 END
 }
 
@@ -6693,7 +6740,7 @@
 	&& !$args->{'frameset'}) {
 	$result .= &help_menu_js();
     }
-
+    $result.=&modal_window();
     if (ref($args->{'redirect'})) {
 	my ($time,$url,$inhibit_continue) = @{$args->{'redirect'}};
 	$url = &Apache::lonenc::check_encrypt($url);
@@ -6818,32 +6865,12 @@
 sub start_page {
     my ($title,$head_extra,$args) = @_;
     #&Apache::lonnet::logthis("start_page ".join(':',caller(0)));
-#SD
-#I don't see why we copy certain elements of %$args to %head_args
-#head args is passed to headtag() and this routine only reads those
-#keys that are needed. There doesn't happen any writes or any processing
-#of other keys.
-#proposal: just pass $args to headtag instead of \%head_args and delete 
-#marked lines
-#<- MARK
-    my %head_args;
-    foreach my $arg ('redirect','force_register','domain','function',
-		     'bgcolor','frameset','no_nav_bar','only_body',
-		     'no_auto_mt_title') {
-	if (defined($args->{$arg})) {
-	    $head_args{$arg} = $args->{$arg};
-	}
-    }
-#MARK ->
 
     $env{'internal.start_page'}++;
     my $result;
 
     if (! exists($args->{'skip_phases'}{'head'}) ) {
-        $result .= 
-                  &xml_begin() . &headtag($title,$head_extra,\%head_args);
-#replace prev line by
-#                 &xml_begin() . &headtag($title, $head_extra, $args);
+        $result .= &xml_begin() . &headtag($title, $head_extra, $args);
     }
     
     if (! exists($args->{'skip_phases'}{'body'}) ) {
@@ -6909,7 +6936,6 @@
 	}
 	$result .= &Apache::lonxml::xmlend($target,$parser);
     }
-
     if ($args->{'frameset'}) {
 	$result .= '</frameset>';
     } else {
@@ -6928,6 +6954,58 @@
     return $result;
 }
 
+sub modal_window {
+    return(<<'ENDMODAL');
+<script type="text/javascript" lang="javascript">
+// <![CDATA[
+// <!-- BEGIN LON-CAPA Internal
+var modalWindow = {
+	parent:"body",
+	windowId:null,
+	content:null,
+	width:null,
+	height:null,
+	close:function()
+	{
+	        $(".LCmodal-window").remove();
+	        $(".LCmodal-overlay").remove();
+	},
+	open:function()
+	{
+		var modal = "";
+		modal += "<div class=\"LCmodal-overlay\"></div>";
+		modal += "<div id=\"" + this.windowId + "\" class=\"LCmodal-window\" style=\"width:" + this.width + "px; height:" + this.height + "px; margin-top:-" + (this.height / 2) + "px; margin-left:-" + (this.width / 2) + "px;\">";
+		modal += this.content;
+		modal += "</div>";	
+
+		$(this.parent).append(modal);
+
+		$(".LCmodal-window").append("<a class=\"LCclose-window\"></a>");
+		$(".LCclose-window").click(function(){modalWindow.close();});
+		$(".LCmodal-overlay").click(function(){modalWindow.close();});
+	}
+};
+	var openMyModal = function(source,width,height)
+	{
+		modalWindow.windowId = "myModal";
+		modalWindow.width = width;
+		modalWindow.height = height;
+		modalWindow.content = "<iframe width='"+width+"' height='"+height+"' frameborder='0' scrolling='no' allowtransparency='true' src='" + source + "'>&lt/iframe>";
+		modalWindow.open();
+	};	
+// END LON-CAPA Internal -->
+// ]]>
+</script>
+ENDMODAL
+}
+
+sub modal_link {
+    my ($link,$linktext,$width,$height,$target)=@_;
+    unless ($width) { $width=480; }
+    unless ($height) { $height=400; }
+    return '<a href="'.$link.'" target="'.$target.'" onclick="openMyModal(\''.$link.'\','.$width.','.$height.'); return false;">'.$linktext.'</a>';
+}
+
 sub html_encode {
     my ($result) = @_;
 




More information about the LON-CAPA-cvs mailing list