#include #include #include #include "util.h" #include "citation.h" #include "web-util.h" #include "web-conf.h" extern char *emailAddress; extern char *comments; void PrintReferFormat (CitationPtr C); void PrintRestOfForm (CitationPtr C); void reportText(); void dateText(); void titleText(); void authorText(); void filenameText(); void keywordsText(); void reviewsText(); void abstractText(); void directionsText(); void emailText(); void commentsText(); void orgText(); /*--------------------------------------------------------*/ /* ListtoArray: */ /* */ /* Puts the items (in list_ptr) in an array, */ /* counts how many there are, */ /* returns the integer number */ /*--------------------------------------------------------*/ int ListtoArray (char array[N_STRINGS][STRING_SIZE], char *list_ptr) { int x, y; char *c, *s; for (s=list_ptr, x=0; *s != '\0';s++) { y = 0; while ((*s != ';') && (*s != '\n') && (*s != '\0')) { array[x][y] = *s; y++; s++; } array[x][y] = '\0'; x++; } return (x); } /*--------------------------------------------------------*/ /* PrintFilledForm: */ /* */ /* Puts its input parameters into an html form */ /* (TR posting form) */ /*--------------------------------------------------------*/ void PrintFilledForm (CitationPtr C) { directionsText(); /* form header stuff */ printf ("
\n", MASTERFORM); printf ("\n"); printf ("

Technical Report Bibliographic Information

