diff --git a/modules/websubmit/web/admin/actionFunctions.php.wml b/modules/websubmit/web/admin/actionFunctions.php.wml index 2e29a049a..deeadcc43 100644 --- a/modules/websubmit/web/admin/actionFunctions.php.wml +++ b/modules/websubmit/web/admin/actionFunctions.php.wml @@ -1,634 +1,634 @@ ## $Id$ ## This file is part of the CERN Document Server Software (CDSware). ## Copyright (C) 2002 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="List of Functions for on $doctype";?>" \ navtrail_previous_links="/admin/> > /admin/websubmit/>" \ - navbar_name="websubmit_admin" \ + navbar_name="admin" \ navbar_select="websubmit" ## $Id$ ## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. /***********************Function Declarations************************/ function displayFunctions($doctype, $action) { global $IMAGES; $lockStr = "LOCK TABLES sbmFUNCTIONS READ"; # Apply a read lock to the given functions table... if($lockRes = mysql_query($lockStr)) { # Execute a query selecting a listing of the functions that make # up an action for the given document type $queryResult = mysql_query("SELECT * FROM sbmFUNCTIONS WHERE doctype='$doctype' and action='$action' ORDER BY step, score"); # We must unlock our table... $unlockRes = mysql_query("UNLOCK TABLES"); # If there were rows returned by this query (i.e. there are # functions composing the given action on the given doctype, we # can display them. if(mysql_num_rows($queryResult) > 0) { # We can now create a table to display the query dynaset in... print(""); # Open the first table row for the column headings... print(""); # Get information about the fields in the table... $columns = mysql_list_fields(DOCS_DATABASE, "sbmFUNCTIONS"); # Display all of the column headings for($headerIndex = 2; $headerIndex < mysql_num_fields($columns); $headerIndex++) { print(""); if(mysql_field_name($columns, $headerIndex) == "function") { # Add another column... print(""); } } // END for # Now that we have added all of the header columns, we can add # one more column header offering the user the ability to # delete a function from the current action on the current # doctype... print("\n"); print(""); # Make a counter for the rows... $rowCount = 0; # Put the contents of the query dynaset into a temporary # array... while($dataRow = mysql_fetch_array($queryResult)) { $allRows[$rowCount] = $dataRow; $rowCount++; } // End while # Reset $rowCount to 0 for use in further processing... $rowCount = 0; # Now, we can display the body of the table... for($i = 0; $i < mysql_num_rows($queryResult); $i++) { print(""); # For each column... for($colIndex = 2; $colIndex < mysql_num_fields($columns); $colIndex++) { if(mysql_field_name($columns, $colIndex) == "function") # If the column is the function name, # create a link to the description of # that function in the fundesc table. { print(""); # Now we can add the up and down buttons to the # table. # Add the small "up" button... print(""); } else # Just display the value, as per normal. { print("\n"); } // End else } // End for # Now, we can fill the contents of the last column with the # "delete button" for removing a function... print("\n" . "\n\n\n\n\n\n\n\n\n"); # We have now completed the current row, and can close it print(""); # Increment the value of $rowCount... $rowCount++; } // End for # Close the table, as it is now finished... print("
  "); print(mysql_field_name($columns, $headerIndex)); print(" Delete
"); print(" "); print(htmlspecialchars($allRows[$i][$colIndex])); print("" . "" . "" . "" . "" . "" . "" . "" . ""); if($rowCount == 0) { print("" . "" . "" . "" . "" . "" . "" . "" . ""); if($rowCount == mysql_num_rows($queryResult) - 1) { print("
" . "Function Already At Top Of Order. "
                          . " Unable To Move Up!"); } // END if else { print("" . "" . "" . ""); } // END else # Add the small "down" button... print("
" . "Function Already At Bottom Of Order. "
                          . " Unable To Move Down!"); } // END if else { print("" . "" . "" . ""); } // END else print("
 "); print(htmlspecialchars($allRows[$i][$colIndex])); print("
\n\n" . "
\n"); # Now, we can display a button to offer the user the chance to # go back to the listing of actions for the given document # type. # This is done using a button. print("


\n\n" . "\n" . "\n" . "\n" . "\n\n" . "\n\n\n\n\n
\n
\n" . "\n" . "
\n"); } // End if else { print("

