<?php

// Run this once from PHP via the command line to create the Help Desk
// and discussion forums.   Add new commands and run again to create new
// forum as you need them.
//
// This properly lives in html/project not html/ops
//
// Eric Myers <myers@vassar.edu> - 25 January 2005




require_once("../inc/db.inc");

db_init();		// gota have Database access


// Create a new "Category" of forums, which may be a helpdesk (or not)

function create_category($orderID, $name, $is_helpdesk) {
    $q = "insert into category (orderID, lang, name, is_helpdesk) values ($orderID, 1, '$name', $is_helpdesk)";
    $result = mysql_query($q);
    if (!$result) {
        echo "can't create category\n";
        echo mysql_error();
        exit();
    }
    return mysql_insert_id();
}

// Create a new forum within a category

function create_forum($category, $orderID, $title, $description) {
    $q = "insert into forum (category, orderID, title, description) values ($category, $orderID, '$title', '$description')";
    $result = mysql_query($q);
    if (!$result) {
        echo "can't create forum\n";
        echo mysql_error();
        exit();
    }
    return mysql_insert_id();
}


//=================================================================
//BEGIN:
//
// Reminder:   create_category($orderID, $name, $is_helpdesk)
//             create_forum($category, $orderID, $title, $description)

// HELP DESKs
//  General Help topics:

if (1) { 
  $catid = create_category(0, "Help Desk: General issues", 1);
  create_forum($catid, 1, "BOINC Problems",  
	       "Questions on installing and running BOINC");
  create_forum($catid, 3, PROJECT ." Problems",  
	       "Questions or Problems with ".PROJECT." applications or project");
  create_forum($catid, 7, "Credit",  
	       "Questions about credit ");
}


// Platform Specific Problems:

if (1) {
  $catid = create_category(5, "Help Desk: Platform-specific problems", 1);
  create_forum($catid, 2, "Windows",    "Questions about ".PROJECT." on Windows");
  create_forum($catid, 4, "Unix/Linux", "Questions about ".PROJECT." on Unix/Linux");
  create_forum($catid, 6, "Macintosh",  "Questions about ".PROJECT." on MacOS X");
  create_forum($catid, 8, "Other Platforms",
	       "Questions about using the \'anonymous\' platform, ".
		"or about porting BOINC or ". PROJECT." to other platforms.");
}


// GENERAL DISCUSSION (not help desks) 
//
// Reminder:   create_category($orderID, $name, $is_helpdesk)
//             create_forum($category, $orderID, $title, $description)

// General Issues:

if (1) {	
  $catid = create_category(10, "General Discussion", 0);

  create_forum($catid, 1, "Announcements", 
	       "Announcements about the project");
  create_forum($catid, 3, "Help!",
	       "Help for users new and old of ".PROJECT
		."<br><b>Please also see the Helpdesk area!</b>");

  create_forum(3, 5, "Number Crunching",
		 "Discussion on credit, leaderboards, and CPU performance");

  create_forum($catid, 7, "Team Talk",
	     "Team organization, invitations, and discussion");

  // NOT CREATED:
  //create_forum($catid, 9, "Preferences",
  //	       "Using preferences to fine-tune BOINC");
  //create_forum($catid, 11, "Wish list",
  //	       "What features would you like to see in BOINC and ".PROJECT);

  create_forum($catid, 13, PROJECT." Applications",
	       "Discuss or help debug ".PROJECT." applications");

  create_forum($catid, 17, "Cafe Einstein",
	       "Trade stories with other ".PROJECT." users");
}



// SCIENCE DISCUSSION ==================================================

if (1) {	//  GRAVITY WAVES 
  $catid = create_category(20, PROJECT." Science", 0);
  create_forum($catid, 1, "Gravity Waves",
	       "Discussion specific to the hunt for gravity waves ");

  create_forum($catid, 3, "General Relativity",
	       "Discussion of Relativity in general");

  create_forum($catid, 5, "Cosmology, Astrophysics, Astronomy",
      "Discussion on Cosmology, Astrophysics, Astronomy, and related topics");

  create_forum($catid, 11, "Other Science Topics",
	       "Discussion on science topics not covered above");

}

// WORLD COMMUNITY ================================================
//  (Add languages as they are asked for)
//  Add optional language ID? 
  

if (1) {
  $catid = create_category(30, PROJECT." World Community", 0);
  create_forum($catid, 2, PROJECT." auf Deutsch",
	       "");
  create_forum($catid, 4, PROJECT." en Espa&ntilde;ol",
	       "");
  create_forum($catid, 6, PROJECT." en Fran&ccedil;ais",
	       "");
  //create_forum($catid, 8, PROJECT." in Polish",     "");
  create_forum($catid, 10, PROJECT." in Portugues",
	       "");
  create_forum($catid, 12, PROJECT." in Russian",
	       "");
}



?>
