]> git.mjollnir.org Git - moodle.git/commitdiff
Added a per-wiki option to allow disabling of automatic camel case linking.
authormchurch <mchurch>
Thu, 24 Jun 2004 15:56:01 +0000 (15:56 +0000)
committermchurch <mchurch>
Thu, 24 Jun 2004 15:56:01 +0000 (15:56 +0000)
If pages have been created using camel case, and this option is activated, those pages remain, but may not be linkable. If the option is disabled, they will be linked again.

lang/en/help/wiki/studentadminoptions.html
lang/en/help/wiki/wikilinkoptions.html [new file with mode: 0644]
lang/en/wiki.php
mod/wiki/db/mysql.php
mod/wiki/db/mysql.sql
mod/wiki/ewiki/ewiki.php
mod/wiki/lib.php
mod/wiki/mod.html
mod/wiki/version.php
mod/wiki/view.php

index 59d7535cb1f17fea85ba29559ea7f688837aebed..19a9b07789fca11c812920e31028cc50b6d321bb 100644 (file)
@@ -1,4 +1,4 @@
-<P ALIGN=CENTER><B>Allow Binary Files</B></P>
+<P ALIGN=CENTER><B>Student Administration Options</B></P>
 
 <P>Certain administration options can be turned 'on' or 'off' for students. When 'on', these options only
 take affect for wikis that can be edited by the student. When 'off', they will not appear in the administrator
diff --git a/lang/en/help/wiki/wikilinkoptions.html b/lang/en/help/wiki/wikilinkoptions.html
new file mode 100644 (file)
index 0000000..65e5385
--- /dev/null
@@ -0,0 +1,10 @@
+<P ALIGN=CENTER><B>Wiki Auto-linking Options</B></P>
+
+<P>In certain situations, you may not want automatic linking based on CamelCase words.
+If this is so, check this box to disable CamelCase linking.
+</p>
+<p>
+<b>WARNING</b> -- CamelCase is a standard wiki feature, and disabling it may cause other
+imported wikis to work incorrectly. Use this feature <i>only</i> if you are absolutely certain
+you do not want CamelCase linking.
+</P>
index 73429834145c5b3a87f62f5522ac42ed5360cc11..566824f197cdef6f2dc65dc0315adae429da3913 100644 (file)
@@ -10,6 +10,7 @@ $string['wikitype'] = 'Type';
 $string['ewikiprinttitle'] = 'Print the wiki name on every page.';
 $string['htmlmode'] = 'HTML Mode';
 $string['ewikiacceptbinary'] = 'Allow binary files';
+$string['wikilinkoptions'] = 'Wiki auto-linking options';
 $string['studentadminoptions'] = 'Student admin options';
 $string['initialcontent'] = 'Choose an Initial Page';
 $string['chooseafile'] = 'Choose/upload initial page';
index e6421f7c3098106c73785d9d70793b74bc7d5886..1fbb95e76b16c72edec051255cc5e68f479e61f8 100644 (file)
@@ -46,6 +46,11 @@ function wiki_upgrade($oldversion) {
                     .' ADD `revertchanges` TINYINT DEFAULT \'1\' NOT NULL AFTER `removepages`');
     }
 
+    if ($oldversion < 2004062400) {
+        execute_sql('ALTER TABLE `'.$CFG->prefix.'wiki`'
+                    .' ADD `disablecamelcase` TINYINT DEFAULT \'0\' NOT NULL AFTER `ewikiacceptbinary`');
+    }
+
     return true;
 }
 
