Kipcool has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/50927


Change subject: Get language-specific annotations also for lexical annotations 
of the current syntrans being viewed.
......................................................................

Get language-specific annotations also for lexical annotations of
the current syntrans being viewed.

Change-Id: Ic221b1d75b574f0ba35afba7facb7c8e0fef9415
---
M OmegaWiki/Editor.php
M OmegaWiki/SpecialSuggest.php
M OmegaWiki/forms.php
3 files changed, 17 insertions(+), 8 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiLexicalData 
refs/changes/27/50927/1

diff --git a/OmegaWiki/Editor.php b/OmegaWiki/Editor.php
index dd02f2f..e4a62d6 100644
--- a/OmegaWiki/Editor.php
+++ b/OmegaWiki/Editor.php
@@ -1708,16 +1708,24 @@
 
        public function add( IdStack $idPath ) {
                if ( $this->isAddField ) {
-                       $syntransId = $idPath->getKeyStack()->peek( 0 
)->syntransId;
-                       if ( $syntransId == "" ) $syntransId = 0 ; // in the 
case of a DM option attribute, there is no syntrans in the PathId
-
                        $parameters = array(
                                "level" => $this->attributesLevelName,
                                "definedMeaningId" => 
$idPath->getDefinedMeaningId(),
-                               "syntransId" => $syntransId,
                                "annotationAttributeId" => 
$idPath->getAnnotationAttribute()->getId()
                        );
 
+                       if ( $this->attributesLevelName == 
WLD_SYNTRANS_MEANING_NAME ) {
+                               // find and add syntransId as a parameter
+                               $syntransId = $idPath->getKeyStack()->peek( 0 
)->syntransId;
+                               if ( $syntransId == "" ) {
+                                       // second tentative, sometimes it is 
called objectId
+                                       $syntransId = 
$idPath->getKeyStack()->peek( 0 )->objectId;
+                               }
+                               if ( $syntransId != "" ) {
+                                       $parameters["syntransId"] = $syntransId;
+                               }
+                       }
+
                        return getSuggest( $this->addId( $idPath->getId() ), 
$this->suggestType(), $parameters );
                }
                else
diff --git a/OmegaWiki/SpecialSuggest.php b/OmegaWiki/SpecialSuggest.php
index 322df36..374d150 100644
--- a/OmegaWiki/SpecialSuggest.php
+++ b/OmegaWiki/SpecialSuggest.php
@@ -259,7 +259,7 @@
 
                $classMids = $wgDefaultClassMids ;
 
-               if ( ( $syntransId != 0 ) && ( 
!is_null($wgIso639_3CollectionId)) ) {
+               if ( ( !is_null($syntransId) ) && ( 
!is_null($wgIso639_3CollectionId)) ) {
                        // find the language of the syntrans and add attributes 
of that language by adding the language DM to the list of default classes
                        // this first query returns the language_id
                        $sql = 'SELECT language_id' .
diff --git a/OmegaWiki/forms.php b/OmegaWiki/forms.php
index 721fbf3..d2985ec 100644
--- a/OmegaWiki/forms.php
+++ b/OmegaWiki/forms.php
@@ -133,9 +133,10 @@
                        '<input type="hidden" id="' . $name . '" name="' . 
$name . '" value="' . $value . '"/>' .
                        '<input type="hidden" id="' . $name . 
'-suggest-dataset" value="' . $dc . '"/>';
 
-       foreach ( $parameters as $parameter => $parameterValue )
-               $result .=
-                       '<input type="hidden" id="' . $name . 
'-suggest-parameter-' . $parameter . '" name="' . $parameter . '" value="' . 
$parameterValue . '"/>';
+       foreach ( $parameters as $parameter => $parameterValue ) {
+               $inputID = $name . '-suggest-parameter-' . $parameter;
+               $result .= HTML::hidden( $parameter, $parameterValue , array( 
"id" => $inputID ) );
+       }
 
        $result .=
                '<span id="' . $name . '-suggest-link" class="suggest-link" 
title="' . wfMsgSc( "SuggestHint" ) . '">' . $label . '</span>' .

-- 
To view, visit https://gerrit.wikimedia.org/r/50927
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic221b1d75b574f0ba35afba7facb7c8e0fef9415
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiLexicalData
Gerrit-Branch: master
Gerrit-Owner: Kipcool <kipmas...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to