some basic cookie support for generating a custom newsletter...
authorjohn <john>
Mon, 14 Apr 2003 19:56:32 +0000 (19:56 +0000)
committerjohn <john>
Mon, 14 Apr 2003 19:56:32 +0000 (19:56 +0000)
basically you can click to have the current article id added to a cookie

(can't do anything with the cookie yet!)

etc/producer/article.template

index df5af1c..2964686 100755 (executable)
                #searchselect   {font-size: 12px; width:120px; height:22px;  background-color:#aaaaaa;}
                #searchbutton   {font-size: 12px; width:120px; height:20px; background-color:#aaaaaa; text-align: right;}
        </style>
+   <script language="javascript">
+       function addToNewsletter(id){
+               var previousValue=getCookie("myNewsletter");    
+               document.cookie="myNewsletter="+previousValue+","+id + ";path=/";                       
+               alert("Added article id to cookie!");           
+       }
+       
+       function getCookie(name){
+               
+               var cookies = document.cookie;
+
+               if (cookies.indexOf(name) != -1){
+                       var startpos = cookies.indexOf(name)+name.length+1;
+                       var endpos = cookies.indexOf(";",startpos)-1;
+                       if (endpos == -2) endpos = cookies.length;
+                       return unescape(cookies.substring(startpos,endpos));
+               }
+               else{
+                       return false; // the cookie couldn't be found! it was never set before, or it expired.
+               }
+       }
+
+   </script>
+
 </head>
  
 <body bgcolor="#dddddd" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" link="#003399" alink="#cc0033" vlink="#660033" >
                                        <br>
                                        <br>
                                        <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr><td bgcolor="#669999">
-            &nbsp;<a href="${article.id}.pdf}">
+            &nbsp;<a href="${config["Producer.OpenAction"]}?do=getpdf&id=${article.id}">
             <font color="#dddddd" size="+1"><b>${lang("article.get_as_pdf")}&gt;&gt;</b></font></a>
                                        </td></tr></table> 
 <br>
                                        <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr><td bgcolor="#669999">
+            &nbsp;<a href="javascript:addToNewsletter(${article.id})">
+            <font color="#dddddd" size="+1"><b>${lang("article.add_to_pdf")}&gt;&gt;</b></font></a>
+                                       </td></tr></table> 
+<br>
+                                       <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr><td bgcolor="#669999">
             &nbsp;<a href="${config["Producer.OpenAction"]}?do=mail&mail_aid=${article.id}&mail_language=${language.code}">
             <font color="#dddddd" size="+1"><b>${lang("article.send_as_email")}&gt;&gt;</b></font></a>
                                        </td></tr></table>