添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Hello

Every time I execute my python-script in the end it says

Runtime error  Traceback (most recent call last):   File "<string>", line 52, in <module>   File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 7211, in SelectLayerByAttribute raise e ExecuteError: ERROR 000229: Cannot open Rest\Kartenausschnitte A3 mit Aussparung Legende. 1:2500 und 1:3000 Failed to execute (SelectLayerByAttribute).

So this is the "bad" part of my script. lyrkartenausschn is "Rest\Kartenausschnitte A3 mit Aussparung Legende. 1:2500 und 1:3000"

cursor = arcpy.da.SearchCursor(lyrkartenausschn, [seitenzkartenausschn])

seitenliste = int(19)

del seitenliste

seitenliste = []

for row in cursor:

seitenliste.append(int(row[0]))

print seitenliste

for seite in seitenliste:

for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):

if elm.name == seitex:

elm.text = str(seite)

pfdausgabePDFeinzeln = pfadausgpdf[0:-4] +"_"+ str(seite) + ".pdf" #Path

arcpy.SelectLayerByAttribute_management (lyrkartenausschn, "NEW_SELECTION", seitenzkartenausschn + " = " +  str(seite))

mxd.dataDrivenPages.exportToPDF(pfdausgabePDFeinzeln, "SELECTED") #PDF Export

mxd.dataDrivenPages.printPages(druckername, "SELECTED") #  Print

mxdspeicher = ausgpdfmxd + "\\" + bewirtschafter + ".mxd"

mxd.saveACopy(mxdspeicher)

del row

del cursor

del seite

del seitenliste

del elm

arcpy.RefreshActiveView()

There's a lot of things I'm doing bevore. So if I leave the "bad" part, it loops trough the whole script perfectly. If I add this part, the error appears.

I also tryed to add the line "arcpy.SelectLayerByAttribute_management (lyrkartenausschn, "CLEAR_SELECTION")" at the verry bottom, but then the same error appears for this line.

So what's wrong with the code? do I have to del something more? or "deactivate" data driven pages? (maybe it's a problem because it's still printing? but then how can I make it wait until it's finished?

thank you for your help!

This may be difficult to solve without the data and only part of the code. If the problem is caused by an access error of the layer contained in variable "lyrkartenausschn", you should have a look at how the layer is defined (this part is not included in the code posted).

I also came across this issue: 43104 - 000229: Cannot open which indicates that if you have background processing switched on, it may cause this problem.

Well. The whole script prints (and exports to pdf) all parcels of each person. it exports only those extens where there are parcels of this person. it adds the extent number and the x of y page number.

so the part of the code above does the following: in my layer ("lyrkartenausschn") I have a column with the page numbers ("x" of x of y). the cursor reads the number and adds it to the "seitenliste" (= page-list). so for every page in my page-list it replaces the numer in the textfield "seitex" (the "x" of x of y) and creates a new PDF-export-path (with the name of the person + page number). then it exports the pdf to that path and prints the extent.

After that it should loop back and do the same for the next person. That's where it should do a selection of my layer ("lyrkartenausschn") again. but it doesn't. if I quote out the script part shown above, it loops trough all the data perfectly.

Since the error message refers to line 52 and the SelectLayerByAttribute tool, I suppose it refers to this line.

arcpy.SelectLayerByAttribute_management (lyrkartenausschn, "NEW_SELECTION", seitenzkartenausschn + " = " +  str(seite))

The format of the where clause depends on the data source. It is normally better to let arcpy how your field should be referenced. What is not clear to me is the data format of the field "seite". You convert is to integer when you read and append it to the list and later on you convert it to string. What is the field type of "seite"?

You could replace the line above for:

# in case 'seite' is integer
where = "{0} = {1}".format(arcpy.AddFieldDelimiters(lyrkartenausschn, seitenzkartenausschn), seite)
# in case 'seite' is string
where = "{0} = '{1}'".format(arcpy.AddFieldDelimiters(lyrkartenausschn, seitenzkartenausschn), seite)
arcpy.SelectLayerByAttribute_management(lyrkartenausschn, "NEW_SELECTION", where)

