Hi Jian, I really do appreciate the help you have offered. The code works great in Smart Edit and Page Preview. However a strange side effect is happeing with publishing. We sometimes create and connect an insatnce of a "document connector" content class to this element as you already know. These "pages" (really just fragments) are set in the Document Connector template "Assign Project Variants" settings as to not publish. We just want the fragment as part of the main page. This always worked. (and restoring to the old code allows it to publish as normal..so strange) For some reason now publishing (no matter how they are run and with any settings) ignore the anchors that have pages connected. It looks fine in page preview but publishing ignores those links. If I set the variant settings to allow the document connector class pages to be published we end up with a page fragments publishing out under thier own page Id's. We absolutely do not want that, however it does allow the main page to display those anchors. Is this a known bug with publishing? We have seen other unrelated sections of the site be ignored during a full nighlty publishing job, but I was able to mitigate that by running a specific publishing job. So frustrated. Your code was so beautiful, but the publishing issue is a killer. Any ideas on why publishing is behaving that way? Thanks for all your help. We realize you are going out of your way to help on this forum. Chris H.
On Friday, November 22, 2013 6:34:16 PM UTC-5, Jian Huang wrote: > Ah Micky, yes, what would micky madden do, something we still sing here. > > Not sure if you have done a project audit prior to upgrade to 10.1+. In > all the audits I have written, I always go through all content class code > and provide optimization sample code. Not all code preexecution code can > upgrade smoothly to 10.1+. > > Anyways, here is the optimized code > > <ul id="<%info_pageID%>"> > <!IoRangeDynLink> > <li><%anc_RelatedLink%><a data-document-link="<%med_Document%>"></li> > <!/IoRangeDynLink> > </ul> > <script> > $('#<%info_pageID%> li').each(function(index){ > $(this).attr('id', 'relatedLink<%info_pageID%>' + (index+1)); > > <!IoRangeNoRedDotMode> > var MediaLink = $(this).find('a').attr('data-document-link'); > if(MediaLink != '') > { > $(this).find('a').attr('href', MediaLink); > } > <!/IoRangeNoRedDotMode> > }); > </script> > > What you are trying to do doesn't have to be done via preexecution and > processed into HTML when it hits the web server. Why not just write out > the HTML and distribute the processing client side, since most of your site > visitors have Duo Core processors. Unless the provided code doesn't meet > some accessibility standard or something. > > Also, thank you for the detailed replied, it really helps in understand > the question better. > > Best, > > -Jian > > On Friday, November 22, 2013 10:59:45 AM UTC-5, cjh wrote: >> >> Thanks for the replies. >> Jian - You are correct it is JScript. >> Support has sent us an example of the method that you allude to using the >> element in a hidden div. >> So am I correct that because of this idiotic change to the anchor element >> to use Javascript psuedo protocol to put an alert in an unlinked anchor >> that an unlinked anchor can no longer be accessed with server side script? >> This is Insane. >> Has anyone else had their legacy projects blow up because of this? >> They have crippled this element. >> I asked if they could change the method they are using to cause this >> alert box but they have no been receptive to changing it. >> >> As far as what happens in [*Do Something Here*].. well we do a couple >> of things.. >> We have a right column (*content class that lives in a container if the >> foundation page*) that contains links either offsite or to another >> reddot page (referenced). >> We use dynamic anchors that the user can expand to add another link. >> These links also serve to connect another content class type (document >> connector) in order to have the link point to a PDF document. >> A newly created page will be created with one unused anchor that can then >> be expanded to make more links in the column. >> (So this section blows up when the open page reddot is clicked for that >> section or if the user expands an existing link on an existing page) >> We check if the anchor is not linked and hide that title and section of >> links or dispaly the section if it is linked. >> If a PDF is attached we used code like this to swap the URL... >> <ul><!IoRangeDynLink> >> <% relatedLinkCounter += 1 %> >> <li id="relatedLink<%info_pageID%><%=relatedLinkCounter%>">< >> !IoRangeRedDotEditOnly><span class="reddot"><!IoRedDot_anc_RelatedLink>[Edit >> this link or add more links:]</span><!/IoRangeRedDotEditOnly>< >> !/IoRangeConditional> >> <% >> Anchor='<%anc_RelatedLink%>'; >> if ('<%flag_pageType%>'=='media'<!IoRangeRedDotMode> && false< >> !/IoRangeRedDotMode>) { >> //replace href with media value >> URL=Anchor.substring(Anchor.indexOf('="') + 2, >> Anchor.indexOf('">')); >> Anchor = Anchor.replace(URL, '<%med_Document%>'); >> } >> %> >> >> <!IoRangeConditional> >> <% if((Anchor!='')){ %> >> <%=Anchor %> </li> >> <%}%> >> <!/IoRangeDynLink> >> This code was written before my time by RedDot services (I think Micheal >> Madden). Maybe you remember him Jian? He is long gone. >> >> >> On Thursday, November 21, 2013 3:31:20 PM UTC-5, Jian Huang wrote: >> >>> Hi Pierre, >>> >>> Yes, in SmartEdit opened mode, the conditional placeholder will always >>> evaluate to true, so the code *[Do something here]* will always run, >>> which may cause problem because it can be empty. >>> >>> The question is, what does *[Do something here] *do? >>> >>> -Jian >>> >>> On Thursday, November 21, 2013 12:54:53 PM UTC-5, Pierre Kruppik wrote: >>>> >>>> Hi Jian, >>>> >>>> this is correct. But i think this not a special property of the link. >>>> In SmartEdit opened mode, the conditional placeholder will be ignored. >>>> The question is: is it necessary to check the anchor in SmartEdit >>>> opened mode. >>>> >>>> >>>> Regards, >>>> Pierre >>>> >>>> Am Donnerstag, 21. November 2013 15:42:05 UTC+1 schrieb Jian Huang: >>>>> >>>>> Hi Pierre, >>>>> >>>>> In SmartEdit page opened mode, <%anc_RelatedLink%> will always be true >>>>> because it returns *href="javascript:alert('No page has been >>>>> connected to this link.')"* even when it is empty. >>>>> >>>>> Hence the only way to determine the true value is to parse and check >>>>> the string within. >>>>> >>>>> -Jian >>>>> >>>>> On Thursday, November 21, 2013 8:41:42 AM UTC-5, Pierre Kruppik wrote: >>>>>> >>>>>> Hi Chris, >>>>>> >>>>>> you can do something like this: >>>>>> >>>>>> myAnchor=FALSE >>>>>> <!IoRangeConditional> >>>>>> myAnchor=TRUE >>>>>> <!--<%anc_RelatedLink%>--> >>>>>> <!/IoRangeConditional> >>>>>> >>>>>> If myAnchor Then >>>>>> *[Do something here]* >>>>>> End If >>>>>> >>>>>> Regards >>>>>> Pierre >>>>>> >>>>>> Am Dienstag, 19. November 2013 17:07:03 UTC+1 schrieb Jian Huang: >>>>>>> >>>>>>> Hi Chris, >>>>>>> >>>>>>> JavaScript don't cause ASP error because it is not a server side >>>>>>> language. >>>>>>> >>>>>>> I think what you are seeing is JScript. >>>>>>> >>>>>>> There is no way to <a href="javascript:alert('No page has been >>>>>>> connected to this link.')">test</a> because it has both " (double >>>>>>> quote) >>>>>>> and ' (single quote). >>>>>>> >>>>>>> However, if you are using C#, you can throw that into a literal tag >>>>>>> and grab text from literal tag (examples are available via search in >>>>>>> this >>>>>>> forum). >>>>>>> >>>>>>> In the same way, if you are using JavaScript, you can throw that >>>>>>> into a div and use JavaScript to check the content. >>>>>>> >>>>>>> -Jian >>>>>>> >>>>>>> On Tuesday, November 19, 2013 9:16:48 AM UTC-5, cjh wrote: >>>>>>>> >>>>>>>> Thanks for your reply Marco, >>>>>>>> >>>>>>>> Any ideas on how to do that so that the preexecute script does not >>>>>>>> break? >>>>>>>> Please keep in mind that we can not return the anchor as "path and >>>>>>>> filename only" and use double quotes instead of single quotes. >>>>>>>> We actually use the returned name of the anchor and users change it. >>>>>>>> Tens of thousands of page rely on this existing structure. >>>>>>>> >>>>>>>> Thanks for the help. >>>>>>>> Chris H. >>>>>>>> >>>>>>>> On Saturday, November 16, 2013 1:36:12 PM UTC-5, mreddot wrote: >>>>>>>> >>>>>>>>> Hi Chris, >>>>>>>>> >>>>>>>>> perhaps you need to escape the returning string because of the >>>>>>>>> value containing apostrophes inside the alert function. >>>>>>>>> >>>>>>>>> >>>>>>>>> Greetings >>>>>>>>> Marco >>>>>>>>> >>>>>>>>> >>>>>>>>> On Wednesday, November 13, 2013 10:27:08 PM UTC+1, cjh wrote: >>>>>>>>>> >>>>>>>>>> We need a method to test an anchor element in javascript to see >>>>>>>>>> if it has been connected to a page or assigned a URL >>>>>>>>>> In Version 9 We would just assign the anchor element to a >>>>>>>>>> javascript variable. >>>>>>>>>> Something like.... >>>>>>>>>> >>>>>>>>>> myAnchor='<%anc_RelatedLink%>'; >>>>>>>>>> if (myAnchor != ' '){ >>>>>>>>>> *[Do something here]* >>>>>>>>>> } >>>>>>>>>> >>>>>>>>>> This now will cause an ASP error when the page is opened and the >>>>>>>>>> anchor is* not* connected to a page. >>>>>>>>>> It will work if the Achor is referenced to a page or assigend a >>>>>>>>>> URL. >>>>>>>>>> We believe this is possibly due to a change in this element >>>>>>>>>> behavior in Version 11 that inserts... >>>>>>>>>> *href="javascript:alert('No page has been connected to this >>>>>>>>>> link.')"* into the anchor tag if it is not connected. >>>>>>>>>> >>>>>>>>>> Does anyone know of a workaround? >>>>>>>>>> We have unsuccesfully tried a render tag. >>>>>>>>>> >>>>>>>>>> <!! >>>>>>>>>> Context:CurrentPage.Elements.GetElement(anc_myAnchor).GetHtml() !!> >>>>>>>>>> >>>>>>>>>> It either does not return any value or if it does seems to have >>>>>>>>>> a caching behavior that maintains an older value. >>>>>>>>>> >>>>>>>>>> Thanks for any advice you can provide, >>>>>>>>>> >>>>>>>>>> Chris >>>>>>>>>> >>>>>>>>>> >>>>>>>>> -- You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to reddot-cms-users+unsubscr...@googlegroups.com. To post to this group, send email to reddot-cms-users@googlegroups.com. Visit this group at http://groups.google.com/group/reddot-cms-users. For more options, visit https://groups.google.com/groups/opt_out.