My last post detailed how to isolate the code for a publicly available project so it could be called from its own url. There are a number of reasons why you might want to separate your public projects in different submission pages. You might have a number of public projects, but only want certain customers to have access to a single project. You might want to change the look of the submission page to something that matches your corporate look. Or maybe you just love to play with html.
I pulled out (almost) everything that wasn’t essential in the code that follows (aside from a little css since I’m going for simple, not hideously ugly). It keeps the forms, input tags, the attach feature, labels, and the buttons, and that’s it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>FogBugz</title>
<style type="text/css">
label { float:left; font-weight: bold; width: 100px; text-align: right; }
input, textarea { width: 500px; }
select{ width: 504px; *width: 506px; }
div#buttons { padding-left: 250px; }
#Button_OKEdit, #Button_CancelEdit { width: 100px; }
</style>
</head>
<body>
<form action="default.asp?pre=preSubmitBug" method="post" enctype="multipart/form-data"
name="formWithProject" style="display: inline;">
<input type="hidden" name="command" value="new" />
<input type="hidden" name="dtTimeStamp" value="7/18/2007 11:55:36 AM" />
<input type="hidden" name="fPublic" value="1" />
<label for="sTitle">Title:</label>
<input type="text" maxlength="128" name="sTitle" id="sTitle" value="" /><br />
<label for="ixProject">Project:</label>
<select name="ixProject" id="ixProject">
<option value="4">Ray Gun</option>
</select><br />
<label for="ixArea">Area:</label>
<select name="ixArea" id="ixArea">
<option value="28">Ray Gun: cool leather holster </option>
</select>
<br />
<label for="sCustomerEmail">Email:</label>
<input type="text" maxlength="80" name="sCustomerEmail" id="sCustomerEmail" value="" /><br />
<label for="sVersion">Version:</label>
<input type="text" maxlength="40" name="sVersion" id="sVersion" value="" /><br />
<label for="sComputer">Computer:</label>
<input type="text" maxlength="80" name="sComputer" id="sComputer" value="" /><br />
<label for="sEvent">Message:</label>
<textarea name="sEvent" id="sEvent" rows="8" cols="55"></textarea><br />
<label for="File1">Attach a file:</label>
<input type="file" name="File1" id="File1" /><br />
<div id="buttons">
<input type="submit" id="Button_OKEdit" name="OK" value="OK" />
<input type="submit" id="Button_CancelEdit" name="OK" value="Cancel" />
</div>
</form>
</body>
</html>
Take note of two places in particular that you’ll need to alter for your site—the option value (and text) for ixProject and ixArea. These are set in this html example to the raygun project I referenced in the last post. I had to strip out any references to other public projects or areas that may have existed, or those would still be visible and defeat the purpose of isolating public projects. Of course, you may want to have two or more projects available in this page in which case you will have to add those extra projects and areas.
Since you have full access to the source code, you can take this html as a starting point to customize it for your own site by changing the project name and option value (see that by viewing the source of your existing new case submission page with the public projects available) to ones that make sense for you. Once you’ve done what you like with the html, put it in the website folder of your FogBugz installation, and call it from your FogBugz install like this: www.myfogbugz.com/raygun.html
Thanks especially to Stefan, one of the Fog Creek programmers, for helping me get the hacked apart html into presentable shape!
Edited on July 18, 2008 to add: If you will be using the public HTML form with FogBugz On Demand, you will have to go to Settings->Site->Advanced in your account, and uncheck "Protect actions against Cross-Site Request Forgery". The forgery protection is to prevent other sites from submitting possibly malicious data into FogBugz, and unfortunately also blocks this sort of HTML form.