// Newsletter Template for Sitecore //by CH 3.30.12 //updated to sitecore: CH 9.27.12 var esriNewsletters = [],esriNewsletter,nl; var Newsletter = function(div){ //Declarations nl = {}; nl.div = $('#'+div); nl.userContent = { html : $(nl.div).html(), //description :$(nl.div).find('#newsletter-description').html(), description :getHTML('newsletter-description'), //previousIssue :$(nl.div).find('#previous-issue'), //VIEW the CURRENT EMAIL (DIgital) currentEmail :$(nl.div).find('#current-email').attr('href'), currentEmailCaption :$(nl.div).find('#current-email').html(), subURL :getHTML('subscribeURL'),//$(nl.div).find('#subscribeURL'), editor:$(nl.div).find('#industry-expert').attr('href'), prevDigital : $(nl.div).find('#previous-issue.digital').find('ul').html(), //Previous Print Content prevPrint : $(nl.div).find('#previous-issue.print').find('ul').html(), prevPrintImage : $(nl.div).find('#previous-issue.print').find('img').attr('src'), prevPrintIssue : $(nl.div).find('#previous-issue.print').find('.issue').html(), prevPrintPDF :$(nl.div).find('#previous-issue.print').find('.nl-pdf').attr('href'), prevPrintFlip :$(nl.div).find('#previous-issue.print').find('.nl-flip').attr('href'), //Current Print Content currPrint : $(nl.div).find('#current-issue.print').find('ul').html(), currPrintImage : $(nl.div).find('#current-issue.print').find('img').attr('src'), currPrintIssue : $(nl.div).find('#current-issue.print').find('.issue').html(), currPrintPDF :$(nl.div).find('#current-issue.print').find('.nl-pdf').attr('href'), currPrintFlip :$(nl.div).find('#current-issue.print').find('.nl-flip').attr('href'), //Archives Content archives: $(nl.div).find('#archives-list').find('ul').html(), archiveYears : $(nl.div).find('#archives-list').data('years') || [2011,2010] } //Adjust Newsletter Container Size to Match 960 Grid nl.parent = nl.div.parent(); if(nl.parent.width() < 720){="" nl.parent.width(720);="" if(nl.parent[0].tagname="=" ("td"="" ||="" "td")){="" nl.parent.attr('width','720');="" nl.div.parents('table').attr('width','940');="" }="" }="" if="" (.attr('width','730')="" text="" +="" link="" settings="" nl.digitalblurb="nl.userContent.description" ||="">

Stay updated on the latest GIS news relevant to your work as well as emerging trends, upcoming events, and successful GIS applications.

", nl.printBlurb = nl.userContent.description || "

Receive a collection of articles detailing the GIS work of your peers, news about Esri events, and updates on advances in GIS technology.

