Project

General

Profile

Revision 4182

Added by walbridge over 12 years ago

Consolidation of property names in register-dataset.cgi; returned runConfiguration to default true

View differences:

register-dataset.cgi
56 56
$properties->load(*METACAT_PROPERTIES);
57 57

  
58 58
# local directory configuration
59
my $configDir = $properties->getProperty('config-dir'); # skins directory
59
my $skinsDir = "${workingDirectory}/../style/skins";
60 60
my $tmpDir = $properties->getProperty('temp-dir');
61
my $xslConvDir = "$configDir/lib/style";
62 61

  
63 62
# url configuration
64
my $metacatUrl = $properties->getProperty('metacatUrl');
63
my $server = $properties->splitToTree(qr/\./, 'server');
64
my $metacatUrl = 'http://' . $properties->getProperty('server.name') . ':' . 
65
                 $properties->getProperty('server.httpPort') . '/' . 
66
                 $properties->getProperty('application.context') . '/metacat';
65 67

  
66 68
my $now = time;
67
my $xslConvDir = "$cfgdir/lib/style/";
68 69

  
69 70
# Import all of the HTML form fields as variables
70 71
import_names('FORM');
......
79 80
    $error = "Application misconfigured.  Please contact the administrator.";
80 81
    push(@errorMessages, $error);
