Hi rscheitlin Is this widget supported as an item in Portal for ArcGIS version 10.6? When I try to load it I just get the waiting gif, and it appears to be looking for a CSVUtils.js file that it can't find.
I’m using WAB developer 2.7 and you’re Enhanced Search Widget Version 2.7. Under the Results Tab the three dots do not show up for Result Menu. How can I fix this?
I'm trying to get the "disable link if null" part to work, but I'm struggling. I am using version 2.3 of the Enhance Search widget. I see in the List.js file where the links get created, but I don't see any code in there that would check if the value is null. How does the widget determine if it should show the link?
Have you considered adding the option of generating/downloading labels (like in the Public Notification Widget) from this widget? I LOVE, and prefer your widget for a number of reasons, but our Assessor's really like this feature in the Public Notification Widget.
When I saw that feature in the Public notification widget I did think about adding it to the eSearch. I just have not found the time to dedicate to this as of yet.
First, I want to say thanks a lot for all the work you have done over the years. I have been using your widgets for years and I'm positive the GIS community has benefited immensely from your work. I am currently using your enhanced search widget and I'm running into an issue with it. The issue is NULL values. I have the widget setup where it searches through the data and creates the dropdown list of available values. All string values within a field work well. The "all" option works well too. The problem is that the drop down creates a value of "null". I am glad it does but when the user selects "null", the search fails. Any help is greatly appreciated.
I am not sure what version you are using or if you have modified the eSearch, because I have code in there to NOT add null values to the widget drop down list when you have configured the search expression to use unique.
I upgraded my Web App Builder Developer Edition to the version 2.7. I re-imported your Enhanced Search Widget and now null values are not populated in the drop down list. Is it possible to give the user the ability to search for any null values or does that always introduce a failed search?
I think I'm asking for the latter, Robert. That is, I had a request to specify the Search Layer's default value as the widget loads. Perhaps I was looking for a way to tweak the index, but it looks like much more would have to be altered than just the Search Layer.
As I was exploring it, I was wondering where one would go to deactivate the auto-zoom or even the auto-pan functionality of the results tab upon mouse click of a found feature after a graphical search. I am still looking in the code.
The autozoom setting under the layer is turned off, and the autozoom in general settings as well.
So even with that unchecked, it doesn't autozoom for you when you click the feature or between the features in the results window? It is for me. :shrug:
The "Auto zoom to search results" setting means that it will or not automatically zoom to the extent of the search results as soon as the search is complete. As far as the widget zooming to the search result when you click on the result item in the widget list this is a default behavior that is no configurable.
Jack announced that you won the 2018 GeoNet MVP Award at the Closing Session of the International ESRI User Conference in San Diego.
On behalf of the Web Builder Community, a million thanks for all your hard work and passion behind creating, enhancing, and updating all these powerful Custom Widgets.
By the next User Conference, the Web AppBuilder will switch from the 3.x JavaScript API to the 4.x JavaScript API, although full parity is not expected.
That will be a monumental task for you to rework all your widgets!
Congratulation on your 2018 GeoNet MVP Award! You really deserve this!
I was trying to add data in Esearch widget 2.8 from one of our rest map service which have almost 900,000 records. When I added the expression by the unique values it is taking a lot of time to load. I wonder how big the data records(no) can be handled by Esearch widget?
Anytime the widget has to retrieve unique values from 900,000 records it is going to take a long time. I don't have a number that I can say is the limit but logically 900K is alot of data.
What I know is Portal is always 2 versions behind WAB Dev. So right now WAB Dev is 2.9 and Portal is 10.6.1 so the WAB version deployed with Portal 10.6.1 should be 2.7.
I have something exciting to share with you on the Web AppBuilder. We had asked for a Widget that will allow us to create Custom Reports. The task seemed too complicated because it is impossible to design a standard template that satisfied everyone.
A one-size-fits-all scenario does not work when it comes to designing Reports.
Latitude Geographics surprised us with their new Geocortex Reporting 5 software.
Anyone can now design Custom Reports via a simple drag & drop interface, position the headers, footers, labels, tables, picture boxes, etc. within the page and save the finished report to their ArcGIS Online Content folder.
This finished report can be used within the Geocortex Reporting Widget that works inside the Web AppBuilder.
This makes it very easy for the end user to select a feature and run a report.
You get a professional looking Report of all the Trees within this Park grouped by Common Name with hyperlinks to open Google Search and a Table of Contents to make it easy to browse through this long report.
The best part is that you do not have to write a single line of code to create this fancy report.
You can also use the Select Widget to select more than one Park.
Press Done to close the Reporting Widget.
Open the Select Widget
Select two Parks
21 features are selected
Expand the Menu and select Run Report
The Reporting Widget shows that 21 features have been selected.
Select the LA County Parks Report
Wait for 5 minutes.
Download Report
View the Report
Everything works like a breeze.
We wanted this feature for such a long time.
Now, this is available to the Web AppBuilder Community.
Now here is my plea to you.
Would it be possible to make this 3rd party Reporting Widget work with your Identify Widget and Enhanced Search Widget?
I know this is asking too much since you are not involved with the Reporting Widget.
However, it would be the icing on the cake if I could somehow use your Enhanced Search Widget to search and zoom to a Park, and then trigger the Report by selecting Run Report from the expanded menu.
Let me explain what is happening now.
Open the Identify Widget (version 2.7)
Use the Extent Tool to select a Park.
Expand the Menu
Select Run Report
This triggers the Reporting Widget.
It shows that one feature has been identified.
This is good.
However, it shows that no reports are available.
Let’s try the Enhanced Search Widget (version 2.7)
Search for Elysian Park.
Expand Menu
Run Report
This triggers the Reporting Widget.
One feature is found from the Search Results.
However, no reports are available.
I am including the Zipped file of this Website.
It is using the Web AppBuilder Developer Edition 2.8
It sounds like the report widget is selecting the appropriate report based on the layer id or layer name and because I have the name of the results layer from the identify and eSearch different from the main layer it symbolizes there is no matching report found. One suggestion is to run the eSearch or Identify first and has them add the results layer and then go and configure the report widget to see if it picks up the result layers from the map in the report widgets settings screens. If it does then configure a report and you are good to go. If not then some effort will need to be done to figure out the report widget logic.
I created a Parcel Report that only returns the ObjectID and Parcel Number.
Next, I opened the Web AppBuilder and added the Geocortex Reporting Widget.
Finally, I ran a few tests:
Web Map Popup
Click to select a Parcel.
This opens the Web Map Popup
Expand the Menu Actions and Select Run Report.
This opens the Geocortex Reporting Widget
The Layer Name is correctly identified as Parcel
This is critical.
The Parcel Report will appear as an option if and only if the selected feature includes a layer named Parcel.
Click on Parcel Report.
Download the Report.
Press Done and close the Reporting Widget.
Here is how the Parcel Report looks like:
Popup Panel Widget
Open the Popup Panel Widget
Select another parcel and expand the Menu Actions
Run Report
Once again, the Layer Name is correctly returned as Parcel
Select the Parcel Report
Download
Done
This works since your Popup Panel Widget mirrors the Web Map Popup.
Enhanced Search Widget
Open the Enhanced Search Widget and select a few parcels with the Extent Tool.
Expand the Menu Actions
Run Report
This opens the Reporting Widget.
The Layer Name is correctly returned as Parcel
Parcel Report shows up as a valid option.
Click on Parcel Report and Download the Report.
The report contains the Parcel Numbers for the 5 selected parcels.
This is perfect!
This is exactly what I was hoping for.
Press Done and Close the Reporting Widget
Click on a Search Result.
This opens the Popup Panel
Expand the Menu Actions
Run Report
The Layer Name is correctly returned as Parcel.
Click on Parcel Report and Download the PDF file.
This is excellent.
So now we have verified that the Geocortex Reporting Widget works with your Enhanced Search Widget and your Popup Panel Widget.
Identify Widget
Refresh the Web App
Open the Identify Widget.
Select a Parcel
Expand Menu Actions
Run Report
Now we can clearly see the source of the problem.
The Identify Widget is returning the Layer Name as Identify Results.
The Reporting Widget is configured to look for a layer named Parcel.
Since it cannot find this, it is saying:
No Reports Available.
I understand now why this cannot be easily fixed.
Unlike the Enhanced Search Widget which only works on a single layer at a time, the Identify Widget can return results from multiple layers.
This is why the Identify Widget is returning Identify Results as the Layer Name rather than naming any specific layer like Parcel.
Potentially, the layer list may contain all of these layers:
Parcel
Zip Code
City
Township Range Section
County
Your Identify Widget is a simple and excellent tool. I do not wish to mangle this widget for the sake of making it compatible with the Geocortex Reporting Widget.
The Enhanced Search Widget is doing the job. This is the Widget that everyone will use to Search for a Parcel, and then they can expand the Menu Actions and Select Run Report to get a detailed Parcel Report with all the Attributes grouped logically.
Here are the detailed steps for creating this simple report using Geocortex Reporting:
I am thrilled to find how simple it is to design Custom Reports with Tables, Pictures and Charts and generate these PDF docs directly off your Enhanced Search Widget.
All this is like magic to me!
I cannot thank enough all the brilliant minds that went into designing these helpful tools.
I cannot believe that all this information for 1.6 million parcels is accessible to the end user on their Smartphones!
I used your enhanced widget, for the search result I could 'Add Result as Operation Layer', this way when I use the print widget the result will be in the printout. I am wondering that would it possible to add the buffer from the spatial search as operation layer? This way I could print out the buffer from the print widget. Right now if I click on the print the buffer graphic is gone.
Hi Robert, will the below code work on your eSearch widget? I'm using multi part graphics and I just want to clear all graphics using the onClose or onDeactivate event. I've tried adding this.map.graphics.clear(); to your onDeactivate function in Widget.js of (server/apps/21/widgets/eSearch) but it's still not clearing the buffers. Thanks for any advice.
If you are talking about the buffer that the eSearch uses then that is the issue. I do not use the map.graphics layer in my widget I have a specific GraphicsLayer I use for the buffer.
Yes thank you for pointing that out. What is the name of that GraphicsLayer and how would one clear it's graphics? Is the onDeactivate function like I mentioned above a good place to do this?
I see that you've used this.graphicsLayerBuffer.clear(); in Widget.js within the _bufferGeometries function. I tried adding that in eith the onClose or onDeactivate functions and no luck so far. Do I need to loop through the graphic container within either of those functions and remove buffers that way?
Hi Robert, unfortunately that did nothing to the buffers so I must of missed a step. Below is the onDeactivate function within (server\apps\21\widgets\eSearch\Widget.js). I'm using WAV dev 2.6 I believe and Portal 10.5, AGS 10.5. Is there another js file I need to update this code by chance? After I close the window for the eSearch tool using the upper right X, the buffers I created still remain (screenshot below). Thoughts?
That makes sense but unfortunately I do not have "add to legend" checked which makes this even odder. I'll keep tweaking the code around this area in widget.js and maybe I'll get lucky, thanks
Your Enhanced Search Widget version 2.7 is working with the Reporting Widget exactly as we expected.
I can search for a Parcel by Address or Owner or simply select a parcel by clicking on the map and then expand the Action Menu and select Run Report.
This downloads a nicely formatted 5-page PDF doc showing all the Parcel Attributes including external Web Links and a Parcel Map and an Overview Map like this:
This approach is much more elegant than trying to download a CSV file to an Excel Table.
Best of all this entire workflow works on my Smartphone. This will allow the citizens of Maricopa County to access and download all the relevant Parcel Information right on their handheld devices without ever having to step into a County Office.
Here is the Web App based on the Foldable Theme of Web AppBuilder Developer Edition 2.9
Let’s locate the County Administration Building based on the Address:
Enter Address = 301 W JEFFERSON ST
Expand the Action Menu and select Run Report
The user gets to select from 3 Report Choices.
I can also download a report for all Parcels within 200ft of this Parcel.
Open the By Spatial Tab and draw a 200ft buffer.
Select the Intersected By tool
13 Parcels are found within 200ft of the County Admin Parcel
Expand the Menu and Run Report.
Select Parcel Report with Web Links
This creates a nicely formatted PDF doc with a Table of Contents for the 13 Parcels that can be viewed on a Smartphone.
I think this is quite a breakthrough.
Before this, there was no elegant way to select, display and download so much information on your smartphone with just a few mouse clicks.
This can be used by realtors and prospective buyers to find the selling price of houses within 300ft of their target parcel. It is easy to insert Charts and Graphs into the Report.
I hope future upgrades to the Web AppBuilder does not break your Enhanced Search Widget. This has become a critical tool for all our Web Apps.
DAVID DAS your post is epic - thank you greatly. Josh Vickrey thanks I'll add this as well.
edit: DAVID DAS so I added the "Report Feature" Widget. (which I was wondering about since it is for QA/QC reporting) and do not see 'Run Report' show up in eSearch. May I ask, what widget exactly do you mean by "Report Widget"? Report Feature? I would think maybe it would more be the Screening widget. So, I added both of these plus Infographic and any other ones that looked relevant. I added Select, Public Notice (which I couldn't get to work or save oddly) Location and Incident. To no avail, Report does not show up. (although location and incident do, and they work. That is why eSearch is so amazingly awesome, in how it ties in to the other widgets). Robert I looked in the Docs and searched Report and did not see indication of it in there. Which Esri widget should I add for Report?
';
}
}
}
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 {
setTimeout(()=>{
lingoThreadLangSelected(lang, '910880');
console.log("Language",lang);
},5000)
} catch (e) {
console.log(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(/