/[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

Contents of /lib/Arh/Bootstrap.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 23 - (show annotations)
Fri Nov 30 23:23:14 2007 UTC (11 years, 8 months ago) by dpavlin
File size: 2919 byte(s)
another huge code dump:
- rename database columns to prevent conficts with standards
- added editing accessor to user which returns edit mode
- ToggleEdit action to change editing state (broken)
- tweaks all over templates to make units entry a breeze
- version bump [0.03]
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
9 =head1 Bootstrap application data
10
11 Create initial data
12
13 =cut
14
15 sub run {
16 #warn "## run",dump(@_);
17 my $self = shift;
18
19 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 editing => 1,
33 );
34
35 $u->create(
36 name => 'Anonymous',
37 lastname => 'User',
38 email => 'anonymous@example.com',
39 email_confirmed => 1,
40 password => 'password',
41 administrator => 0,
42 organization => 'Part of anonymous user crowd',
43 );
44
45 my $pt = Arh::Model::PictureType->new(current_user => $system_user);
46
47 $pt->create( name => $_ ) foreach ( qw/
48 tlocrt
49 slika
50 rekonstrukcija
51 aksiometrija
52 arhitektura
53 namještaj
54 / );
55
56 my $chronology_8 = Arh::Model::Chronology->new(current_user => $system_user);
57 $chronology_8->create(
58 name => '8. stoljeće',
59 year_from => 701,
60 year_to => 800,
61 );
62 my $chronology_end8 = Arh::Model::Chronology->new(current_user => $system_user);
63 $chronology_end8->create(
64 name => 'kraj 8. stoljeća',
65 year_from => 760,
66 year_to => 800,
67 part_of => $chronology_8,
68 );
69
70
71 my $material = Arh::Model::Material->new;
72 $material->create(
73 name => 'tvrdi vapnenac',
74 );
75
76 my $material2 = Arh::Model::Material->new;
77 $material2->create(
78 name => 'nepoznato',
79 );
80
81 my $location = Arh::Model::Location->new;
82 $location->create(
83 name => 'Lapidarij u Balama',
84 );
85
86 my $place = Arh::Model::Place->new;
87 $place->create(
88 name => 'mjesto iskapanja',
89 );
90
91 my $campaign = Arh::Model::Campaign->new(current_user => $system_user);
92 $campaign->create(
93 place => $place,
94 name => 'prvo iskapanje',
95 date_from => '2007-11-28',
96 date_to => '2008-03-15',
97 );
98
99 my $unit = Arh::Model::Unit->new(current_user => $system_user);
100 $unit->create(
101 name => 'Mali kapitel stupića mnolitnog oltara',
102 inv_id => 'SMV - 96/60',
103 campaign => $campaign,
104 dimensions => 'visina kapitola 13,5 cm; ukupna visina: 14,5 cm; presjek 13,5x13,5x5cm; manji presjek 11cm',
105 discovered_at => 'otkriveno cca 12m od istočne fasade crkve',
106 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.',
107 chronology => $chronology_end8,
108 location => $location,
109 );
110
111 my $um = Arh::Model::UnitMaterial->new;
112 $um->create(
113 unit => $unit,
114 material => $material,
115 );
116 $um->create(
117 unit => $unit,
118 material => $material2,
119 );
120
121 $unit->create(
122 name => 'Staklo',
123 inv_id => 'SMV - 42/60',
124 campaign => $campaign,
125 chronology => $chronology_8,
126 location => $location,
127 );
128
129 $um->create(
130 unit => $unit,
131 material => $material2,
132 );
133 }
134
135 1;

  ViewVC Help
Powered by ViewVC 1.1.26