1 |
use warnings; |
2 |
use strict; |
3 |
|
4 |
package Arh::Bootstrap; |
5 |
use base qw(Jifty::Bootstrap); |
6 |
|
7 |
use Data::Dump qw/dump/; |
8 |
use utf8; |
9 |
|
10 |
=head1 Bootstrap application data |
11 |
|
12 |
Create initial data |
13 |
|
14 |
=cut |
15 |
|
16 |
sub run { |
17 |
#warn "## run",dump(@_); |
18 |
my $self = shift; |
19 |
|
20 |
my $system_user = Arh::CurrentUser->superuser( _bootstrap => 1 ); |
21 |
|
22 |
|
23 |
my $u = Arh::Model::User->new(current_user => $system_user); |
24 |
|
25 |
$u->create( |
26 |
name => 'Admin', |
27 |
lastname => 'User', |
28 |
email => 'admin@example.com', |
29 |
email_confirmed => 1, |
30 |
password => 'password', |
31 |
administrator => 1, |
32 |
organization => 'Site administrator', |
33 |
editing => 1, |
34 |
); |
35 |
|
36 |
$u->create( |
37 |
name => 'Anonymous', |
38 |
lastname => 'User', |
39 |
email => 'anonymous@example.com', |
40 |
email_confirmed => 1, |
41 |
password => 'password', |
42 |
administrator => 0, |
43 |
organization => 'Part of anonymous user crowd', |
44 |
); |
45 |
|
46 |
my $pt = Arh::Model::PictureType->new(current_user => $system_user); |
47 |
|
48 |
$pt->create( name => $_ ) foreach ( qw/ |
49 |
tlocrt |
50 |
slika |
51 |
rekonstrukcija |
52 |
aksiometrija |
53 |
arhitektura |
54 |
namještaj |
55 |
/ ); |
56 |
|
57 |
my $chronology_8 = Arh::Model::Chronology->new(current_user => $system_user); |
58 |
$chronology_8->create( |
59 |
name => '8. stoljeće', |
60 |
year_from => 701, |
61 |
year_to => 800, |
62 |
); |
63 |
my $chronology_end8 = Arh::Model::Chronology->new(current_user => $system_user); |
64 |
$chronology_end8->create( |
65 |
name => 'kraj 8. stoljeća', |
66 |
year_from => 760, |
67 |
year_to => 800, |
68 |
part_of => $chronology_8, |
69 |
); |
70 |
|
71 |
|
72 |
my $material = Arh::Model::Material->new; |
73 |
$material->create( |
74 |
name => 'tvrdi vapnenac', |
75 |
); |
76 |
|
77 |
my $material2 = Arh::Model::Material->new; |
78 |
$material2->create( |
79 |
name => 'nepoznato', |
80 |
); |
81 |
|
82 |
my $location = Arh::Model::Location->new; |
83 |
$location->create( |
84 |
name => 'Lapidarij u Balama', |
85 |
); |
86 |
$location->create( |
87 |
name => 'Katedralni kompleks', |
88 |
); |
89 |
|
90 |
|
91 |
my $place = Arh::Model::Place->new; |
92 |
$place->create( |
93 |
name => 'mjesto iskapanja', |
94 |
); |
95 |
|
96 |
|
97 |
my $campaign = Arh::Model::Campaign->new(current_user => $system_user); |
98 |
$campaign->create( |
99 |
place => $place, |
100 |
name => 'prvo iskapanje', |
101 |
date_from => '2007-11-28', |
102 |
date_to => '2008-03-15', |
103 |
); |
104 |
|
105 |
my $cat = Arh::Model::Category->new; |
106 |
$cat->create( name => $_ ) foreach ( qw/ |
107 |
arhitektura |
108 |
skulptura |
109 |
slikarstvo |
110 |
liturgijske |
111 |
instalacije |
112 |
epigrafija |
113 |
metal |
114 |
/ ); |
115 |
|
116 |
my $site = Arh::Model::Site->new; |
117 |
$site->create( name => $_ ) foreach ( qw/ |
118 |
Poreč |
119 |
/ ); |
120 |
|
121 |
my $unit = Arh::Model::Unit->new(current_user => $system_user); |
122 |
$unit->create( |
123 |
unit_id => '01/01', |
124 |
name => 'Eufrazijeva bazilika', |
125 |
subcategory => 'crkva', |
126 |
category => $cat, |
127 |
location => $location, |
128 |
site => $site, |
129 |
# gps |
130 |
placement => 'Sjeveroistočno od antičkog foruma, uz sjeverne zidine grada', |
131 |
context => 'urbani', |
132 |
function => 'Katedrala', |
133 |
ownership => 'Katolička crkva - porečko-pulska biskupija', |
134 |
dimensions => '20x35x15m', |
135 |
condition => 'Very good', |
136 |
toplogy => 'Trobrodna bazilika s apsidom i dvije apsidiole', |
137 |
# material |
138 |
technique => 'Opus incertum', |
139 |
description => "Trobrodna bazilika s istaknutom srednjom apsidom (izvana poligonalna iznutra polukružna)\ndvije bočne apsidiole upisane u ravni začeljni zid.", |
140 |
construction => "Stupovi s kapitelima i impostima;\ndrveno gređe, otvoreno krovište", |
141 |
decoration => "Podni mozaik, zidni mozaik, štuko", |
142 |
chronology => $chronology_end8, |
143 |
bibliography => 'M. Prelog; A.Terry, I. Matejčić', |
144 |
copyright => 'I. Matejčić', |
145 |
); |
146 |
|
147 |
my $um = Arh::Model::UnitMaterial->new; |
148 |
$um->create( |
149 |
unit => $unit, |
150 |
material => $material, |
151 |
); |
152 |
$um->create( |
153 |
unit => $unit, |
154 |
material => $material2, |
155 |
); |
156 |
|
157 |
=for later |
158 |
$unit->create( |
159 |
name => 'Staklo', |
160 |
inventory_nr => 'SMV - 42/60', |
161 |
campaign => $campaign, |
162 |
chronology => $chronology_8, |
163 |
location => $location, |
164 |
); |
165 |
|
166 |
$um->create( |
167 |
unit => $unit, |
168 |
material => $material2, |
169 |
); |
170 |
|
171 |
=cut |
172 |
|
173 |
} |
174 |
|
175 |
1; |