diff --git a/modules/websubmit/web/admin/removeDoctypeEDS.php.wml b/modules/websubmit/web/admin/removeDoctypeEDS.php.wml index 7dc51aa7c..29912b5fe 100644 --- a/modules/websubmit/web/admin/removeDoctypeEDS.php.wml +++ b/modules/websubmit/web/admin/removeDoctypeEDS.php.wml @@ -1,357 +1,333 @@ ## $Id$ ## This file is part of the CERN Document Server Software (CDSware). ## Copyright (C) 2002, 2003, 2004, 2005 CERN. ## ## The CDSware is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## The CDSware is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDSware; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. #include "cdspage.wml" \ title="Referees" \ navtrail_previous_links="/admin/> > /admin/websubmit/>" \ navbar_name="admin" \ navbar_select="websubmit_deldoctype" ## $Id$ ## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. function displayRemoveDoctypePage($killIt) { global $doc2delete; if($killIt) { # In this case, this is the second call to this script, and the # user has selected the doctype that they wish to kill, and have # confirmed that they indeed wish to kill it. We can therefore # begin the removing process. We need to delete from the # "sbmCATEGORIES", "sbmDOCTYPE", "sbmIMPLEMENT", and "sbmFIELD" tables. # Get all rows of the sbmIMPLEMENT table relating to this doctype... $q1Res = mysql_query("SELECT subname FROM sbmIMPLEMENT WHERE " . "docname = '$doc2delete'"); if($q1Res) { - # Cool, query worked. Now for each of the subnames, delete - # all of its elements. - while($sub = mysql_fetch_array($q1Res)) { # Delete all elements & pages for the given submission. $q2Str = "DELETE FROM sbmFIELD WHERE subname = '" . $sub["subname"] . "'"; $q2Res = mysql_query($q2Str); if(!$q2Res) { - # Bad. Query failed. Output the detailed error message - # on the screen. - - print("\n"); } // END if } // END while # Now delete all of the submissions for the current document # type from the sbmIMPLEMENT table... $q3Str = "DELETE FROM sbmIMPLEMENT WHERE docname = " . "'$doc2delete'"; $q3Res = mysql_query($q3Str); if(!$q3Res) { - # Bad, query didn't work. Alert the user. + # query failed - print("\n"); } // END if # Now delete the record of the doctype from the "sbmCATEGORIES" - # table... + # table $q4Res = mysql_query("DELETE FROM sbmCATEGORIES WHERE doctype = " . "'$doc2delete'"); if(!$q4Res) { - # Oh dear. Unable to delete the doctypes dets from the - # sbmCATEGORIES table. Alert the user. + # Unable to delete doctype details from + # sbmCATEGORIES table. Alert user - print("\n"); } // END if # Now delete the entries for the doctype's function in the actual functions # table. $q6Res = mysql_query("DELETE FROM sbmFUNCTIONS WHERE doctype = '" . "$doc2delete'"); if(!$q6Res) { # Unable to delete. Alert the user. - print("\n"); } // END if # Now delete the entries for the doctype's parameters in the actual parameters # table. $q7Res = mysql_query("DELETE FROM sbmPARAMETERS WHERE doctype = '" . "$doc2delete'"); if(!$q7Res) { - # Unable to delete. Alert the user. + # Unable to delete. Alert the user. - print("\n"); } // END if # Now delete the entry for the doctype in the "sbmSUBMISSIONS" # table. $q8Res = mysql_query("DELETE FROM sbmSUBMISSIONS WHERE doctype = '" . "$doc2delete'"); if(!$q8Res) { - # Unable to delete. Alert the user. + # Unable to delete. Alert the user. - print("\n"); } // END if # Now delete the entry for the doctype in the "sbmCOLLECTION_sbmDOCTYPE" # table. $q9Res = mysql_query("DELETE FROM sbmCOLLECTION_sbmDOCTYPE WHERE id_son = '" . "$doc2delete'"); if(!$q9Res) { - # Unable to delete. Alert the user. + # Unable to delete. Alert the user. - print("\n"); } // END if # Now delete the entry for the doctype in the actual "sbmDOCTYPE" # table. $q5Res = mysql_query("DELETE FROM sbmDOCTYPE WHERE sdocname = '" . "$doc2delete'"); if(!$q5Res) { # Unable to delete the record of the doctype from the - # sbmDOCTYPE table. Alert the user. + # sbmDOCTYPE table. Alert the user. - print("\n"); } // END if - # Our work here is done, so we can alert the user of this, and - # then redirect the browser to the "home page". - print("

The $doc2delete document typ" . "e has been deleted from the " . DOCS_DATABASE . " database.

\n"); - print("\n"); - # Redirect the browser... - print("
\n" - . "\n
\n"); + print("
\n" + . "\n
\n"); - print("\n"); } // END if else { - # Damn, query failed... - # Alert the user, and redirect browser to + # Alert the user, and redirect browser - print("\n"); } // END else } // END if else { - # In this case, this is the first call to the script, so we just - # need to display the interface for selecting which doctype to - # delete. - - # Display a title... + # first call to page print("

Delete A Doctype

\n"); - # Get all of the doctypes... + # Get all doctypes $myRes = mysql_query("SELECT sdocname, ldocname FROM sbmDOCTYPE " . "ORDER BY ldocname"); if($myRes) { - # In this case, the query worked... - - # Make a little info box... - print("\n\n" . "\n
\n

\n

You can " . "delete a doctype and all of its submissions and their " . "elements.
Simply choose the doctype from the list, " . "and click on the \"REMOVE DOCTYPE\" button.

\n
\n"); - # Make the input form for the element deletion... - print("
\n" - . "\n" - . "\n\n\n
" - . "Document Type: \n" + . "\n\n\n\n\n
" + . "Document Type: 
\n"); - # Produce the submit button... - print("\n\n\n\n\n
\n
\n
\n\n"); } // END if else { - # In this case, the query failed, so we can just output the - # relevant error message, and provide a button for the user to - # click to get back to the "index.php" page. - - # Make a message on the screen... + # query failed print("

ERRO" . "R: It was not possible to obtain a list of documen" . "t types from the sbmDOCTYPE table.
This means that it is " . "not possible to delete a doctype.

\n"); - # Provide a button for the user to press to escape this - # situation - print("
\n\n\n<" - . "TD ALIGN='center'>\n\n
\n\n<" + . "TD ALIGN=\"center\">\n\n\n\n
\n
" . "\n"); } // END else } // END else } /**********************Start of main script***************************/ # Connect to the MySQL server serverConnect(MYSQLDOCMACHINE, MYSQLDOCUSERID, MYSQLDOCPASSWORD); # Select the CDS Search database... dbSelect(DOCS_DATABASE); $auth = canUseWebSubmitAdmin($uid); if (!$auth[0]) outWarning($auth[1]); else displayRemoveDoctypePage($killIt); /************************End of main script***************************/ ?>