Please use syntax highlighting for your code (see: Posting Code blocks in the new GeoNet )

thank you for your post. and also for the hint for syntax highlighting!

so here's the original code again.

cursor = arcpy.da.SearchCursor(lyrkartenausschn, [seitenzkartenausschn])
    seitenliste = int(19)
    del seitenliste
    seitenliste = []
    for row in cursor:
        seitenliste.append(int(row[0]))
    print seitenliste
    for seite in seitenliste:
        for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
            if elm.name == seitex:
                elm.text = str(seite)
                pfdausgabePDFeinzeln = pfadausgpdf[0:-4] +"_"+ str(seite) + ".pdf" #Path
        arcpy.SelectLayerByAttribute_management (lyrkartenausschn, "NEW_SELECTION", seitenzkartenausschn + " = " +  str(seite))
        mxd.dataDrivenPages.exportToPDF(pfdausgabePDFeinzeln, "SELECTED") #PDF Export
        mxd.dataDrivenPages.printPages(druckername, "SELECTED") #  Print
    mxdspeicher = ausgpdfmxd + "\\" + bewirtschafter + ".mxd"
    mxd.saveACopy(mxdspeicher)
    del row
    del cursor
    del seite
    del seitenliste
    del elm
    arcpy.RefreshActiveView()

One thing I saw when reading your message: Line 52 isn't the line you guessed. I forgot to post it, sorry.

it's the following (Line 1):

    arcpy.SelectLayerByAttribute_management(lyrkartenausschn, "NEW_SELECTION", seitenzkartenausschn + " IS NOT NULL")
    arcpy.CalculateField_management(lyrkartenausschn, seitenzkartenausschn,  "NULL", "VB")

This part of the code selects the "x in x of y" from the previous iteration and sets them to "NULL". So first it selects de extents which were used the previous times, then calculates the field to set the values to "NULL". As I see now, it's not really necessary to select it first, since I want to set all the values in that column to "NULL". But anyway, I can't see, why it shouldn't work.


Another thing I saw is that I must have forgotten to delete the first "seitenliste" (line 2+3) when I wrote the code.
I think there's no use for it. In the end, I think it must be integer, since in line 6 I make an integer out of the "row".

I convert the seitenliste to integer so I can make a for loop on it (line 8). and then in line 12 and 13 I need the same number to be written in the textfield and also to the path, so I think I really need to convert it twice?

So tomorrow I will try your suggestions and also delete the unnecessary rows.

An other question: is there a page where I can read about the   .format ?  I don't really understand how this works.

Thank you for your help! 🙂

So I changed the code. Now it looks like this:

(what i posted bevore was from line 58 to the end).

#start code Block
mxd = arcpy.mapping.MapDocument("CURRENT")  #wählt das aktuelle mxd aus
opentext = open (bewtextdok)  #öffnet das Textdokument bewtextdok
for line in opentext: #iteration durch alle linien des bewtextdok
##################################################################
# path and definition qry
    bewirtschafter = line[0:-1]  #"extraktion" des bewirtschafternamens aus dem textfeld
    pfadausgpdf = ausgpdfmxd + "\\" + bewirtschafter + ".pdf" #Zusammenführen des PDF-Ausgabepfades
    pfadausgmxd = ausgpdfmxd + "\\" + bewirtschafter + ".mxd" #Zusammenfügen des MXD-Ausgabepfades
    print pfadausgpdf
    print pfadausgmxd
    print "*****************************************"
    query = qryweiteres + spueberschr + "=" + "'" + bewirtschafter + "'" #zusammenfügen der Query
    print query
    lyr = arcpy.mapping.Layer(qrylyr)    #wählt den layer für die query aus
    lyr.definitionQuery = query    #führt die query aus
