Once you have your app in WAB 2.0 you just copy the new 2.x eSearch widget to the [install dir]\server\apps\[app#]\widgets folder. The old config_Enhanced Search.json file that copied over from 1.3 will still work, so you do not have to reconfigure the widget.
Ahh..sorry figured it out! Had to click on the title tab of the widget!
Sorry about that…
Widget Version: 1.1.6 Widget is designed to run in Web AppBuilder version: 1.1 This enhanced search widget offers the ability to search by a string, geometry and spatial relationship.
The 2.0.1.3 version of the widget is what you will get when you click on this documents attachments eSearch.zip at the top of this page:
What is strange is that you pasted the contents of the 2.0.1.3 manifest.json in your previous post so you have downloaded the 2.0.1.3 version but somehow you are not using it.
yes that is very strange. I do have the older version of the widgets...maybe I need to remove those. Let me try deleting the older widgets and re adding the newer one.
Widget Version: 2.0.1.3 Widget is designed to run in Web AppBuilder version: 2.0.1 This enhanced search widget offers the ability to search by a string, geometry and spatial relationship.
Maybe I didn't make clear enough where my problems are:
With this setting:
-> I get a popup from the results list but not the popup that was defined in the web map.
-> Outside the search I get the web map defined popup.
With this setting:
-> From the search result I can zoom to the parcel but no popup is displayed
-> When I click into the parcel the webmap defined popup shows.
What I would like: Click on result list zooms to parcel AND shows the web map defined popup.
Regarding the link:
I defined the link in the settings for the search layer:
I can say to disable the link in the popup:
But I can't disable it for the results list.
Not trying to be sarcastic, but if it were that easy I would have already added it. You can look at the buildWhereClause function but there is a lot more going on with adding or removing of Features from the currentFeatures array.
Hehe, yes, sorry. Somehow I was "hoping" that nobody needed it until now 😉
OK, I am so glad that your webmap you are using is public this allowed me to see the issue with the popups and figure out that I have the popups working for MapServer layers but not individual FeatureLayers coming from FeatureServer urls. Here is the fix I would like you to try:
In the Widget.js file find line 1197 through 1211 with this code:
//now setup the infoTemplate
//check if this layer is part of map and if it has a popup defined already
This should fix the using webmap popups for individual FeatureServer Layers. Let me know how it goes. If this works than your second issue is not an issue any more because you will not need to add the link at all if you have it in your webmaps popup.
Make sure you are making this change to the specific apps Widget.js file. The one thing that throws people off intially is that they make changes to the [install dir]\client\stemapp\widgets\eSearch\Widget.js and then they do not see that change in their app. That is because when you create an app and add the widget it copies the widget from [install dir]\client\stemapp\widgets folder over to the [install dir]\server\apps\[app#]\widgets folder. That means you have to make the changes in the [install dir]\server\apps\[app#]\widgets\eSearch\Widget.js file.
Make sure you are making this change to the specific apps Widget.js file. The one thing that throws people off intially is that they make changes to the \client\stemapp\widgets\eSearch\Widget.js and then they do not see that change in their app. That is because when you create an app and add the widget it copies the widget from \client\stemapp\widgets folder over to the \server\apps\[app#]\widgets folder. That means you have to make the changes in the \server\apps\[app#]\widgets\eSearch\Widget.js file.
Thanks Robert, this hint was crucial! The string change worked with applying the change also to the file in the app folder.
Unfortunately I still get this error message after doing the change in the Widget.js file:
(I can’t log in on geonet at the moment so I hope you can see the image…)
Unfortunately not (no image visible). I used your web map and your eSearch config to setup a test app on my end and made the change I outlined above and was able to get the eSearch to use the webmaps popups. So your error is likely a syntax error but I would need to see it to help more.
Thanks. I didn't realize the configs were in a separate directory, so copying over new widgets and overwriting the old files does not affect the configs.
Unfortunately not (no image visible). I used your web map and your eSearch config to setup a test app on my end and made the change I outlined above and was able to get the eSearch to use the webmaps popups. So your error is likely a syntax error but I would need to see it to help more.
The message says:
create widget error: widgets/eSearch/Widget
And as can be expected the widget does not load.
I just uploaded the latest version of the app under www.nicoleueberschaer.de/minagri_2/<http://www.nicoleueberschaer.de/minagri_2/>
My eSearch, which used to work in 1.3, no longer does. Now I've made many changes including exporting the project, importing it, reinstalling the WABde, upgrading to 2.0, reinstalling portal, changing to https and upgrading the widgets.
What I notice is that I see all my old searches there that will not run, however, if I add a new search, the search layer does not go into the widget in the app preview (or launched app), even after I save it and restart. It's like the config is not being saved or something. If I create a new map, the widget appears to work correctly in it, so I'm not sure what is wrong. Can you help me restore my eSearch config from my original map?
Are there any errors in your browsers web console when you try and save the newly added layer? You mention something about https was your old WAB version running http and this new one is using https?
As you are asking about a change to the widget and not about a bug or how to use the widget as it is developed you will need to start a new thread and I may be able to walk you through where to look in the code.
When I try to make an edit by adding fields, I get an "Unable to set property 'fieldInfo' of undefined or null reference, line 766, column 9... file: SingleSearchEdit.js
Oh, and yes, the old one was running http and https, and I had some mixed content issues, so the new one is full https now.
Since I don't get these issues in a new map, I could just rebuild everything, but I'd like to keep all that config if I can because it took time to set up. I also see that when I create a new map for testing and add one layer in eSearch, it works as intended, but I do get errors on the map nonetheless:
SCRIPT5007: Unable to set property 'fieldinfo' of undefined or null reference. File: SingleSearchEdit.js Line:766, column 9. (same error)
and also:
SCRIPT16389: Unspecified error. File: about:blank, Line: 1, column 1. (I get 2 of these).
SCRIPT16389: Unspecified error. File:5, line 1, column 1. ( I also get 2 of these).
Although the popups are now showing (on the first sight) as the ones defined in the web map, there is a small but fine difference: The result popup does not show all attribute values while the normal popup does. You can see that behavior (hopefully) when you select for example all parcels bigger than 300 hectare, then click on one of the results from the list and then examine the popup: The sqm and acre size values are missing. When you click now with the mouse on this parcel you get first the selections operational layer info, then probably a district and then the one from the parcel itself – there you will see the sizes in sqm and acre.
And another funny thing: When I disable the operational layer, then the default popups come again, not the ones from the web map when clicking on the result list.
If your search configuration for that layer does not return those fields then the popup will not have access to the data. Make sure you have added all field that are used by your web maps popup.
The web maps popups are currently only supported when using the layer as an operational layer.
Have you tried making a new app using the same layers in the eSearch to see if it is just a configuration issue. As you can see on my Live Preview Site searching point is not a problem.
There must be some miscommunication here them. When the Live Preview Site pulls up the Traffic Camera layers (a point layer) are searched by value and the results display. I can also select the Traffic Cameras by Shape. There are things that have been updated in the widget and config from 1.3 to 2.0 so the fact that you have not changed anything in the config is not a guarantee that it should work without issue.
Is there not a line number or file reference that show with the error you posted above?
Hi Robert, our client is already very happy with his application! 🙂
I still have some more issues, sorry:
- I have about 50 attributes for which I would like to show the values for in my popup. But unfortunately the "include all" button doesn't seem to do anything, instead I have to select each attribute separately and click "include". Is there a limit for attributes that can be included?
Adam Drackley found the issue…He has been an amazing amount of help in finding my issues.
This is what he found.
Just seems a little weird to require a popup for Point features only?.....
Thanks again for the eSearch Widget. Great job……..
Richard Bell
For the eSearch widget to work properly, a popup template for that particular layer needs to be defined. If you define a popup for your Survey Images layer using the LocalLayer widget, for instance, it will ensure that your fields are exposed, and the eSearch widget will display the fields properly as part of its output.
For example, try changing the configs\LocalLayer\config_localLayer.json entry for SURVEY DATA from this:
And try using the eSearch widget to search on the Survey Images layer. In my experience, it worked properly. Having popups configured for participating layers appears to be a prerequisite of the eSearch widget, but I'll make sure that this is mentioned in the LocalLayer Readme.md as well.
I have to say that if having a popup defined for a point layer to work in the eSearch was necessary this is news to the widgets developer!
I took the url provided above and layer 7 survey image to a eSearch widget on my end and searching by value and by shape worked fine. No popup needed and no local layer widget involved. So this lends to more questions... What is it about your configuration that is blocking the eSearch from working for points when no one else has reported this issue?
Then I tested with adding the whole map service to the app using the LL widget and did not define popups and the survey image layer that I configured with the eSearch still worked fine (which I expected as the eSearch does not need the layer to be added to the map to work).
It is probably doing what it is suppose to and you are just not noticing the difference. Try removing all the fields and then clicking the include all button.
The browser console. IE, which I'm forced to work with for now as Firefox and Chrome aren't working with my WABde. I found what causes the issue and it is repeatable... checking the box for "Add Result as Operational Layer".
I'm also getting warnings in the web console when some searches are done: "Observable store detected, but no sort order specified. You may experience quirks when adding/updating items. These can be resolved by setting a sort order on the list or grid.
I'm also getting some errors after I uncheck the box, but they are not consistent in all searches. One is
CancelError: Request canceled
{
[functions]: ,
__proto__: { },
description: "Request canceled",
dojoType: "cancel",
log: undefined,
message: "Request canceled",
name: "CancelError",
response: { },
responseText: undefined,
stack: undefined,
status: undefined,
xhr: { }
}
Observable store detected, but no sort order specified. You may experience quirks when adding/updating items. These can be resolved by setting a sort order on the list or grid.
Observable store detected, but no sort order specified. You may experience quirks when adding/updating items. These can be resolved by setting a sort order on the list or grid.
Another I'll get on a few searches after clicking on a result that comes up is:
Observable store detected, but no sort order specified. You may experience quirks when adding/updating items. These can be resolved by setting a sort order on the list or grid.
Observable store detected, but no sort order specified. You may experience quirks when adding/updating items. These can be resolved by setting a sort order on the list or grid.
Observable store detected, but no sort order specified. You may experience quirks when adding/updating items. These can be resolved by setting a sort order on the list or grid.
Observable store detected, but no sort order specified. You may experience quirks when adding/updating items. These can be resolved by setting a sort order on the list or grid.
TypeError: Object doesn't support property or method 'apply' TypeError: Object doesn't support property or method 'apply'
I have no idea if these are related or not or where to go next.
My hyperlinks also do not work, even if I uncheck that box. I don't know if that's related or not. The tooltip comes up correctly, but I get a "This page can't be displayed" error. Make sure the web address //ieframe.dll/dnserror.htm# is correct. The url box shows "javascript:void(0);" in it. The identical hyperlink text works fine in the Identify widget.
I am at a loss on how to help you. My recommendation is what you don't want to hear. Start over from scratch. I think all this has to do with the move from http to https.
I actually just did start from scratch; this is all brand new this week after I had the initial errors. Portal, WABde and the web adaptor were just reinstalled last week, too. When recreating everything, I have the same issues. All the other widgets work OK (with minor exceptions), except for eSearch.
Yes. I manually redid the entire map with all the widgets, and did not copy-paste anything. I still have the old map and used it for reference to see what I did earlier, but none of the files were reused.
When you downloaded the zip file from this page did you extract the "eSearch" folder (not just it contents) from the zip and add it to the stemapp widget folder (not changing the name of the folder from eSearch)?
By the way, I'm not using a proxy. Esri told me I didn't need one. I read the Tapas Das article on setting everything up, and the proxy info was online for ArcGIS Online; I use Portal. And it's really unclear whether that will help me or not.
';
}
}
}
catch(e){
}
}
}
if (newSub.getAttribute("slang").toLowerCase() != code_l.toLowerCase()) {
if (trLabelsHtml != "") {
var labelSname = "";
if(labelEle[i].querySelector("ul li:nth-child(1)").getAttribute("aria-hidden")){
labelSname = labelEle[i].querySelector("ul li:nth-child(1)").outerHTML;
}
labelEle[i].innerHTML = "";
labelEle[i].innerHTML = labelSname + trLabelsHtml;
}
}
}
}
}
catch(e){
}
}
}
/* V 2.0:3 = Store not translated reply id */
if(lingoRSXML.snapshotLength == 0){
if($scope.falseReplyID == "") {
$scope.falseReplyID = value;
}
}
/* Get translated Body of Replies/Comments */
var lingoRBXML = doc.evaluate(lingoRBExp, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for(var i=0;i 0) {
var attachDiv = rootElement.querySelector('div.lia-quilt-row-main').querySelector('div.custom-attachments');
if (attachDiv) {
attachDiv = attachDiv.outerHTML;
}
else if(rootElement.querySelector('div.lia-quilt-row-main').querySelectorAll('#attachments').length > 0){
if ("TkbArticlePage" == "BlogArticlePage") {
attachDiv = rootElement.querySelector('div.lia-quilt-row-main .lia-message-body-content').querySelector('#attachments');
if (attachDiv) {
attachDiv = attachDiv.outerHTML;
}
else{
attachDiv = "";
}
}else{
attachDiv = rootElement.querySelector('div.lia-quilt-row-main').querySelector('#attachments').outerHTML;
}
}
else {
attachDiv = "";
}
/* Feedback Div */
var feedbackDiv = "";
var feedbackDivs = rootElement.querySelector('div.lia-quilt-row-main').querySelectorAll('div.lia-panel-feedback-banner-safe');
if (feedbackDivs.length > 0) {
for (var k = 0; k < feedbackDivs.length; k++) {
feedbackDiv = feedbackDiv + feedbackDivs[k].outerHTML;
}
}
}
else {
var attachDiv = rootElement.querySelector('div.lia-message-body-content').querySelector('div.Attachments.preview-attachments');
if (attachDiv) {
attachDiv = attachDiv.outerHTML;
} else {
attachDiv = "";
}
/* Everyone tags links */
if (document.querySelectorAll("div.TagList").length > 0){
var everyoneTagslink = document.querySelector('div.lia-quilt-row-main').querySelector(".MessageTagsTaplet .TagList");
if ((everyoneTagslink != null)||(everyoneTagslink != undefined)){
everyoneTagslink = everyoneTagslink.outerHTML;
}
else{
everyoneTagslink = "";
}
}
/* Feedback Div */
var feedbackDiv = "";
var feedbackDivs = rootElement.querySelector('div.lia-message-body-content').querySelectorAll('div.lia-panel-feedback-banner-safe');
if (feedbackDivs.length > 0) {
for (var m = 0; m < feedbackDivs.length; m++) {
feedbackDiv = feedbackDiv + feedbackDivs[m].outerHTML;
}
}
}
}
} catch (e) {
}
if (body_L == "") {
/* V 2.0:7 Replacing translated video data with source video data */
var newBodyVideoData = newBody.querySelectorAll('div[class*="video-embed"]');
angular.forEach($scope.videoData[value], function (sourceVideoElement, index) {
if (index <= (newBodyVideoData.length - 1)) {
newBodyVideoData[index].outerHTML = sourceVideoElement.outerHTML
}
});
/* V 2.0:7 = Replacing translated image data with source data */
var newBodyImageData = newBody.querySelectorAll('[class*="lia-image"]');
angular.forEach($scope.imageData[value], function (sourceImgElement, index) {
if (index <= (newBodyImageData.length - 1)) {
newBodyImageData[index].outerHTML = sourceImgElement.outerHTML;
}
});
/* V 2.0:7 = Replacing translated pre tag data with source data */
var newBodyPreTagData = newBody.querySelectorAll('pre');
angular.forEach($scope.preTagData[value], function (sourcePreTagElement, index) {
if (index <= (newBodyPreTagData.length - 1)) {
newBodyPreTagData[index].outerHTML = sourcePreTagElement.outerHTML;
}
});
}
var copyBodySubject = false;
if (body_L == "") {
copyBodySubject = true;
body_L = newBody.innerHTML;
}
/* This code is written as part of video fix by iTalent */
/* try{
var iframeHTMLText = body_L;
var searchIframeText = "<IFRAME";
var foundiFrameTag;
if (iframeHTMLText.indexOf(searchIframeText) > -1) {
foundiFrameTag = decodeHTMLEntities(iframeHTMLText);
foundiFrameTag = foundiFrameTag.split('src="')[1];
body_L = foundiFrameTag;
}
}
catch(e){
} */
/* This code is placed to remove the extra meta tag adding in the UI*/
try{
body_L = body_L.replace('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />','');
}
catch(e){
}
/** We should not replace the source content if user profile language and selected target language matches with source language **/
if(showTrContent) {
var compiled = false;
rootElement.querySelectorAll('div.lia-message-body-content')[0].innerHTML = null
if("TkbArticlePage"=="IdeaPage"){
// var customAttachDiv = '';
rootElement.querySelectorAll('div.lia-message-body-content')[0].innerHTML = body_L + feedbackDiv ;
$compile(rootElement.querySelectorAll('div.lia-message-body-content')[0])($scope);
compiled = true;
/* Attach atttach div */
// document.querySelector("div.translation-attachments-"+value).innerHTML = attachDiv;
rootElement.querySelectorAll('div.lia-message-body-content')[0].insertAdjacentHTML('afterend',attachDiv);
if(rootElement.querySelectorAll('div.lia-quilt-idea-message .lia-message-body .lia-attachments-message').length > 1){
rootElement.querySelectorAll('div.lia-quilt-idea-message .lia-message-body .lia-attachments-message')[1].remove();
}
} else {
if("TkbArticlePage"=="TkbArticlePage"){
rootElement.querySelectorAll('div.lia-message-body-content')[0].innerHTML = body_L + feedbackDiv ;
}else{
rootElement.querySelectorAll('div.lia-message-body-content')[0].innerHTML = body_L + feedbackDiv + attachDiv;
compiled = true;
}
}
/* Destroy and recreate OOyala player videos to restore the videos in target languages which is written by iTalent as part of iTrack LILICON-79 */ /* Destroy and recreate OOyala player videos */
try{
// $scope.videoData[value][0].querySelector("div").getAttribute("id");
for(var vidIndex=0; vidIndex<$scope.videoData[value].length; vidIndex++){
if( $scope.videoData[value][vidIndex].querySelector("div") != null){
var containerId = LITHIUM.OOYALA.players[$scope.videoData[value][vidIndex].querySelector("div").getAttribute("id")].containerId;
videoId = LITHIUM.OOYALA.players[$scope.videoData[value][vidIndex].querySelector("div").getAttribute("id")].videoId;
/** Get the Video object */
vid = OO.Player.create(containerId,videoId);
/** Destroy the video **/
vid.destroy();
/** recreate in the same position */
var vid = OO.Player.create(containerId,videoId);
}
}
}
catch(e){
}
try{
for(var vidIndex=0; vidIndex<($scope.videoData[value].length); vidIndex++){
if($scope.videoData[value][vidIndex].querySelector('video-js') != null){
var data_id = $scope.videoData[value][vidIndex].querySelector('video-js').getAttribute('data-video-id');
var data_account = $scope.videoData[value][vidIndex].querySelector('video-js').getAttribute('data-account');
var data_palyer = $scope.videoData[value][vidIndex].querySelector('video-js').getAttribute('data-player');
var div = document.createElement('div');
div.id = "brightcove";
div.class = "brightcove-player";
div.innerHTML =
'(view in my videos)'
var data = div.getElementsByClassName("video-js");
var script = document.createElement('script');
script.src = "https://players.brightcove.net/" + data_account + "/" + data_palyer + "_default/index.min.js";
for(var i=0;i< data.length;i++){
videodata.push(data[i]);
}
}
}
for(var i=0;i< videodata.length;i++){
document.getElementsByClassName('lia-vid-container')[i].innerHTML = videodata[i].outerHTML;
document.body.appendChild(script);
}
}
catch(e){
}
if(!compiled){
/* Re compile html */
$compile(rootElement.querySelectorAll('div.lia-message-body-content')[0])($scope);
}
}
if (code_l.toLowerCase() != newBody.getAttribute("slang").toLowerCase()) {
/* Adding Translation flag */
var tr_obj = $filter('filter')($scope.sourceLangList, function (obj_l) {
return obj_l.code.toLowerCase() === newBody.getAttribute("slang").toLowerCase()
});
if (tr_obj.length > 0) {
tr_text = "Esri may utilize third parties to translate your data and/or imagery to facilitate communication across different languages.".replace(/lilicon-trans-text/g, tr_obj[0].title);
try {
if ($scope.wootMessages[$rootScope.profLang] != undefined) {
tr_text = $scope.wootMessages[$rootScope.profLang].replace(/lilicon-trans-text/g, tr_obj[0].title);
}
} catch (e) {
}
} else {
//tr_text = "This message was translated for your convenience!";
tr_text = "Esri may utilize third parties to translate your data and/or imagery to facilitate communication across different languages.";
}
try {
if (!document.getElementById("tr-msz-" + value)) {
var tr_para = document.createElement("P");
tr_para.setAttribute("id", "tr-msz-" + value);
tr_para.setAttribute("class", "tr-msz");
tr_para.style.textAlign = 'justify';
var tr_fTag = document.createElement("IMG");
tr_fTag.setAttribute("class", "tFlag");
tr_fTag.setAttribute("src", "/html/assets/langTrFlag.PNG");
tr_fTag.style.marginRight = "5px";
tr_fTag.style.height = "14px";
tr_para.appendChild(tr_fTag);
var tr_textNode = document.createTextNode(tr_text);
tr_para.appendChild(tr_textNode);
/* Woot message only for multi source */
if(rootElement.querySelector(".lia-quilt-forum-message")){
rootElement.querySelector(".lia-quilt-forum-message").appendChild(tr_para);
} else if(rootElement.querySelector(".lia-message-view-blog-topic-message")) {
rootElement.querySelector(".lia-message-view-blog-topic-message").appendChild(tr_para);
} else if(rootElement.querySelector(".lia-quilt-blog-reply-message")){
rootElement.querySelector(".lia-quilt-blog-reply-message").appendChild(tr_para);
} else if(rootElement.querySelector(".lia-quilt-tkb-message")){
rootElement.querySelector(".lia-quilt-tkb-message").appendChild(tr_para);
} else if(rootElement.querySelector(".lia-quilt-tkb-reply-message")){
rootElement.querySelector(".lia-quilt-tkb-reply-message").insertBefore(tr_para,rootElement.querySelector(".lia-quilt-row.lia-quilt-row-footer"));
} else if(rootElement.querySelector(".lia-quilt-idea-message")){
rootElement.querySelector(".lia-quilt-idea-message").appendChild(tr_para);
} else if(rootElement.querySelector('.lia-quilt-occasion-message')){
rootElement.querySelector('.lia-quilt-occasion-message').appendChild(tr_para);
}
else {
if (rootElement.querySelectorAll('div.lia-quilt-row-footer').length > 0) {
rootElement.querySelectorAll('div.lia-quilt-row-footer')[0].appendChild(tr_para);
} else {
rootElement.querySelectorAll('div.lia-quilt-column-message-footer')[0].appendChild(tr_para);
}
}
}
} catch (e) {
}
}
} else {
/* Do not display button for same language */
// syncList.remove(value);
var index = $scope.syncList.indexOf(value);
if (index > -1) {
$scope.syncList.splice(index, 1);
}
}
}
}
});
});
/* V 1.1:2 = Reply Sync button for multi source translation */
} catch(e){
console.log(e);
}
};
if((rContent != undefined) && (rContent != "")) {
drawCanvas(decodeURIComponent(rContent));
/** Update variable with selected language code **/
$scope.previousSelCode = code_l;
}
};
/**
* @function manageTranslation
* @description Managess the translation of given language for the thread
* @param {string} langCode - Language Code
* @param {string} tid - Thread ID
*/
$scope.manageTranslation = function (langCode, tid) {
//debugger;
$scope.showTrText = false;
/* V 2.0:5 = actualStatus variable introduced to indicate detailed connector status on UI. This variable holds the actual translation percentage */
$scope.transPercent = "";
$scope.actualStatus = "";
if (tid != "") {
var bulkTranslation = lithiumPlugin.bulkTranslation(langCode, tid);
bulkTranslation.then(function (trContent) {
if(trContent.body != "") {
$scope.showPreview(trContent.body, $scope.mszList, langCode);
if(langCode != "en-US") {
$scope.showTrText = true;
}
}
if((trContent.status != "NA") && trContent.status != null) {
// $scope.transPercent = String(trContent.status);
$scope.actualStatus = String(trContent.status);
} else {
// $rootScope.errorMsg = "Translation is in progress. Please check again a few minutes."
$rootScope.errorMsg = "Translation is in progress. Please retry in a few minutes."
}
$scope.workbench = trContent.wb;
/* V 2.0:4 = Trigger uncalled or delayed callbacks (documnet uploaded/translation completed from lithium).*/
if(trContent.callback == 'true') {
var trCompletCallback = lithiumPlugin.trCompletCallback(langCode, trContent.docID);
trCompletCallback.then(function (callback){
// $rootScope.errorMsg = "Downloading Translated content in " + langCode + " now. Please check again in a few minutes."
$rootScope.errorMsg = "Uploading content to translate. Please check again in a few minutes."
});
} else if (trContent.callback == 'upload') {
var trCompletUpload = lithiumPlugin.trCompletUpload(langCode, trContent.docID);
trCompletUpload.then(function (callback) {
//$rootScope.errorMsg = "Uploading content to translate. Please check again in a few minutes."
$rootScope.errorMsg = "Uploading content to translate. Please check again in a few minutes."
});
} else if ("many" == "one") {
$scope.updateOOS();
} else if("SmartConx" == "SmartConx"){
if ("many" == "many"){
$scope.updateOOS();
}
}else if ((trContent.status != null) && trContent.status.includes("100")) {
/* If everything fine then only check Out of Sync status */
$scope.updateOOS();
} else {
/* If translation perccent is less than 100 then show the percentage on UI */
$scope.transPercent = $scope.actualStatus;
}
});
}
}
/**
* @function selectThisLang
* @description Called on select dropdown.
* @param {string} lang - Language code
*
*/
$scope.selectThisLang = function (lang, anonymousFlag) {
/* 1.4:3 Update Analytics on language selection */
try {
lingoThreadLangSelected(lang, '910880');
} catch (e) {
}
/** Display Translated content **/
var getTranslation = lithiumPlugin.getTranslation(lang, "910880");
getTranslation.then(function (trContent) {
if (trContent.body != "") {
$scope.showPreview(trContent.body, $scope.mszList, lang);
} else {
//$rootScope.errorMsg = "Translation is in progress. Please check again in a few minutes."
$rootScope.errorMsg = "Translation is in progress. Please retry in a few minutes."
}
});
};
var decodeEntities = (function() {
// this prevents any overhead from creating the object each time
var element = document.createElement('div');
function decodeHTMLEntities (str) {
if(str && typeof str === 'string') {
// strip script/html tags
str = str.replace(/