/[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 14 by dpavlin, Fri Nov 30 16:43:53 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_8 = Arh::Model::Chronology->new(current_user => $system_user);
56            $chronology_8->create(
57                    name => '8. stoljeće',
58                    year_from => 701,
59                    year_to => 800,
60            );
61            my $chronology_end8 = Arh::Model::Chronology->new(current_user => $system_user);
62            $chronology_end8->create(
63                    name => 'kraj 8. stoljeća',
64                    year_from => 760,
65                    year_to => 800,
66                    part_of => $chronology_8,
67            );
68    
69    
70            my $material = Arh::Model::Material->new;
71            $material->create(
72                    name => 'tvrdi vapnenac',
73            );
74    
75            my $material2 = Arh::Model::Material->new;
76            $material2->create(
77                    name => 'nepoznato',
78            );
79    
80            my $location = Arh::Model::Location->new;
81            $location->create(
82                    name => 'Lapidarij u Balama',
83            );
84    
85            my $place = Arh::Model::Place->new;
86            $place->create(
87                    name => 'mjesto iskapanja',
88            );
89    
90            my $campaign = Arh::Model::Campaign->new(current_user => $system_user);
91            $campaign->create(
92                    place => $place,
93                    name => 'prvo iskapanje',
94                    date_from => '2007-11-28',
95                    date_to => '2008-03-15',
96            );
97    
98            my $unit = Arh::Model::Unit->new(current_user => $system_user);
99            $unit->create(
100                    name => 'Mali kapitel stupića mnolitnog oltara',
101                    number => 'SMV - 96/60',
102                    campaign => $campaign,
103                    dimensions => 'visina kapitola 13,5 cm; ukupna visina: 14,5 cm; presjek 13,5x13,5x5cm; manji presjek 11cm',
104                    position => 'otkriveno cca 12m od istočne fasade crkve',
105                    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.',
106                    chronology => $chronology_end8,
107                    location => $location,
108            );
109    
110            my $um = Arh::Model::UnitMaterial->new;
111            $um->create(
112                    unit => $unit,
113                    material => $material,
114            );
115            $um->create(
116                    unit => $unit,
117                    material => $material2,
118            );
119    
120            $unit->create(
121                    name => 'Staklo',
122                    number => 'SMV - 42/60',
123                    campaign => $campaign,
124                    chronology => $chronology_8,
125                    location => $location,
126            );
127    
128            $um->create(
129                    unit => $unit,
130                    material => $material2,
131            );
132  }  }
133    
134  1;  1;

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

  ViewVC Help
Powered by ViewVC 1.1.26