ParameterArray["OrgName"]; ?>
+Data Center Configuration
+Database Version: ParameterArray["Version"]; ?>
+ParameterArray['OrgName']; ?>
+Data Center Department Detail
+ ++
diff --git a/installer.php b/installer.php
new file mode 100644
index 000000000..7c39df060
--- /dev/null
+++ b/installer.php
@@ -0,0 +1,646 @@
+
+\nOpen db.inc.php with a text editor and fill in the blanks for user, pass, database, and server.";
+ exit;
+ }
+
+ require_once( "db.inc.php" );
+// Functions for upgrade / installing db objects
+ $successlog="";
+
+function applyupdate ($updatefile){
+ //Make sure the upgrade file exists.
+ if(file_exists($updatefile)){
+ $file=fopen($updatefile, 'r');
+ $sql=array();
+ while(feof($file)===false){
+ $sql[]=fgets($file);
+ }
+ $sqlstring="";
+ foreach($sql as $key => $value){
+ // I really need a better way to filter out comments but this works.
+ if(substr($value,0,1)=='-'){
+ }else{
+ $sqlstring.=trim($value);
+ }
+ }
+ fclose($file);
+ $sql=explode(";",$sqlstring);
+ unset($sql[count($sql)-1]);
+ $result=0;
+ foreach($sql as $key => $value){
+ echo $value."
\n";
+ if(!mysql_query($value)){
+ //something broke log it
+ @$errormsg.=mysql_error();
+ $result=1;
+ }
+ }
+ if($result){
+ if(!isset($errormsg)){
+ $errormsg="An error has occured while applying $updatefile. Please consult the server logs for more details.";
+ }
+ }else{
+ $successlog="$updatefile: Database updates applied.\n
";
+ }
+ }else{
+ $errormsg="Seems you're at 1.0 but you're missing the db updates to goto 1.1. Are you sure that db-1.0-to-1.1.sql unpacked from the archive?";
+ }
+ $temp=array();
+ if(isset($errormsg)){
+ $temp[1]=$errormsg;
+ }else{
+ $temp[0]=$successlog;
+ }
+ return $temp;
+}
+ $upgrade=false;
+// Check to see if we are doing an upgrade or an install
+ $result=mysql_query("SHOW TABLES;");
+ if(mysql_num_rows($result)==0){ // No tables in the DB so try to install.
+ $results[]=applyupdate("create.sql");
+ $upgrade=true;
+ }
+// test for openDCIM version
+ $result=mysql_query("SELECT Value FROM fac_Config WHERE Parameter='Version' LIMIT 1;");
+ if(mysql_num_rows($result)==0){// Empty result set means this is either 1.0 or 1.1. Surely the check above caught all 1.0 instances.
+ $results[]=applyupdate("db-1.1-to-1.2.sql");
+ $upgrade=true;
+ }else{
+ $version=mysql_result($result,0);//sets version number
+ }
+ if($version=="1.2"){ // Do 1.2 to 1.3 Update
+// $upgrade=true;
+ }
+ if($upgrade==true){ //If we're doing an upgrade don't call the rest of the installer.
+?>
+
+
+
If all updates have completed. Please remove upgrade.php to return to normal functionality
"; +}else{ + echo 'All is well. Please remove upgrade.php to return to normal functionality
'; +} +?> + + + + +ParameterArray as $key=>$value){ + if($key=="ClassList"){ + $List=explode(", ",$_REQUEST[$key]); + $config->ParameterArray[$key]=$List; + }else{ + $config->ParameterArray[$key]=$_REQUEST[$key]; + } + } + $config->UpdateConfig($facDB); + } + +// Departments Form Submission + if(isset($_REQUEST['deptid'])&&($_REQUEST['deptid']>0)){ + $dept->DeptID = $_REQUEST['deptid']; + $dept->GetDeptByID( $facDB ); + } + + if(isset($_REQUEST['deptaction'])&& (($_REQUEST['deptaction']=='Create') || ($_REQUEST['deptaction']=='Update'))){ + $dept->DeptID = $_REQUEST['deptid']; + $dept->Name = $_REQUEST['name']; + $dept->ExecSponsor = $_REQUEST['execsponsor']; + $dept->SDM = $_REQUEST['sdm']; + $dept->Classification = $_REQUEST['classification']; + + if($_REQUEST['deptaction']=='Create'){ + if($dept->Name != '' && $dept->Name != null) + $dept->CreateDepartment($facDB); + }else{ + $dept->UpdateDepartment($facDB); + } + } + $result=mysql_query("SELECT * FROM fac_Department LIMIT 1;"); + if(mysql_num_rows($result)==0){ // No departments defined + $nodept="You have completed the basic configuration for openDCIM. At this time please goto the wiki for additional questions that you might have or join our mailing list at [insert link here].
+To start normal operation of openDCIM please delete install.php from the installation directory
+ + +