81 82
} else {
82
    my $skinProps = "$configDir/$FORM::cfg/$FORM::cfg.properties";
83
    my $skinProps = "$skinsDir/$FORM::cfg/$FORM::cfg.properties";
83 84
    unless (open (SKIN_PROPERTIES, $skinProps)) {
84 85
        print "Content-type: text/html\n\n";
85 86
        print "Unable to locate skin properties at $skinProps.  Is this path correct?";
......
89 90
}
90 91

  
91 92
# replacements for appconfig values using properties
92
my $metacatUrl = $properties->getProperty('metacatUrl');
93
my $moderators = $properties->getProperty('ldap.moderators');
93
my $moderators = $properties->getProperty('ldap.moderators'); # scw TODO: check if this changes to per-skin
94 94
my $config = $properties->splitToTree(qr/\./, 'registry.config');
95 95
my $templates = $properties->splitToTree(qr/\./, 'registry.templates');
96 96
my $modules = $properties->splitToTree(qr/\./, 'registry.modules');
97 97
my $required = $properties->splitToTree(qr/\./, 'registry.required');
98 98
my $spatial = $properties->splitToTree(qr/\./, 'registry.spatial');
99 99

  
100
my $metacatUrl = $properties->getProperty('metacatUrl');
101
my $username = $config->{'username'};
102
my $password = $config->{'password'};
103

  
104
# XXX replace these with the proper array versions once the templates work correctly
105
my $showWgList = $required->{'wgList'};
106
my $showOrganization = $required->{'organization'};
107
my $hasKeyword = $required->{'keyword'};
108
my $hasTemporal = $required->{'temporal'};
109
my $hasSpatial = $required->{'spatial'};
110
my $hasTaxonomic = $required->{'taxonomic'};
111
my $hasMethod = $required->{'method'};
112
my $hasUpload = $required->{'upload'};
113

  
114
# contains sender, recipient, admin, mailhost
115
my $email = $properties->splitToTree(qr/\./, 'email');
116

  
117 100
# set stderr printing if configured
118 101
my $debug_enabled = $config->{'debug'};
119 102
if ($FORM::debug) {
......
137 120
my $hasUpload = $required->{'upload'};
138 121

  
139 122
# contains sender, recipient, admin, mailhost
140
my $email = $properties->splitToTree(qr/\./, 'email');
123
my $email = $skinProperties->splitToTree(qr/\./, 'email');
141 124

  
142 125
# set stderr printing if configured
143 126
my $debug_enabled = $config->{'debug'};
......
148 131
# populate db parameters for NCEAS AdminDB
149 132
my $database = '';
150 133
if ($FORM::cfg eq 'nceas') {
151
    my $database = $properties->splitToTree(qr/\./, 'registry.db');
134
    my $database = $skinProperties->splitToTree(qr/\./, 'registry.db');
152 135
}
153 136

  
154 137
#Convert the lat and lon configs into usable data structures
......
156 139
my %siteLatDMS;
157 140
my %siteLongDMS;
158 141
while ( my ($key, $value) = each (%$spatial)) {
159
    my ($name, $lon, $lat) = split(",", $value);
142
    my ($name, $lon, $lat) = split("|", $value);
160 143
    my ($latd, $latm, $lats, $latdir) = split(':', $lat);
161 144
    my ($lond, $lonm, $lons, $londir) = split(':', $lon);
162 145
    push(@sitelist, $name);
......
592 575
      (my $foundScope, my $id, my $rev) = split(/\./, $docid);
593 576
      debug("Docid is: $docid\n");
594 577
      debug("Lastid is: $id");
595
      my $scopeFile = $configDir . "/" . $FORM::cfg . "/" . $scope . ".lastid";
578
      my $scopeFile = $skinsDir . "/" . $FORM::cfg . "/" . $scope . ".lastid";
596 579
      # FIXME: skins dir isn't generally writeable by the HTTP server, use tmp instead
597 580
      open(LASTID, "+>$scopeFile") or 
598 581
          die "Failed to open lastid file for writing!";
......
653 636
  my $docrev = 1;
654 637
  my $lastid = 1;
655 638

  
656
  my $scopeFile = $configDir . "/" . $FORM::cfg . "/" . $scope . ".lastid";
639
  my $scopeFile = $skinsDir . "/" . $FORM::cfg . "/" . $scope . ".lastid";
657 640
  if (-e $scopeFile) {
658 641
    open(LASTID, "<$scopeFile") or die "Failed to generate accession number!";
659 642
    $lastid = <LASTID>;
......
1905 1888
    $doc = $httpMessage->content();
1906 1889
    $xmldoc = $parser->parse_string($doc);
1907 1890

  
1908
    #$tempfile = $xslConvDir.$docid;
1909
    #push (@fileArray, $tempfile);
1910

  
1911 1891
    if ($xmldoc eq "") {
1912 1892
        $error ="Error in parsing the eml document";
1913 1893
        push(@errorMessages, $error);
......
1950 1930
                            push(@errorMessages, "Failed during reading.\n");
1951 1931
                        } else {
1952 1932
                            my $xdoc = $response->content();
1953
                            #$tempfile = $xslConvDir.$pushDoc;
1954 1933
                            open (TFILE,">$tempfile") || 
1955 1934
                                die ("Cant open xml file... $tempfile\n");
1956 1935
                            print TFILE $xdoc;
......
2856 2835
    exit(0);
2857 2836
    } else {
2858 2837
        # session found ... redirect to index page
2859
        my $url = "$configDir/$FORM::cfg/index.html";
2838
        my $url = "$skinsDir/$FORM::cfg/index.html";
2860 2839
        redirect($url);
2861 2840
        exit(0);
2862 2841
   }
......
2875 2854
    if ( $session->is_empty || $session->is_expired) {
2876 2855
        # no session found ... send back to index.html page ... 
2877 2856
        debug("Session empty or not found");
2878
        my $url = "$configDir/$FORM::cfg/index.html";
2857
        my $url = "$skinsDir/$FORM::cfg/index.html";
2879 2858
        redirect($url);
2880 2859
        # should logout request be sent to metacat??? 
2881 2860
    } else {
......
2963 2942
    my $session = CGI::Session->load();
2964 2943
        if ( $session->is_empty || $session->is_expired) {
2965 2944
            # no session found ... send back the regular read page ...
2966
       	    my $url = "$configDir/$FORM::cfg/index.html";
2945
       	    my $url = "$skinsDir/$FORM::cfg/index.html";
2967 2946
       	    redirect($url);
2968 2947
        } else {
2969 2948
       	    my $htmldoc = "";
2970 2949
       	    $htmldoc .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">";
2971 2950
       	    $htmldoc .= "<html><head><title>Dataset Description: ".$docid."</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head>";
2972 2951
       	    $htmldoc .= "<frameset rows=\"150,*\" cols=\"*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">";
2973
       	    $htmldoc .= "<frame src=\"$configDir/$FORM::cfg/header.jsp\" marginwidth=\"40\" name=\"topFrame\" scrolling=\"NO\" noresize>";
2952
       	    $htmldoc .= "<frame src=\"$skinsDir/$FORM::cfg/header.jsp\" marginwidth=\"40\" name=\"topFrame\" scrolling=\"NO\" noresize>";
2974 2953
       	    $htmldoc .= "<frameset cols=\"200,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">";
2975 2954
       	    $htmldoc .= "<body></body><frame src=\"$cgiUrl?cfg=$FORM::cfg&stage=review_frame&docid=".$docid."\" name=\"rightFrame\" scrolling=\"NO\" noresize></frame>";
2976 2955
       	    $htmldoc .= "<frame src=\"". $metacatUrl ."?action=read&qformat=".$FORM::cfg."&docid=".$docid."&insertTemplate=0\" name=\"mainFrame\">";

Also available in: Unified diff