Index: trunk/extensions/Wikidata/OmegaWiki/SpecialSuggest.php |
— | — | @@ -37,15 +37,13 @@ |
38 | 38 | |
39 | 39 | |
40 | 40 | function getSuggestions() { |
41 | | - |
42 | | - |
43 | 41 | $o=OmegaWikiAttributes::getInstance(); |
44 | 42 | global $wgUser; |
45 | 43 | $dc=wdGetDataSetContext(); |
46 | 44 | @$search = ltrim($_GET['search-text']); |
47 | 45 | @$prefix = $_GET['prefix']; |
48 | 46 | @$query = $_GET['query']; |
49 | | - @$objectId = $_GET['objectId']; |
| 47 | + @$definedMeaningId = $_GET['definedMeaningId']; |
50 | 48 | @$offset = $_GET['offset']; |
51 | 49 | @$attributesLevel = $_GET['attributesLevel']; |
52 | 50 | $sql=''; |
— | — | @@ -64,16 +62,16 @@ |
65 | 63 | $sql=constructSQLWithFallback($sqlActual, $sqlFallback, array("member_mid", "spelling", "collection_mid")); |
66 | 64 | break; |
67 | 65 | case 'option-attribute': |
68 | | - $sql = getSQLToSelectPossibleAttributes($objectId, $attributesLevel, 'OPTN'); |
| 66 | + $sql = getSQLToSelectPossibleAttributes($definedMeaningId, $attributesLevel, 'OPTN'); |
69 | 67 | break; |
70 | 68 | case 'translated-text-attribute': |
71 | | - $sql = getSQLToSelectPossibleAttributes($objectId, $attributesLevel, 'TRNS'); |
| 69 | + $sql = getSQLToSelectPossibleAttributes($definedMeaningId, $attributesLevel, 'TRNS'); |
72 | 70 | break; |
73 | 71 | case 'text-attribute': |
74 | | - $sql = getSQLToSelectPossibleAttributes($objectId, $attributesLevel, 'TEXT'); |
| 72 | + $sql = getSQLToSelectPossibleAttributes($definedMeaningId, $attributesLevel, 'TEXT'); |
75 | 73 | break; |
76 | 74 | case 'link-attribute': |
77 | | - $sql = getSQLToSelectPossibleAttributes($objectId, $attributesLevel, 'URL'); |
| 75 | + $sql = getSQLToSelectPossibleAttributes($definedMeaningId, $attributesLevel, 'URL'); |
78 | 76 | break; |
79 | 77 | case 'language': |
80 | 78 | require_once('languages.php'); |
— | — | @@ -226,19 +224,19 @@ |
227 | 225 | return $sql; |
228 | 226 | } |
229 | 227 | |
230 | | -function getSQLToSelectPossibleAttributes($objectId, $attributesLevel, $attributesType) { |
| 228 | +function getSQLToSelectPossibleAttributes($definedMeaningId, $attributesLevel, $attributesType) { |
231 | 229 | global |
232 | 230 | $wgUser; |
233 | 231 | |
234 | | - $sqlActual = getSQLToSelectPossibleAttributesForLanguage($objectId, $attributesLevel, $attributesType, $wgUser->getOption('language')); |
235 | | - $sqlFallback = getSQLToSelectPossibleAttributesForLanguage($objectId, $attributesLevel, $attributesType, 'en'); |
| 232 | + $sqlActual = getSQLToSelectPossibleAttributesForLanguage($definedMeaningId, $attributesLevel, $attributesType, $wgUser->getOption('language')); |
| 233 | + $sqlFallback = getSQLToSelectPossibleAttributesForLanguage($definedMeaningId, $attributesLevel, $attributesType, 'en'); |
236 | 234 | |
237 | 235 | return constructSQLWithFallback($sqlActual, $sqlFallback, array("attribute_mid", "spelling")); |
238 | 236 | } |
239 | 237 | |
240 | 238 | # language is the 2 letter wikimedia code. use "<ANY>" if you don't want language filtering |
241 | 239 | # (any does set limit 1 hmph) |
242 | | -function getSQLToSelectPossibleAttributesForLanguage($objectId, $attributesLevel, $attributesType, $language="<ANY>") { |
| 240 | +function getSQLToSelectPossibleAttributesForLanguage($definedMeaningId, $attributesLevel, $attributesType, $language="<ANY>") { |
243 | 241 | global $wgDefaultClassMids; |
244 | 242 | global $wgUser; |
245 | 243 | $dc=wdGetDataSetContext(); |
— | — | @@ -274,7 +272,7 @@ |
275 | 273 | " AND ({$dc}_class_attributes.class_mid IN (" . |
276 | 274 | ' SELECT class_mid ' . |
277 | 275 | " FROM {$dc}_class_membership" . |
278 | | - " WHERE {$dc}_class_membership.class_member_mid = " . $objectId . |
| 276 | + " WHERE {$dc}_class_membership.class_member_mid = " . $definedMeaningId . |
279 | 277 | ' AND ' . getLatestTransactionRestriction("{$dc}_class_membership") . |
280 | 278 | ' )'. |
281 | 279 | $defaultClassRestriction . |
Index: trunk/extensions/Wikidata/OmegaWiki/suggest.js |
— | — | @@ -46,8 +46,8 @@ |
47 | 47 | suggestText = document.getElementById(suggestPrefix + "text"); |
48 | 48 | suggestText.className = "suggest-loading"; |
49 | 49 | |
50 | | - var suggestAttributesLevel = document.getElementById(suggestPrefix + "parameter-attributesLevel"); |
51 | | - var suggestObjectId = document.getElementById(suggestPrefix + "parameter-attributesObjectId"); |
| 50 | + var suggestAttributesLevel = document.getElementById(suggestPrefix + "parameter-level"); |
| 51 | + var suggestDefinedMeaningId = document.getElementById(suggestPrefix + "parameter-definedMeaningId"); |
52 | 52 | |
53 | 53 | var URL = 'index.php'; |
54 | 54 | var location = "" + document.location; |
— | — | @@ -63,11 +63,11 @@ |
64 | 64 | '&offset=' + encodeURI(suggestOffset) + |
65 | 65 | '&dataset='+dataSet; |
66 | 66 | |
67 | | - if((suggestAttributesLevel != null) && (suggestObjectId != null)) |
| 67 | + if((suggestAttributesLevel != null) && (suggestDefinedMeaningId != null)) |
68 | 68 | URL = |
69 | 69 | URL + |
70 | 70 | '&attributesLevel=' + encodeURI(suggestAttributesLevel.value) + |
71 | | - '&objectId=' + encodeURI(suggestObjectId.value); |
| 71 | + '&definedMeaningId=' + encodeURI(suggestDefinedMeaningId.value); |
72 | 72 | http.open('GET', URL, true); |
73 | 73 | http.onreadystatechange = function() { |
74 | 74 | if (http.readyState == 4) { |
Index: trunk/extensions/Wikidata/OmegaWiki/Editor.php |
— | — | @@ -1263,8 +1263,8 @@ |
1264 | 1264 | public function add(IdStack $idPath) { |
1265 | 1265 | if ($this->isAddField) { |
1266 | 1266 | $parameters = array( |
1267 | | - "attributesLevel" => $this->attributesLevelName, |
1268 | | - "attributesObjectId" => $idPath->getDefinedMeaningId() |
| 1267 | + "level" => $this->attributesLevelName, |
| 1268 | + "definedMeaningId" => $idPath->getDefinedMeaningId() |
1269 | 1269 | ); |
1270 | 1270 | |
1271 | 1271 | return getSuggest($this->addId($idPath->getId()), $this->suggestType(), $parameters); |
— | — | @@ -1274,7 +1274,7 @@ |
1275 | 1275 | } |
1276 | 1276 | |
1277 | 1277 | public function getEditHTML(IdStack $idPath, $value) { |
1278 | | - $parameters = array("attributesLevel" => $this->attributesLevelName); |
| 1278 | + $parameters = array("level" => $this->attributesLevelName); |
1279 | 1279 | return getSuggest($this->updateId($idPath->getId()), $this->suggestType(), $parameters); |
1280 | 1280 | } |
1281 | 1281 | } |
— | — | @@ -1307,9 +1307,9 @@ |
1308 | 1308 | $syntransId = $idPath->getKeyStack()->peek(0)->syntransId; |
1309 | 1309 | |
1310 | 1310 | $parameters = array( |
1311 | | - 'attributesLevel' => $this->attributesLevelName, |
1312 | | - 'attributesObjectId' => $idPath->getDefinedMeaningId(), |
1313 | | - 'onUpdate' => 'updateSelectOptions(\'' . $this->addId($idPath->getId()) . '-option\',' . $syntransId |
| 1311 | + "level" => $this->attributesLevelName, |
| 1312 | + "definedMeaningId" => $idPath->getDefinedMeaningId(), |
| 1313 | + "onUpdate" => 'updateSelectOptions(\'' . $this->addId($idPath->getId()) . '-option\',' . $syntransId |
1314 | 1314 | ); |
1315 | 1315 | return getSuggest($this->addId($idPath->getId()), $this->suggestType(), $parameters); |
1316 | 1316 | } |
— | — | @@ -1319,8 +1319,8 @@ |
1320 | 1320 | |
1321 | 1321 | public function getEditHTML(IdStack $idPath, $value) { |
1322 | 1322 | $parameters = array( |
1323 | | - 'attributesLevel' => $this->attributesLevelName, |
1324 | | - 'onUpdate' => 'updateSelectOptions(\'' . $this->updateId($idPath->getId()) . '-option\'' |
| 1323 | + "level" => $this->attributesLevelName, |
| 1324 | + "onUpdate" => 'updateSelectOptions(\'' . $this->updateId($idPath->getId()) . '-option\'' |
1325 | 1325 | ); |
1326 | 1326 | |
1327 | 1327 | return getSuggest($this->updateId($idPath->getId()), $this->suggestType(), $parameters); |