##################################################################
# change legend text
    #Bewirtschafter Name
    for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
        if elm.name == bewtxtbox:
            elm.text = bewirtschafter[0:31]
    print "Bewirtschafter ersetzt"
    print "************************"
    # Seitenzahl
        #Seitenzahl auf "" setzen
    arcpy.CalculateField_management(lyrkartenausschn, seitenzkartenausschn,  "NULL", "VB")
        #selektieren der Kartenausschnitte - auch für drucken und exportieren
    arcpy.SelectLayerByLocation_management (lyrkartenausschn, "", lyr, "", "NEW_SELECTION") #selektiert die Kartenausschnitte, welche den lyr (mit qry) enthalten
        #Neue Seitenzahl für die Markierten Seiten setzen (Nummerierung 1 bis X)
    lyr = lyrkartenausschn # replace this with your layer name  
    fields = ['Nummer', 'OID@']  
    # set up a dictionary and counter  
    dict = {}  
    counter = 0# Use list comprehension to build a list of Nummer values combined with ObjectID values as a tuple  
    dict = {(row[0:]):0 for row in arcpy.da.SearchCursor(lyr, fields)}  
    # Sort the list and put the counter into a dictionary for fast random access  
    for value in sorted(dict.keys()):  
        counter += 1  
        dict[value] = counter  
    # Write back to the layer with an update cursor using the dictionary. Change 'COUNTER' to your counter field  
    fields = ['Nummer', 'OID@', seitenzkartenausschn]  
    with arcpy.da.UpdateCursor(lyr, fields) as cursor:  
        for row in cursor:  
            row[2] = dict[(row[0],row[1])]  
            cursor.updateRow(row)  
        #seitenzahl total
    anzahlseiten = arcpy.GetCount_management(lyrkartenausschn) #Auslesen der Anzahl makrierten Seiten
    for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
        if elm.name == vony:
            elm.text = str(anzahlseiten)
    print "Anzahl Seiten = " + str(anzahlseiten)
#print and export for every page 
    cursor = arcpy.da.SearchCursor(lyrkartenausschn, [seitenzkartenausschn])
    seitenliste = []
    for row in cursor:
        seitenliste.append(int(row[0]))
    print seitenliste  #dieser ganze for-loop generiert die "seitenliste", welche alle zu druckenden Seiten beinhaltet
    for seite in seitenliste:
        for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
            if elm.name == seitex:
                elm.text = str(seite)
                pfdausgabePDFeinzeln = pfadausgpdf[0:-4] +"_"+ str(seite) + ".pdf" #Pfad bei einzelner PDF-Ausgabe
        where = "{0} = {1}".format(arcpy.AddFieldDelimiters(lyrkartenausschn, seitenzkartenausschn), seite)  
        arcpy.SelectLayerByAttribute_management(lyrkartenausschn, "NEW_SELECTION", where)
        mxd.dataDrivenPages.exportToPDF(pfdausgabePDFeinzeln, "SELECTED") #PDF Export
        #mxd.dataDrivenPages.printPages(druckername, "SELECTED") # Drucken
        arcpy.SelectLayerByAttribute_management(lyrkartenausschn, "CLEAR_SELECTION")
    mxdspeicher = ausgpdfmxd + "\\" + bewirtschafter + ".mxd"
    mxd.saveACopy(mxdspeicher)
    del row
    del cursor
    del seite
    del seitenliste
    del elm
    arcpy.RefreshActiveView()

what happens now:

Runtime error  Traceback (most recent call last):   File "<string>", line 52, in <module>   File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 3453, in CalculateField     raise e ExecuteError: ERROR 000229: Cannot open Rest\Kartenausschnitte A3 mit Aussparung Legende. 1:2500 und 1:3000 Failed to execute (CalculateField).

Line 52 is line 28 in the code above.

