Index: trunk/extensions/Wikidata/OmegaWiki/forms.php |
— | — | @@ -2,13 +2,18 @@ |
3 | 3 | |
4 | 4 | require_once( 'languages.php' ); |
5 | 5 | |
6 | | -function getTextBox( $name, $value = "", $onChangeHandler = "" ) { |
| 6 | +function getTextBox( $name, $value = "", $onChangeHandler = "", $disabled = false ) { |
7 | 7 | if ( $onChangeHandler != "" ) |
8 | 8 | $onChangeAttribute = ' onchange="' . $onChangeHandler . '"'; |
9 | 9 | else |
10 | 10 | $onChangeAttribute = ''; |
11 | 11 | |
12 | | - return '<input type="text" id="' . $name . '" name="' . $name . '" value="' . htmlspecialchars( $value ) . '"' . $onChangeAttribute . ' style="width: 100%; padding: 0px; margin: 0px;"/>'; |
| 12 | + $disableText = $disabled ? 'disabled="disabled" ' : '' ; |
| 13 | + $inputHTML = '<input ' . $disableText . 'type="text" id="' . $name . '" name="' . $name . |
| 14 | + '" value="' . htmlspecialchars( $value ) . '"' . $onChangeAttribute . |
| 15 | + ' style="width: 100%; padding: 0px; margin: 0px;"/>' ; |
| 16 | + |
| 17 | + return $inputHTML ; |
13 | 18 | } |
14 | 19 | |
15 | 20 | function getTextArea( $name, $text = "", $rows = 5, $columns = 80, $disabled = false ) { |
Index: trunk/extensions/Wikidata/OmegaWiki/Editor.php |
— | — | @@ -1228,9 +1228,19 @@ |
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | public function getEditHTML( IdStack $idPath, $value ) { |
1232 | | - return getTextBox( $this->updateId( $idPath->getId() ), $value, $this->onChangeHandler ); |
| 1232 | + global $wgUser; |
| 1233 | + $dc = wdGetDataSetContext(); |
| 1234 | + if ( ($dc == "uw") and (! $wgUser->isAllowed( 'deletewikidata-uw' ) ) ) { |
| 1235 | + // disable |
| 1236 | + return getTextBox( $this->updateId( $idPath->getId() ), $value, $this->onChangeHandler, true ); |
| 1237 | + } else { |
| 1238 | + return getTextBox( $this->updateId( $idPath->getId() ), $value, $this->onChangeHandler ); |
| 1239 | + } |
1233 | 1240 | } |
| 1241 | + |
1234 | 1242 | |
| 1243 | + } |
| 1244 | + |
1235 | 1245 | public function add( IdStack $idPath ) { |
1236 | 1246 | if ( $this->isAddField ) |
1237 | 1247 | return getTextBox( $this->addId( $idPath->getId() ), "", $this->onChangeHandler ); |