changed git call from https to git readonly
[atutor.git] / mods / wiki / plugins / edit / flags.php
1 <?php
2 /*
3    provides users the ability to set certain page flags on editing;
4    for example the _HIDDEN or _MINOR flags could be set (though there
5    is a separate plugin for minor edits)
6 */
7
8 $ewiki_config["user_flags"] = array(
9    EWIKI_DB_F_MINOR => "minor edit",
10    EWIKI_DB_F_HIDDEN => "hidden page",
11 #  EWIKI_DB_F_HTML => "html is allowed",
12 );
13 $ewiki_plugins["edit_form_append"][] = "ewiki_edit_user_flags";
14 $ewiki_plugins["edit_save"][] = "ewiki_edit_save_user_flags";
15
16 $ewiki_t["de"]["minor edit"] = "kleine Ă„nderung";
17 $ewiki_t["de"]["hidden page"] = "versteckte Seite";
18
19
20 function ewiki_edit_save_user_flags(&$save, &$old) {
21    global $ewiki_config;
22
23    foreach ($ewiki_config["user_flags"] as $FLAG=>$str) {
24       $save["flags"] = $save["flags"] & (0xFFFF ^ $FLAG)
25         | ($_REQUEST["page_user_flag"][dechex($FLAG)] ? $FLAG : 0x00);
26    }
27 }
28
29
30 function ewiki_edit_user_flags($id, &$data, $action) {
31    global $ewiki_config;
32    
33    $o = "";
34    foreach ($ewiki_config as $FLAG => $str) {
35       $o .= '<input type="checkbox" name="page_user_flag['.dechex($FLAG).']" value="1"'
36          . (($FLAG != EWIKI_DB_F_MINOR) && ($data["flags"] & $FLAG) ? " checked" : "")
37          . ' id="page_user_flag_'.$FLAG.'"><label for="page_user_flag_'.$FLAG.'"> '
38          . ewiki_t($str) . '</label><br />' . "\n";
39    }
40    return($o);
41 }
42
43
44 ?>