Last modified: 2012-09-27 01:10:44 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T21559, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 19559 - JS addPortletLink() should perhaps have vector specific code in order to be compatible
JS addPortletLink() should perhaps have vector specific code in order to be c...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Interface (Other open bugs)
1.13.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Trevor Parscal
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-07-07 02:44 UTC by Bawolff (Brian Wolff)
Modified: 2012-09-27 01:10 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Bawolff (Brian Wolff) 2009-07-07 02:44:47 UTC
Very similar to Bug 19531 . Basically, Vector changes the portlet structure of the html, thus making the javascript function addPortletLink() not work as expected in some cases. Perhaps there should be some special case code in the function to make it compatible with vector in so much that it would behave in the way most closey to that as it would on monobook.

For example if in vector, addPortletLink() should do the following:
 if the portlet id is namespaces or views it should wrap the new portlet link in a span
 if on vector, and portlet id is 'p-personal' it should make it go to the id 'personal'
 if on vector, and portlet id is 'p-cactions' it should make it go to id 'actions' (as thats the closest)

Modifying the function from wikibits as follows would accomplish that:

function addPortletLink(portlet, href, text, id, tooltip, accesskey, nextnode) {
        var wrapSpan = false; //default
        if (skin === "vector") {
            if (portlet === "namespaces"  || portlet === "views") {
                wrapSpan = true;
            }
            else if (portlet === 'p-personal') {
                portlet = 'personal';
            }
            else if (portlet === 'p-cactions') {
                portlet = 'actions';
            }
        
        }
	var node = document.getElementById(portlet);
	if ( !node ) return null;
	node = node.getElementsByTagName( "ul" )[0];
	if ( !node ) return null;

	var link = document.createElement( "a" );
        var linkText;
        if (wrapSpan) {
        linkText = document.createElement('span');
	linkText.appendChild( document.createTextNode( text ) );
        } else {
        linkText = document.createTextNode( text );
        }

	link.appendChild( linkText );
	link.href = href;

	var item = document.createElement( "li" );
	item.appendChild( link );

	if ( id ) item.id = id;

	if ( accesskey ) {
		link.setAttribute( "accesskey", accesskey );
		tooltip += " ["+accesskey+"]";
	}
	if ( tooltip ) {
		link.setAttribute( "title", tooltip );
	}
	if ( accesskey && tooltip ) {
		updateTooltipAccessKeys( new Array( link ) );
	}

	if ( nextnode && nextnode.parentNode == node )
		node.insertBefore( item, nextnode );
	else
		node.appendChild( item );  // IE compatibility (?) 

	return item;
}

Thanks,
[[n:user:Bawolff]]
Comment 1 Roan Kattouw 2009-07-07 20:54:12 UTC
Fixed differently in r52855 by renaming actions to p-cactions. addPortletLink() now successfully adds dropdown actions in Vector, although it's not possible to add namespace or action tabs (but those categories don't even exist in Monobook and other skins anyway).
Comment 2 Bawolff (Brian Wolff) 2009-07-08 01:02:00 UTC
How about 'personal' to 'p-personal'. As far as i can tell that portlet is almost identical to monobook, and there are things that add to it. (For example the utcclock gadget on enwikinews, but thats a bad example as it was recently modified to detect vector, and handle the differences).

Well the namespace tabs don't exist on monobook, it would still be very nice to be able to add to them, and necessary for any gadget that makes it look like there are more linked namespaces than the standard 2.
Comment 3 Roan Kattouw 2009-07-08 03:09:52 UTC
(In reply to comment #2)
> How about 'personal' to 'p-personal'. As far as i can tell that portlet is
> almost identical to monobook, and there are things that add to it. (For example
> the utcclock gadget on enwikinews, but thats a bad example as it was recently
> modified to detect vector, and handle the differences).
> 
This has already happened on trunk, and will likely be pushed live tomorrow.

> Well the namespace tabs don't exist on monobook, it would still be very nice to
> be able to add to them, and necessary for any gadget that makes it look like
> there are more linked namespaces than the standard 2.
> 
You can do this, but you'd have to differ between skins anyway because of the inherent incompatibility.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links