r95300 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95299‎ | r95300 | r95301 >
Date:07:40, 23 August 2011
Author:jeroendedauw
Status:deferred
Tags:lamecommitsummary 
Comment:
fu r95298, some initial work
Modified paths:
  • /trunk/extensions/Survey/INSTALL (modified) (history)
  • /trunk/extensions/Survey/Survey.hooks.php (modified) (history)
  • /trunk/extensions/Survey/Survey.php (modified) (history)
  • /trunk/extensions/Survey/Survey.settings.php (modified) (history)
  • /trunk/extensions/Survey/Survey.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/Survey/Survey.settings.php
@@ -0,0 +1,44 @@
 2+<?php
 3+
 4+/**
 5+ * File defining the settings for the Survey extension.
 6+ * More info can be found at http://www.mediawiki.org/wiki/Extension:Survey#Settings
 7+ *
 8+ * NOTICE:
 9+ * Changing one of these settings can be done by assigning to $egSurveySettings,
 10+ * AFTER the inclusion of the extension itself.
 11+ *
 12+ * @since 0.1
 13+ *
 14+ * @file Survey.settings.php
 15+ * @ingroup Survey
 16+ *
 17+ * @licence GNU GPL v3+
 18+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
 19+ */
 20+class SurveySettings {
 21+
 22+ protected static function getDefaultSettings() {
 23+ return array(
 24+ );
 25+ }
 26+
 27+ public static function getSettings() {
 28+ static $settings = false;
 29+
 30+ if ( $settings === false ) {
 31+ $settings = array_merge(
 32+ self::getDefaultSettings(),
 33+ $GLOBALS['egSurveySettings']
 34+ );
 35+ }
 36+
 37+ return $settings;
 38+ }
 39+
 40+ public static function get( $settingName ) {
 41+ $settings = self::getSettings();
 42+ return array_key_exists( $settingName, $settings ) ? $settings[$settingName] : null;
 43+ }
 44+
 45+}
Index: trunk/extensions/Survey/Survey.php
@@ -0,0 +1,63 @@
 2+<?php
 3+
 4+/**
 5+ * Initialization file for the Survey extension.
 6+ *
 7+ * Documentation: http://www.mediawiki.org/wiki/Extension:Survey
 8+ * Support http://www.mediawiki.org/wiki/Extension_talk:Survey
 9+ * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Survey
 10+ *
 11+ * @file Survey.php
 12+ * @ingroup Survey
 13+ *
 14+ * @licence GNU GPL v3+
 15+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
 16+ */
 17+
 18+/**
 19+ * This documenation group collects source code files belonging to Survey.
 20+ *
 21+ * @defgroup Survey Survey
 22+ */
 23+
 24+if ( !defined( 'MEDIAWIKI' ) ) {
 25+ die( 'Not an entry point.' );
 26+}
 27+
 28+if ( version_compare( $wgVersion, '1.16', '<' ) ) {
 29+ die( '<b>Error:</b> Survey requires MediaWiki 1.16 or above.' );
 30+}
 31+
 32+define( 'Survey_VERSION', '0.1 alpha' );
 33+
 34+$wgExtensionCredits['other'][] = array(
 35+ 'path' => __FILE__,
 36+ 'name' => 'Survey',
 37+ 'version' => Survey_VERSION,
 38+ 'author' => array(
 39+ '[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]',
 40+ ),
 41+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Survey',
 42+ 'descriptionmsg' => 'survey-desc'
 43+);
 44+
 45+$wgExtensionMessagesFiles['Survey'] = dirname( __FILE__ ) . '/Survey.i18n.php';
 46+
 47+$wgAutoloadClasses['SurveyHooks'] = dirname( __FILE__ ) . '/Survey.hooks.php';
 48+$wgAutoloadClasses['SurveySettings'] = dirname( __FILE__ ) . '/Survey.settings.php';
 49+
 50+$wgAutoloadClasses['ApiAddSurvey'] = dirname( __FILE__ ) . '/api/ApiAddSurvey.php';
 51+$wgAutoloadClasses['ApiDeleteSurvey'] = dirname( __FILE__ ) . '/api/ApiDeleteSurvey.php';
 52+$wgAutoloadClasses['ApiEditSurvey'] = dirname( __FILE__ ) . '/api/ApiEditSurvey.php';
 53+$wgAutoloadClasses['ApiQuerySurveys'] = dirname( __FILE__ ) . '/api/ApiQuerySurveys.php';
 54+$wgAutoloadClasses['ApiSubmitSurvey'] = dirname( __FILE__ ) . '/api/ApiSubmitSurvey.php';
 55+
 56+$wgAutoloadClasses['Survey'] = dirname( __FILE__ ) . '/includes/Survey.class.php';
 57+
 58+$wgAutoloadClasses['SpecialSurveys'] = dirname( __FILE__ ) . '/specials/SpecialSurveys.php';
 59+$wgAutoloadClasses['SpecialSurveyStats'] = dirname( __FILE__ ) . '/specials/SpecialSurveyStats.php';
 60+
 61+$wgSpecialPages['SpecialSurveys'] = 'SpecialSurveys';
 62+$wgSpecialPages['SpecialSurveyStats'] = 'SpecialSurveyStats';
 63+
 64+$egSurveySettings = array();
