http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72106
Revision: 72106
Author: yaron
Date: 2010-09-01 13:55:02 +0000 (Wed, 01 Sep 2010)
Log Message:
-----------
Fixed handling of uploadable/FancyBox links in mutliple-instance templates
Modified Paths:
--------------
trunk/extensions/SemanticForms/includes/SF_FormUtils.php
Modified: trunk/extensions/SemanticForms/includes/SF_FormUtils.php
===================================================================
--- trunk/extensions/SemanticForms/includes/SF_FormUtils.php 2010-09-01
13:54:14 UTC (rev 72105)
+++ trunk/extensions/SemanticForms/includes/SF_FormUtils.php 2010-09-01
13:55:02 UTC (rev 72106)
@@ -247,6 +247,7 @@
var children = new_div.getElementsByTagName('*');
// this array is needed to counteract an IE bug
var orig_children = starter_div.getElementsByTagName('*');
+ var fancybox_ids = new Array();
var x;
for (x = 0; x < children.length; x++) {
if (children[x].name)
@@ -259,6 +260,10 @@
if (children[x].href)
children[x].href = children[x].href
.replace(/input_/g, 'input_' + num_elements +
'_');
+ if (children[x].id.match("^fancybox")) {
+ fancybox_ids.push(children[x].id);
+ }
+
// for dropdowns, copy over selectedIndex from original div,
// to get around a bug in IE
if (children[x].type == 'select-one') {
@@ -288,9 +293,21 @@
//Add the new instance
main_div.appendChild(new_div);
attachAutocompleteToAllFields(new_div);
-
- //In order to add the new instances in multiple floatBox (multiple
templates)
- fb.tagAnchors(self.document);
+
+ // For each 'upload file' link in this latest instance,
+ // add a call to fancybox()
+ for (x = 0; x < fancybox_ids.length; x++) {
+ jQuery("#" + fancybox_ids[x]).fancybox({
+ 'width' : '75%',
+ 'height' : '75%',
+ 'autoScale' : false,
+ 'transitionIn' : 'none',
+ 'transitionOut' : 'none',
+ 'type' : 'iframe',
+ 'overlayColor' : '#222',
+ 'overlayOpacity' : '0.8',
+ });
+ }
}
function removeInstanceEventHandler(this_div_id)
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs