diff --git a/lib/Lacuna/Web/Admin.pm b/lib/Lacuna/Web/Admin.pm
index 8303cc94..a89783c2 100644
--- a/lib/Lacuna/Web/Admin.pm
+++ b/lib/Lacuna/Web/Admin.pm
@@ -963,6 +963,16 @@ sub www_view_empire {
$out .= sprintf('
| Isolationist | %s | Toggle |
', $empire->is_isolationist, $empire->id);
$out .= sprintf('| Admin | %s |
', $empire->is_admin);
$out .= sprintf('| Mission Curator | %s | Toggle |
', $empire->is_mission_curator, $empire->id);
+
+ my $notes = Lacuna->db->resultset('Log::EmpireAdminNotes')->find({empire_id => $empire->id},{order_by => { -desc => 'id' }, limit => 1 });
+ $out .= sprintf('| Admin Notes | | Last set by: %s Last set on: %s View Log |
',
+ $empire->id,
+ $notes ? $notes->notes : '',
+ $notes ? $notes->creator : 'not set yet',
+ $notes ? $notes->date_stamp : 'not set yet',
+ $empire->id
+ );
+
$out .= '';
$out .= sprintf('- Become This Empire In-Game
', $empire->id);
$out .= sprintf('- View All Colonies
', $empire->id);
@@ -972,6 +982,41 @@ sub www_view_empire {
return $self->wrap($out);
}
+sub www_set_admin_notes {
+ my ($self, $request) = @_;
+
+ my $id = $request->param('id');
+ my $empire = Lacuna->db->empire($id);
+ my $notes = $request->param('notes');
+
+ my $note = Lacuna->db->resultset('Log::EmpireAdminNotes')->new({
+ empire_id => $empire->id,
+ empire_name => $empire->name,
+ date_stamp => DateTime->now,
+ notes => $notes,
+ creator => $request->user,
+ })->insert;
+
+ return $self->www_view_empire($request);
+}
+
+sub www_view_admin_note_log {
+ my ($self, $request, $id) = @_;
+ $id ||= $request->param('id');
+ my $empire = Lacuna->db->empire($id);
+
+ my $history = Lacuna->db->resultset('Log::EmpireAdminNotes')->search({empire_id => $empire->id},{order_by => { -desc => 'date_stamp' }});
+ my $out = sprintf '"%s" Empire notes log
', $empire->name;
+ $out .= sprintf('Back To Empire', $empire->id);
+ $out .= '| Date | Creator | Notes |
';
+ while (my $log = $history->next) {
+ $out .= sprintf('| %s | %s | %s |
',
+ $log->date_stamp, $log->creator, Plack::Util::encode_html($log->notes));
+ }
+ $out .= '
';
+ return $self->wrap($out);
+}
+
sub www_set_alliance_logo {
my ($self, $request, $id) = @_;
$id ||= $request->param('id');
diff --git a/var/upgrades/3.0909.sql b/var/upgrades/3.0909.sql
index c40ced24..54992357 100644
--- a/var/upgrades/3.0909.sql
+++ b/var/upgrades/3.0909.sql
@@ -2,3 +2,15 @@ alter table ships add column number_of_docks int default 1;
alter table ships modify hold_size bigint;
alter table battle_log add column attacking_number int default 1;
alter table battle_log add column defending_number int default 1;
+
+CREATE TABLE empire_admin_notes (
+ id integer(11) NOT NULL auto_increment,
+ date_stamp datetime NOT NULL,
+ empire_id integer(11) NOT NULL,
+ empire_name varchar(30) NOT NULL,
+ notes text NOT NULL,
+ creator varchar(30) NOT NULL,
+ INDEX idx_empire_id (empire_id),
+ INDEX idx_empire_name (empire_name),
+ PRIMARY KEY (id)
+);