In Part 1, I did all the background programming to put the settings in and display them the correct way in the settings page, but I haven't actually used the settings to create the link yet. I also was blogging as I was programming which I now know why this is a rarity- It takes a long time and although the side trips down a buggy path may be interesting, its distracting from getting the actual work accomplished. I finished this up yesterday without blogging about it and it went much faster. So this is all done now and I probably won't linger too long on any of the problems I had.
The purpose of all the settings was to enable a link to be made from my Online OP module to the Datasprings Dynamic Forms module I have set up to take Award Reccommendations. The first part was to customize this form a bit more so that it would even recognize this data. The Dynamic Forms Module allows for data to come in in several ways, cookie, session, and querystring. I decided to use the querystring to send this info forward. In the advanced options of the question I found the setting I was looking for.
I set this for the Name and Branch field of the Awards Form and I also set up a hidden field for the internal member id. I would use this to pass the id forward so it could link to the person in the OP.
Once the fields were set up, I modified the email result so that it could contain a link directly to the person that was being recommended. The form completion events have 2 events, one to send an email to the crown, the other to send it to the person submitting a recommendation. Both of these would recieve the link. Each already had the main email set up so I only had to add the link at the bottom of the existing email text. The main trick (if you can call it a trick) was to put the $(memid) field into the link target. $(memid) was the hidden field I had set up to read a querystring I was sending.
Now to set up the Online OP module to provide the link. The first thing I did was put the link in near the Awards header in the OP Record screen.
<asp:Literal ID="litNoAwards" runat="server" Visible="false">No Awards Recorded.<br /></asp:Literal>
<asp:HyperLink runat="server" ID="hlRecommend" CssClass="RecommendLink" >Recommend this person for an award.</asp:HyperLink>
<asp:Panel ID="pnlAwards" runat="server" Visible="true">
<asp:DataGrid ID="dgAwards" runat="server" AutoGenerateColumns="False" CssClass="ResultList">
I also set up the link so it would float off to the right, under the picture of the person if there is one but inline with the Awards header. This is from the module.css
margin:15px 0px 15px 0;
Next I had to generate the link. I checked the settings to see if I should generate the link and then if I should, which tab should I direct to. The querystring key's are determined by the short name of the fields in the Dynamic Forms module.
hlRecommend.NavigateUrl = Globals.NavigateURL(Convert.ToInt32(Settings["AwardRecTabId"]), "",
"Recommended=" + h1MemberName.InnerText, "memid=" + memid, "branch=" + Residence);
hlRecommend.Visible = false;
I initially had some trouble with the Friendly Url Provider I was using (iFinity Friendly Url Provider) and the way it was handling some special characters such as commas and single quotes (apostrophes), but this was resolved by using the latest dll provided on the site for DNN 5.
Writing this blog after the fact is definately the way to go. Its like providng your own code review, which is very handy on a project you work on by yourself.