+ /**
+ * Returns an array of html code of the following checkboxes:
+ * minor and watch
+ *
+ * @param $tabindex Current tabindex
+ * @param $skin Skin object
+ * @param $checked Array of checkbox => bool, where bool indicates the checked
+ * status of the checkbox
+ *
+ * @return array
+ */
+ public static function getCheckboxes( &$tabindex, $skin, $checked ) {
+ global $wgUser;
+
+ $checkboxes = array();
+
+ $checkboxes['minor'] = '';
+ $minorLabel = wfMsgExt('minoredit', array('parseinline'));
+ if ( $wgUser->isAllowed('minoredit') ) {
+ $attribs = array(
+ 'tabindex' => ++$tabindex,
+ 'accesskey' => wfMsg( 'accesskey-minoredit' ),
+ 'id' => 'wpMinoredit',
+ );
+ $checkboxes['minor'] =
+ Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) .
+ " <label for='wpMinoredit'".$skin->tooltipAndAccesskey('minoredit').">{$minorLabel}</label>";
+ }
+
+ $watchLabel = wfMsgExt('watchthis', array('parseinline'));
+ $checkboxes['watch'] = '';
+ if ( $wgUser->isLoggedIn() ) {
+ $attribs = array(
+ 'tabindex' => ++$tabindex,
+ 'accesskey' => wfMsg( 'accesskey-watch' ),
+ 'id' => 'wpWatchthis',
+ );
+ $checkboxes['watch'] =
+ Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) .
+ " <label for='wpWatchthis'".$skin->tooltipAndAccesskey('watch').">{$watchLabel}</label>";
+ }
+ return $checkboxes;
+ }
+
+ /**
+ * Returns an array of html code of the following buttons:
+ * save, diff, preview and live
+ *
+ * @param $tabindex Current tabindex
+ *
+ * @return array
+ */
+ public function getEditButtons(&$tabindex) {
+ global $wgLivePreview, $wgUser;
+
+ $buttons = array();
+
+ $temp = array(
+ 'id' => 'wpSave',
+ 'name' => 'wpSave',
+ 'type' => 'submit',
+ 'tabindex' => ++$tabindex,
+ 'value' => wfMsg('savearticle'),
+ 'accesskey' => wfMsg('accesskey-save'),
+ 'title' => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']',
+ );
+ $buttons['save'] = wfElement('input', $temp, '');
+
+ ++$tabindex; // use the same for preview and live preview
+ if ( $wgLivePreview && $wgUser->getOption( 'uselivepreview' ) ) {
+ $temp = array(
+ 'id' => 'wpPreview',
+ 'name' => 'wpPreview',
+ 'type' => 'submit',
+ 'tabindex' => $tabindex,
+ 'value' => wfMsg('showpreview'),
+ 'accesskey' => '',
+ 'title' => wfMsg( 'tooltip-preview' ).' ['.wfMsg( 'accesskey-preview' ).']',
+ 'style' => 'display: none;',
+ );
+ $buttons['preview'] = wfElement('input', $temp, '');
+
+ $temp = array(
+ 'id' => 'wpLivePreview',
+ 'name' => 'wpLivePreview',
+ 'type' => 'submit',
+ 'tabindex' => $tabindex,
+ 'value' => wfMsg('showlivepreview'),
+ 'accesskey' => wfMsg('accesskey-preview'),
+ 'title' => '',
+ 'onclick' => $this->doLivePreviewScript(),
+ );
+ $buttons['live'] = wfElement('input', $temp, '');
+ } else {
+ $temp = array(
+ 'id' => 'wpPreview',
+ 'name' => 'wpPreview',
+ 'type' => 'submit',
+ 'tabindex' => $tabindex,
+ 'value' => wfMsg('showpreview'),
+ 'accesskey' => wfMsg('accesskey-preview'),
+ 'title' => wfMsg( 'tooltip-preview' ).' ['.wfMsg( 'accesskey-preview' ).']',
+ );
+ $buttons['preview'] = wfElement('input', $temp, '');
+ $buttons['live'] = '';
+ }
+
+ $temp = array(
+ 'id' => 'wpDiff',
+ 'name' => 'wpDiff',
+ 'type' => 'submit',
+ 'tabindex' => ++$tabindex,
+ 'value' => wfMsg('showdiff'),
+ 'accesskey' => wfMsg('accesskey-diff'),
+ 'title' => wfMsg( 'tooltip-diff' ).' ['.wfMsg( 'accesskey-diff' ).']',
+ );
+ $buttons['diff'] = wfElement('input', $temp, '');
+
+ return $buttons;
+ }
+