Skin talk:Monaco

Add topic
From mediawiki.org
Latest comment: 7 days ago by WikiForMen in topic Handling of themes

Untitled[edit]

WikiApiary has many examples of wikis that use this skin. Leucosticte (talk) 05:36, 1 May 2014 (UTC)Reply

working on 1.24?[edit]

I have been using Monaco on my 1.19 install for a few years and am now looking to upgrade to 1.24 - I had no luck getting the skin to work on my test site. Is this skin working on the latest version of mediawiki ? --Stampstudy (talk) 23:15, 22 December 2014 (UTC)Reply

Arcane21 version[edit]

It's better and has a lot of fixes to work properly, not just thrown onto MW. Lieutenant Aleksandr Reznov 04:47, 15 January 2015 (UTC)Reply

Thank you, for some reason I did not see the version for Arcane. I have this now installed on my wiki and have the wiki updated to 1.24. The only issue I can see so far is the menu not working correctly under Internet Explorer. The second level links are not working on my site under countries - http://www.stampsoftheworld.co.uk/ --Stampstudy (talk) 14:23, 26 January 2015 (UTC)Reply
The formatting of your monaco-sidebar system message doesn't look correct, as it's trying to use external links. The format should be articletitle|text - I believe you can specify any anchor tags after the article title and they should work, though I've never tried it personally (like Foo#A|A). See here for a functional example. --QuasarEE (talk) 05:02, 2 February 2015 (UTC)Reply

monaco[edit]

Maintained open fork[edit]

I mentioned this on IRC but I am maintaining an updated version of this skin's code base on github, for use on DoomWiki.org, and while the skin is in wide use, most users of it haven't open-sourced their work so far. When we updated to 1.22, this issue was bad enough (emailed multiple wikis' bureaucrats to ask for their code, only to receive no replies) to prompt me to learn php, jQuery, and the MediaWiki API just to take over maintenance of the code base for our personal use. I believe my fork could be generally useful to people who want to use the Monaco skin, and so I'd like to revamp this page to be less centered on the now very dated dantman fork, which doesn't work out of the tar.gz with anything > MediaWiki 1.18 and includes my own fork. Besides fixing various bugs and regression issues, I have also started development on a new sidebar widget system replacing the original Wikia php system with a frontend-driven, Extension:Gadgets-compatible JavaScript solution. I didn't want to add the info here without sufficient discussion and have it look like some type of conflict of interest, so this is my proposal. --QuasarEE (talk) 12:24, 15 August 2014 (UTC)Reply

Update: Wanted to note that my current code base is compatible with MediaWiki up to v1.29 currently, and is probably trivially patchable for v1.30 (haven't tried yet as my site runs on LTS releases). --QuasarEE (talk) 05:26, 21 August 2018 (UTC)Reply

SkinMonaco (hope, MediaWiki 1.34.0 Support)[edit]

-P1ayer (talk) 15:51, 13 March 2020 (UTC)Reply

Hook for insert a Donate Button[edit]

			<!-- haleyjd 20140420: FIXME: DoomWiki.org-specific; make generic! -->
			<!--
			<tr>
				<td colspan="2" style="text-align:center;">
					<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
						<input type="hidden" name="cmd" value="_s-xclick">
						<input type="hidden" name="hosted_button_id" value="D5MLUSDXA8HMQ">
						<input type="image" src="' . $this->get('stylepath') . '/Monaco/style/images/contribute-button.png" name="submit" alt="PayPal - The safer, easier way to pay online!" style="border: 0; width:139px; margin:0;">
						<img alt="" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1" style="border: 0;">
					</form>
				</td>
			</tr>
			-->
		</tbody>';
	}
	// END: create static box
	$html .= '</table>
			</div>
			<!-- /SEARCH/NAVIGATION -->' .
		$this->printExtraSidebar();
Hooks::run( 'MonacoSidebarEnd', [ $this ] );

Doom Wiki still runs with MediaWiki version 1.27 using a fork maintained by James Haley. The request from haleyjd in the comments section above to make this generic is from 2014-04-20.

This was ten years ago and it's time to replace this proprietary solution for the Doom Wiki with a hook that allows the insertion of a donate button through an extension. For example MonacoStaticboxEnd:

		</tbody>';
	}
	// END: create static box
	$html .= '</table>';
Hooks::run( 'MonacoStaticboxEnd', [ $this, &$html ] );
	$html .= '</div>
			<!-- /SEARCH/NAVIGATION -->' .
		$this->printExtraSidebar();