There Are No Functions " . "Associated With The $action Action For The $doctype " . "Document Type
\n"); # Now, we can offer the user the chance to add functions to # the given action on the given doctype... # This requires a table with a form in it, with a button to # press in order to add the functions. print("
\n
\n"); print("" . "\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("
"); print("\n
\n"); print("\n"); print("\n"); print("\n"); print("
 
"); print(""); print("
 
\n"); print("\n"); print("
\n"); } // End else } # END if else { # Display error message (couldnt lock tables). print("
\n" . "Error: Unable to retrieve information.
\n
".mysql_error()."\n"); print("\n\n\n\n\n\n
\n\n
\n"); } # END else } // END function displayFunctions() function displayPage() { global $calledBefore,$doctype,$action,$up,$x,$y,$previousScore,$currentStep,$previousStep,$function,$currentScore,$down,$nextStep,$nextScore,$deleteFunc,$previousFunction,$nextFunction; if(!($calledBefore)) { displayFunctions($doctype, $action); } // END if else { if(isset($up)) { # Destroy memory space associated with x and y coordinates # which were passed from the input image... unset($x); unset($y); # Destroy $up... unset($up); # Make a query string to update the row to move, to its new # score and step values... $queryStringA = "UPDATE sbmFUNCTIONS SET score = " . "'$previousScore'"; if($previousStep < $currentStep) { # If the function aboves step is lower, then we must also # change this... $queryStringA = $queryStringA . ", step = " . "'$previousStep'"; } // END if $queryStringA = $queryStringA . " WHERE doctype = '$doctype'" . " AND function = '$function' AND score = " . "'$currentScore' AND step = '$currentStep' and action='$action'"; # Now, make another query string to update the function that # was above the function that we have just updated in the # order. This function should be updated to have the values # that the function that we just updated had! $queryStringB = "UPDATE sbmFUNCTIONS SET score = " . "'$currentScore'"; if($previousStep < $currentStep) { # If the function we are alterring to the one above has a # lower step than the one that came after it in the list, # we must change the steps around... $queryStringB = $queryStringB . ", step = '$currentStep'"; } // END if $queryStringB = $queryStringB . " WHERE doctype = '$doctype'" . " AND function = '$previousFunction' AND " . "score = '$previousScore' AND step = " . "'$previousStep' and action='$action'"; # Lock our tables... $lockStr = "LOCK TABLES sbmFUNCTIONS WRITE"; if($lockRes = mysql_query($lockStr)) { # Execute the update on the first function... $queryResultA = mysql_query($queryStringA) or die("Could Not Update Table. Error: (A) $queryStringA"); # Execute the update on the second function... $queryresultB = mysql_query($queryStringB) or die("Could Not Update Table. Error: (B)"); # Unlock our tables... $unlockRes = mysql_query("UNLOCK TABLES"); } # END if else { # Couldn't lock tables, therefore couldn't allow write print("
\nError: Unable to commit movement." . "
\n
\n"); } # END else unset($lockStr); # Display the table of functions once again... displayFunctions($doctype, $action); } // END if elseif(isset($down)) { # Destroy memory space associated with $x and $y coordinates # which were passed from the input image... unset($x); unset($y); # Destroy $down unset($down); # Make a query string to update the row to move, to it's new # score and step values... $queryStringA = "UPDATE sbmFUNCTIONS SET score = " . "'$nextScore'"; if($currentStep < $nextStep) { # If the step requires changing also, change it... $queryStringA = $queryStringA . ", step = '$nextStep'"; } $queryStringA = $queryStringA . " WHERE doctype = '$doctype'" . " AND function = '$function' AND score = " . "'$currentScore' AND step = '$currentStep' and action='$action'"; # Now make another query string to update the function whose # position in the order the other function is moving to... $queryStringB = "UPDATE sbmFUNCTIONS SET score = " . "'$currentScore'"; if($currentStep < $nextStep) { # If the step requires changing also, change it... $queryStringB = $queryStringB . ", step = '$currentStep'"; } $queryStringB = $queryStringB . " WHERE doctype = '$doctype'" . "AND function = '$nextFunction' AND score = " . "'$nextScore' AND step = '$nextStep' and action='$action'"; # Lock our tables... $lockStr = "LOCK TABLES sbmFUNCTIONS WRITE"; if($lockRes = mysql_query($lockStr)) { # Execute the query on the first data item... $queryResultA = mysql_query($queryStringA) or die("no query A!"); # Execute the query on the second data item... $queryresultB = mysql_query($queryStringB) or die("no query B!"); # Unlock our tables... $unlockRes = mysql_query("UNLOCK TABLES"); } # END if else { # Couldn't lock tables, therefore couldn't allow write print("
\nError: Unable to commit movement." . "
\n
\n"); } # END else unset($lockStr); # Display the table of functions once more... displayFunctions($doctype, $action); } // END elseif elseif(isset($deleteFunc)) { # This is a call to delete a function from the current action # of the current doctype. # Free some wasted space. unset($deleteFunc); $delStr = "DELETE FROM sbmFUNCTIONS WHERE doctype = '$doctype" . "' AND function = '$function' AND score = '$currentScore' " . "AND step = '$currentStep' and action='$action'"; # Make our LOCK query... $lockStr = "LOCK TABLES sbmFUNCTIONS WRITE"; if($lockRes = mysql_query($lockStr)) { $delRes = mysql_query($delStr); if($delRes) { # The deletion query was successful, but did it actually # delete anything? if(mysql_affected_rows() == 1) { # Perfect! 1 row deleted as expected. # We must unlock our table... $unlockRes = mysql_query("UNLOCK TABLES"); print("\n"); } // END elseif else { # Ahhhhhh! We have deleted no function! # We must unlock our table... $unlockRes = mysql_query("UNLOCK TABLES"); print("\n"); } // END else } // END if else { # Deletion query failed. # We must unlock our table... $unlockRes = mysql_query("UNLOCK TABLES"); print("\n"); } // END else } # END if else { # Could not lock the table. No display allowed. print("
\nError: Unable to delete function." . "
\n
\n"); } # END else # Display the table of functions once more... displayFunctions($doctype, $action); } // END elseif else { print("

" . "\nERROR IN UPDATE

\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); if (!canUseWebSubmitAdmin($uid,$doctype)) outWarning("You are not allowed to access WebSubmit Admin for this " . "type of documents"); else displayPage($doctype); /************************End of main script***************************/ ?> diff --git a/modules/websubmit/web/admin/addActionEDS.php.wml b/modules/websubmit/web/admin/addActionEDS.php.wml index 9c37ac276..ab8b1f6a2 100644 --- a/modules/websubmit/web/admin/addActionEDS.php.wml +++ b/modules/websubmit/web/admin/addActionEDS.php.wml @@ -1,438 +1,438 @@ ## $Id$ ## This file is part of the CERN Document Server Software (CDSware). ## Copyright (C) 2002 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="Create a new action" \ navtrail_previous_links="/admin/> > /admin/websubmit/>" \ - navbar_name="websubmit_admin" \ + navbar_name="admin" \ navbar_select="websubmit" ## $Id$ ## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. ?> \n\n

Below, is " . "a form in which you can enter the details of a new action." . "

When you enter a new action, it will not be " . "accepted by the system unless you have given it a unique " . "\"Action Code\".
" . "
You can commit this new action to the database by " . "clicking on \"SAVE DETAILS\".

\n\n\n" . "\n"); # Make a horizontal rule to divide the page sections... drawSeparator(); print("
\n" . "\n" . "\n"); # Get the columns list $columns = mysql_list_fields(DOCS_DATABASE, "sbmACTION"); # Get the number of fields $numTblFlds = mysql_num_fields($columns); # Get the data, so that it can be committed for the modification # date field (md)... $dateDets = makeEDSmdDate(); # Now display the upper part of the table - fields that are system # generated... print("
\n\n\n\n\n\n\n\n\n"); # Now create the fields that the user can edit... # Make the sactname field... print("\n\n\n\n"); print(""); for($indx = 0; $indx < $numTblFlds; $indx++) { # Get the name of the current field... $currentField = mysql_field_name($columns, $indx); # Ensure we dont once again print certain fields if(($currentField != "cd") && ($currentField != "md") && ($currentField != "sactname")&& ($currentField != "actionbutton")) { # First display the form field label... print("\n\n\n\n"); } // END if } // END for # Now that the table has been created, it can be closed... print("
\nCreation " . "Date: \n
\nModification " . "Date: \n
\n" . "Action Code: \n\n
\n"); if($currentField == "lactname") { print("Action Description: "); } // END if else { print("$currentField" . ": "); } // END else print(" \n\n
\n"); # Now make the commit buttons that must be used for the form... print("" . "\n\n\n\n\n\n\n
\n\n\n\n
\n\n
\n"); } // END function enterEDSaction() function displayPage() { global $commitAct,$sactname,$lactname,$dir,$actionbutton,$statustext; if($commitAct) { # In this case, the user has entered the details of the new # action, and these details should be committed to the DB. # Make sure the sactname field is uppercase... $sactname = strtoupper($sactname); # First we can ensure that there is not already an action in the # DB with the same name as that given to the new action... # Lock table mysql_query("LOCK TABLES sbmACTION READ"); $checkRes = mysql_query("SELECT sactname FROM sbmACTION WHERE " . "sactname = '$sactname'"); if($checkRes) { # In this case, the query has worked , so carry on... if(mysql_num_rows($checkRes) != 0) { # Ah-Hah! They have tried to add an action whose ID Code # is already in use! mysql_query("UNLOCK TABLES"); # Let the check result go... mysql_free_result($checkRes); # Give them an explanatory error message... print("

Unable To Commit These" . " Details. The Action Code Used Already Exists. Try " . "Again With A New Code.

