2 package SMMID
::Controller
::SMID
;
6 BEGIN { extends
'Catalyst::Controller'; }
9 sub browse
:Path
('/browse') Args
(0) {
14 sub curator
:Path
('/curator') Args
(0) {
19 sub smid
:Chained
('/') PathPart
('smid') CaptureArgs
(1) {
22 $c->stash->{compound_id
} = shift;
25 sub detail
:Chained
('smid') PathPart
('') Args
(0) {
29 if ($c->user()) { $c->stash->{login_user
} = $c->user()->get_object->dbuser_id(); }
30 $c->stash->{template
} = '/smid/detail.mas';
33 # compatibility with old site
34 sub smid_old
: Chained
('/') PathPart
('detail') Args
(1) {
39 # google links sometimes have windows like end characters... remove!
43 print STDERR
"SMID ID = |$smid_id|\n";
45 my $row = $c->model('SMIDDB')->resultset("SMIDDB::Result::Compound")->find( { smid_id
=> $smid_id });
49 $compound_id = $row->compound_id();
52 $c->stash->{template
} = '/message.mas';
53 $c->stash->{message
} = "The specified SMID does not exist.";
56 $c->stash->{compound_id
} = $compound_id;
58 if ($c->user()) { $c->stash->{login_user
} = $c->user()->get_object->dbuser_id(); }
59 $c->stash->{template
} = '/smid/detail.mas';
62 sub add
:Path
('/smid') Args
(0) {
66 $c->stash->{action
} = 'new';
67 $c->stash->{compound_id
} = 0;
68 if ($c->user()) { $c->stash->{login_user
} = $c->user()->get_object->dbuser_id(); }
69 $c->stash->{template
} = '/smid/detail.mas';
73 sub edit
:Chained
('smid') PathPart
('edit') Args
(0) {
77 $c->stash->{action
} = "edit";
78 if ($c->user()) { $c->stash->{login_user
} = $c->user()->get_object->dbuser_id(); }
79 $c->stash->{template
} = '/smid/detail.mas';
82 sub add_image
:Chained
('smid') PathPart
('image') Args
(0) {
86 my $rs = $c->model("SMIDDB")->resultset("SMIDDB::Result::CompoundImage")->search( { compound_id
=> $c->stash->{compound_id
} });
89 while (my $row = $rs->next()) {
90 push @image_ids, $row->image_id();
93 $c->stash->{image_ids
} = \
@image_ids;
94 $c->stash->{template
} = '/image/index.mas';
98 'SMMID::Controller::SMID';