insert into webguiVersion values ('4.9.1','upgrade',unix_timestamp());
delete from template where namespace='MessageBoard' and templateId<2;
delete from template where namespace='LinkList' and templateId<5;
INSERT INTO template VALUES (1,'Default Link List','<tmpl_if displayTitle>\r\n    <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n    <tmpl_var description><p/>\r\n</tmpl_if>\r\n\r\n<tmpl_if session.var.adminOn>\r\n  <a href=\"<tmpl_var addlink.url>\"><tmpl_var addlink.label></a><p />\r\n</tmpl_if>\r\n\r\n<tmpl_loop link_loop>\r\n   <tmpl_if session.var.adminOn>\r\n         <tmpl_var link.controls>\r\n   </tmpl_if>\r\n   &middot;\r\n   <a href=\"<tmpl_var link.url>\"\r\n   <tmpl_if link.newwindow>\r\n          target=\"_blank\"\r\n    </tmpl_if>\r\n    ><span class=\"linkTitle\"><tmpl_var link.name></span></a>\r\n\r\n    <tmpl_if link.description>\r\n              - <tmpl_var link.description>\r\n   </tmpl_if>\r\n   <br/>\r\n</tmpl_loop>\r\n','LinkList');
INSERT INTO template VALUES (2,'Unordered List','<tmpl_if displayTitle>\r\n    <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n    <tmpl_var description><p/>\r\n</tmpl_if>\r\n\r\n<tmpl_if session.var.adminOn>\r\n  <a href=\"<tmpl_var addlink.url>\"><tmpl_var addlink.label></a><p />\r\n</tmpl_if>\r\n\r\n<ul>\r\n<tmpl_loop link_loop>\r\n<li>\r\n   <tmpl_if session.var.adminOn>\r\n         <tmpl_var link.controls>\r\n   </tmpl_if>\r\n   \r\n   <a href=\"<tmpl_var link.url>\"\r\n   <tmpl_if link.newwindow>\r\n          target=\"_blank\"\r\n    </tmpl_if>\r\n    ><span class=\"linkTitle\"><tmpl_var link.name></span></a>\r\n\r\n    <tmpl_if link.description>\r\n              - <tmpl_var link.description>\r\n   </tmpl_if>\r\n </li>\r\n</tmpl_loop>\r\n</u>','LinkList');
INSERT INTO template VALUES (3,'Ordered List','<tmpl_if displayTitle>\r\n    <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n    <tmpl_var description><p/>\r\n</tmpl_if>\r\n\r\n<tmpl_if session.var.adminOn>\r\n  <a href=\"<tmpl_var addlink.url>\"><tmpl_var addlink.label></a><p />\r\n</tmpl_if>\r\n\r\n<ol>\r\n<tmpl_loop link_loop>\r\n  <li>\r\n   <tmpl_if session.var.adminOn>\r\n         <tmpl_var link.controls>\r\n   </tmpl_if>\r\n\r\n   <a href=\"<tmpl_var link.url>\"\r\n   <tmpl_if link.newwindow>\r\n          target=\"_blank\"\r\n    </tmpl_if>\r\n    ><span class=\"linkTitle\"><tmpl_var link.name></span></a>\r\n\r\n    <tmpl_if link.description>\r\n              - <tmpl_var link.description>\r\n   </tmpl_if>\r\n  </li>\r\n</tmpl_loop>\r\n</ol>','LinkList');
INSERT INTO template VALUES (4,'Descriptive','<tmpl_if displayTitle>\r\n    <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n    <tmpl_var description><p/>\r\n</tmpl_if>\r\n\r\n<tmpl_if session.var.adminOn>\r\n  <a href=\"<tmpl_var addlink.url>\"><tmpl_var addlink.label></a><p />\r\n</tmpl_if>\r\n\r\n<tmpl_loop link_loop>\r\n   <tmpl_if session.var.adminOn>\r\n         <tmpl_var link.controls> <br />\r\n   </tmpl_if>\r\n\r\n  <a href=\"<tmpl_var link.url>\"\r\n   <tmpl_if link.newwindow>\r\n          target=\"_blank\"\r\n    </tmpl_if>\r\n    ><span class=\"linkTitle\"><tmpl_var link.name></span></a>\r\n\r\n    <tmpl_if link.description>\r\n              - <tmpl_var link.description>\r\n   </tmpl_if>\r\n   <p />\r\n</tmpl_loop>\r\n','LinkList');
INSERT INTO template VALUES (1,'Default Message Board','<tmpl_if displayTitle>\r\n    <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n    <tmpl_var description><p/>\r\n</tmpl_if>\r\n\r\n<table width=\"100%\" cellpadding=2 cellspacing=1 border=0>\r\n<tr>\r\n <td align=\"right\" valign=\"bottom\" class=\"tableMenu\">\r\n  <tmpl_if canPost>\r\n        <a href=\"<tmpl_var post.url>\"><tmpl_var post.label></a> &middot;\r\n  </tmpl_if>\r\n  <a href=\"<tmpl_var search.url>\"><tmpl_var search.label></a>\r\n  </td></tr></table>\r\n\r\n  <table border=0 cellpadding=2 cellspacing=1 width=\"100%\">\r\n      <tr>\r\n            <td class=\"tableHeader\"><tmpl_var subject.label></td>\r\n            <td class=\"tableHeader\"><tmpl_var user.label></td>\r\n            <td class=\"tableHeader\"><tmpl_var date.label></td>\r\n            <td class=\"tableHeader\"><tmpl_var views.label></td>\r\n            <td class=\"tableHeader\"><tmpl_var replies.label></td>\r\n            <td class=\"tableHeader\"><tmpl_var last.label></td>\r\n     </tr>\r\n\r\n<tmpl_loop message_loop>\r\n   <tr><td class=\"tableData\">\r\n        <a href=\"<tmpl_var message.url>\"><tmpl_var message.subject></a>\r\n         <tmpl_if message.currentUser>\r\n              (<tmpl_var message.status>)\r\n         </tmpl_if>  \r\n     </td>\r\n      <td class=\"tableData\"><a href=\"<tmpl_var message.userProfile>\"><tmpl_var message.username></a></td>\r\n      <td class=\"tableData\"><tmpl_var message.date></td>\r\n      <td class=\"tableData\"><tmpl_var message.views></td>\r\n      <td class=\"tableData\"><tmpl_var message.replies></td>\r\n      <td class=\"tableData\">\r\n         <span style=\"font-size: 8pt;\">\r\n              <a href=\"<tmpl_var last.url>\"><tmpl_var last.subject></a>\r\n              @ <tmpl_var last.date> \r\n              by <a href=\"<tmpl_var last.userProfile>\"><tmpl_var last.username></a>\r\n          </span>\r\n     </td>\r\n   </tr>\r\n</tmpl_loop>\r\n</table>\r\n\r\n\r\n<tmpl_if multiplePages>\r\n  <div class=\"pagination\">\r\n    <tmpl_var previousPage>  &middot; <tmpl_var pageList> &middot; <tmpl_var nextPage>\r\n  </div>\r\n</tmpl_if>\r\n\r\n','MessageBoard');
delete from international where languageId=1 and namespace='USS' and internationalId=77;
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (77,1,'USS','The following are the template variables used in a submission template. Submission templates are used to display the individual submissions in a user submission system.\r\n<p/>\r\n\r\n<b>title</b><br/>\r\nThe title of this submission.\r\n<p/>\r\n\r\n<b>content</b><br/>\r\nThe full text content of this submission.\r\n<p/>\r\n\r\n<b>user.label</b><br/>\r\nThe translated label indicating what user posted this submission.\r\n<p/>\r\n\r\n<b>user.profile</b><br/>\r\nThe URL to the profile of the user that posted this submission.\r\n<p/>\r\n\r\n<b>user.username</b><br/>\r\nThe username of the user that posted this submission.\r\n<p/>\r\n\r\n<b>user.id</b><br/>\r\nThe unique identifier for the user that posted this submission.\r\n<p/>\r\n\r\n<b>date.label</b><br/>\r\nThe translated label indicating what date this submission was posted.\r\n<p/>\r\n\r\n<b>date.epoch</b><br/>\r\nThe number of seconds since January 1, 1970 that this submission was posted.\r\n<p/>\r\n\r\n<b>date.human</b><br/>\r\nA human readable date that displays the date and time this submission was posted.\r\n<p/>\r\n\r\n<b>status.label</b><br/>\r\nA translated label indicating the status of this submission.\r\n<p/>\r\n\r\n<b>status.status</b><br/>\r\nThe actual status of this submission (pending, approved, denied).\r\n<p/>\r\n\r\n<b>views.label</b><br/>\r\nA translated label indicating how many times this submission has been viewed.\r\n<p/>\r\n\r\n<b>views.count</b><br/>\r\nThe number of times this submission has been viewed.\r\n<p/>\r\n\r\n<b>canPost</b><br/>\r\nAn condition indicating whether or not this user can post a new submission.\r\n<p/>\r\n\r\n<b>post.url</b><br/>\r\nThe URL to post a new submission.\r\n<p/>\r\n\r\n<b>post.label</b><br/>\r\nA translated label for the post link.\r\n<p/>\r\n\r\n<b>previous.more</b><br/>\r\nAn condition indicating whether there are any posts prior to this one available for viewing.\r\n<p/>\r\n\r\n<b>previous.url</b><br/>\r\nA URL to the post that came before this one.\r\n<p/>\r\n\r\n<b>previous.label</b><br/>\r\nA translated label for the previous link.\r\n<p/>\r\n\r\n<b>next.more</b><br/>\r\nA condition indicating whether there are any posts after this one available for viewing.\r\n<p/>\r\n\r\n<b>next.url</b><br/>\r\nThe URL to the post that came after this one.\r\n<p/>\r\n\r\n<b>next.label</b><br/>\r\nA translated label for the next link.\r\n<p/>\r\n\r\n<b>canEdit</b><br/>\r\nA condition indicating whether the current user cane edit or delete this post.\r\n<p/>\r\n\r\n<b>edit.url</b><br/>\r\nThe URL to edit this post.\r\n<p/>\r\n\r\n<b>edit.label</b><br/>\r\nA translated label for the edit link.\r\n<p/>\r\n\r\n<b>delete.url</b><br/>\r\nThe URL to delete this post.\r\n<p/>\r\n\r\n<b>delete.label</b><br/>\r\nA translated label for the delete link.\r\n<p/>\r\n\r\n<b>canChangeStatus</b><br/>\r\nA condition indicating whether the current user has the privileges to change the status of this post.\r\n<p/>\r\n\r\n<b>approve.url</b><br/>\r\nThe URL to approve this post.\r\n<p/>\r\n\r\n<b>approve.label</b><br/>\r\nA translated label for the approve link.\r\n<p/>\r\n\r\n<b>deny.url</b><br/>\r\nThe URL to deny this post.\r\n<p/>\r\n\r\n<b>deny.label</b><br/>\r\nA translated label for the deny link.\r\n<p/>\r\n\r\n<b>leave.url</b><br/>\r\nThe URL to leave this post in it\'s current state.\r\n<p/>\r\n\r\n<b>leave.label</b><br/>\r\nA translated label for the leave link.\r\n<p/>\r\n\r\n<b>canReply</b><br/>\r\nA condition indicating whether the current user can reply to this post.\r\n<p/>\r\n\r\n<b>reply.url</b><br/>\r\nThe URL to reply to this post.\r\n<p/>\r\n\r\n<b>reply.label</b><br/>\r\nA translated label for the reply link.\r\n<p/>\r\n\r\n<b>search.url</b><br/>\r\nThe URL to toggle on the WebGUI power search form.\r\n<p/>\r\n\r\n<b>search.label</b><br/>\r\nA translated label for the search link.\r\n<p/>\r\n\r\n<b>back.url</b><br/>\r\nThe URL to return the user to the main listing.\r\n<p/>\r\n\r\n<b>back.label</b><br/>\r\nA translated label for the back link.\r\n<p/>\r\n\r\n<b>replies</b><br/>\r\nA complete listing of all replies to this post.\r\n<p/>\r\n', 1039019783);
delete from template where namespace='USS/Submission' and templateId=1;
INSERT INTO template VALUES (1,'Default Submission','<h1><tmpl_var title></h1>\r\n<table width=\"100%\" cellpadding=2 cellspacing=1 border=0>\r\n<tr><td valign=\"top\" class=\"tableHeader\" width=\"100%\">\r\n<b><tmpl_var user.label>:</b> <a href=\"<tmpl_var user.Profile>\"><tmpl_var user.username></a><br>\r\n<b><tmpl_var date.label>:</b> <tmpl_var date.human><br>\r\n<b><tmpl_var status.label>:</b> <tmpl_var status.status><br>\r\n<b><tmpl_var views.label>:</b> <tmpl_var views.count><br>\r\n</td>\r\n<td rowspan=\"2\" class=\"tableMenu\" nowrap=\"1\" valign=\"top\">\r\n\r\n<tmpl_if previous.more>\r\n   <a href=\"<tmpl_var previous.url>\">&laquo;<tmpl_var previous.label></a><br>\r\n</tmpl_if>\r\n<tmpl_if next.more>\r\n   <a href=\"<tmpl_var next.url>\"><tmpl_var next.label>&raquo;</a><br>\r\n</tmpl_if>\r\n<tmpl_if canEdit>\r\n   <a href=\"<tmpl_var edit.url>\"><tmpl_var edit.label></a><br>\r\n   <a href=\"<tmpl_var delete.url>\"><tmpl_var delete.label></a><br>\r\n</tmpl_if>\r\n<tmpl_if canChangeStatus>\r\n   <a href=\"<tmpl_var approve.url>\"><tmpl_var deny.label></a><br>\r\n   <a href=\"<tmpl_var leave.url>\"><tmpl_var leave.label></a><br>\r\n   <a href=\"<tmpl_var deny.url>\"><tmpl_var deny.label></a><br>\r\n</tmpl_if>\r\n<tmpl_if canReply>\r\n   <a href=\"<tmpl_var reply.url>\"><tmpl_var reply.label></a><br>\r\n</tmpl_if>\r\n<tmpl_if canPost>\r\n   <a href=\"<tmpl_var post.url>\"><tmpl_var post.label></a><br>\r\n</tmpl_if>\r\n<a href=\"<tmpl_var search.url>\"><tmpl_var search.label></a><br>\r\n<a href=\"<tmpl_var back.url>\"><tmpl_var back.label></a><br>\r\n\r\n</td</tr><tr><td class=\"tableData\">\r\n<tmpl_if image.url>\r\n  <img src=\"<tmpl_var image.url>\" border=\"0\"><p/>\r\n</tmpl_if>\r\n<tmpl_var content><p/>\r\n<tmpl_var attachment.box><br/>\r\n\r\n</td></tr></table>\r\n\r\n<tmpl_var replies>','USS/Submission');
alter table discussion add index MessageBoard1 (wobjectId,pid,status,userId);
alter table discussion add index MessageBoard2 (wobjectId,rid,status);
alter table USS_submission change userId userId int not null default 1;
alter table USS_submission change status status varchar(30) not null default 'Approved';
alter table USS_submission add index test (wobjectId,status,userId);
alter table MailForm_entryData add index MailForm1 (MailForm_entryId,sequenceNumber);


