diff --git a/modules/websubmit/web/admin/editRecordFile.php.wml b/modules/websubmit/web/admin/editRecordFile.php.wml index fe2a089ec..348579120 100644 --- a/modules/websubmit/web/admin/editRecordFile.php.wml +++ b/modules/websubmit/web/admin/editRecordFile.php.wml @@ -1,296 +1,250 @@ ## $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="Edit bibconvert configuration for the document type" \ navtrail_previous_links="/admin/> > /admin/websubmit/>" \ navbar_name="admin" \ navbar_select="websubmit" $uploadTplPath = "/bibconvert/config"; + ## $Id$ ## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. + /*********************Function Declarations***************************/ function criticalFileFailRedirect($functionName, $doctype, $action, $returnTo) { /******************************************************************* This function simply redirects the browser to the func.php page. It is called when the file cannot be opened for reading/writing. Author: Nicholas Robinson Email: Nicholas.Robinson@cern.ch ca8nro@yahoo.co.uk Created: 01/02/2001 Last Modified: 06/02/2001 *******************************************************************/ # Make the functionality to send the page back home... print("
\n\n\n\n\n\n\n\n\n
" . "\n\n
\n
\n\n"); } // END function criticalFileFailRedirect() //************** - function doBusiness($file, $functionName, $doctype, $action, $returnTo) + function doBusiness($uploadTplPath, $file, $functionName, $doctype, $action, $returnTo) { /******************************************************************* This function has the task of reading from the file, and with this data, producing the page. Author: Nicholas Robinson Email: Nicholas.Robinson@cern.ch ca8nro@yahoo.co.uk Created: 01/02/2001 Last Modified: 01/02/2001 *******************************************************************/ # Test to see if the file already exists. - if(!is_file($file)) + if(!is_file("$uploadTplPath/$file")) { - # The file does not exist. We had better create it... - if(!$filePtr = fopen($file, "w")) + # The file does not exist. Create it. + if(!$filePtr = fopen("$uploadTplPath/$file", "w")) { # Unable to make the file - - print("\n"); - - # Set an error flag to indicate the failure of this file - # creation. - + # Set an error flag to indicate the failure of this file creation. $file_there = false; } // END if else { - # ok, set file there equal to true, as we have managed to - # create it. + fclose($filePtr); $file_there = true; } // END else } // END if else { # File already exists, so we can set the flag to say so... $file_there = true; } // END else # Now we can see if the file exists or not. If so, we can output # our form, with its details. If not, we can simply present the # user with an error message, and redirect the page back to # "func.php". if($file_there) { - # Cool. Our file lives. - - # Cool. Now we must open our file (Possibly again if it - # hadn't already existed!), and read its contents... - - if(!$fPtr = fopen($file, "r")) + # read file contents + if(!$fPtr = fopen("$uploadTplPath/$file", "r")) { - # Great, the damn file did not open... - - print("\n"); - print("
Unable To Open File." . "
\n"); - criticalFileFailRedirect($functionName, $doctype, $action, $returnTo); } // END if else { - # Cool. We have opened it just nicely... - print("Contents of " . "$file\n"); - #Separate our page out.... drawSeparator(); # Make our text area with all of the files data in it... print("
\n" . "\n" . "\n" . "\n\n\n\n\n\n\n\n
\n\n
\n\n" . "\n\n\n\n\n\n\n\n\n
\n\n\n\n
\n\n<" . "/TD>\n\n
\n"); } // END else } // END if else { # File can't be raised. Better just output error messages, # and redirect page to "func.php". - - print("\n"); - print("
Unable To Open File." . "
\n"); - criticalFileFailRedirect($functionName, $doctype, $action, $returnTo); } // END else } // END function doBusiness() - function displayPage() + function displayPage($uploadTplPath) { global $doctype,$saveDets,$functionName,$action,$returnTo,$content,$file; - # Now perform tests in order to determine what we want to do... + # Now perform tests to determine what to do if(isset($saveDets)) { # In this case, this is a self referential call to the form in # order to update the file. # Free some wasted space... unset($saveDets); - if(!$fh = fopen($file, "w")) + if(!$fh = fopen("$uploadTplPath/$file", "w")) { - # Oh dear. We could not open this file for writing. - - print("\n"); - + # Could not open this file for writing. print("
Unable To Open File." . "
\n"); - - criticalFileFailRedirect($functionName, $doctype, $action, - $returnTo); + criticalFileFailRedirect($functionName, $doctype, $action, $returnTo); } // END if else { - # Let's use ereg_replace to replace any weird MAC \015 (CR) + # ereg_replace to replace any \015 (CR) # (\r) chars with nothing. $content = stripslashes(ereg_replace("\015","",$content)); - # Good. We can open our file. + # Open file for writing if(!fwrite($fh, $content, strlen($content))) { # Couldn't write to the file. - print("\n"); - print("
Unable To Open File." . "
\n"); - fclose($fh); - criticalFileFailRedirect($functionName, $doctype, $action, $returnTo); } // END if else { - # We should have by now written our details to the file, - # and so should close it. - fclose($fh); - - print("\n
File " . "Updated
\n"); - # Now redisplay the main page. - doBusiness($file, $functionName, $doctype, $action, - $returnTo); + doBusiness($uploadTplPath, $file, $functionName, $doctype, $action, $returnTo); } // END else } // END else } // END if else { # This is the first call to this script, and it is simply our # task to display the files dets in a textarea box, offering # links to update it, or simply leave this form. - - doBusiness($file, $functionName, $doctype, $action, $returnTo); + doBusiness($uploadTplPath, $file, $functionName, $doctype, $action, $returnTo); } // 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,$doctype); + + $uploadTplPath = "/bibconvert/config"; + if (!$auth[0]) outWarning($auth[1] . "

" . "You are not allowed to access WebSubmit Admin for this type of documents"); else - displayPage(); + displayPage($uploadTplPath); /************************End of main script***************************/
?>