maybe somehow my layer "lyrkartenausschn"  (= Rest\Kartenausschnitte A3 mit Aussparung Legende. 1:2500 und 1:3000) gets locked.

First I thought it mus be because of the data driven pages. but then i quoted out both ddp-lines and the same error occured. so there must be another mistake in my script.

maybe this can give a hint: when I run the script (even with the lines 59 to 74 quoted out) the error occurs now. After the error I'm not able to run the script again. First I need to close ArcMap and then run it again.

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){ /* 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-column-alley-left")){ rootElement.querySelector(".lia-quilt-column-alley-left").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); angular.forEach(mszList_l, function (value) { if (document.querySelectorAll('div.lia-js-data-messageUid-' + value).length > 0) { var rootElements = document.querySelectorAll('div.lia-js-data-messageUid-' + value); }else { var rootElements = document.querySelectorAll('div.message-uid-' + value); angular.forEach(rootElements, function (rootElement) { if (value == '561807' && "ForumTopicPage" == "TkbArticlePage") { rootElement = document.querySelector('.lia-thread-topic'); /* V1.1 Remove from UI */ if (document.getElementById("tr-msz-" + value)) { document.getElementById("tr-msz-" + value).remove(); if (document.getElementById("tr-sync-" + value)) { document.getElementById("tr-sync-" + value).remove(); /* XPath expression for subject and Body */ var lingoRBExp = "//lingo-body[@id = "+"'lingo-body-"+value+"'"+"]"; lingoRSExp = "//lingo-sub[@id = "+"'lingo-sub-"+value+"'"+"]"; /* Get translated subject of the message */ lingoRSXML = doc.evaluate(lingoRSExp, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for(var i=0;i 0){ angular.forEach(document.querySelectorAll(".PageTitle"), function(subEle) { subEle.textContent = sub_L; // Label translation var labelEle = document.querySelectorAll(".LabelsList .lia-list-standard-inline"); if(!labelEle){ labelEle = document.querySelector(".LabelsList"); for(var i = 0; i < labelEle.length; i++){ var listContains = labelEle[i].querySelector('.label'); if (listContains) { /* Commenting this code as bussiness want to point search with source language label */ // var tagHLink = labelEle.querySelectorAll(".label")[0].querySelector(".label-link").href.split("label-name")[0]; var lingoLabelExp = "//lingo-label/text()"; trLabels = []; trLabelsHtml = ""; /* Get translated labels of the message */ lingoLXML = doc.evaluate(lingoLabelExp, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var labelsLength = labelEle[i].querySelectorAll(".label").length; var labelSnapshotLength = lingoLXML.snapshotLength; if (labelsLength == labelSnapshotLength){ for (var k = 0; k < lingoLXML.snapshotLength; k++) { //trLabels.push(lingoLXML.snapshotItem(i).textContent); if (k != 0) { //trLabelsHtml = trLabelsHtml + '
  • ,
  • '; //diffVariable = kValue if(labelEle[i].querySelectorAll(".label")[k]){ tagHLink = labelEle[i].querySelectorAll(".label")[k].querySelector(".label-link").href; if ("ForumTopicPage" == "BlogArticlePage") { trLabelsHtml = trLabelsHtml + '
  • ' + lingoLXML.snapshotItem(k).textContent + '
  • '; else { // trLabelsHtml = trLabelsHtml + '
  • ' + lingoLXML.snapshotItem(k).textContent + '

  • '; trLabelsHtml = trLabelsHtml + '
  • ' + lingoLXML.snapshotItem(k).textContent + '
  • '; 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 ("ForumTopicPage" == "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*/ 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("ForumTopicPage"=="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("ForumTopicPage"=="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 */ // $scope.videoData[value][0].querySelector("div").getAttribute("id"); for(var vidIndex=0; vidIndex (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, '561807'); console.log("Language",lang); },5000) } catch (e) { console.log(e); /** Display Translated content **/ var getTranslation = lithiumPlugin.getTranslation(lang, "561807"); 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');