\n"); # Now a JavaScript alert... print("\n"); # Now redisplay the page... enterEDSaction($lactname, $dir, $actionbutton, $statustext); } // END if else { # The details should now be fine to commit... # Unlock tables. mysql_query("UNLOCK TABLES"); # Let the previous result set go... mysql_free_result($checkRes); # Make the insert string... $updStr = "INSERT INTO sbmACTION (lactname, sactname, dir, " . "cd, md, actionbutton, statustext) VALUES" . "('$lactname', '$sactname', '$dir', '$cd', '$md', " . "'$actionbutton', '$statustext')"; # LOCK sbmACTION table as write. mysql_query("LOCK TABLES sbmACTION WRITE"); # Commit the details... $updRes = mysql_query($updStr); if($updRes) { # Query worked... if(mysql_affected_rows() == 1) { # Insertion successful...alert user, email admin, and # redirect browser... # UNLOCK TABLES. mysql_query("UNLOCK TABLES"); print("\n"); print("

The New Action Has Been Added." . "

\n"); $msgTxt = "A new action has been added to the " . DOCS_DATABASE; $msgTxt .= " database."; $msgTxt .= " This action is the $sactname " . "action.\n\n"; $msgTxt .= "WebSubmit Administrator ("; $msgTxt .= makeDate(); $msgTxt .= ")"; # Now send the mail.. mail(ADMIN_EMAIL, "$sactname Action Added to " . "EDS/WebSubmit", $msgTxt, "From: WebSubmit_Administrator"); # Redirect the browser... print("
\n" . "
\n"); print("\n"); } // END if else { # Unable to add the thing... # Now unlock the ACTION table. mysql_query("UNLOCK TABLES"); # Alert the user... print("

Unable To " . "Commit These Details. Try Again Later.

\n"); print("\n"); # Redisplay the form - with the details... enterEDSaction($lactname, $dir, $actionbutton, $statustext, $sactname); } // END else } // END if else { # Couldn't execute insert query # Now unlock the sbmACTION table. mysql_query("UNLOCK TABLES"); # Alert the user... print("

Unable To " . "Execute The Query To Commit These Details. Try " . "Again Later.

\n"); print("\n"); # Redisplay the form - with the details... enterEDSaction($lactname, $dir, $actionbutton, $statustext, $sactname); } // END else } // END else } // END if else { # In this case, we were unable to read from the sbmACTION table # to see if there was already a record withthe same action # code as the action that we have just attempted to add. We # should therefore not try to add the new action, incase we # cause key inconsistencies in the sbmACTION table. Instead, # simply redisplay the form, with the new action data in it. # Unlock tables. mysql_query("UNLOCK TABLES"); # Alert the user of the problem... print("

Unable To Commit These Details." . " Try Again Later.

\n"); print("\n"); # Now redisplay the form... enterEDSaction($lactname, $dir, $actionbutton, $statustext, $sactname); } // END else } // END if else { # In this case, this is the first call to the page, so we should # just display the form in which the new action will be entered. enterEDSaction(); } // END else } /**********************Start of main script***************************/ # Connect to the MySQL server serverConnect(MYSQLDOCMACHINE, MYSQLDOCUSERID, MYSQLDOCPASSWORD); # Select the CDS Search database... dbSelect(DOCS_DATABASE); if (!canUseWebSubmitAdmin($uid)) outWarning("You are not allowed to access WebSubmit Admin for this " . "type of documents"); else displayPage(); /************************End of main script***************************/ ?> diff --git a/modules/websubmit/web/admin/addCheckEDS.php.wml b/modules/websubmit/web/admin/addCheckEDS.php.wml index 1d0f8abe3..be23fdf79 100644 --- a/modules/websubmit/web/admin/addCheckEDS.php.wml +++ b/modules/websubmit/web/admin/addCheckEDS.php.wml @@ -1,250 +1,250 @@ ## $Id$ ## This file is part of the CERN Document Server Software (CDSware). ## Copyright (C) 2002 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="Add a javascript checking function" \ navtrail_previous_links="/admin/> > /admin/websubmit/>" \ - navbar_name="websubmit_admin" \ + navbar_name="admin" \ navbar_select="websubmit_listchecks" ## $Id$ ## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. /********************Function Declarations****************************/ function makeChecksInputFormEDS($chdesc = "", $chname = "") { /******************************************************************* This function has the task of displaying a form for the inputting of a new check. The function is passed 3 variables. These are the $link variable, the $chdesc variable (which is the description of the check i.e. the actual JavaScript code itself), and the chname variable (which is the unique name of the check. The chdesc and chname variables can be defaulted to nothing when they are left out. This is because depending upon certain error conditions when we attempt to add a check, we may want to refuse committment of the check, and redisplay the form with its details for certain parts to be changed. Author: Nicholas Robinson Email: Nicholas.Robinson@cern.ch ca8nro@yahoo.co.uk Created: 18/12/2000 Last Modified: 18/12/2000 *******************************************************************/ # Provide a quick description of the pages function... print("\n\n\n
\n

Below, is a" . " form that allows you to add a new check to EDS.

" . "An EDS check is a checking function written in JavaScript" . " that can be applied to a given EDS submission page or " . "element(s),
to perform some sort of validation task." . "

It is important that when you create new EDS " . "checks, you do not give them a name that is already in " . "use, as the check name must
be unique due to the fact " . "that it is used to identify a given check when the EDS " . "system attempts to use it.

When the check has been " . "written in the text area provided (Check Description), " . "click on the \"SAVE DETAILS\" button
to commit this new" . " check to EDS.

\n
\n"); # Make a horizontal rule to divide the page sections... drawSeparator(); # Get the current date... $modifiedDate = makeEDSmdDate(); # Get a list of the fields in the sbmCHECKS table $columns = mysql_list_fields(DOCS_DATABASE, "sbmCHECKS"); # Now begin making the form... print("\n\n" . "\n" . "\n\n\n" . "\n\n\n\n\n\n\n" . "\n\n\n\n\n
Creation " . "Date: 
Modificat" . "ion Date: " . "
Check Name: \n
Check Description:" . " <" . "TEXTAREA COLS=50 ROWS=20 NAME='chdesc'>$chdesc" . "
\n"); # Now make a table to contain a set of buttons for the submission of # the form, resetting of the form, and cancelling of a check # addition (this will send the browser back to "allChecksEDS.php"). print("" . "\n\n\n\n\n\n" . "\n\n
" . "
\n"); } // END function makeChecksInputFormEDS() function displayPage() { global $addIt,$chname,$chdesc; if($addIt) { # In this case, the user has filled in the form to add a new # check, and has submitted it... # The first thing to do is to run a quick query to ensure that # there is not already a check with the same name as that that we # have just entered... $quickRes = mysql_query("SELECT chname FROM sbmCHECKS WHERE chname " . "= '$chname'"); if($quickRes) { # Query successful if(mysql_num_rows($quickRes) != 0) { # Check name already used...redisplay form, with the check # in it print("

" . "ERROR: Checkname Entered Already Exists. Try " . "Another.

\n"); makeChecksInputFormEDS($chdesc); } // END if else { # Checkname not used, so commit these new details to the # database # free the above result for speeds sakes. mysql_free_result($quickRes); # Build an insert query string... $insStr = "INSERT INTO sbmCHECKS (chname, chdesc, cd, md, " . "chefi1, chefi2) VALUES('$chname', '$chdesc', '$cd', " . "'$md', '', '')"; # Execute this query... $insRes = mysql_query($insStr); if($insRes) { # The new check has been entered into the database! # Inform the user & the administrator, and redirect the # browser to "allChecksEDS.php". print("\n"); $msgTxt = "The $chname check has been added to the EDS " . "Database.\n\nWebSubmit Administrator ("; $msgTxt .= makeDate(); $msgTxt .= ")"; # Now send the mail.. mail(ADMIN_EMAIL, "EDS: $chname Check Added", $msgTxt, "From: WebSubmit_Administrator"); # Make a background... print("

