Extension talk:DynamicTabs

Please report new issues at the bug tracker: http://code.google.com/p/micke/issues/list

suggestion to hide new tabs from users
Issue moved to: http://code.google.com/p/micke/issues/detail?id=1 MiCkE 11:19, 3 October 2009 (UTC)

Small issue with DPL
Issue moved to: http://code.google.com/p/micke/issues/detail?id=2 MiCkE 11:17, 3 October 2009 (UTC)

Just a little request
Issue moved to: http://code.google.com/p/micke/issues/detail?id=3 MiCkE 11:16, 3 October 2009 (UTC)

Manage Tabs for Anonymous user
Issue moved to: http://code.google.com/p/micke/issues/detail?id=4 MiCkE 11:22, 3 October 2009 (UTC)

Bugs in code
Issue moved to: http://code.google.com/p/micke/issues/detail?id=5 MiCkE 11:24, 3 October 2009 (UTC)

internal links...
This issue is reported as: http://code.google.com/p/micke/issues/detail?id=6 MiCkE 09:28, 30 October 2009 (UTC)

Turn off Subpages
Is it possible to turn off subpages, so the tabs don't apply to the subpages, but just the main page or article?
 * Dont think this extension is supported anymore but I'll second this anyway in case someone takes it over. Without controls you can end up with extreme subpaging like Help:Help:Help:Help:Help:Help:Pagename. This is unacceptable and reduces the use of this ext to a source tab blocker. ~ 19:35, 26 March 2011 (UTC)

Hide Extension Tabs
The documentation gives a list of the standard tabs shown in MW but what if an extension adds a new tab i only want to show to sysops? I use Semantic Mediawiki and Semantic Forms which adds a tab called "edit with form". I want to turn this tab off for anonymous. Is there a handle i can pull from the tab to turn it off? When i look at the other tabs the URL shows me the name to use to turn them off. This URL ends in the page title then "action=" and the name of the tab. If i add #edit to dynamic tabs page it turns off edit tab for anons. But my new tab called "form edit" wont turn off if i add "#formedit" to my dynamic tabs page. Any ideas on how to identify and turn off custom tabs?

Thanks!

Link Back to Main page from Namespaces
So I've got this working. The problem is that once I get into the custom namespace tab, it's very difficult to get back to the main page. Anyone have any suggestions on settings that will add a "Main Page" tab to any "subpages"? Yeah, I know this extension isn't technically supported anymore. I'm just looking for advice.

Thanks.

Suggestion of improvement for work with recent versions of MW
Hi, I presently use an application of MW 1.24, on which I wanted to us the nsTab feature of DynamicTabs. The following code seems to be up-to-date considering this feature only (I did not improve further, other features won't operate) and for pages in main namespace only. A tab named 'page' allows to go back to top page where the tab link has been followed. If that can bring any help...

DynamicTabs.php looks then like that (other features following nsTab are commented) :

 'DynamicTabs',	'version' => '0.5.3',	'author' => 'Micke Nordin, David Öhlin',	'url' => 'http://www.mediawiki.org/wiki/Extension:DynamicTabs',	'description' => 'Adds and removes custom tabs', );

