We have a weblink field and we’d like to have the text be formatted as a hyperlink, as “clickable”<http://apps.sos.ky.gov/land/cities/citydetail.asp?id=1&city=ADAIRVILLE&idctr=1> text.
Like it is in the results for the Attributes Table view
If you look at my live preview site the Louisville Traffic Cameras layer has cameras image links as a field and the Attribute Table Widget displays the url as a hyperlink.
Robert J, yes you can do that and Robert S has done it in his preview too, only he is using an icon as the link. We use the link function similar to the way you describe. It sounds like you want to use text so under the Search Links you just select the Link Type as Text. Give it an alias, and enter the hyperlink field in the Link content. It works great.
Your Enhanced Search Widget and Identify Widget is now almost perfect. It is amazing how well it performs on all Desktops and Laptops with a pointing device such as a mouse or trackpad.
I was wondering if you could add a few minor enhancements to improve the usability on some Tablets.
I will run through a few examples with screenshots using the following devices:
Apple iPhone 6
Apple iPad Air 2
Google Nexus 9
Microsoft Surface Pro 3
I am testing them against your Enhanced Search Widget 1.1.6 and Identify Widget 1.1.2
First, let's test the behavior of the Enhanced Search Widget on an Apple iPhone 6 where it rocks!!
When I open the Enhanced Search Widget, I get the By Attribute Pane which fills up the whole screen. Wonderful!
I can tap the X icon which closes the widget.
I can tap the Search button which returns my results.
The Results Pane displays my Search Results.
I can tap on the down arrow to go back to the main Map.
If I want to close this In-Panel Widget, I have two choices.
I can tap on the eSearch icon.
or,
I can tap the X button on the bottom bar.
Both work as expected on an iPhone 6.
This is perfect.
Now let's repeat this process on an Apple iPad Air 2
Open the Enhanced Search Widget
Tap Search
The results pane displays the results.
I can tap on the header and drag the results pane to a different location.
However, I cannot close this pane by tapping the X button on the header!
The only way I can close this In-Panel widget is to open another In-Panel widget.
In this example, when I open your Identify Widget, it closes the Enhanced Search Widget.
Now I am stuck with the Identify Widget. I cannot close it.
I can open your Enhanced Basemap Gallery to close the Identify Widget.
Can the Life Cycle of In-Panel Widgets be modified to fix this issue on Tablets?
Here is another usability issue I am facing. When I activate a Selection Tool by tapping it once, it turns gray. This is perfect.
However, when I tap it the second time, it still remains gray.
Unless the gray background is toggled back to white, I have not visual clue as to what state this is in.
Let's try the same steps on a Google Nexus 9 Tablet.
Open the Enhanced Search Widget and tap Search on the By Attribute Pane.
Here again, I cannot close the Results Pane. I can move the widget, but I cannot tap X on the header to close the widget.
Just like on the iPad Air 2, the Search Tool does not display the deactivated state when I tap on it again.
I can chose a different tool, which deactivates the previous one.
But now, I cannot deactivate this new tool.
Visually, it keeps showing the gray background, although in practice, the tool is really deactivated.
Finally, let's run these steps on a Microsoft Surface Pro 3 which is a hybrid device.
I am using Firefox version 37.
I can tap the X icon on the screen and it closes the Enhanced Search Widget as expected.
Works perfectly!
Once an In-Panel Widget is closed, it is grayed out, showing that it is closed.
There are no issues closing a Widget on the Microsoft Surface Pro 3.
These leads me to these 3 enhancement requests to make the user experience better on Tablets.
Add a Minimize button on the header of the Widget
When you close the Widget, it also removes the selection graphics.
A minimize button will allow me to keep the selection graphics on the screen, while preserving the screen real estate.
All your Flex Widgets had this minimize option.
Make the Close button work on Tablets
Add a None Section Tool
This will remove the ambiguity. You can tell that no Selection Tool is active, when this Null Tool is gray.
I need to deactivate the selection tools when I am trying to Pan the map.
Thanks again for the wonderful tools you are creating for us. I hope you get a special recognition for all your hard work on the Web AppBuilder at the ESRI User Conference!
Thanks once again for the detailed explanation. The problem is all these issues are not limited to my widgets they are base widget framework issues and need to be tested and reported using any OTB WAB widget.
Thanks for the explanation. Now I realize how much more complicated and involved the process is on developing widgets for the Web AppBuilder.
You have to tie everything to the Base Widget and build on top of that.
It was a lot simpler on the Flex platform where the Flash Player took care of all browser inconsistencies. So long your device could run Flash, and you downloaded the latest version of the Adobe Flash Player, your Flex Apps were guaranteed to work.
With the Web AppBuilder, one has to test the Web Apps on all browsers (Firefox, Chrome, Safari, Internet Explorer) and the specific versions as well as all devices, especially Tablets with a touch interface to see how every control in the UI responds.
Yes, this one is for Moxie and his team to fix. They monitor your thread. The message has already been delivered!
I have not been able to work with your ESearch widget for the WebAppBuilder very much because of the AGOL hosted services requirement, so I was wondering if you duplicated the grid look and feel where it opens very quickly when you hover over the Search Results tab, but it closes slowly when the mouse is moved off the grid. If you did duplicate this functionality, where in your code would I find the objects to modify this functionality so the grid closes more quickly? Thank you.
The OTB Attribute Table Widget is a separate widget this is not tied to the eSearch. So yes it stays open and the user controls the widget through the normal means of opening and closing as desired (Though the eSearch will automatically open it when a search is completed assuming the user configured it for that option).
Can you point me to the best public sample that would show me this specific functionality so I can compare it myself to the way the E-Search widget works in the Flex environment?
After additional review, it doesn't appear to be an issue with the eSearch widget. Rather, it appears to be an issue with the Attribute Table widget and using a basemap with a custom coordinate system that doesn't have a WKID.
1. There is a built in minimize for all the widgets in the Header controller bar. So if you add the widget to the to bar where you have your layer list you will get an option to minimize the widget. It looks like two down chevrons.
2. One way to work around the widget not closing is to select the widget icon again.
3. Why would you want to use the search by shape tab and use no shape?
Yes, adding the Widget to the Header Controller Bar as opposed to adding it as an In-Panel widget solves the problem.
You can minimize the widget by tapping the down chevrons as you indicated.
2.
Yes, I just verified this workaround. You can tap on the Widget Icon to close the Widget. I did not know of this trick!
3.
Here is one use case where it may be convenient to have an additional selection tool that deactivates the others.
Let's say you are using Robert's Enhanced Search Widget and you want to make a graphical search based on two circles on your map spaced quite a distance apart.
So, first you would open the By Shape pane.
You would check the Enable multi-part graphics option.
You would tap once on the Select by Circle tool.
It would turn gray showing that this tool is now activated.
Next, you would draw a circle by tapping once on the map to define the center, and then drag to define the radius.
So far, so good.
However, now you want to pan the map to a different location before you tap the center of the second circle.
Here is where it would be nice to have a "Select None" tool. You can tap on this tool to deactivate the others.
You can now pan the map to a different location.
Then you can activate the circle tool and proceed to draw your second circle.
Finally, you can press the Search button to trigger your search based on these two circles on the map.
Question -- I'm attempting to replicate the "Select" widget functionality from Flex viewer, by using your eSearch widget. I have one map server with over a dozen layers, and I want to create a search for several fields in each layer. While it will take some time to set up, it is not actually that complicated and will be useful once done. Basically, I want users to be able to search by Name, Address, Parcel Number, Property value (greater than and less than) and a few other things. But, we have a parcel layer for every year going back more than a decade. So for each single field in each layer I am creating a query that allows user input. I have no use for pre-set inputs so I just put a 0 in. I wish that was not a required value actually. Is that a limit of the API or WAB? I notice the same thing, it's required value, in ESRI's Query widget. Minor quibble.
But I do have a feature request that I think would be extremely useful to me and many others. Allow us to select which attributes to show in the Results pane. You allow this for Identify, thankfully. Because, if there are 50 results (and there will be at times), and each result has 20 attributes, that means a user can only see one result at a time since the result takes up the entire vertical space in the eSearch widget Results pane. Instead of being able to see about 10 at a time, if I elected to only display Name and Address. Do you know what I mean? Screenshots below demonstrate this. Again, Identify allows this perfectly. The way it accomplishes this is with the Checkbox in the setup options "PopUp Only" under the Included Fields section. So, you can display only Name and Address for each result in the Results pane in the Widget panel, yet display all attributes in the Popup. Perfect! I'd like this in eSearch widget. Except instead of the Popup it would apply to the Attribute Table where the results are added. In other words, I'd like to see only two or three attributes per result in the Results panel of the Widget (Name, Address) but I would still like to see ALL attributes in the Attribute table. The reason being, if you go to export to CSV you'll probably want all Attribs. Would this be possible as a future feature enhancement? Would anyone else find this useful? And if so Thank you!!!
The example below shows how useful this concept is in your Identify widget. Notice how I have opted to only display 3 attributes for Tax parcels. Yet the full complement of attributes are present in the Popup. If this could be mirrored in the eSearch widget, with Attribute Table retaining the full set of attributes but with the widget allowing us to only display certain attributes in the Results pane that would be great.
Your multi-part graphics selection feature using a mix of selection tools already does a lot more than your Flex version.
In the Flex version, I could only use a single selection tool during a multi-part graphics session.
In this WAB version, I was surprised to find that you could start with the Rectangle Tool, then switch to the Circle Tool, and then use the Polygon Tool, and each geometry was recognized in the final selection set.
Your Enhanced Search Widget along with its companion Identify Widget are the two most essential and valuable Widgets in any Web Application. After the brilliant work you have done on the Flex version, all our users now naturally expect to find the same implementation on the JavaScript apps.
I never thought I would ever see all the Flex functionality carried over to the Web AppBuilder. You are making the impossible possible!
The ability in the WAB version to draw two different geometry types is likely an over-site in my programming as right now I can not figure how to actually perform the query with two different geometry types or if that is even going to be a possibility. In the Flex version I probably knew that I couldn't do that and put code in place to prevent selecting a different geometry type.
Can you please help me with a few questions I have with the configuration?
1) I want to have our users search for a parcel address by a partial address. For example, if I'm looking for the address 100 N Main St I want to be able to find that result by entering just 100 Main or 100 Main St. Our parcels dataset has a field called SiteAddress that is the concatenation of "100" + "N" + "Main" + "St" (there are fields used for that concatenation) so I don't know if this is possible or not but want to know if there is a way to pull it off.
I am using an expression of 'PropertyAddress(String) contains <value radial w/box empty>'. Should this work for a partial address search or will the user have to enter the value exactly as its entered in our dataset?
2) I have set up individual searches for voting precincts and zoning classification using the expression 'FieldName(String) is <unique radial w/first entry in ascending alphabetical order>'. The search executes in that it finds the results of a unique item from the dropdown list like I want but I don't get the list of actual results. Instead, I get the message "Features selected: 1", so I'm not able to zoom to the feature or view the attributes that I want the user to see.
For both of these searches I currently have the following settings:
Spatial Search Layer = yes
Layer symbology = from Config
Zoom scale = specific cache scale
Add as operational layer = yes
all other settings are default
Can you tell me how I need to set up these searches so the widget automatically zooms to the feature and/or so the user can see the attributes in the Results window?
3) This question is for you and everybody else out there.
I want to build an 'Export to CSV' option into your eSearch widget so that the user can export the results directly from that widget instead of having to open the LayerList widget, click the dropdown in the LayerList to open the attribute table in the Attribute Table widget, and then export to CSV. If I could streamline this for our users it would be great but I'm not quite sure how to incorporate that into the eSearch widget.
Can somebody give me some tips or good direction on how to add 'Export to CSV' into the eSearch widget? Or would it be better to start a whole new thread/topic for this matter?
I have not downloaded and deployed the application I'm currently working on, so I don't have a link for you to view and see what I've set up. Please let me know if it would be better to see screenshots. Thank you.
I am assuming you are trying to configure the Identify Widget and not the Enhanced Search Widget.
When you go to configure the Identify Widget, and you scroll all the way down on this Configure Identify panel, you will see the Identify Layer Option dropdown list.
I have an example on page 128 of this Tutorial doc:
I agree with you Raviteja that it would be a nice feature to have on the Enhanced Search Widget, just so that you can limit the search layers that show up in the drop down list.
We have Web Apps with 76 layers.
With the current implementation of the Enhanced Search Widget, you get a drop down list with 76 layers.
It can be daunting to scroll through to get to the one you want.
If there was a Visible Option, I would see only the search layers in the list that are within the scale threshold.
This would greatly reduce the number of layers I see in my drop down list, and improve usability.
You would use the concatenated field with the contains or ends with option in the UI as both of these do a wildcard query.
There seems to be several issues with the text and missing screenshots in your post. You need to start a new discussion as the comments portion of this document has limitations.
When you start a new thread there please attach your config_Enhanced Search.json file.
HI Robert- The excellent eSearch is working very well for us. I just noticed something that I'm wondering if you might consider as an enhancement or guide me on how to adjust for our use. We have one search expression based on a menu of unique values, where the universe of unique values is about 2,300. The regular WebApp query tool would show the full list but the eSearch is limiting the list to the first 1,000 unique values. Is there an option to get the full list? Thanks for all your work on others behalf!
amyk did you set your records setting limit on ArcGIS Server to be higher? I think that is the default 1,000 records queried but you can raise it. I don't know if this bottleneck is the widget or your service so I thought I'd mention this.
Thanks Robert. I will gladly start a new thread and provide screenshots. Can you please first let me know if you are suggesting to start a new thread for all of my questions above or for a specific item/items?
Just when you need detailed help on one of my widgets like this one the comments section on this document in GeoNet is limited in a couple of ways that a new discussion is not limited to.
What version of ArcGIS Server are you running? My widget uses a custom pagingQueryTask to get past the limit that the server has set to return all unique values (at least it is suppose to).
Yes, that fixed the problem. One reason that did not occur to me is that I checked the Query widget that comes with WAB and I can get the full list of 2,300 values there. I assumed 1000 record limit in the service was more related to the number of records returned in the query result. Thank you for the help!
So using Server 10.2 you should not have to change the servers return feature limit to get the full 2300 unique values using the eSearch. So there must be an issue for me to look at. On a side note having a drop down (combobox) with 2300 values is not user friendly at all and you so consider your user experience.
Thank you for looking into it Robert. On the user-friendly note, I agree but cannot find a better option for this particular case. We need users to be able to select from a statewide list of sites by site name. The names are not always intuitive so they might miss if they type something (‘contains’ is not enough to get it right but we might consider going to that). The good thing is that the menu scroll is very fast.
Thanks, Robert. I'm trying to reply to you in that discussion but I get the following error message. I've logged out of geonet, cleared my cache and even tried in a new browser and get the message each time I try to reply.
';
}
}
}
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(/