", nl.contactLink = "/publications/apps/subscriptions/index.cfm?fuseaction=esriPubs.ccInfoform", nl.subtype = $(nl.div).data('subtype'), nl.nl_title = $(nl.div).data('title') || $(nl.div).attr('title'), nl.code = $(nl.div).data('code'); if(!nl.code){alert('please specify the newsletter code');} else{//only take second code for hybrids if($.type(nl.code) == "array"){nl.code = nl.code[1];} } nl.subLink ='/publications/apps/subscriptions/index.cfm?fuseaction=esriPubs.selectedpub&news='+nl.code, //nl.subLink = 'http://www.esri.com/publications/apps/subscriptions/index.cfm?fuseaction=esriPubs.subscriptionForm&news='+nl.code, nl.unsubLink = '/publications/apps/subscriptions/index.cfm?fuseaction=esriPubs.unSubscribepub&news='+nl.code; //Adjust industry to include default subject line /*if(nl.userContent.editor.toLowerCase().indexOf("subject") == -1){ nl.userContent.editor = nl.userContent.editor + '?subject='+nl.nl_title; }*/ //Content Checks and Updates if(!nl.subtype){alert('please specify the newsletter type');} if(!nl.nl_title){alert('please specify the newsletter title');} //Make updates if the title is present else{ //add "esri news for" to all titles, unless exact=true if(nl.nl_title.indexOf('Esri News') == -1 && !$(nl.div).data('exact-title')){ nl.nl_title ="Esri News for "+nl.nl_title; } //update page title document.title = nl.nl_title.replace('for','|'); //update side navigation link //$('#dynamicNav,.featureBlock').find('a[href="'+location.pathname+'"]').html("Newsletter"); $('#dynamicNav,').find('a[href="'+location.pathname+'"]').html("Newsletter"); $('.featureBlock').find('a[href="'+location.pathname+'"]').html(nl.nl_title); } //else{nl.nl_title=""+nl.nl_title+""} //Hide submit article nl.hideSubmitBlock = $(nl.div).data('hide-submit'); // HEADERS PANELS nl.nl_header = function(){ return'
'+nl.nl_title+'
'; }; //format links in the archives section if(nl.userContent.archives){ nl.userContent.archives = nl.userContent.archives .replace(/:/g,'').replace(/\[/g,'').replace(/\]/g,'') .replace(/[ ') .replace(/<\ pan="">/gi," \]") .replace(/(http)\/\//g,'http://') } //.replace(/<\ pan="">/g," \]"); //.replace(""," ]"); /*---------------------------------------------------------- Manage Substription ------------------------------------------------------------*/ nl.manageSubscriptionPanel = function(){ var str = '
'+ /*'

Manage Subscription

'+*/ '

Manage Your Subscription

'+ '
'; return str; } nl.manageSubscriptionBlock = function(){ var str = '
'+ '

Manage Subscription

'+ '
'; return str; } /*---------------------------------------------------------- Article Submission and Advertisement Links ------------------------------------------------------------*/ nl.submitArticle = function(){ if(!nl.hideSubmitBlock){ var str = '
'+ '

Submit Your Article

'+ '
'+ '

How have you used Esri technology to meet a particular challenge?

'+ '

'+ 'Submit Your Article'; //add inline guidelines if set to do so str += $(nl.div).data('inline-guidelines')? 'Guidelines for submitting your article ': 'Guidelines for submitting your article'; str +='

'+'
'; str += generateSubmissionGuidelines(); str+='
'; //don't show more info if no content necessary if(nl.subtype != 'digital' || (nl.subtype == 'digital' && nl.userContent.editor)){ str+= '
'+ '

Need More Info?

'+ '
'; //only show editor link if one is passed if(nl.userContent.editor && nl.userContent.editor != ''){ if(nl.userContent.editor.indexOf('subject') == -1){ nl.userContent.editor += "?subject="+nl.nl_title; } str+= '

For questions regarding '+nl.nl_title+', e-mail '+ ' the editor.

'; } if(nl.subtype != 'digital'){ str+= '

To advertise in '+nl.nl_title +', e-mail ads@esri.com.

'+ '
'; } } str+='
'; return str; } return ""; } /*---------------------------------------------------------- Combining it all together ------------------------------------------------------------*/ nl.formatNewsletter = function(){ /* setup newsletter framework */ var focusDiv = '
', secondaryDiv = '
', footerDiv = ''; nl.div.addClass('esriNewsletter').addClass(nl.subtype).html( nl.nl_header()+ focusDiv+ secondaryDiv+ footerDiv ); switch(nl.subtype){ case 'print'://the print template to use nl.div.find('#newsletter-focus') .append(nl.fullPrintTemplate()); nl.div.find('#newsletter-secondary') .append(nl.manageSubscriptionPanel()); nl.div.find('#newsletter-footer') .append(nl.submitArticle()); break; case 'digital': nl.div.find('#newsletter-focus') .append(nl.subscriptionBlock()); nl.div.find('#newsletter-footer') .append(nl.manageSubscriptionPanel()) .append(nl.submitArticle()); //nl.div.find('#newsletter-focus').append(nl.subscriptionPanel()); break; case 'hybrid': nl.div.find('#newsletter-focus') .append(nl.fullHybridTemplate()); nl.div.find('#newsletter-footer') .append(nl.manageSubscriptionPanel()) .append(nl.submitArticle()); break; default: var str = nl.nl_header(); str += nl.subscriptionPanel(); str += nl.manageSubscriptionPanel(); str += nl.submitArticle(); } $('.issueBullets li').addClass('singleline'); }; /*---------------------------------------------------------- Subscription Block ------------------------------------------------------------*/ nl.subscriptionBlock = function(settings){ var desc = nl.userContent.description || nl.printBlurb; var subBlock = document.createElement('div'); $(subBlock).attr({ 'id' : 'subscribePanel', 'class' : 'newsletter-block-content fleft halfBlock' }).html('

Subscribe

'); //setup menu //var title = $(subBlock).find('h2'); var menu = $(subBlock).find('#subscriptionMenu'); var content = $(subBlock).find('.newsletter-block-content'); var descstr = nl.subtype+'Blurb'; desc = nl.userContent.description || nl[descstr]; //$(content).html(desc); switch(nl.subtype){ case 'digital': var curlink = (nl.userContent.currentEmail)? ''+ nl.userContent.currentEmailCaption+ '':""; $(content) .html(desc) .append('

Inside the Latest Issue

'+ curlink+ '
'); $(subBlock).removeClass('fleft').removeClass('halfBlock'); $(menu) .append('Subscribe to Digital Newsletter'); $(subBlock).find('h2').remove(); break; /*case 'print': $(content) .html(desc); //desc = nl.userContent.description || nl.printBlurb; $(menu) .append('Subscribe to Print Newsletter'); break; case 'hybrid': $(content) .append('

Digital Newsletter

'+ '

Inside the Previous Issue

') .append('

Print Newsletter

'+ '

Inside the Previous Issue

'); $(subBlock).remove('h2'); break;*/ } return subBlock; } /*---------------------------------------------------------- Current Issue Block ------------------------------------------------------------*/ nl.currentIssueBlock = function(settings){ /* var currBlock = document.createElement('div'); $(currBlock).attr({ 'id' : 'currentIssuePanel', 'class' : 'newsletter-block-content fleft halfBlock' }).html('

View Current Issue

'); var content = $(currBlock).find('.newsletter-block-content'); $(content) .append(''+nl.userContent.currPrintIssue+' cover') .append('
'+ ''+nl.userContent.currPrintIssue+'' +''+ 'View: '+ 'PDF '+' | '+ 'Flipbook'+ '
' );*/ return currBlock || ''; } /*---------------------------------------------------------- Archives Block ------------------------------------------------------------*/ nl.archiveTabs = function(){ var y, year, tabStr = '
'+// Past Issues
'+ ""; tabStr += "
" return tabStr; } nl.archivesBlock = function(settings){ var arcBlock = document.createElement('div'); $(arcBlock).attr({ 'id' : 'archivesPanel', 'class' : 'newsletter-block-content halfBlock fleft ' }).html('

Archives

'); var content = $(arcBlock).find('.newsletter-block-content'); $(content).append(nl.archiveTabs()); /*switch(nl.subtype){ case "print": $(content) .append('
'+ 'Previous Issue
'+nl.userContent.currPrintIssue+'
' +'
'); break; }*/ return arcBlock; } /*---------------------------------------------------------- PRINT TEMPLATE ------------------------------------------------------------*/ nl.fullPrintTemplate = function(){ var printHTML = '
'+ '
'+ ''+nl.userContent.currPrintIssue+' cover'+ '
'+ ''; //conditionally add links to media if(nl.userContent.currPrintFlip){ printHTML += ''+ 'Adobe Flash'+ 'Digital Magazine'+ ''; } if(nl.userContent.currPrintPDF){ printHTML += ''+ 'Adobe PDF'+ 'PDF'+ ''; } printHTML += '
'+ '
'+ '
'+ '
'+ '

Subscribe Today

'+ nl.printBlurb+ 'Subscribe to Newsletter'+ '
'+ '

Recent Issues

'+ '

Latest Issue
'+nl.userContent.currPrintIssue+ ' [ '; //conditionally add links to media if(nl.userContent.currPrintFlip){ printHTML +='Digital Magazine'; } if(nl.userContent.currPrintFlip && nl.userContent.currPrintPDF){printHTML +=' | '} if(nl.userContent.currPrintPDF){ printHTML +='PDF'; } printHTML +=' ]

'+ '
'+ 'In this issue '+ '| Archives'+ '
'+ '
    '+nl.userContent.currPrint+'
'+ '
'+ '
'+ '
    '+nl.userContent.archives+'
'+ '
'+ '
'+ '
'+ '
'; return(printHTML); } /*---------------------------------------------------------- HYBRID (PRINT & DIGITAL) TEMPLATE ------------------------------------------------------------*/ nl.fullHybridTemplate = function(){ var digiSub = printSub = nl.subLink; var printHTML = '
'+ '

Digital Newsletter

'+ nl.digitalBlurb+ 'Inside the Latest Issue'+ ''+ '
'+ '
'+ '

Print Newsletter

'+ nl.printBlurb+ ''+nl.userContent.currPrintIssue+' cover'+ '
'+ '

'+ 'Latest Issue
'+ ''+nl.userContent.currPrintIssue+''+ '[ '; //conditionally add links to media if(nl.userContent.currPrintFlip){ printHTML += 'Digital Magazine'; } if(nl.userContent.currPrintFlip && nl.userContent.currPrintPDF){ printHTML += ' | ';} if(nl.userContent.currPrintPDF){ printHTML +=' PDF'; } printHTML += ' ]

'+ '
'+ 'In this issue '+ '| Archives'+ '
'+ '
    '+nl.userContent.currPrint+'
'+ '
'+ '
'+ '
    '+nl.userContent.archives+'
'+ '
'+ '
'+ '
'+ '
'+ '
'+ '
'+ '
'+ '
'+ /*'
'+ ' | '+ '
'+ 'Subscribe to Digital & Print Newsletters'*/ 'Subscribe to Newsletter'+ '
'; /*---------------------------------------------------------- Hybrid Subscription Selection Panel ------------------------------------------------------------*/ return(printHTML); } /*run esriNewsletter automatically */ nl.formatNewsletter(); esriNewsletter = nl; $(nl.div).show(); return nl; } function updateHSButton(){ var dnl = $('#subscribe-digital:checked').length, pnl = $('#subscribe-print:checked').length; if(dnl && pnl){ $('#hybridSubscribeButton').html("Subscribe to Digital & Print Newsletters"); } else if(dnl){$('#hybridSubscribeButton').html("Subscribe to Digital Newsletter");} else if(pnl){$('#hybridSubscribeButton').html("Subscribe to Print Newsletter");} else{$('#hybridSubscribeButton').html("select a subscription type");} //alert('d: '+dnl+' p: '+pnl); } function setToggledContent(content){ content = ".nl-"+content; $('.content-toggler .current').removeClass('current'); $('.content-toggler '+content).addClass('current'); } function setArchiveYear(elem){ var showing = 0,archDate, tab = $(elem), aList = $(elem).parent().next('.archiveList'), year = $(elem).data('year'); tab.addClass('current').siblings().removeClass('current'); if(year != 'all'){ aList.find('li').each(function(){ archDate = $(this).html(); if(archDate.indexOf(year) != -1){$(this).show(); showing++;} else{$(this).hide();} }) if(!showing){aList.find('.noneMatching').show();} } //default, show all years else{ aList.find('li').show(); aList.find('.noneMatching').hide(); } } /*---------------------------------------------------------- INLINE SUBMISSION GUIDELINES ------------------------------------------------------------*/ function toggleGuidelines(ind){ ind = ind || 0; $('.submission-guidelines').eq(ind).toggle(); } function generateSubmissionGuidelines(){ var sg_html = "
" sg_html += '
'+ '

Thank you for your interest in submitting an article to your industry newletter. Review the following guidelines when writing and submitting your article.

'+ ''+ '

The newsletter editor will review all articles and make changes for readability, organization, and Esri style. The editor will send edited articles back to you for final author approval.

'; sg_html += (nl.userContent.editor)? '

Please contact the editor for writing assistance or developing your article through an interview.

':''; sg_html+= "
"; return sg_html; } /*---------------------------------------------------------- HELPERS ------------------------------------------------------------*/ function getHTML(id){ var element = document.getElementById(id); return element?document.getElementById(id).innerHTML: ""; } function showImagesText(){ var desc = '' document.getElementById("image-desc-box").innerHTML = desc; document.getElementById("image-desc-box").style.visibility = "visible"; } function hideImagesText(){ document.getElementById("image-desc-box").style.visibility = "hidden"; } function divWrap(content,classes){ var retStr = "
" +content+ "
"; return retStr; } //auto-run, just use id esriNewsletter //var subT = $GET('type'); $(document).ready( function(){ if($('#esriNewsletter').length && esriNewsletters.length < $('#esrinewsletter').length){="" if(subt){$('#esrinewsletter').attr('data-subtype',subt);}="" esrinewsletters.push(="" newsletter('esrinewsletter')="" );="" }="" });="" $('#esrinewsletter').length){="" if(subt){$('#esrinewsletter').attr('data-subtype',subt);}="" esrinewsletters.push(="" newsletter('esrinewsletter')="" );="" }="">