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

Annotation of /lib/Arh/Bootstrap.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 23 - (hide annotations)
Fri Nov 30 23:23:14 2007 UTC (12 years 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 dpavlin 4 use warnings;
2     use strict;
3    
4     package Arh::Bootstrap;
5     use base qw(Jifty::Bootstrap);
6    
7 dpavlin 11 use Data::Dump qw/dump/;
8    
9 dpavlin 4 =head1 Bootstrap application data
10    
11     Create initial data
12    
13     =cut
14    
15     sub run {
16 dpavlin 14 #warn "## run",dump(@_);
17 dpavlin 4 my $self = shift;
18    
19     my $system_user = Arh::CurrentUser->superuser( _bootstrap => 1 );
20    
21 dpavlin 10
22 dpavlin 11 my $u = Arh::Model::User->new(current_user => $system_user);
23    
24     $u->create(
25 dpavlin 10 name => 'Admin',
26     lastname => 'User',
27     email => 'admin@example.com',
28     email_confirmed => 1,
29 dpavlin 11 password => 'password',
30 dpavlin 10 administrator => 1,
31     organization => 'Site administrator',
32 dpavlin 23 editing => 1,
33 dpavlin 10 );
34    
35 dpavlin 11 $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 dpavlin 4 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 dpavlin 9 namještaj
54 dpavlin 4 / );
55    
56 dpavlin 14 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 dpavlin 9 name => 'kraj 8. stoljeća',
65 dpavlin 12 year_from => 760,
66     year_to => 800,
67 dpavlin 14 part_of => $chronology_8,
68 dpavlin 9 );
69    
70 dpavlin 14
71 dpavlin 9 my $material = Arh::Model::Material->new;
72     $material->create(
73     name => 'tvrdi vapnenac',
74     );
75    
76 dpavlin 14 my $material2 = Arh::Model::Material->new;
77     $material2->create(
78     name => 'nepoznato',
79     );
80    
81 dpavlin 9 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 dpavlin 23 inv_id => 'SMV - 96/60',
103 dpavlin 9 campaign => $campaign,
104     dimensions => 'visina kapitola 13,5 cm; ukupna visina: 14,5 cm; presjek 13,5x13,5x5cm; manji presjek 11cm',
105 dpavlin 23 discovered_at => 'otkriveno cca 12m od istočne fasade crkve',
106 dpavlin 9 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 dpavlin 14 chronology => $chronology_end8,
108 dpavlin 9 location => $location,
109     );
110    
111     my $um = Arh::Model::UnitMaterial->new;
112     $um->create(
113     unit => $unit,
114     material => $material,
115     );
116 dpavlin 14 $um->create(
117     unit => $unit,
118     material => $material2,
119     );
120    
121     $unit->create(
122     name => 'Staklo',
123 dpavlin 23 inv_id => 'SMV - 42/60',
124 dpavlin 14 campaign => $campaign,
125     chronology => $chronology_8,
126     location => $location,
127     );
128    
129     $um->create(
130     unit => $unit,
131     material => $material2,
132     );
133 dpavlin 4 }
134    
135     1;

  ViewVC Help
Powered by ViewVC 1.1.26