The $chname Check Has Been Added To " . DOCS_DATABASE . "

\n"); # Redirect the browser print("\n\n"); print("\n"); } // END if else { # The insert query has failed for some reason. print("\n"); makeChecksInputFormEDS($chdesc); } // END else } // END else } // END if else { # In this case, we were unable to read from the sbmCHECKS table # to see if there was already a check with the name of the # current check. This means that we should not try to commit # the new check, simply redisplay the form with the check # details in it, and display an error message to the user... print("\n"); # Redisplay the form wih all of the details in it... makeChecksInputFormEDS($chdesc, $chname); } // END else } // END if else { # In this case, this is the first call to this script, so it can # simply display the form in which the details of the new # JavaScript check can be entered... makeChecksInputFormEDS(); } // END else } /**********************Start of main script***************************/ # Connect to the MySQL server serverConnect(MYSQLDOCMACHINE, MYSQLDOCUSERID, MYSQLDOCPASSWORD); # Select the CDS Search database... dbSelect(DOCS_DATABASE); if (!canUseWebSubmitAdmin($uid)) outWarning("You are not allowed to access WebSubmit Admin for this " . "type of documents"); else displayPage(); /************************End of main script***************************/ ?> diff --git a/modules/websubmit/web/admin/addElement2PageEDS.php.wml b/modules/websubmit/web/admin/addElement2PageEDS.php.wml index 8ef8cea23..c8220906c 100644 --- a/modules/websubmit/web/admin/addElement2PageEDS.php.wml +++ b/modules/websubmit/web/admin/addElement2PageEDS.php.wml @@ -1,786 +1,786 @@ ## $Id$ ## This file is part of the CERN Document Server Software (CDSware). ## Copyright (C) 2002 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="Add Element to Page " \ navtrail_previous_links="/admin/> > /admin/websubmit/>" \ - navbar_name="websubmit_admin" \ + navbar_name="admin" \ navbar_select="websubmit" ## $Id$ ## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. ?> alert('ERROR: Unable" . " to update the Modification Date field for this " . "submission
in the sbmIMPLEMENT table.');\n"); } // END else # Update the md field for our doctype updateEDSDOCTYPEmd($doctype, $md); # Now output a message on screen informing the user that the # update has been completed print("

The New Element Has Been Added" . "

\n"); # Now output a javascript alert saying more or less the same, in # a little more detail print("\n"); # Now make a message and send it to the system administrator to # inform them that this element addition has taken place. $msgTxt = "A new element has been added to page $pageNumber of " . "the $subname submission of the $doctype document type. " . "This new element is an instance of the $fidesc element " . "description, and was inserted into position $fieldnb." . "\n\nWebSubmit Administrator ("; $msgTxt .= makeDate(); $msgTxt .= ")"; # Now send the mail.. mail(ADMIN_EMAIL, "$fidesc Element added to $subname page " . "$pageNumber", $msgTxt, "From: WebSubmit_Administrator"); # Now redirect the browser to "pageDetsEDS.php" sendToPageDets($subname, $pageNumber, $nPgs, $doctype); } // END if else { # In this case, the query to insert the new details has failed. # This means that we must warn the user of this problem, warn the # administrator by email, and then redirect the page back to the # "pageDetsEDS.php" page. # Now output a message on screen informing the user that the # update has been completed print("

ERROR:" . " Unable To Add This Element To The $subname" . " Submission

\n"); # Now output a javascript alert saying more or less the same, in # a little more detail print("\n"); # Now make a message and send it to the system administrator to # inform them that this element addition has taken place. $msgTxt = "An error ocurred when attempting to add the " . "$fidesc element to page $pageNumber of " . "the $subname submission of the $doctype document type. " . "This error meant that it was not possible to commit the " . "details for this new element to the sbmFIELD table, and " . "therefore the element has not been added.\n\nThere may be" . " a problem with the sbmFIELD table, and this situation should" . " be looked into as soon as possible.\n\nWebSubmit Administrator " . "("; $msgTxt .= makeDate(); $msgTxt .= ")"; # Now send the mail.. mail(ADMIN_EMAIL, "ERROR: Unable To Add $fidesc Element To " . "$subname Page $pageNumber", $msgTxt, "From: WebSubmit_Administrator"); # Now redirect the browser to "pageDetsEDS.php" sendToPageDets($subname, $pageNumber, $nPgs, $doctype); } // END else } // END function procInsrtn() //************ function charSmaller($chr, $datum) { /************************************************************** This function simply compares 2 values to see if a character ($chr) is smaller than a given other character ($datum). It was written because I wanted to split a " . "\n\n" . "\n" . "\n\n\n\n\n
\nElement Description Code: \n"); # We are going to have 3 select boxes (1 for a-h, 1 for i-p # and 1 for p-z), because there are so many elements. # Get the number of elements returned by query $numEles = mysql_num_rows($qRes); # Put all elements as returned by the query into a 2d array $eles = resToArray($qRes); # ****************Make the 1st select list***************** print(""); print(" "); # ****************Make the 2nd select list***************** print(""); print(" "); # ****************Make the 3rd select list***************** print(""); # Now close up the newly created listbox print("\n
\n"); # Now, we can present the user with the form in which they can # fill in the details that will be committed to the sbmFIELD # table... # Get the date for the created date & modification date $theDate = makeEDSmdDate(); # Get information about all of the fields in the fitext table $cols = mysql_list_fields(DOCS_DATABASE, "sbmFIELD"); print("
\n\n\n\n\n\n\n\n\n\n<" . "TH ALIGN='right' WIDTH='25%' BGCOLOR='#D3DCE3'>Creation D" . "ate: \n\n\n\n\n\n\n\n" . "\n\n\n\n\n\n
Submission Code: 
Page Number: \n\n
Field Number: 
" . "
Modification Date: 
Element Label: " . "<" . "INPUT TYPE='text' NAME='fitext' SIZE=40 VALUE='" . ereg_replace("'", "'", htmlspecialchars($fitext)) . "'>
Level: 
Short Desc: 
Check: "); # Now, we wish to use a select list of checks to ensure that # the user can only select checks that are already stored in # the EDS DB. Therefore, we need to query sbmCHECKS. if($chksRes = mysql_query("SELECT chname FROM sbmCHECKS ORDER " . "BY chname")) { # Query fine. if(mysql_num_rows($chksRes) > 0) { # Checks to be put into a select box...good! print("\n"); } // END if else { # No checks stored in DB! Offer link to add a check page print("There are " . "currently no " . DOCS_DATABASE . " checks.  " . "Add.\n"); } // END else } // END if else { # Can't query for checks, therefore can't add any! print("Unable to retrieve " . "details of checks from " . DOCS_DATABASE . ".  " . "Try adding check later.\n"); } // END else # Close the current table cell print("
"); # Now that we have finished displaying the input fields of the # form, we can produce some buttons....1 for submitting the # form, 1 for resetting the form, and 1 for cancelling the # action (i.e. not adding a new element at all) - this button # will return you to the "pageDetsEDS.php" page. print("\n\n\n\n\n\n\n\n\n\n\n\n\n
\n\n" . "\n\n" . "" . "\n
\n"); } // END else } // END if else { # In this case, the query to retrieve the descriptions of all # elements has failed, so we can display an error message # indicating this and redirect the browser to the # "pageDetsEDS.php" page # Display an error message about this... print("

