/[Arh]/lib/Arh/Bootstrap.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/Arh/Bootstrap.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4 by dpavlin, Thu Nov 29 11:20:24 2007 UTC revision 12 by dpavlin, Thu Nov 29 19:32:41 2007 UTC
# Line 4  use strict; Line 4  use strict;
4  package Arh::Bootstrap;  package Arh::Bootstrap;
5  use base qw(Jifty::Bootstrap);  use base qw(Jifty::Bootstrap);
6    
7    use Data::Dump qw/dump/;
8    
9  =head1 Bootstrap application data  =head1 Bootstrap application data
10    
11  Create initial data  Create initial data
# Line 11  Create initial data Line 13  Create initial data
13  =cut  =cut
14    
15  sub run {  sub run {
16            warn "## run",dump(@_);
17      my $self = shift;      my $self = shift;
18    
19          my $system_user = Arh::CurrentUser->superuser( _bootstrap => 1 );          my $system_user = Arh::CurrentUser->superuser( _bootstrap => 1 );
20    
21    
22            my $u = Arh::Model::User->new(current_user => $system_user);
23    
24            $u->create(
25                    name => 'Admin',
26                    lastname => 'User',
27                    email => 'admin@example.com',
28                    email_confirmed => 1,
29                    password => 'password',
30                    administrator => 1,
31                    organization => 'Site administrator',
32            );
33    
34            $u->create(
35                    name => 'Anonymous',
36                    lastname => 'User',
37                    email => 'anonymous@example.com',
38                    email_confirmed => 1,
39                    password => 'password',
40                    administrator => 0,
41                    organization => 'Part of anonymous user crowd',
42            );
43    
44          my $pt = Arh::Model::PictureType->new(current_user => $system_user);          my $pt = Arh::Model::PictureType->new(current_user => $system_user);
45                    
46          $pt->create( name => $_ ) foreach ( qw/          $pt->create( name => $_ ) foreach ( qw/
# Line 23  slika Line 49  slika
49  rekonstrukcija  rekonstrukcija
50  aksiometrija  aksiometrija
51  arhitektura  arhitektura
52  namjetaj  namještaj
53  / );  / );
54    
55            my $chronology = Arh::Model::Chronology->new(current_user => $system_user);
56            $chronology->create(
57                    name => 'kraj 8. stoljeća',
58                    year_from => 760,
59                    year_to => 800,
60            );
61    
62            my $material = Arh::Model::Material->new;
63            $material->create(
64                    name => 'tvrdi vapnenac',
65            );
66    
67            my $location = Arh::Model::Location->new;
68            $location->create(
69                    name => 'Lapidarij u Balama',
70            );
71    
72            my $place = Arh::Model::Place->new;
73            $place->create(
74                    name => 'mjesto iskapanja',
75            );
76    
77            my $campaign = Arh::Model::Campaign->new(current_user => $system_user);
78            $campaign->create(
79                    place => $place,
80                    name => 'prvo iskapanje',
81                    date_from => '2007-11-28',
82                    date_to => '2008-03-15',
83            );
84    
85            my $unit = Arh::Model::Unit->new(current_user => $system_user);
86            $unit->create(
87                    name => 'Mali kapitel stupića mnolitnog oltara',
88                    number => 'SMV - 96/60',
89                    campaign => $campaign,
90                    dimensions => 'visina kapitola 13,5 cm; ukupna visina: 14,5 cm; presjek 13,5x13,5x5cm; manji presjek 11cm',
91                    position => 'otkriveno cca 12m od istočne fasade crkve',
92                    description => 'Ukrašen u doljnjem dijelu astragalom. U dobrom stanju. Abakus ukrašen na klasičan način, astragal u dva pojasa. Pojasnica sa spojenim listovima.',
93                    chronology => $chronology,
94                    location => $location,
95            );
96    
97            my $um = Arh::Model::UnitMaterial->new;
98            $um->create(
99                    unit => $unit,
100                    material => $material,
101            );
102  }  }
103    
104  1;  1;

Legend:
Removed from v.4  
changed lines
  Added in v.12

  ViewVC Help
Powered by ViewVC 1.1.26