![]() |
Platforms, Frameworks & Libraries »
Cross Platform »
General
Intermediate
ASP.NET Issue Tracker Starter Kit in PHP and PostgreSQL (Race to Linux)By Brian HendricksonHow to setup and install the PHP issue tracker starter kit on a Linux server. |
SQL, Windows, Linux, .NET 2.0, DotGNU, PHP, VS2005, DBA, Dev
|
|
Advanced Search |
|
|
|
||||||||||||||||
Porting the ASP.NET application for the Race to Linux has been quite a challenge this week. I was eager to test my latest development tools, which include a small persistent PHP framework with a data access layer, and a new novice-friendly generative software development application I call Code Stylist IDE. These tools were written by me and are available from my software company, Megapump, Inc.
First things first, I looked at the table schemas for the ASP.NET Issue Tracker. Hmm, 18 tables, not a trivial project! I shortened the table names a bit and began creating the PostgreSQL tables via Code Stylist. Next, I mapped the relationships between the tables, and in less than an hour I had 90% of the PHP, SQL, CSS, JavaScript and the HTML template code ready to go. In fact, I could have submitted my entry the same day but the contest requirements stipulated that the ported application should look nearly identical to the original.
The hardest part about porting the ASP.NET application to PHP was trying to thread the auto-generated back-end code into the repurposed front-end code. I saved the original pages as HTML and used the web browser OmniWeb (it has a great 'Reformat' command) to tidy it up before extracting the crucial bits of the layout code. I was very much impressed by the ASP.NET output, it was quite concise and Microsoft has some amazing JavaScript wizardry going on in there. Unfortunately, given that this was a Race, I decided right away to implement much of that functionality server-side (in PHP) rather than try to adapt the JavaScript. Given more time it might be possible to take advantage of some of that infrastructure.
After analyzing the HTML from the ASP.NET application, I was able to slice the header, footer and the sidebar code that was common to each page. I added a %content% tag at the center and pasted it into the template view in Code Stylist. On previewing or publishing, the %content% tag gets replaced with <?php echo $page_content; ?>. When opening a page in a browser, the execution order dictated by Code Stylist is roughly:
The default page generators plus the user-defined table relationships were all I needed to instantly build the complete page and the template views and controllers, including the complex multi-table SELECT/JOIN queries, for most of the pages in the application. However, the generated views did not look at all like the original and I didn't have time to customize the generators, so it was necessary to throw out the view code in favor of the chunks carefully cut from the ASP.NET Issue Tracker.
The final step of porting the ASP.NET application to PHP was to replace the form input names so that they matched the auto-generated controller code. For instance, in the ASP.NET implementation an input field has code like name="txtTitle", but the generated code uses tablename_fieldname so I would change the source to name="issues_title" and that was the routine throughout. After getting the forms sorted out, I added behaviors with simple JavaScript for the various buttons, and server-side code to populate popup menus.
The resulting application looks and works almost exactly like the original, since it shares most of the same HTML. It was a lot of painstaking handiwork to get everything functional, but my new generative coding methods were of big help and are sure to improve from the experience that I have gained. This code will be implemented for MySQL, keep an eye on this for more "developments".
I tested with PHP 4.3.11 and PostgreSQL 7.4.8, but everything should work under PHP 5 as well. Code Stylist IDE (Windows, Mac, Linux) can output the IssueTracker.cst project file to MySQL or PostgreSQL, with more databases to be supported soon.
You must be logged in with a standard (not root) user account.
In the issue_tracker/config.php file, set $db_host = ''; and $db_port = '';. With those strings blank, PHP will use local sockets instead of TCP/IP to connect to PostgreSQL.
(As root) check the access control file called pg_hba.conf. On many systems (RedHat/SUSE) it's in /var/lib/pgsql/data. You can find it like this: 'find / -name pg_hba.conf' and edit it like this 'pico /var/lib/pgsql/data/pg_hba.conf'. At the end of the file you can paste the following two lines:
host all all 0.0.0.0 255.255.255.255 trust
local all all trust trust
All other lines should be commented out with a '#'. Now restart PostgreSQL (as root) '/etc/init.d/postgresql restart'
You may need to set 'tcpip_socket = true' in /var/lib/pgsql/data/postgresql.conf. Change issue_tracker/config.php to use $db_host='localhost'; and $db_port='5432';. And finally restart PostgreSQL.
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 27 Sep 2005 Editor: Rinish Biju |
Copyright 2005 by Brian Hendrickson Everything else Copyright © CodeProject, 1999-2009 Web18 | Advertise on the Code Project |