{{extend 'layout.html'}}
<table>
<tr><td><!--------------- COLUMN 1 ------------------->
<h3>
Choose recipients
</h3>
{{=grid}}</td>
<td style="padding:0px 10px 10px 10px"> <!------------------- COLUMN 2 -------------------->
<h3>
Recipient list
</h3>
<table class="table table-striped">
{{for row in selectedIndividuals:}}
<tr><td>
{{=row.TempInternalMessageRecipient.recipientOfMessage}} {{=row.auth_user.first_name}} {{=row.auth_user.last_name}} </td><td>
{{=A("deselect", _href=URL('default','remove_from_recipient_list', args=row.auth_user.id), _class='btn btn-mini', ajax=True)}} </td> </tr>
{{pass}}
</table>
</td>
<td> <!----------------------------- COLUMN 3 ----------------------->
<!------------javascript stuff below ------------>
<h3>Compose</h3>
<form action="javascript:goToURL()" onSubmit="javascript:goToURL();">
Subject: <input type="text" id="subjectID" onchange="storeSubjectLine()"/><br/>
Message: <input type="text" id="messageBodyID" onchange="storeMessageBody()"/><br/>
<input type="submit" value="submit"/>
</form>
<script>
//getting the value from the storage
var subjectLineFromStorage = localStorage.getItem("storeTheSubjectLine");
var messageFromStorage = localStorage.getItem("storeTheMessageBody");
//checking the value is not empty
if(subjectLineFromStorage!=undefined&&subjectLineFromStorage!=null&&subjectLineFromStorage.trim().length!=0&& typeof subjectLineFromStorage == "string"){
document.getElementById("subjectID").value=subjectLineFromStorage;
}
//storing the value in the storage
function storeSubjectLine(){
var nameInputVal = document.getElementById("subjectID").value;
localStorage.setItem("storeTheSubjectLine",nameInputVal);
//window.location="{{=URL('default', 'siteMap') + '/'}}" + subjectLineFromStorage;
}
//storing the value in the storage
function storeMessageBody(){
var nameInputVal2 = document.getElementById("messageBodyID").value;
localStorage.setItem("storeTheMessageBody",nameInputVal2);
//window.location="{{=URL('default', 'siteMap') + '/'}}" + messageFromStorage;
}
function goToURL(){
window.location="{{=URL('default', 'siteMap') + '/'}}" + subjectLineFromStorage ;
}
</script>
<!------ javascript stuff above -------------------->
</td>
</tr>
</table>