index d52f88120a757c95f271a89db32382cbb8c5c135..7bef549eb1944b62ec9cedb47139c99bdaf2b857 100644 (file)
@@ -15,6 +15,7 @@ CREATE TABLE `prefix_wiki` (
   `ewikiprinttitle` tinyint(4) NOT NULL default '1',
   `htmlmode` tinyint(4) NOT NULL default '0',
   `ewikiacceptbinary` tinyint(4) NOT NULL default '0',
+  `disablecamelcase` tinyint(4) NOT NULL default '0',
   `setpageflags` tinyint(4) NOT NULL default '1',
   `strippages` tinyint(4) NOT NULL default '1',
   `removepages` tinyint(4) NOT NULL default '1',
index 17c79c8edf721acb4e9bffd4ddafc837a8d7359b..e06defcc897437aa730cc6c4193f23587e0dc541 100644 (file)
        define("EWIKI_AUTO_LOGIN", 1);          # [auth_query] on startup
 
        #-- allowed WikiPageNameCharacters
-       define("EWIKI_CHARS_L", "a-z_µ¤$\337-\377");
-       define("EWIKI_CHARS_U", "A-Z0-9\300-\336");
+
+#### BEGIN MOODLE CHANGES - to remove auto-camelcase linking.   
+    global $moodle_disable_camel_case;   
+    if ($moodle_disable_camel_case) {
+        define("EWIKI_CHARS_L", "");
+        define("EWIKI_CHARS_U", "");
+    }
+    else {
+#### END MOODLE CHANGES
+
+       define("EWIKI_CHARS_L", "a-z_µ¤$\337-\377");
+    define("EWIKI_CHARS_U", "A-Z0-9\300-\336");
+
+#### BEGIN MOODLE CHANGES   
+    }
+#### END MOODLE CHANGES
+   
        define("EWIKI_CHARS", EWIKI_CHARS_L.EWIKI_CHARS_U);
 
         #-- database
            "script_url" => (defined("EWIKI_SCRIPT_URL")?EWIKI_SCRIPT_URL:NULL),
            "script_binary" => EWIKI_SCRIPT_BINARY,
        #-- heart of the wiki -- don't try to read this! ;)
+
            "wiki_pre_scan_regex" =>    '/
                (?<![~!])
                ((?:(?:\w+:)*['.EWIKI_CHARS_U.']+['.EWIKI_CHARS_L.']+){2,}[\w\d]*)
                |\^([-'.EWIKI_CHARS_L.EWIKI_CHARS_U.']{3,})
                |\[ (?:"[^\]\"]+" | \s+ | [^:\]#]+\|)*  ([^\|\"\[\]\#]+)  (?:\s+ | "[^\]\"]+")* [\]\#] 
                |(\w{3,9}:\/\/[^?#\s\[\]\'\"\)\,<]+)    /x',
+
            "wiki_link_regex" => "\007 [!~]?(
                \#?\[[^<>\[\]\n]+\] |
                \^[-".EWIKI_CHARS_U.EWIKI_CHARS_L."]{3,} |
                \b([\w]{3,}:)*([".EWIKI_CHARS_U."]+[".EWIKI_CHARS_L."]+){2,}\#?[\w\d]* |
                ([a-z]{2,9}://|mailto:)[^\s\[\]\'\"\)\,<]+ |
                \w[-_.+\w]+@(\w[-_\w]+[.])+\w{2,}       ) \007x",
+
        #-- rendering ruleset
            "wm_indent" => '<div style="margin-left:15px;" class="indent">',
            "wm_table_defaults" => 'cellpadding="2" border="1" cellspacing="0"',
index 9b37a12c24badc795e998d64648401221f9595ac..079629bd5834585df77a52b3d02f5027385be591 100644 (file)
@@ -25,6 +25,7 @@ function wiki_add_instance($wiki) {
     $wiki->pagename = wiki_page_name($wiki);
 
     /// Check 'check boxes'. The variables won't be set at all of they were deselected.
+    $wiki->disablecamelcase = (isset($wiki->disablecamelcase)) ? 1 : 0;
     $wiki->setpageflags = (isset($wiki->setpageflags)) ? 1 : 0;
     $wiki->removepages = (isset($wiki->removepages)) ? 1 : 0;
     $wiki->strippages = (isset($wiki->strippages)) ? 1 : 0;
@@ -43,6 +44,7 @@ function wiki_update_instance($wiki) {
     $wiki->pagename = wiki_page_name($wiki);
 
     /// Check 'check boxes'. The variables won't be set at all of they were deselected.
+    $wiki->disablecamelcase = (isset($wiki->disablecamelcase)) ? 1 : 0;
     $wiki->setpageflags = (isset($wiki->setpageflags)) ? 1 : 0;
     $wiki->removepages = (isset($wiki->removepages)) ? 1 : 0;
     $wiki->strippages = (isset($wiki->strippages)) ? 1 : 0;
index 406309aec19fd38d3a1f4d3e414516302afab5d0..21d925c40501ef7cc89846a37a504bc29b76b86c 100644 (file)
     </TD>
 </TR>
 
+<tr valign="top">
+    <td align="right">
+    <?php helpbutton('wikilinkoptions', get_string('wikilinkoptions', 'wiki'), 'wiki') ?>
+    <b> <?php print_string('wikilinkoptions', 'wiki') ?>:</b></td>
+    <td>
+        <input type="checkbox" name="disablecamelcase" value="1" <?php echo $form->disablecamelcase?"CHECKED":""; ?> />
+            Disable CamelCase linking.<br />
+    </td>
+</tr>
+
 <tr valign="top">
     <td align="right">
     <?php helpbutton('studentadminoptions', get_string('studentadminoptions', 'wiki'), 'wiki') ?>
index 9d446606a423e1f6cf9d2cc1ba00165083602a49..b46f4f9007f30ef70d4d007a2e6cb0ecf94124ac 100644 (file)
@@ -5,7 +5,7 @@
 ///  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 /////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2004061300;  // The current module version (Date: YYYYMMDDXX)
+$module->version  = 2004062400;  // The current module version (Date: YYYYMMDDXX)
 $module->cron     = 0;           // Period for cron to check this module (secs)
 
 ?>
index 09cd3debc7c593332dc7f203590d596fd2cbe41a..ba95ea78a28cd7f9c08a656036f2f968796af0e0 100644 (file)
@@ -60,6 +60,9 @@
     ### SAVE ID from Moodle
     $moodleID=@$_REQUEST["id"];
 
+/// Globally disable CamelCase, if the option is selected for this wiki.
+    $moodle_disable_camel_case = ($wiki->disablecamelcase == 1);
+
     if (($wiki_entry = wiki_get_default_entry($wiki, $course, $userid, $groupid))) {
 
 ///     ################# EWIKI Part ###########################