Index: trunk/extensions/Survey/Survey.hooks.php
@@ -0,0 +1,18 @@
 2+<?php
 3+
 4+/**
 5+ * Static class for hooks handled by the Survey extension.
 6+ *
 7+ * @since 0.1
 8+ *
 9+ * @file Survey.hooks.php
 10+ * @ingroup Survey
 11+ *
 12+ * @licence GNU GPL v3+
 13+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
 14+ */
 15+final class SurveyHooks {
 16+
 17+
 18+
 19+}
Index: trunk/extensions/Survey/INSTALL
@@ -36,8 +36,8 @@
3737 == Configuration ==
3838
3939 Configuration of Survey is done by assigning to $egSurveySettings in your
40 -[[Manual:LocalSettings.php|LocalSettings.php]] file. The options are
41 -listed below and their default is set in the Survey settings file [0].
 40+[[Manual:LocalSettings.php|LocalSettings.php]] file, AFTER the inlcusion of the
 41+extension. The options are listed below and their default is set in the Survey settings file [0].
4242 You should NOT modify the settings file, but can have a look at it to get an idea of
4343 how to use the settings, in case the below descriptions do not suffice.
4444
Index: trunk/extensions/Survey/Survey.sql
@@ -0,0 +1,37 @@
 2+-- MySQL version of the database schema for the Survey extension.
 3+-- Licence: GNU GPL v3+
 4+-- Author: Jeroen De Dauw < jeroendedauw@gmail.com >
 5+
 6+-- Surveys
 7+CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/surveys (
 8+ survey_id SMALLINT unsigned NOT NULL auto_increment PRIMARY KEY,
 9+ survey_name VARCHAR(255) NOT NULL,
 10+ survey_enabled TINYINT NOT NULL default '0'
 11+) /*$wgDBTableOptions*/;
 12+
 13+-- Questions
 14+CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/survey_questions (
 15+ question_id INT(10) unsigned NOT NULL auto_increment PRIMARY KEY,
 16+ question_survey_id SMALLINT unsigned NOT NULL, -- Foreign key: surveys.survey_id
 17+ question_text TEXT NOT NULL,
 18+ question_type INT(2) unsigned NOT NULL,
 19+ question_required INT(2) unsigned NOT NULL,
 20+ question_answers BLOB NOT NULL
 21+) /*$wgDBTableOptions*/;
 22+
 23+-- Submissions
 24+CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/survey_submissions (
 25+ submission_id INT(10) unsigned NOT NULL auto_increment PRIMARY KEY,
 26+ submission_survey_id SMALLINT unsigned NOT NULL, -- Foreign key: surveys.survey_id
 27+ submission_user_name VARCHAR(255) NOT NULL, -- The person that made the submission (account name or ip)
 28+ submission_page_id INT(10) unsigned NULL, -- The id of the page the submission was made on
 29+ submission_time CHAR(14) binary NOT NULL default '' -- The time the submission was made
 30+) /*$wgDBTableOptions*/;
 31+
 32+-- Answers
 33+CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/survey_answers (
 34+ answer_id SMALLINT unsigned NOT NULL auto_increment PRIMARY KEY,
 35+ answer_submission_id INT(10) unsigned NOT NULL, -- Foreign key: survey_submissions.submission_id
 36+ answer_question_id INT(10) unsigned NOT NULL, -- Foreign key: survey_questions.question_id
 37+ answer_text BLOB NOT NULL
 38+) /*$wgDBTableOptions*/;
\ No newline at end of file

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r95298importing Survey extensionjeroendedauw04:45, 23 August 2011

Status & tagging log