Curious if you've had any issues with the popups that are configured in the initial web map conflicting with the "select by shape" option? Basically, when I try to create a polygon or a point to select by, my clicks bring up my pop ups. I can still create my polygon, I just have to ignore the popups and click around them.
Awesome. Thanks a bunch for pointing me in the right direction to all the custom widgets. Knew about it on the Flex forum, but not here. Keep up the awesome work!
Since you are working on the next release and since this widget is very popular around the office I would like to submit two possible enhancements we commonly discuss:
1) When searching by attribute eSearch zooms and centers in the screen. If the attribute table is configured to pop open my screen will not re-zoom and re-center causing some of the selected geometry to reside under the attribute table. Would it be possible to rezoom and center after the attribute table is open?
2) Some user do not like the attribute table taking real estate after a search. Would it be possible to add an operational layer, populate the attribute table but not have the attribute table open. This would allow users control as to when they can show/hide the attribute table.
I have not graduated from the school of wizardry yet so I am not sure how probable these suggestion are but I submit them for your consideration. Thank you for all of the time and effort you have put into this widget, it has been a valuable asset.
So it turns out that your #1 is a no go. The issue is the Attribute Table Widget automatically opens itself when data is sent to it. The work around fro your users that what to not have the AT to open automatically after each search is for then to configure the layer to NOT have " Show in Attribute Table Widget" checked and then when they do want to see the results in the AT they will have to open the LayerList widget and click on the dropdown arrow next to the Search Results: xx and choose "Open Attribute Table". Your #2 will be in Version 1.1.9.
Funny…we were just looking at our sites today and thinking the same thing about the AT. One workaround that I found was that you can resize the AT in the website. So users can also click just below the minimize button and drag the AT down so it takes up very little space. When the user searches it doesn’t open to the original size anymore.
Another solution would be to set the initial size of the AT to be very small and make the use increase it in the App
This magical widget wraps 4 essential functions - Identify, Search, Buffer, and Spatial Relationships - all under a simple, elegant and intuitive GUI that a lay person can figure out without having to read a help manual.
I am amazed to find how well it handles 49 Search Layers. The Parcel layer has around 1.6 million records.
This was the most critical widget we needed for our migration to JavaScript. Your widget has delivered in spades.
I actually like it the way you have it implemented. The drop down list always fills up the available vertical space on the window. This means when I am working on a Dell 3007 UltraSharp 30 inch 2560 x 1600 monitor, I get to view the complete list of 49 search layers within the drop down without having to scroll.
On the other hand when I am working on a Dell U2412M UltraSharp 24 inch 1920 x 1200 monitor, I get the drop down list which still fills up the whole vertical space, but I have to use the scroll bar to get the bottom 10 layers. The example screenshot above is from a Dell U2412M monitor.
A drop down list which always fills up the available vertical space works better for me. It gives me a sense of having more breathing space. I would feel restricted if the list is limited to a finite number of lines like 10.
I guess this is a matter of perception. I would vote to leave it the way it is.
OK I was not able to tell from the image if the bottom of the Drop Down was going beyond the bottom screen edge. Go to know that it handles this. Does it still work OK for small mobile screens?
No, the Drop Down never goes beyond the bottom of the screen.
Everything tested out ok on the iPhone 6 and iPad Air2 both in portrait and landscape mode.
What happens is that the drop down always extends to the bottom edge of the screen filling up the vertical available space. It never overflows. However, if there are more layers than what could be fitted into this vertical space, you just get a scroll bar. The user can scroll to get to the bottom of the list.
This is actually an elegant solution. The scroll bars appear only when necessary.
On a large monitor, if you shrink down the size of the window, and launch the app, the drop down stops at the bottom edge of the screen, never spilling beyond the bottom border.
Now, if it did spill beyond the bottom edge we would have had an issue.
So far, it works just fine and self configures gracefully on smart phones, tablets, and larger screens, presenting a scroll bar only when necessary.
modified by Robert Scheitlin, GISP in Web AppBuilder Custom Widgets - View the full document
Live Preview Site
List of the latest enhancements and changes:
Added option to have limit search by map extent checked by default.
If there is only one search expression for a particular layer then the search alias drop down is hidden from the widget UI
Fixed a bug where drop down lists would hang on screen if the drop down was opened and the widget was closed before a list option was selected.
The maps popups are disabled now when using the graphical search draw tools.
When a layer is configured to set results to the attribute table and be added as an operational layer the widget now waits for the Attribute Table Widget to open before it attempts to zoom to the results.
Changes have been made to the interaction with the Attribute Table Widget to ensure better behavior.
Older enhancements or changes
Check the "Older enhancements or changes.txt" in the download for a complete list.
Comment by replying to this email, or go to the document on GeoNet
Create a new document in Web AppBuilder Custom Widgets by email, or at GeoNet
Following Enhanced Search Widget Version 1.1.9 - 7/2/15 in these streams: Inbox
This email was sent by GeoNet because you are a registered user.
You may unsubscribe instantly from GeoNet, or adjust email frequency in your email preferences
My code checks for a actual null in the field data and a empty string "" If you have a " " (one blank space) then this is not considered null. Would this possibly be your issue?
This what the code looks like and I've attached an image of the field. The link still shows wether it is blank or
GeoNet
Enhanced Search Widget Version 1.1.9 - 7/2/15
new comment by Robert Scheitlin, GISP View all comments on this document
Cameron,
My code checks for a actual null in the field data and a empty string "" If you have a " " (one blank space) then this is not considered null. Would this possibly be your issue?
Reply to this email to respond to Robert Scheitlin, GISP's comment.
Following Enhanced Search Widget Version 1.1.9 - 7/2/15 in these streams: Inbox
This email was sent by GeoNet because you are a registered user.
You may unsubscribe instantly from GeoNet, or adjust email frequency in your email preferences
So it looks like you have a mix of null and empty strings in your data. Are you getting a link for the both the null records and the empty string or just one and not the other?
You are the first to report this as not working and in my testing it is working fine so I am trying to see if I can narrow this down.
Yes it is happing for both the null and empty strings.
Cameron Johnsen
Cache County
GIS Specialist
435-755-1635
cameron.johnsen@cachecounty.org
>>> "Robert Scheitlin, GISP" <geonet@esri.com> 7/7/2015 11:37 AM >>>
GeoNet
Enhanced Search Widget Version 1.1.9 - 7/2/15
new comment by Robert Scheitlin, GISP View all comments on this document
Cameron,
So it looks like you have a mix of null and empty strings in your data. Are you getting a link for the both the null records and the empty string or just one and not the other?
You are the first to report this as not working and in my testing it is working fine so I am trying to see if I can narrow this down.
Reply to this email to respond to Robert Scheitlin, GISP's comment.
Following Enhanced Search Widget Version 1.1.9 - 7/2/15 in these streams: Inbox
This email was sent by GeoNet because you are a registered user.
You may unsubscribe instantly from GeoNet, or adjust email frequency in your email preferences
Thanks for your widget, it is working great for us. One suggestion we keep getting is to have the ability to use the SQL Statement of 'IN' so users can search multiple items at once.
I actually have code inside the widget to handle IN SQL statements, I just have not worked on the UI to enable configuration of this. So yes I am considering this.
I have only used this widget once in one viewer on one service o far so I am kind of a newbie at it. Here goes. I had it on Parcel 2014 service. Well we now have a Parcel 2015 service. All the layers and even layer ids are the same except i just has a 2015 layer in it now. So I switched my AGOL Arcgis.com map over to the 2015 service and removed the 2014 service. I did a find/replace all in eSearch and your Identify for 2014 changing to 2015 in the URL strings so it would point to the new service's URL. I relaunched WAB Builder. When I go to add a new Expression, the attribute field name popup is blank. Restarted WAB several times, tried different browsers, same result. Has anyone else seen this? I am on 1.1.9.
Remove the eSearch Widget, and then add the eSearch Widget back into your Web AppBuilder session.
This will essentially blank out the contents of the eSearch config file, and you will be starting fresh.
When you add the URL to your 2015 Parcel Map Service, make sure that you include the index number at the end of the string. It must always point to a specific layer ID for it to work.
I would like to revisit the error message reported by Tim Jacobsen a few days back.
This is not an issue with your Enhanced Search Widget 1.1.9, but rather with the Attribute Table Widget from the Web AppBuilder Developer Edition 1.1 that your Widget connects to.
Nevertheless, I would like to bring this up because this is going to affect everyone of us using your Enhanced Search Widget.
The problem is easily reproducible 100% of the time.
To illustrate the issue, I have made 2 test cases - app32, and app33.
The first one works flawlessly while the second one throws an error.
Case-1: Enhanced Search Widget 1.1.9 without the Attribute Table.
After an annoyingly long wait, the Attribute Table does get populated.
However, the Console Window in Developer Tools throws this error:
Uncaught TypeError: Cannot read property 'geometry' of undefined
These are the details:
It appears this is something that Moxie and this team needs to address.
Try a Search for Owner Name containing "Smith John"
Once again you get the busy cursor, and after a long wait the Attribute Table gets populated.
However, you get the exact same error message:
Uncaught TypeError: Cannot read property 'geometry' of undefined
You can ignore these errors. The app does work, albeit with a slow response time.
Now here is the curious part.
You can perform as many Graphical Searches you like. There are no errors!
Also, the Attribute Table gets populated almost instantly during a Graphical Search. There is no lag.
Robert, I know that you did not design the Attribute Table Widget. Your Enhanced Search Widget is simply displaying the Search Results through the built-in Attribute Table Widget in the Web AppBuilder.
The Attribute Table Widget is the weakest link in the Web AppBuilder. I wish someone would recreate the awesome Data Grid you had in your Flex version of the Enhanced Search Widget.
When I ran the Attribute Search for Parcels, I still got the same error message in the Console Window for Developer Tools.
Note: If I do not clear my browser cache, and reload the page a second time, and run the exact same attribute search, the error message does not come up.
However, running a new Attribute Search like Parcel Number = 1691603 will again trigger the error message.
What is the best way to upgrade to a new version with out having to re-create and relink your layers in e-search widget? replacing the eSearch folder in stemap/widgets makes you redo the widget and takes time.
What you would want to do is replace the eSearch widget folder in your deployed app
[install dir]\server\apps\[app#]\widgets\eSearch
after you have done that then go configure the app in app builder and open the eSearch widget config UI and change something (so that it writes any new properties to the json).
For new apps:
Do just as you already are doing just overwrite the eSearch widget in the stemapp.
I have a simple enhancement request that will solve our problem with the Attribute Table right away.
The real reason we like to have the results displayed in the Attribute Table is because of the nifty Export to CSV option. This is a powerful feature. It allows us to view the results in Excel, make charts, reports, and perform further analysis.
The Attribute Table also allows us an easy way to sort the columns. However, this can be done easily in Excel.
So if the Export to CSV function is the only real requirement, would it be possible to add this option directly on your Results Pane?
Here is a mockup of how it may look like:
If we can get this option on the Results Pane, and the Export to CSV captures all the fields that are shown in the Popup, then we won't have any need to display the Attribute Table.
We can completely bypass the Attribute Table, and enjoy faster performance, and more screen real estate to display the map.
It would also be wonderful to have this Export to CSV option on your Identify Results Panel as well.
In the Flex version of your Identify Widget, you had a Copy to Clipboard option which we found very useful.
I have some ideas on the Attribute Table issue that I will try soon. I will consider the export to csv as well. As far as the ability I had in the Flex verion of the identify for copy to clipboard this is going to be something that is restricted in JS. Flash ran in a browser plugin so it had access to more things than JS like the clipboard. JS has no or little liberty to put something on the clipboard.
We got another tip from ESRI that may explain why we are getting this error.
Uncaught TypeError: Cannot read property 'geometry' of undefined
They explained that the zoomall function is getting invoked before the queries are coming back from the server.
The setTimeout value in milliseconds is there to delay the calling of the zoomall function allowing sufficient time for the results to be returned.
Line 1574 on file widgets\eSearch\Widgets.js
The default value was 300 milliseconds. This delay is enough for most scenarios.
However, we are making searches on the Parcels Layer with around 1.6 million records.
It can take around 12 seconds for the results to appear.
So until this 12 seconds have elapsed, the array this.currentLayerAdded.graphics is empty.
Line 1280 on file widgets\eSearch\Widgets.js
So when the zoomall function tries to read the first item of this empty array, it throws the error.
The trick will be to add the necessary logic to make the call to the zoomall function to wait until the array is populated.
If the wait time is based on a fixed delay value like 300 or 600 milliseconds, it will be a hit and miss scenario. One cannot anticipate the size of the database being queried.
This makes the solution complex.
Perhaps the delay time can be a user defined value tied to a specific layer.
Perhaps there could be a way to check to see if the array is empty before calling the zoomall function.
#winning Robert & Tapas. Thanks for all your efforts both.
Ah and Tapas yes it worked fine when I cleared out the widget and put a fresh copy in. Who knows, maybe caching or something. But updating is now seamless and working.
I love your widget and have used it in the flexviewer and in the javascript WAB. I was wondering though if the options from the flexviewer version where you could add a new search to a previous search and where you can use the graphical search and the text search together would make an appearance in the javascript WAB? Or if they are there and I might have overlooked them?
Anything in the widget configuration UI (i.e. name of the search layer, symbology any of the options) just so that WAB recognizes a change and enabled the save button.
Again, this would not occur unless there was an error setting up the search Layers dropdown list. So there will be an error in the browsers web console.
';
}
}
}
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(/