Hooks::run( 'MonacoSidebarEnd', [ $this, &$html ] );

WikiForMen (talk) 15:22, 25 April 2024 (UTC)Reply

Handling of themes[edit]

I spend two day to figure out, how the theme thing works.

I tried the skins Bouquet, Dusk, and Gamepress with extension Theme and they work fine.

Monaco does not. I can get the theme layout adding i.e. &usetheme=sky to the url, but thats all. :-(

And it is possible to set a default theme as $wgMonacoTheme = "sky";. But it is not possible to select the themes in the preferences.

Who is familiar with this topic and can contribute something? WikiForMen (talk) 20:49, 2 May 2024 (UTC)Reply

I spent one day and night more and got it run! ;-)
The first issue is, that the skins Bouquet, Dusk, and Gamepress are using something like
	"ThemeModules": {
		"monaco": [ "/*comma separated list of theme names*/" ]
	},
in the style.php with the "manifest_version" 1. ThemeModules seems not to work with "manifest_version" 2, so I went back to Schema 1.
The second issue is, that skin Monaco does not work with Theme. I haven't really figured out the why. However, I did find out that the skin has (almost) everything to run the themes without the extension. I had to add two things:
  1. UserOptionsLookup and
  2. the hook GetPreferences
As I noticed, this ThemeModulesin the style.php, which the other skins with theme support use, is only required by the Theme extension. In this case the [ "/*comma separated list of theme names*/" ] can be hardcoded and everything is fine. :-)
Feel free on testing: Version 2.8.0 WikiForMen (talk) 05:10, 3 May 2024 (UTC)Reply
Finally I substituted this portion of code in class SkinMonaco
use MediaWiki\MediaWikiServices;
use MediaWiki\Revision\SlotRecord;

[...]

		$theme = $this->config->get( 'MonacoTheme' );
        
		if ( $this->config->get( 'MonacoAllowUseTheme' ) ) {
			$theme = $this->getRequest()->getText( 'usetheme', $theme );
			if ( preg_match( '/[^a-z]/', $theme ) ) {
				$theme = $this->config->get( 'MonacoTheme' );
			}
		}
		if ( preg_match( '/[^a-z]/', $theme ) ) {
			$theme = 'sapphire';
		}
		
		// Theme is another conditional feature, we can't really resource load this
		if ( isset( $theme ) && is_string( $theme ) && $theme != 'sapphire' ) {
			$out->addStyle( "Monaco/style/{$theme}/css/main.css", 'screen' );
		}
with this one:
use MediaWiki\MediaWikiServices;
use MediaWiki\Revision\SlotRecord;
use MediaWiki\User\UserOptionsLookup;

[...]

		$request = $this->getRequest();
		$user = RequestContext::getMain()->getUser();
		// Check the following things in this order:
		// 1) value of $wgDefaultTheme (set in site configuration)
		// 2) user's personal preference/override
		// 3) per-page usetheme URL parameter
		$theme = $this->config->get( 'MonacoTheme' );
		$theme = $this->mUserOptionsLookup->getOption( $user, 'theme', $theme );
		$theme = $request->getText( 'usetheme', $theme );
		
		$themes = SkinMonaco::getSkinMonacoThemeList();
		$theme_fallback = SkinMonaco::getSkinMonacoDefaultTheme();
		if ( !in_array( $theme, $themes ) ) {
			$theme = $theme_fallback;
		}
		
		if ( $this->config->get( 'MonacoAllowUseTheme' ) ) {
			// Theme is another conditional feature, we can't really resource load this
			if ( $theme !== $theme_fallback ) {
				$out->addStyle( "Monaco/style/{$theme}/css/main.css", 'screen' );
			}
		}
That should take care of most of the work. But wait a moment! There is another problem with style.php, which has issues with Extension:Theme in "manifest_version" 2.
And then there's the matter of using the global variable $wgMonacoAllowUsetheme to enable and disable theme selection in the configuration. The "Theme" extension cannot handle this at all! And anyway! Why bother with an additional extension at all?
All that is needed is the additional provision of the hook function for "GetPreferences"! Plus the two static convenience functions:
	public static function getSkinMonacoDefaultTheme() {
		return "sapphire";
	}
	public static function getSkinMonacoThemeList() {
		return [ "beach", "brick", "carbon", "forest", "gaming", "jade", "moonlight", "obsession", "ruby", "sapphire", "sky", "slate", "smoke", "spring" ];
	}
This means that the Monaco skin works without any theme extension. ;-) WikiForMen (talk) 18:43, 4 May 2024 (UTC)Reply