function dynamicTabs( $skin, &$links) { //, modified following http://stackoverflow.com/questions/12192641/how-to-add-custom-tab-button-with-external-link, ynedelec3 global $wgUser, $wgTitle, $wgCanonicalNamespaceNames, $wgScriptPath; $organizedArray = getTabsConfig; //Call the function that reads Mediawiki:DynamicTabs if ($wgTitle->mNamespace != 0) {//Bugfix when used with Extension:DPL $nsVar = $wgCanonicalNamespaceNames[$wgTitle->mNamespace]; //Get namespace name } else { $nsVar = MWNamespace::getCanonicalName(NS_MAIN); }		if(isset($organizedArray["nsTabs"])) { foreach($organizedArray["nsTabs"] as $it) {//Loop array of the tabs if($nsVar == MWNamespace::getCanonicalName(NS_MAIN) OR $nsVar == $it) { $page = Title::newFromText( trim($it) . ':' . $wgTitle->getText); $href = $page->getLocalUrl; $links['namespaces'][trim(strtolower($it))] = Array(					'class' => (trim($it) == $nsVar?'selected':''),					'text' => $it,					'href' => $href,					); if ($nsVar == $it) { $topPage = Title::newFromText($wgTitle->getText); $topHref = $topPage->getLocalUrl; $links['namespaces']['page'] = Array(						'class' => (trim($it) == $nsVar?'selected':''),						'text' => 'page',						'href' => $topHref,						); }				}			}

//Next features are disabled, ynedelec3 ////if(isset($organizedArray["intLinks"])) {//Display internal links ////foreach($organizedArray["intLinks"] as $it) { ////$arr = myParser($it, '|'); ////$page = Title::newFromText($arr[0]); ////$href = $page->getLocalUrl; ////$content_actions[$arr[1]] = Array(				////'class' => ($arr[0] == $wgTitle->getText?'selected':''),				////'text' => $arr[1],				////'href' => $href,				////); ////}		////} //// 		////if(isset($organizedArray["extLinks"])) {//Display external links ////foreach($organizedArray["extLinks"] as $it) { ////$arr = myParser($it, ' '); ////$content_actions[$arr[1]] = Array(				////'text' => $arr[1],				////'href' => $arr[0],				////); ////}		////} 	////} //// 		////foreach($content_actions as $key => $value)	{//Loop all tabs ////if ( $wgUser->isAnon ) {//If user is anonymous ////if(isset($organizedArray["hideAnonymous"]) and 			////in_array($key, $organizedArray["hideAnonymous"])) {//And it's a tab we want to hide ////unset($content_actions[$key]); //Hide it			////} ////} else if ( !in_array('sysop', $wgUser->getGroups) and !$wgUser->isAnon ) {//If user is not sysop ////if(isset($organizedArray["hideUser"]) and in_array($key, $organizedArray["hideUser"])) {//And it's a tab we want to hide ////unset($content_actions[$key]); //Hide it			////} //// 		////} else if(in_array('sysop', $wgUser->getGroups) and 		////isset($organizedArray["hideSysop"]) and in_array($key, $organizedArray["hideSysop"]) ) {//Hide tabs from sysops ////unset($content_actions[$key]); //Hide tab ////}	} 	return true; }

function getTabsConfig { $organizedArray = array; //initialize variable if config page is empty, to avoid pollution of the template if PHP error messages are activated $dynTabsPage = Article::newFromId(Title::newFromText("Mediawiki:DynamicTabs")->getArticleId); //Get MediaWiki:DynamicTabs if(isset($dynTabsPage)) {//If that worked $dynTabsText = explode("*", $dynTabsPage->getRawText); //Make an array of that string foreach($dynTabsText as $list) {//Loop array $list = trim($list); //Remove surrounding white spaces if (strpos($list, "hideAnonymous")!== false) { //Do the tabs that should be hidden from anonymous viewer $organizedArray["hideAnonymous"] = array_slice( explode("#", $list), 1); //Remove title and make an array of the rest foreach($organizedArray["hideAnonymous"] as $key => $value) {//Loop array $organizedArray["hideAnonymous"][$key] = trim($value); //And remove white spaces }					}			if (strpos($list, "hideUser")!== false) { //Do the tabs that should be hidden :from users $organizedArray["hideUser"] = array_slice( explode("#", $list), 1); //Remove title and make an array of the rest foreach($organizedArray["hideUser"] as $key => $value) {//Loop array $organizedArray["hideUser"][$key] = trim($value); //And remove white spaces }			}		   if (strpos($list, "hideSysop")!== false) { //Do the tabs that should be hidden from sysops $organizedArray["hideSysop"] = array_slice( explode("#", $list), 1); foreach($organizedArray["hideSysop"] as $key => $value) {//Remove title and make an array of the rest $organizedArray["hideSysop"][$key] = trim($value); //And remove white spaces }		   }		    if (strpos($list, "nsTabs") !== false) {//Do the tabs that should be added based on namespaces $organizedArray["nsTabs"] = array_slice( explode("#", $list), 1); //Remove title }		   if (strpos($list, "intLinks") !== false) {//Do static internal links $organizedArray["intLinks"] = array_slice( explode("#", $list), 1); //Remove title }		   if (strpos($list, "extLinks") !== false) {//Do static external links $organizedArray["extLinks"] = array_slice( explode("#", $list), 1); //Remove title }	   } 	}	return $organizedArray; //Return the organized arrays stored in another array }

function myParser($string, $explodeBy) { $stringArr = explode($explodeBy, trim($string, "[] \n")); //explode by $explodeBy var

if(count($stringArr) < 2) {//If there was no second argument, put the string in the second slot $arr[] = trim($string, "[] \n"); $arr[] = trim($string, "[] \n"); } else {//else all is well $arr = $stringArr; }

return $arr; //return the parsed array }