Permalink
Browse files

a lot of changes

  • Loading branch information...
1 parent 1979043 commit b8132fef47cdc722e8aee9004b48e0e1a8b3d6f6 @reneeb committed Mar 2, 2011
View
Binary file not shown.
@@ -159,6 +159,12 @@ sub to_hash {
return %info;
}
+sub save {
+ my ($self) = @_;
+
+ $self->DEMOLISH;
+}
+
sub BUILD {
my ($self) = @_;
@@ -232,6 +238,8 @@ sub DEMOLISH {
uploaded_by => 0,
name_id => 0,
});
+
+ $self->add_object( package => $package );
}
#$self->_schema->storage->debug( 1 );
@@ -268,6 +276,7 @@ sub DEMOLISH {
}
$package->in_storage ? $package->update : $package->insert;
+ $self->package_id( $package->package_id );
}
no Moose;
@@ -239,6 +239,7 @@ sub package_to_hash {
VIRTUAL_PATH => $package->virtual_path,
WEBSITE => $package->website,
BUGTRACKER => $package->bugtracker,
+ FRAMEWORK => $package->framework,
};
return $info;
View
@@ -61,11 +61,13 @@ sub base_url {
return $uri;
}
-sub index_url {
- my ($self) = @_;
+sub script_url {
+ my ($self,$name) = @_;
+
+ $name ||= 'index';
my $script = $ENV{SCRIPT_NAME};
- $script =~ s{[a-z]*\.cgi}{index.cgi};
+ $script =~ s{[a-z]*\.cgi}{$name.cgi};
my $uri = "http://$ENV{HTTP_HOST}$script";
return $uri;
@@ -46,7 +46,9 @@ sub view{
$tmpl->param(
BODY => $tmpl_path . $template,
__SCRIPT__ => $self->base_url,
- __INDEX__ => $self->index_url,
+ __INDEX__ => $self->script_url( 'index' ),
+ __AUTHOR__ => $self->script_url( 'author' ),
+ __ADMIN__ => $self->script_url( 'admin' ),
%{$self->stash},
%notifications,
);
@@ -9,10 +9,10 @@ use File::Basename;
use File::Spec;
use Path::Class;
-use OTRS::OPR::DAO::Package;
use OTRS::OPR::DAO::Author;
-use OTRS::OPR::DAO::Maintainer;
use OTRS::OPR::DAO::Comment;
+use OTRS::OPR::DAO::Maintainer;
+use OTRS::OPR::DAO::Package;
use OTRS::OPR::DB::Helper::Job qw(create_job find_job);
use OTRS::OPR::DB::Helper::Package (qw(page user_is_maintainer package_exists), { version_list => 'versions' } );
use OTRS::OPR::Web::App::Forms qw(:all);
@@ -192,6 +192,10 @@ sub do_upload : Permission( 'author' ) {
$package->name_id( $name_id );
$package->upload_time( time );
+ $package->save;
+
+ $self->logger->trace( 'created package id ' . $package->package_id );
+
# create an entry in job queue that the package
# should be analyzed
my $job_id = $self->create_job({
@@ -475,6 +479,10 @@ sub _upload_file {
$self->logger->debug( "Target file: $file_path" );
+ if ( -e $file_path ) {
+ return 0, 'File already exists';
+ }
+
my $path_stringified = $path->stringify;
mkdir $path_stringified unless -e $path_stringified;
@@ -4,6 +4,8 @@ use strict;
use warnings;
use CGI::Cookie;
+no warnings 'redefine';
+
my $cookiename = 'MyCookie';
my $expiretime = 60;
View
@@ -8,10 +8,11 @@
my $dir;
BEGIN {
- $dir = dirname __FILE__;
- use lib "$dir/lib";
+ $dir = dirname __FILE__;
}
+use lib "$dir/lib";
+
use OTRS::OPR::Daemon;
my $conf_dir = Path::Class::Dir->new( $dir, 'conf' );
View
@@ -25,15 +25,27 @@
of this website, please enable JavaScript.
</div>
</noscript>
+
+
+ <section class="menu">
+ <ul>
+ <li><a href="<%= __SCRIPT__ %>/package/upload">Upload a new opm file</a></li>
+ <li><a href="<%= __SCRIPT__ %>/package/list">Package list</a></li>
+ <li><a href="<%= __SCRIPT__ %>/profile">View/Edit your profile</a></li>
+ <li><a href="">Administer the comments</a></li>
+ </ul>
+ </section>
<%LOOP NOTIFICATIONS %>
<%INCLUDE_VAR include %>
<%/LOOP %>
<%INCLUDE_VAR BODY %>
<footer>
- &copy; 2010 by OPAR Team --
- <a href="<%= __INDEX__ %>/static/imprint">Imprint</a>
+ &copy; 2010 by
+ <a href="<%= __INDEX__ %>/static/team">OPAR Team</a> --
+ <a href="<%= __INDEX__ %>/static/imprint">Imprint</a> -
+ <a href="<%= __INDEX__ %>/feedback">Feedback</a>
</footer>
</div>
@@ -1,12 +1,3 @@
<section>
<h1>Welcome to OPAR author portal</h1>
</section>
-
-<section class="menu">
- <ul>
- <li><a href="<%= __SCRIPT__ %>/package/upload">Upload a new opm file</a>
- <li><a href="<%= __SCRIPT__ %>/package/list">Package list</a>
- <li><a href="<%= __SCRIPT__ %>/profile">View/Edit your profile</a>
- <li><a href="">Administer the comments</a>
- </ul>
-</section>
@@ -7,27 +7,13 @@
<div>
<form action="<%= __SCRIPT__ %>/package/do_upload" method="post" enctype="multipart/form-data">
<input type="hidden" name="formid" value="<%= FORMID %>" />
- <fieldset class="table_like">
- <dl>
- <dt>
- <label for="opm_file">
- <span class="<%= ERROR_OPM_FILE %>">File</span>
- </label>
- </dt>
- <dd>
- <div class="field <%= ERROR_OPM_FILE %>">
- <input type="file" name="opm_file" id="opm_file" class="px290" />
- </div>
- </dd>
+ <dl>
+ <dt>File</dt>
+ <dd><input type="file" name="opm_file" id="opm_file" class="px290" /></dd>
- <dt class="empty">&nbsp;</dt>
- <dd class="right">
- <div class="button_row">
- <button type="submit" name="submit" value="Upload">Upload</button>
- </div>
- </dd>
- </dl>
- </fieldset>
+ <dt class="empty">&nbsp;</dt>
+ <dd class="right"><button type="submit" name="submit" value="Upload">Upload</button></dd>
+ </dl>
</form>
</div>
</section>
@@ -35,7 +35,7 @@
</ul>
</dd>
<%/IF %>
-
+<!--
<dt>OPAR Kwalitee (OK)</dt>
<dd class="kwalitee">
<span class="<%= OK_GRADE %>">
@@ -44,6 +44,7 @@
</a>
</span>
</dd>
+-->
</dl>
</div>
</section>
View
@@ -35,6 +35,7 @@
<li><a href="<%= __SCRIPT__ %>">Home</a></li>
<li><a href="<%= __SCRIPT__ %>/authors">List of Authors</a></li>
<li>&nbsp;</li>
+ <li><a href="<%= __AUTHOR__ %>">Author-Login</a></li>
<li><a href="<%= __SCRIPT__ %>/registration">Register</a></li>
</ul>
</section>

0 comments on commit b8132fe

Please sign in to comment.