r32: Preparing for template set system.
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 25 Dec 2004 06:52:23 +0000 (06:52 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 25 Dec 2004 06:52:23 +0000 (06:52 +0000)
Forgot to add index.php to Alpha 1... OOPS! :D.

docs/recache.php
includes/functions_datastore.php
includes/init.php
index.php [new file with mode: 0644]

index 453f1e14f96965be1352d2a095f271abc6718a45..8d8fbbd4dafff6af86c3afee811aebc6006b8117 100755 (executable)
@@ -44,6 +44,10 @@ build_products();
 
 echo '<p>Products cached</p>';
 
+build_templatesets();
+
+echo '<p>Template sets cached</p>';
+
 // $Id$
 
 ?>
\ No newline at end of file
index 8238ac0ef5bdb1212e80bcf3bcc080d0e1977052..1cc1210ac10a1b05ab50968b4a545bb54ae121e4 100755 (executable)
@@ -216,6 +216,26 @@ function build_products()
        $bugsys->datastore['product'] = $tempstore;
 }
 
+// ##################### Start build_templatesets ####################
+function build_templatesets()
+{
+       global $DB_sql, $bugsys;
+       
+       $templatesets = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "templateset");
+       while ($templateset = $DB_sql->fetch_array($templatesets))
+       {
+               $tempstore["$templateset[templatesetid]"] = $templateset;
+       }
+       
+       $DB_sql->query("
+               ### replacing the template set cache ###
+               REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
+               VALUES ('templateset', '" . addslasheslike(serialize($tempstore)) . "')"
+       );
+
+       $bugsys->datastore['templateset'] = $tempstore;
+}
+
 /*=====================================================================*\
 || ###################################################################
 || # $HeadURL$
index 012c889b8aac8845595126cb0f8f1d9d15f2400a..6e0ee26c2aff8a0679460a2ead7d70ce6d7b91db 100755 (executable)
@@ -104,6 +104,35 @@ class BugTracker
                        echo "language file (locale/$language[filename]) could not be loaded!";
                        exit;
                }
+               
+               // get the templateset
+               if ($this->userinfo['userid'])
+               {
+                       $templatesetid = $this->userinfo['templatesetid'];
+                       $templateset = $this->datastore['templateset']["$templatesetid"];
+               }
+               if (!$templatesetid)
+               {
+                       foreach ($this->datastore['templateset'] AS $templateset)
+                       {
+                               if ($templateset['default'])
+                               {
+                                       $templatesetid = $templateset['templatesetid'];
+                                       $templateset = $this->datastore['templateset']["$templatesetid"];
+                               }
+                       }
+               }
+               
+               // load the template system
+               if (file_exists("./templates/$templateset[shortname]/tsinfo.php"))
+               {
+                       $this->options['ts_includepath'] = "./templates/$templateset[shortname]/";
+               }
+               else
+               {
+                       echo "template set info (templates/$templateset[shortname]/tsinfo.php) could not be loaded!";
+                       exit;
+               }
        }
        
        function fetch_userinfo($userid = -1, $verify_password = false)
diff --git a/index.php b/index.php
new file mode 100644 (file)
index 0000000..7a02bf4
--- /dev/null
+++ b/index.php
@@ -0,0 +1,61 @@
+<?php
+/*=====================================================================*\
+|| ################################################################### ||
+|| # [#]app[#] [#]version[#]
+|| # --------------------------------------------------------------- # ||
+|| # All parts of this file are ©2003-[#]year[#] Iris Studios, Inc. No     # || 
+|| # part of this file may be reproduced in any way: part or whole.  # ||
+|| # --------------------------------------------------------------- # ||
+|| # ©2003 - [#]year[#] Iris Studios, Inc. | http://www.iris-studios.com   # ||
+|| ################################################################### ||
+\*=====================================================================*/
+
+require_once('./global.php');
+
+if (!can_perform('canviewbugs'))
+{
+       echo 'no permission';
+       exit;
+}
+
+// ###################################################################
+
+// #*# pagination needs to be done here
+
+$bugs = $DB_sql->query("
+       SELECT bug.*, user1.displayname AS firstreport, user2.displayname AS lastpost
+       FROM " . TABLE_PREFIX . "bug AS bug
+       LEFT JOIN user AS user1
+               ON (bug.userid = user1.userid)
+       LEFT JOIN user AS user2
+               ON (bug.lastpostby = user2.userid)
+       ORDER BY bug.lastposttime DESC"
+);
+
+echo '<table border="1" cellspacing="2" cellpadding="4" width="100%"><tr style="background-color:#EEEEEE">';
+echo '<td>Bug ID</td><td>Title</td><td>Reporter</td><td>Product/Version</td><td>Status/Resolution</td><td>Last Post</td></tr>';
+
+
+while ($bug = $DB_sql->fetch_array($bugs))
+{
+       echo "<tr>";
+       echo "<td>$bug[bugid]</td>";
+       echo "<td><a href=\"showreport.php?bugid=$bug[bugid]\">$bug[summary]</a></td>";
+       echo "<td>$bug[firstreport]</td>";
+       echo "<td>" . $bugsys->datastore['product']["$bug[productid]"]['title'] . '/' . $bugsys->datastore['version']["$bug[versionid]"]['version'] . "</td>";
+       echo "<td>" . $bugsys->datastore['status']["$bug[status]"]['status'] . '/' . $bugsys->datastore['resolution']["$bug[resolution]"]['resolution'] . "</td>";
+       echo "<td>" . datelike('standard', $bug['lastposttime']) . ' by ' . $bug['lastpost'] . "</td>";
+       echo "</tr>";
+}
+
+echo '</table>';
+
+echo '[<a href="newreport.php?">New Report</a>]';
+
+/*=====================================================================*\
+|| ###################################################################
+|| # $HeadURL$
+|| # $Id$
+|| ###################################################################
+\*=====================================================================*/
+?>
\ No newline at end of file