\n"); printf ("
    "); /* TR number */ reportText(); if (!getTrId(C)) { printf ("

    \n"); } else { printf ("

    \n",getTrId(C)); } PrintRestOfForm (C); } /*--------------------------------------------------------*/ /* PrintUpdatedFilledForm: */ /* */ /* Puts its input parameters into an html form */ /* (TR update posting form) */ /*--------------------------------------------------------*/ void PrintUpdatedFilledForm (CitationPtr C) { directionsText(); /* print form header stuff */ printf ("\n", MASTERFORM); printf ("\n"); printf ("

    Technical Report Bibliographic Information

    \n"); printf ("
      "); /* tr number */ reportText(); printf ("\n",getTrId(C)); printf ("%s

      \n",getTrId(C)); C->url = NULL; /* forestalls some potential update problems later on */ PrintRestOfForm (C); }/*end of PrintUpdatedFilledForm*/ /*--------------------------------------------------------*/ /* PreviewReferFormat: */ /* */ /* Puts its input parameters into refer format for viewing*/ /* And saves state using "hidden" forms. */ /* For first time posting. */ /*--------------------------------------------------------*/ void PreviewReferFormat (CitationPtr C) { printf ("TR Bibliographic Preview Form\n"); printf("

      Preview TR Bibliographic Information

      \n"); printf("

      The bibliographic information you have entered \n"); printf("will be appended to the database in refer format as follows:\n"); printf("

      \n"); printf ("Note that you must include author (%%A), title (%%T), tr number (%%R), and date (%%D) "); printf ("before posting.

      \n"); printf ("


      "); PrintReferFormat (C); /* now create "hidden" forms in order to save state: */ /* the first hidden form is for going ahead with the posting */ printf ("\n", MASTERFORM); printf ("\n"); printf ("\n"); if (getTrId(C)) { printf ("\n",getTrId(C)); } else { printf (" \n"); } if (getDate(C)) { printf ("\n",getDate(C)); } else { printf (" \n"); } if (getOrg(C)) { printf ("\n",getOrg(C)); } else { printf (" \n"); } if (emailAddress) { printf ("\n",emailAddress); } else { printf (" \n"); } if (comments) { printf ("\n",comments); } else { printf (" \n"); } if (getTitle(C)) { printf ("\n",getTitle(C)); } else { printf (" \n"); } if (getAuthor(C)) { printf ("\n",getAuthor(C)); } else { printf (" \n"); } if (getUrl(C)) { printf ("\n",getUrl(C)); } else { printf (" \n"); } if (getAbstract(C)) { printf ("\n",getAbstract(C)); } else { printf (" \n"); } if (getKeywords(C)) { printf ("\n",getKeywords(C)); } else { printf (" \n"); } if (getCategories(C)) { printf ("\n",getCategories(C)); } else { printf (" \n"); } printf ("

      \n"); printf ("

      \n"); /* the second hidden form is for returning to the posting form */ printf ("
      \n", MASTERFORM); printf ("\n"); printf ("\n"); if (getTrId(C)) { printf ("\n",getTrId(C)); } else { printf (" \n"); } if (getDate(C)) { printf ("\n",getDate(C)); } else { printf (" \n"); } if (getOrg(C)) { printf ("\n",getOrg(C)); } else { printf (" \n"); } if (emailAddress) { printf ("\n",emailAddress); } else { printf (" \n"); } if (comments) { printf ("\n",comments); } else { printf (" \n"); } if (getTitle(C)) { printf ("\n",getTitle(C)); } else { printf (" \n"); } if (getAuthor(C)) { printf ("\n",getAuthor(C)); } else { printf (" \n"); } if (getUrl(C)) { printf ("\n",getUrl(C)); } else { printf (" \n"); } if (getAbstract(C)) { printf ("\n",getAbstract(C)); } else { printf (" \n"); } if (getKeywords(C)) { printf ("\n",getKeywords(C)); } else { printf (" \n"); } if (getCategories(C)) { printf ("\n",getCategories(C)); } else { printf (" \n"); } printf ("

      \n"); printf ("

      "); }/* end of PreviewReferFormat */ /*--------------------------------------------------------*/ /* PreviewUpdatedReferFormat: */ /* */ /* Puts its input parameters into refer format for viewing*/ /* And saves state using "hidden" forms. */ /* For update posting. */ /*--------------------------------------------------------*/ void PreviewUpdatedReferFormat (CitationPtr C) { printf ("TR Bibliographic Preview Form\n"); printf("

      Preview TR Bibliographic Information

      \n"); printf("

      The bibliographic information you have entered \n"); printf("will be updated in the database in refer format as follows:\n"); printf("

      \n"); printf ("Note that you must include author, title, and date before reposting.

      \n"); printf ("


      "); PrintReferFormat (C); /* now create "hidden" forms to save state */ /* the first is for going straight from previewing to updating (posting) */ printf ("
      \n", MASTERFORM); printf ("\n"); printf ("\n"); if (getTrId(C)) { printf ("\n",getTrId(C)); } else { printf (" \n"); } if (getDate(C)) { printf ("\n",getDate(C)); } else { printf (" \n"); } if (getTitle(C)) { printf ("\n",getTitle(C)); } else { printf (" \n"); } if (getOrg(C)) { printf ("\n",getOrg(C)); } else { printf (" \n"); } if (emailAddress) { printf ("\n",emailAddress); } else { printf (" \n"); } if (comments) { printf ("\n",comments); } else { printf (" \n"); } if (getAuthor(C)) { printf ("\n",getAuthor(C)); } else { printf (" \n"); } if (getUrl(C)) { printf ("\n",getUrl(C)); } else { printf (" \n"); } if (getAbstract(C)) { printf ("\n",getAbstract(C)); } else { printf (" \n"); } if (getKeywords(C)) { printf ("\n",getKeywords(C)); } else { printf (" \n"); } if (getCategories(C)) { printf ("\n",getCategories(C)); } else { printf (" \n"); } /* printf ("Everything is fine:\n");*/ printf ("

      \n"); printf ("

      "); /* the second is for going from previewing back to the update form */ printf ("
      \n", MASTERFORM); printf ("\n"); printf ("\n"); if (getTrId(C)) { printf ("\n",getTrId(C)); } else { printf (" \n"); } if (getDate(C)) { printf ("\n",getDate(C)); } else { printf (" \n"); } if (getOrg(C)) { printf ("\n",getOrg(C)); } else { printf (" \n"); } if (emailAddress) { printf ("\n",emailAddress); } else { printf (" \n"); } if (comments) { printf ("\n",comments); } else { printf (" \n"); } if (getTitle(C)) { printf ("\n",getTitle(C)); } else { printf (" \n"); } if (getAuthor(C)) { printf ("\n",getAuthor(C)); } else { printf (" \n"); } if (getUrl(C)) { printf ("\n",getUrl(C)); } else { printf (" \n"); } if (getAbstract(C)) { printf ("\n",getAbstract(C)); } else { printf (" \n"); } if (getKeywords(C)) { printf ("\n",getKeywords(C)); } else { printf (" \n"); } if (getCategories(C)) { printf ("\n",getCategories(C)); } else { printf (" \n"); } printf ("

      \n"); printf ("

      "); }/* end of PreviewUpdatedReferFormat */ /*--------------------------------------------------------*/ /* DisplayReferEntry: */ /* */ /* Takes as input all the bibliographic data available. */ /* Puts its input parameters into html format for viewing.*/ /* (called by Refer2View) */ /*--------------------------------------------------------*/ void DisplayReferEntry (CitationPtr C) { /*printf ("

      TR Bibliographic Information

      \n");*/ printf ("
        "); /***There HAS to be one, so we should not check for one!!??*****/ if (getTrId(C)) { printf ("
      • TR NUMBER: "); printf (" %s\n

        ", getTrId(C)); } if (getDate(C)) { printf ("

      • DATE: "); printf (" %s\n

        ",getDate(C)); } if (getTitle(C)) { printf ("

      • TITLE: "); printf (" %s\n

        ",getTitle(C)); } if (getAuthor(C)) { printf ("

      • AUTHOR(S): "); printf (" %s\n

        ",getAuthor(C)); } if (getUrl(C)) { printf ("

      • URL: "); printf (" %s\n

        ",getUrl(C), getUrl(C)); } if (getAbstract(C)) { printf ("

      • ABSTRACT: "); printf ("%s\n

        ",getAbstract(C)); } if (getKeywords(C)) { printf ("

      • KEYWORDS:"); printf ("%s

        \n", getKeywords(C)); } if (getCategories(C)) { printf ("

      • CATEGORIES: "); printf ("%s

        \n", getCategories(C)); } if (getOrg(C)) { printf ("

      • TR Series Name: "); printf ("%s

        \n", getOrg(C)); } }/*end of DisplyReferEntry*/ /*--------------------------------------------------------*/ /* Refer2Form: */ /* */ /* reads a refer bib entry (in passedfilename) */ /* and passes the information to PrintUpdatedFilledForm. */ /* (used for updating) */ /*--------------------------------------------------------*/ void Refer2Form (char *passedfilename) { FILE *fp; CitationPtr C; /* The passed file should contain a single citation */ fp = fopen (passedfilename, "r"); if (!fp) { printf ("ERROR: Could not open file passed from techrep.\n"); return; } C = read_one_citation (fp); if (!C) { printf ("ERROR: Could not read citation passed from techrep.\n"); return; } fclose(fp); PrintUpdatedFilledForm (C); }/* end of Refer2Form */ /*--------------------------------------------------------*/ /* Refer2View: */ /* */ /* reads a refer bib entry (in passedfilename) */ /* and displays the information in html format. */ /* (by calling DisplayReferEntry) */ /* (used for previewing during posting) */ /*--------------------------------------------------------*/ void Refer2View (char *passedfilename) { FILE *fp; CitationPtr C; /* The passed file should contain a single citation */ fp = fopen (passedfilename, "r"); if (!fp) { printf ("ERROR: Could not open file passed from techrep.\n"); return; } C = read_one_citation (fp); if (!C) { printf ("ERROR: Could not read citation passed from techrep.\n"); return; } fclose(fp); DisplayReferEntry (C); }/* end of Refer2View */ /* * Prints html-ized refer for the given citation. */ void PrintReferFormat (CitationPtr C) { char temp_array[N_STRINGS][STRING_SIZE]; int listCount; int x; if (getAuthor(C)) { listCount = ListtoArray(temp_array, getAuthor(C)); for (x = 0; x < listCount; x++) { printf ("%%%c %s\n
        ", REF_AUTHOR, temp_array[x]); } } if (getTitle(C)) { printf ("%%%c %s\n
        ", REF_TITLE, getTitle(C)); } if (getOrg(C)) { printf ("%%%c %s\n
        ", REF_INST, getOrg(C)); } if (getTrId(C)) { printf ("%%%c %s\n
        ", REF_REPORT, getTrId(C)); } if (getDate(C)) { printf ("%%%c %s\n
        ", REF_DATE, getDate(C)); } if (getUrl(C)) { printf ("%%%c %s\n
        ", REF_URL, getUrl(C)); } if (getKeywords(C)) { printf ("%%%c ", REF_KEYWORDS); listCount = ListtoArray(temp_array, getKeywords(C)); for (x = 0; x < listCount; x++) { printf ("%s, ",temp_array[x]); } printf ("\n
        "); } if (getCategories(C)) { printf ("%%%c ", REF_CATEGORY); listCount = ListtoArray(temp_array, getCategories(C)); for (x = 0; x < listCount ; x++) { printf ("%s, ",temp_array[x]); } printf ("\n
        "); } if (getAbstract(C)) { printf ("%%%c %s\n
        ", REF_ABSTRACT,getAbstract(C)); } } void PrintRestOfForm (CitationPtr C) { int i; FILE *fp; char orgFile[STRING_SIZE]; char line[STRING_SIZE], *org; int first = TRUE; /* organization */ sprintf (orgFile, "%s/lib/TrSeriesNames", TR_HOME); if ((fp = fopen(orgFile, "r")) == NULL) { fprintf (stderr, "Could not find file containing organization names."); exit(1); } orgText (); printf ("

        \n"); fclose (fp); /* date */ dateText(); if (!getDate(C)) { printf ("

        \n"); } else { printf ("

        \n",getDate(C)); } /* title */ titleText(); if (!getTitle(C)) { printf ("

        \n"); } else { printf ("

        \n",getTitle(C)); } /* authors */ authorText(); if (!getAuthor(C)) { printf ("

        \n"); } else { printf ("

        \n",getAuthor(C)); } emailText(); printf ("

        \n"); /* url */ filenameText(); if (!getUrl(C)) { printf ("

        \n"); } else { printf ("

        \n",getUrl(C)); } /* abstract */ abstractText(); if (!getAbstract(C)) { printf ("

        \n"); } else { printf ("

        \n",getAbstract(C)); } /* keywords */ keywordsText(); if (!getKeywords(C)) { printf ("

        \n"); } else { printf ("

        \n", getKeywords(C)); } /* cr subject categories */ reviewsText(); if (!getCategories(C)) { printf ("

        \n"); } else { printf ("

        \n", getCategories(C)); } commentsText(); printf ("

        \n"); printf ("

      • CHOOSE TO SUBMIT INFORMATION FOR POSTING OR TO PREVIEW IT FIRST
        \n"); printf ("

        \n"); printf ("

      "); printf ("

      \n"); /* printf ("

      \n");*/ printf (""); printf ("

      \n", MASTERFORM); printf ("\n"); printf ("

      \n"); printf ("

      \n"); } void directionsText() { printf ("

      Directions

      "); printf ("Fill out the form below. Be sure to specify your email address in the\n"); printf ("space provided. This information is collated and sent to %s,\n", TR_ADMIN); printf ("who is the report administrator at your site. The report administrator\n"); printf ("verifies the information on the form with you before posting it in\n"); printf ("the online archive.

      \n"); printf ("Be aware that when you request a change to the archive through POST, DELETE\n"); printf ("or UPDATE, the change must be verified. Thus there will be some delay\n"); printf ("in the appearance of your report in the online archive.

      \n"); printf ("\n"); } void reportText() { printf ("

    • TECHNICAL REPORT NUMBER:This is a unique string that identifies\n"); printf ("your TR. You have to obtain this from Sally Elder in 226 Bell.
      \n"); } void dateText() { printf ("
    • DATE WRITTEN: The date format should be \"Month Day, Year\",\n"); printf ("for example, \"July 4, 1994\"
      \n"); } void titleText() { printf ("
    • TITLE OF TECHNICAL REPORT:
      \n"); } void authorText() { printf ("
    • AUTHORS: Separate authors' names with a semicolon, comma, or other delimiter
      \n"); } void filenameText() { printf ("
    • PATH AND FILENAME OF TECHNICAL REPORT:This file must be\n"); printf ("readable by the Report Administrator so that it can be copied to the TR archive.
      \n"); } void abstractText() { printf ("
    • ABSTRACT: You can put the full text of the abstract here\n"); printf ("or simply specify the full path to a filename containing this text.
      \n"); } void keywordsText() { printf ("
    • KEYWORDS:
      \n"); } void reviewsText() { printf ("
    • COMPUTING REVIEWS SUBJECT CATEGORIES (OPTIONAL):
      \n"); printf ("Here is a list of possible categories\n", HELP_URL); printf ("Separate category names with a semicolon \";\"
      \n"); } void commentsText() { printf ("
    • COMMENTS: Place any comments you need to make to the Report\n"); printf ("Administrator here. These comments are not saved as part of\n"); printf ("the bibliographic entry for your report.
      \n"); printf ("Please mention here which system (castor, hadar etc.) that the files mentioned above are on.
      \n"); } void emailText() { printf ("
    • CONTACT PERSON: The email address (probably your own) of the\n"); printf ("person who will verify the information provided here.
      \n"); } void orgText() { printf ("
    • INSTITUTION/TR-SERIES: Select one from the list.
      \n"); }