" . "ERROR: It was not possible to retrieve the details of " . "the element descriptions from the sbmFIELDDESC " . "table.
Unable to add element.

\n"); # Now display a JavaScript alert saying more or less the same as # the above message... print("\n"); # Now redirect the browser sendToPageDets($subname, $pageNumber, $nPgs, $doctype); } // END else } // END function makeEleForm() function displayPage() { global $insertElement,$fidesc_A,$fidesc_B,$fidesc_C,$subname,$pageNumber,$nPgs,$doctype,$fieldnb,$fitext,$level,$sdesc,$checkn,$noElements; # The first thing to do is to work out what sort of call to the script # this is. It can either be a first call whereby the form to fill in # must be displayed, or a self-referential call, whereby the new # element must actually be inserted into the sbmFIELD table. if(isset($insertElement)) { # In this case, this call to the page is a call to insert the new # element details. We must however perform certain tests to ensure # values have been filled/selected, just incase our JavaScript # failed (Likely!). # Free the $insertElement value... unset($insertElement); # Now ensure that the value of "level" is in upper case... $level = strtoupper($level); if($fidesc_A == "--X--" && $fidesc_B == "--X--" && $fidesc_C == "--X--") { # No element descr code selected print("

\nNo Element Description " . "Code Was Selected\n

\n"); # Redisplay the form for re-entry. makeEleForm($subname, $pageNumber, $nPgs, $doctype, $fieldnb - 1, $fitext, $level, $sdesc, $checkn); } // END if elseif($fidesc_A != "--X--") { # Perfect...we take the left-most, which in this case is # $fidesc_A, so it does not matter if $fidesc_B or $fidesc_C # are selected or not - we don't care. if($level == "M" || $level == "O") { # $level checks out. procInsrtn($subname, $pageNumber, $fieldnb, $fidesc_A, $fitext, $level, $sdesc, $checkn, $doctype, $nPgs); } // END if else { # Level doesn't check out print("

\nThe Value of the Level " . "Field Must be \"M\" or \"O\"\n

\n"); # Redisplay input form makeEleForm($subname, $pageNumber, $nPgs, $doctype, $fieldnb - 1, $fitext, "", $sdesc, $checkn, "fidesc_A", $fidesc_A); } // END else } // END elseif elseif($fidesc_A == "--X--" && $fidesc_B != "--X--") { # Here, $fidesc_A has not been selected, but $fidesc_B has # been, meaning that $fidesc_B is the leftmost, and we don't # care whether or not $fidesc_C has been selected - we take B if($level == "M" || $level == "O") { # $level checks out. procInsrtn($subname, $pageNumber, $fieldnb, $fidesc_B, $fitext, $level, $sdesc, $checkn, $doctype, $nPgs); } // END if else { # $level doesn't check out print("

\nThe Value of the Level " . "Field Must be \"M\" or \"O\"\n

\n"); # Redisplay input form makeEleForm($subname, $pageNumber, $nPgs, $doctype, $fieldnb - 1, $fitext, "", $sdesc, $checkn, "fidesc_B", $fidesc_B); } // END else } // END elseif else { # $fidesc_C must be the only one selected if($level == "M" || $level == "O") { # $level checks out. procInsrtn($subname, $pageNumber, $fieldnb, $fidesc_C, $fitext, $level, $sdesc, $checkn, $doctype, $nPgs); } // END if else { # Level doesn't check out print("

\nThe Value of the Level " . "Field Must be \"M\" or \"O\"\n

\n"); # Redisplay input form makeEleForm($subname, $pageNumber, $nPgs, $doctype, $fieldnb - 1, $fitext, "", $sdesc, $checkn, "fidesc_C", $fidesc_C); } // END else } // END else } // END if else { # In this case, this is the first call to the page, and it is # necessary to display the form in which the user can enter the # details of the new element for the given page of the given # submission of the given doctype. makeEleForm($subname, $pageNumber, $nPgs, $doctype, $noElements); } // END else } /**********************Start of main script***************************/ # Connect to the MySQL server serverConnect(MYSQLDOCMACHINE, MYSQLDOCUSERID, MYSQLDOCPASSWORD); # Select the CDS Search database... dbSelect(DOCS_DATABASE); if (!canUseWebSubmitAdmin($uid,$doctype)) outWarning("You are not allowed to access WebSubmit Admin for this " . "type of documents"); else displayPage(); /************************End of main script***************************/ ?> diff --git a/modules/websubmit/web/admin/addElementDescrEDS.php.wml b/modules/websubmit/web/admin/addElementDescrEDS.php.wml index b222d2d96..e0e10de23 100644 --- a/modules/websubmit/web/admin/addElementDescrEDS.php.wml +++ b/modules/websubmit/web/admin/addElementDescrEDS.php.wml @@ -1,1001 +1,1001 @@ ## $Id$ ## This file is part of the CERN Document Server Software (CDSware). ## Copyright (C) 2002 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="Add an element description" \ navtrail_previous_links="/admin/> > /admin/websubmit/>" \ - navbar_name="websubmit_admin" \ + navbar_name="admin" \ navbar_select="websubmit_listelements" ## $Id$ ## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. /*********************Function Descriptions***************************/ function enterEDSelementDescr($elename = "", $alephcode = "", $size = "", $rows = "", $cols = "", $maxlength = "", $val = "", $fidesc = "", $cookie = 0, $type = "", $modifytext = "") { /******************************************************************* This function has the task of creating the form that allows a user to enter the details of a new element description. Author: Nicholas Robinson Email: Nicholas.Robinson@cern.ch ca8nro@yahoo.co.uk Created: 10/01/2001 Last Modified: 08/02/2001 *******************************************************************/ # Now, display a quick set of page instructions for the user.. print("\n\n" . "\n
\n

Below, is " . "a form in which you can enter the details of a new " . "element description." . "

When you enter a new element description, it will " . "not be accepted by the system unless you have given it a " . "unique
\"Element Name\".
" . "
You can commit this new element description to the " . "database by clicking on \"SAVE DETAILS\".

\n
\n"); # Make a horizontal rule to divide the page sections... drawSeparator(); print("
\n" . "\n" . "\n"); # Get the columns list $columns = mysql_list_fields(DOCS_DATABASE, "sbmFIELDDESC"); # Get the number of fields $numTblFlds = mysql_num_fields($columns); # Get the data, so that it can be committed for the modification # date field (md)... $dateDets = makeEDSmdDate(); # Now display the upper part of the table - fields that are system # generated... print("
"); # Now create the fields that the user can edit... # Make the name field... print("\n\n\n\n"); # Make the modify text field... print("\n\n\n\n"); # Make the type field... print("\n\n\n" . "\n"); for($indx = 0; $indx < $numTblFlds; $indx++) { # Get the name of the current field... $currentField = mysql_field_name($columns, $indx); # Ensure we dont once again print certain fields if(($currentField != "cd") && ($currentField != "md") && ($currentField != "name") && ($currentField != "type") && ($currentField != "cookie") && ($currentField != "modifytext") && ($currentField != "fddfi2")) { # First display the form field label... print("\n\n\n\n"); } // END if } // END for print("\n\n\n
\n" . "Element Name " . "(Req'd)\n\n
\n" . "Modification Text: \n\n
\n" . "Element Type (Req'd): " . "\n" . "\n
\n"); if($currentField == "alephcode") { print("Aleph Code " . ":"); } // END if elseif($currentField == "marccode") { print("Marc Code:"); } // END elseif elseif($currentField == "size") { print("Size (Text" . "):"); } // END elseif elseif($currentField == "rows") { print("No. Rows (TextArea)" . ":"); } // END elseif elseif($currentField == "cols") { print("No. Cols (TextArea)" . ":"); } // END elseif elseif($currentField == "maxlength") { print("Max Length (Text)" . ":"); } // END elseif elseif($currentField == "val") { print("Value (Text" . "/Hidden):"); } // END elseif elseif($currentField == "fidesc") { print("Item Description " . "(User Defined):"); } // END elseif else { print("$currentField:"); } // END else print(" \n"); if($currentField == "fidesc") { # Here, we ought to make a textarea for fidesc... print("\n"); } // END if else { # Just a normal text input will do... print("\n"); } // END else print("
\n" . "Sets Cookie?: "); printCookie($cookie); # Close up the cookie row, and the table! print("\n
\n"); # Now make the commit, reset, and cancel buttons for the form... print("" . "\n\n\n\n\n\n\n
\n\n\n\n
\n\n
" . "\n"); } // END enterEDSelementDescr() //************ function charIsInt($thing) { /******************************************************************* This function tests to see if a string only contains integer characters. Author: Nicholas Robinson Email: Nicholas.Robinson@cern.ch ca8nro@yahoo.co.uk Created: 11/01/2001 Last Modified: 11/01/2001 *******************************************************************/ # Reset an error flag $errorFlag = 0; # get the length of the string.. $len = strlen($thing); for($i = 0; $i < $len; $i++) { if($thing[$i] < "0" || $thing[$i] > "9") { $errorFlag = 1; break; } // END if } // END for # Return true/false depending upon string status return ($errorFlag == 1) ? false : true; } // END function charIsInt($thing) //******** function insertBon($elename) { /******************************************************************* This function has the task of displaying a message on the screen to say that the insertion of the new element was successful. It also displays a button to click to send the browser to the page displaying the details of the new element description. Author: Nicholas Robinson Email: Nicholas.Robinson@cern.ch ca8nro@yahoo.co.uk Created: 11/01/2001 Last Modified: 11/01/2001 *******************************************************************/ print("

Element Added.
Click To View details." . "

\n
\n\n\n\n\n\n\n
\n\n
\n
" . "\n\n"); } // END function insertBon() //*********** function insertMal() { /******************************************************************* This function handles the situation whereby the insert of the new element description has failed, and we wish to inform the user, and provide a button to click to goto the list all element descriptions page. Author: Nicholas Robinson Email: Nicholas.Robinson@cern.ch ca8nro@yahoo.co.uk Created: 12/01/2001 Last Modified: 12/01/2001 *******************************************************************/ print("

\nERROR:" . " Unable to insert new element description.

\n" . "\n\n\n" . "\n
\n" . "
\n\n
\n
\n"); print mysql_error(); } // END function insertMal() //************ function emailRecord($elename) { /******************************************************************* Since it is necessary to email the admin informing them about the success of the addition of a new element description, this function has been written, which does just that. Author: Nicholas Robinson Email: Nicholas.Robinson@cern.ch ca8nro@yahoo.co.uk Created: 11/01/2001 Last Modified: 25/01/2001 *******************************************************************/ $msgTxt = "A new element description was successfully added to the " . DOCS_DATABASE . " database. This was the $elename element " . "description.\n\nWebSubmit Administrator. ("; $msgTxt .= makeDate(); $msgTxt .= ")"; # Now send the mail.. mail(ADMIN_EMAIL, "$elename Element Description Added", $msgTxt, "From: WebSubmit_Administrator"); } // END function emailRecord($elename) function displayPage() { global $commitElement,$elename,$alephcode,$marccode,$size,$rows,$cols,$maxlength,$val,$fidesc,$cookie,$type,$modifytext; if($commitElement) { # In this case, this is a self-referential call to the form, and # it is time to process the addition of the new element. # Carry out some form validation (I'm not using JavaScript any # more for this, as it is rubbish), and take the relevant action # based upon the resuts... if($type == "NONE_SELECTED") { # In this case, the user has not selected a type for the new # element. Therefore redisplay the form with the values in # that they have already entered. print("

Selection Of Element " . "Type is Mandatory.

\n"); enterEDSelementDescr($elename, $alephcode, $size, $rows, $cols, $maxlength, stripslashes($val), stripslashes($fidesc), $cookie, "",$modifytext); } // END if else { # The element type was selected, but we must now ensure that # the other various field combos were correct... if(!$elename) { # User has not input the element name, or aleph code. print("

The Element Name " . "Field Is Mandatory.

\n"); enterEDSelementDescr($elename, $alephcode, $size, $rows, $cols, $maxlength, stripslashes($val), stripslashes($fidesc), $cookie, $type, $modifytext); } // END if else { if(!test_key_legal($elename)) { # Damn...invalid characters in either the alephcode or # the element name... print("

The Element Name " . "May Only Contain Alphabetical" . " Characters, Integer Digits or Underscores.

\n"); enterEDSelementDescr("", $alephcode, $size, $rows, $cols, $maxlength, stripslashes($val), stripslashes($fidesc), $cookie, $type,$modifytext); } // END if else { # General Mandatory fields all filled correctly. Now # make specialised tests... if($type == "T") { # Element is TextArea - can have rows and cols. if($rows) { if(!charIsInt($rows)) { # Damn...user has given a non-int value for # $rows print("

The No. Rows Field Must Have" . " an Integer Value.

"); # Make an error flag to mark this fact... $rowsInvalid = true; enterEDSelementDescr($elename, $alephcode, $size, "", $cols, $maxlength, stripslashes($val), stripslashes($fidesc), $cookie, $type,$modifytext); } // END if } // END if if($cols && !$rowsInvalid) { if(!charIsInt($cols)) { # Damn...user has given a non-int value for # $rows print("

The No. Cols Field Must Have" . " an Integer Value.

"); # Set an error flag to mark this failure $colsInvalid = true; enterEDSelementDescr($elename, $alephcode, $size, $rows, "", $maxlength, stripslashes($val), stripslashes($fidesc), $cookie, $type,$modifytext); } // END if } // END if if(!$rowsInvalid && !$colsInvalid) { # Well now. If we have reached this far, then the # data for the TEXTAREA must all be present and # valid, so we can finally make this new element # description, and commit it to the DB. $insStr = "INSERT INTO sbmFIELDDESC (name, alephcode" . ", marccode, type, size, rows, cols, maxlength, val, " . "fidesc, cd, md, modifytext, fddfi2, cookie) VALUES" . "('$elename', '$alephcode', '$marccode', '$type', NULL, "; # Deal with rows if(isset($rows) && $rows != "") { # A value was provided for rows... $insStr .= "'$rows', "; } // END if else { # No value was provided for rows... $insStr .= "NULL, "; } // END else # Deal with cols if(isset($cols) && $cols != "") { # A value was provided for rows... $insStr .= "'$cols', "; } // END if else { # No value was provided for rows... $insStr .= "NULL, "; } // END else $insStr .= "NULL, NULL, NULL, NOW(), NOW(), ".(isset($modifytext)?"'$modifytext', ":"NULL, ") . " NULL, '$cookie')"; # Execute the insertion $insRes = mysql_query($insStr); if($insRes) { # In this case, the insertion of the new # element description has been successful. # Therefore we need to inform the user and # redirect the browser. emailRecord($elename); insertBon($elename); } // END if else { # If the insert failed... insertMal(); } // END else } // END if } // END if elseif($type == "I") { # Element is HTML text input - needs size, maxlength, # val if($size) { if(!charIsInt($size)) { # Damn...user has given a non-int value for # $size print("

The Size Field Must Have an" . " Integer Value.

"); # Make a flag to mark this failure $sizeFailed = true; enterEDSelementDescr($elename, $alephcode, "", $rows, $cols, $maxlength, stripslashes($val), stripslashes($fidesc), $cookie, $type,$modifytext); } // END if } // END if if($maxlength && !$sizeFailed) { if(!charIsInt($maxlength)) { # User has given a non-int value for $maxlength print("

" . "The Max Length Field Must Have an " . "Integer Value.

"); # Make a flag to mark this failure $maxlengthFailed = true; enterEDSelementDescr($elename, $alephcode, $size, $rows, $cols, "", stripslashes($val), stripslashes($fidesc), $cookie, $type,$modifytext); } // END if } // END if if(!$sizeFailed && !$maxlengthFailed) { # Well now. If we have reached this far, then the # data for the input must all be present and # valid, so we can finally make this new element # description, and commit it to the DB. $insStr = "INSERT INTO sbmFIELDDESC (name, alephcode, marccode" . ", type, size, rows, cols, maxlength, val, " . "fidesc, cd, md, modifytext, fddfi2, cookie) " . "VALUES('$elename', '$alephcode', '$marccode', '$type', "; # Deal with size if(isset($size) && $size != "") { # A value was provided for rows... $insStr .= "'$size', "; } // END if else { # No value was provided for rows... $insStr .= "NULL, "; } // END else $insStr .= "NULL, NULL, "; # Deal with maxlength if(isset($maxlength) && $maxlength != "") { # A value was provided for rows... $insStr .= "'$maxlength', "; } // END if else { # No value was provided for rows... $insStr .= "NULL, "; } // END else # Deal with val if(isset($val) && $val != "") { # A value was provided for rows... $insStr .= "'$val', "; } // END if else { # No value was provided for rows... $insStr .= "NULL, "; } // END else $insStr .= "NULL, NOW(), NOW(), ".(isset($modifytext)?"'$modifytext', ":"NULL, ")."NULL, " . "'$cookie')"; # Execute the insertion $insRes = mysql_query($insStr); if($insRes) { # In this case, the insertion of the new # element description has been successful. # Therefore we need to inform the user and # redirect the browser. emailRecord($elename); insertBon($elename); } // END if else { # Insert failed... insertMal(); } // END else } // END if } // END elseif elseif($type == "H") { # Element is hidden - can have val $insStr = "INSERT INTO sbmFIELDDESC (name, alephcode, marccode, " . "type, size, rows, cols, maxlength, val, fidesc, " . "cd, md, modifytext, fddfi2, cookie) VALUES('" . "$elename', '$alephcode', '$marccode', '$type', NULL, NULL, " . "NULL, NULL, "; # Deal with val if(isset($val) && $val != "") { # A value was provided for rows... $insStr .= "'$val', "; } // END if else { # No value was provided for rows... $insStr .= "NULL, "; } // END else $insStr .= "NULL, NOW(), NOW(), ".(isset($modifytext)?"'$modifytext', ":"NULL, ")."NULL, " . "'$cookie')"; # Execute the insertion $insRes = mysql_query($insStr); if($insRes) { # In this case, the insertion of the new element # description has been successful. Therefore we # need to inform the user and redirect the # browser. emailRecord($elename); insertBon($elename); } // END if else { # Insert failed insertMal(); } // END else } // END elseif elseif($type == "F") { # Element is file - needs size, maxlength if($size) { if(!charIsInt($size)) { # Damn...user has given a non-int value for # $size print("

The Size Field Must Have " . "an Integer Value.

"); # Make a flag to mark this failure $sizeFailed = true; enterEDSelementDescr($elename, $alephcode, "", $rows, $cols, $maxlength, stripslashes($val), stripslashes($fidesc), $cookie, $type,$modifytext); } // END if } // END if if($maxlength && !$sizeFailed) { if(!charIsInt($maxlength)) { # User has given a non-int value for $maxlength print("

" . "The Max Length Field Must Have an " . "Integer Value.

"); # Make a flag to mark this failure $maxlengthFailed = true; enterEDSelementDescr($elename, $alephcode, $size, $rows, $cols, "", stripslashes($val), stripslashes($fidesc), $cookie, $type,$modifytext); } // END if } // END if if(!$sizeFailed && !$maxlengthFailed) { # Well now. If we have reached this far, then the # data for the input must all be present and # valid, so we can finally make this new element # description, and commit it to the DB. $insStr = "INSERT INTO sbmFIELDDESC (name, alephcode" . ", marccode, type, size, rows, cols, maxlength, val, " . "fidesc, cd, md, modifytext, fddfi2, cookie) " . "VALUES('$elename', '$alephcode', '$marccode', '$type', "; # Deal with size if(isset($size) && $size != "") { # A value was provided for rows... $insStr .= "'$size', "; } // END if else { # No value was provided for rows... $insStr .= "NULL, "; } // END else $insStr .= "NULL, NULL, "; # Deal with maxlength if(isset($maxlength) && $maxlength != "") { # A value was provided for rows... $insStr .= "'$maxlength', "; } // END if else { # No value was provided for rows... $insStr .= "NULL, "; } // END else $insStr .= "NULL, NULL, NOW(), NOW(), ".(isset($modifytext)?"'$modifytext', ":"NULL, ")."NULL," . " '$cookie')"; # Execute the insertion $insRes = mysql_query($insStr); if($insRes) { # In this case, the insertion of the new # element description has been successful. # Therefore we need to inform the user and # redirect the browser. emailRecord($elename); insertBon($elename); } // END if else { # Insert failed insertMal(); } // END else } // END if } // END elseif elseif($type == "D") { # Element is user defined - needs fidesc $insStr = "INSERT INTO sbmFIELDDESC (name, alephcode, marccode, " . "type, size, rows, cols, maxlength, val, fidesc, " . "cd, md, modifytext, fddfi2, cookie) VALUES('" . "$elename', '$alephcode', '$marccode', '$type', NULL, NULL, " . "NULL, NULL, NULL, "; $insStr .= "'$fidesc', NOW(), NOW(), ".(isset($modifytext)?"'$modifytext', ":"NULL, ")."NULL, " . "'$cookie')"; # Execute the insertion $insRes = mysql_query($insStr); if($insRes) { # In this case, the insertion of the new element # description has been successful. Therefore we # need to inform the user and redirect the # browser. emailRecord($elename); insertBon($elename); } // END if else { # Insert failed insertMal(); } // END else } // END elseif elseif($type == "R") { # Element is of response type - needs fidesc $insStr = "INSERT INTO sbmFIELDDESC (name, alephcode, marccode, " . "type, size, rows, cols, maxlength, val, fidesc, " . "cd, md, modifytext, fddfi2, cookie) VALUES('" . "$elename', '$alephcode', '$marccode', '$type', NULL, NULL, " . "NULL, NULL, NULL, "; $insStr .= "'$fidesc', NOW(), NOW(), ".(isset($modifytext)?"'$modifytext', ":"NULL, ")."NULL, " . "'$cookie')"; # Execute the insertion $insRes = mysql_query($insStr); if($insRes) { # In this case, the insertion of the new element # description has been successful. Therefore we # need to inform the user and redirect the # browser. emailRecord($elename); insertBon($elename); } // END if else { # Insert failed insertMal(); } // END else } // END elseif elseif($type == "S") { # Element is user defined - needs fidesc $insStr = "INSERT INTO sbmFIELDDESC (name, alephcode, marccode, " . "type, size, rows, cols, maxlength, val, fidesc, " . "cd, md, modifytext, fddfi2, cookie) VALUES('" . "$elename', '$alephcode', '$marccode', '$type', NULL, NULL, " . "NULL, NULL, NULL, "; $insStr .= "'$fidesc', NOW(), NOW(), ".(isset($modifytext)?"'$modifytext', ":"NULL, ")."NULL, " . "'$cookie')"; # Execute the insertion $insRes = mysql_query($insStr); if($insRes) { # In this case, the insertion of the new element # description has been successful. Therefore we # need to inform the user and redirect the # browser. emailRecord($elename); insertBon($elename); } // END if else { # Insert failed insertMal(); } // END else } // END elseif else { # Oops! Element type invalid! We must deny # commitment, and represent the form for the user to # once again attempt to fill in. print("

Invalid " . "Element Type is Mandatory.

\n"); enterEDSelementDescr($elename, $alephcode, $size, $rows, $cols, $maxlength, stripslashes($val), stripslashes($fidesc), $cookie,"",$modifytext); } // END else } // END else } // END else } // END else } // END if else { # In this case, this is not a self-referential call to this page, # and it is therefore time to display a form in which the user # can enter the details of the element description... enterEDSelementDescr(); } // END else } /**********************Start of main script***************************/ # Connect to the MySQL server serverConnect(MYSQLDOCMACHINE, MYSQLDOCUSERID, MYSQLDOCPASSWORD); # Select the CDS Search database... dbSelect(DOCS_DATABASE); if (!canUseWebSubmitAdmin($uid)) outWarning("You are not allowed to access WebSubmit Admin for this " . "type of documents"); else displayPage(); /************************End of main script***************************/ ?> diff --git a/modules/websubmit/web/admin/addFunctions.php.wml b/modules/websubmit/web/admin/addFunctions.php.wml index d22ded6e9..7a0f3bf99 100644 --- a/modules/websubmit/web/admin/addFunctions.php.wml +++ b/modules/websubmit/web/admin/addFunctions.php.wml @@ -1,570 +1,570 @@ ## $Id$ ## This file is part of the CERN Document Server Software (CDSware). ## Copyright (C) 2002 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="Add a functions for on $doctype";?>" \ navtrail_previous_links="/admin/> > /admin/websubmit/>" \ - navbar_name="websubmit_admin" \ + navbar_name="admin" \ navbar_select="websubmit" ## $Id$ ## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. ?> Functions of the $action action
on the $doctype" . " document type\n"); if(mysql_num_rows($selQRes) > 0) { # If this clause has been reached, there are functions # belonging to the current action on the given doctype, and # therefore we can create a table to display them in for # reference when adding the new function. # Get the fields names of the fields in the relevant functions # table... $tableFields = mysql_list_fields(DOCS_DATABASE, "sbmFUNCTIONS"); print("\n"); # Display the column titles in the table makeTableHeaderRow($tableFields, 2); print(""); # Now that the table headers have been displayed, it is # possible to display the table body. makeTbleBdy($selQRes,2); # Now close the table, as it is finished. print("
\n"); # Destroy all query result sets etc that are no longer needed mysql_free_result($tableFields); } // END if else { # If this clause has been reached, it means that there are no # functions belonging to the current action on the current # doctype, and so we should just display a message stating # this, as opposed to a table of functions. print("

The $action action on" . " the $doctype
document type has no functions

"); } // END else } // END function createActFunsList($selQRes) //***************** function makeTbleBdy($result, $forIndxStrt = 0) { /******************************************************************* This function is a very simple function that creates the body of a table, with no bells or whistles, by taking a result set, and displaying each row of the result set in a row of the table. It closes each row after it has been displayed. The function is passed the $result variable, which contains the result set, and the $forIndxStrt variable, which simply contains an integer, allowing the function to commence each row at a given cell index. Author: Nicholas Robinson Email: Nicholas.Robinson@cern.ch Created: 10/10/2000 Last Modified: 10/10/2000 *******************************************************************/ # Get the number of fields in the result set $numTblFlds = mysql_num_fields($result); while($dataRow = mysql_fetch_array($result)) { print("\n"); # Display each field in a given row... for($indx = $forIndxStrt; $indx < $numTblFlds; $indx++) { print("" . ereg_replace("'", "'", htmlspecialchars($dataRow[$indx])) . "\n"); } // END for # Now close up the table row... print("\n"); } // END while } // END function //********************** function pageFocusHome() { /****************************************************************** This function is just a simple page to redirect the browser to the prototype.php page (the administrators home page). is the page that displays details of a document type and all of its actions. The function makes a quick form with no inputs, but an action of prototype.php. It then pauses for 2 seconds, before submitting this form, and hence calling the prototype.php script. This function uses client-side JavaScript to automatically submit the form after a time delay. Author: Nicholas Robinson Email: Nicholas.Robinson@cern.ch Created: 04/09/2000 Last Modified: 06/02/2001 ******************************************************************/ # Make the invisible html form... print("
\n" . "\n" . "
\n"); # Now, pause for 2 seconds, and then submit the form... print("\n"); } // END function pageFocusHome() //*************** function makeSelectList($queryResult, $listName, $defaultCode, $defaultText, $valueIndex, $textIndex) { /**************************************************************** This function has the task of making a drop down list (type SELECT in HTML). The list made is of course part of a form, but this form is not made by this function. It is intended that this function will be called after the form has been opened, and when it is desired that a SELECT list be added to a form. This function is passed 6 variables upon calling. They are as follows: 1. $queryResult. This is the result of mysql_query - a select query. 2. $listName. This is the name that the SELECT list will be given. 3. $defaultCode. This is the default value of the first selected item of the list. 4. $defaultText. This is the text of the first default selected item. 5. $valueIndex. The values for each