Skip to content
This repository has been archived by the owner on Jun 22, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/1.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Rochester committed Oct 1, 2012
2 parents 3001651 + d48f160 commit d8b1fcf
Show file tree
Hide file tree
Showing 46 changed files with 1,052 additions and 213 deletions.
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: php

php:
- 5.2
- 5.3
#- 5.4

env:
- OMEKA_BRANCH=stable-1.5
#- OMEKA_BRANCH=master

before_script:
- ./travis_setup.sh

script: ./travis_tests.sh

notifications:
irc: "irc.freenode.org#slab"
8 changes: 8 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[main]
host = https://www.transifex.com

[neatline.neatline-maps]
file_filter = languages/<lang>.po
source_file = languages/template.pot
source_lang = en

91 changes: 79 additions & 12 deletions NeatlineMapsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class NeatlineMapsPlugin
'public_append_to_items_show',
'before_delete_item',
'public_theme_header',
'admin_theme_header'
'admin_theme_header',
'initialize',
'define_acl'
);

private static $_filters = array(
Expand Down Expand Up @@ -201,20 +203,41 @@ public function defineRoutes($router)
public function afterSaveFormItem($item, $post)
{

if (!isset($_FILES['file'])
|| count($_FILES['file']['size']) == 1
&& empty($_FILES['file']['size'][0])
) {
$hasTiff = false;
if (isset($_FILES['file'])) {

// Create/update/delete WMS.
$this->servicesTable->createOrUpdate(
$item,
$post['address'],
$post['layers']
);
$fcount = count($_FILES['file']['name']);
for ($i=0; $i<$fcount; $i++) {
$hasTiff = $hasTiff ||
(!empty($_FILES['file']['size'][$i]) &&
$_FILES['file']['type'][$i] == 'image/tiff');
}

}

if (!$hasTiff) {
$this->_createOrUpdateWMS($item, $post);
}

}


/**
* This creates or updates the WMS server on an item.
*
* @param Item $item The item.
* @param array $post The complete $_POST.
*
* @return void
* @author Eric Rochester <erochest@virginia.edu>
**/
protected function _createOrUpdateWMS($item, $post)
{
$this->servicesTable->createOrUpdate(
$item,
$post['address'],
$post['layers']
);
}

/**
Expand Down Expand Up @@ -338,6 +361,47 @@ public function adminThemeHeader($request)

}

/**
* Initialization.
*
* Adds translation source.
*
* @return void.
*/
public function initialize()
{
add_translation_source(dirname(__FILE__) . '/languages');
}

/**
* Define the ACL
*/
public function defineAcl($acl)
{
$resourceName = 'NeatlineMaps_Servers';

$resourceList = array(
$resourceName => array(
'add',
'browse',
'edit',
'delete',
'show',
'active'
)
);

if (!$acl->has($resourceName)) {
$acl->loadResourceList($resourceList);
foreach ($resourceList as $resource => $privileges) {
$acl->deny(null, $resource);
$acl->allow('super', $resource);
$acl->allow('admin', $resource);
}
}


}

/**
* Filter callbacks:
Expand All @@ -354,7 +418,10 @@ public function adminThemeHeader($request)
public function adminNavigationMain($tabs)
{

$tabs[__('Neatline Maps')] = uri('neatline-maps');
if (has_permission('NeatlineMaps_Servers', 'browse')) {
$tabs['Neatline Maps'] = uri('neatline-maps');
}

return $tabs;

}
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Neatline Maps

[![Build Status](https://secure.travis-ci.org/scholarslab/NeatlineMaps.png)](http://travis-ci.org/scholarslab/NeatlineMaps)

Working with geospatial data can be difficult. The NeatlineMaps plugin allows
you to upload georeferenced maps to the popular open source
[Geoserver][geoserver], allowing you not only to use your data easily in Omeka,
Expand Down Expand Up @@ -151,13 +153,38 @@ Neatline will automatically render the map on the exhibit. In this way, you can
configure any combination of WMS maps in the exhibit by activating or
deactivating the Omeka items associated with that exhibit.

### Migrating Data to Another Server

Often when developing a site, it's useful to be able to work on a separate
server running GeoServer, whether on your laptop or on a staging site. You can
easily migrate this information to your production server. GeoServer keeps all
configuration and data in its [data directory][geoserver-data]. To find where
this is, go into GeoServer and click the *Server Status* link at the top of the
left column. The first item on the status page is the location of the data
directory.

![GeoServer Data Directory](http://neatline.org/wp-content/uploads/2012/08/geoserver-data-dir.png)

Now after you install GeoServer on the final server, you can copy the data
directory from the old server onto the new server and have access to your data.

## Support

We use an [issue tracker][issues] for feedback on issues and requested
improvements. If you have general questions, you may also post them to
the [Omeka Forums][forums]  or the [Omeka Developers Group][groups].

## Credits

### Translations

* Martin Liebeskind (German)
* Gillian Price (Spanish)
* Oguljan Reyimbaeva (Russian)
* Katina Rogers (French)

[geoserver]: http://geoserver.org
[geoserver-data]: http://docs.geoserver.org/latest/en/user/datadirectory/index.html
[neatline-maps-download]: http://neatline.scholarslab.org/plugins/neatline-maps
[ogc]: http://www.opengeospatial.org/
[gmaps]: http://maps.google.com/
Expand Down
67 changes: 24 additions & 43 deletions controllers/ServersController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4; */
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
* Servers controller.
Expand All @@ -22,17 +22,19 @@ class NeatlineMaps_ServersController extends Omeka_Controller_Action
*/
public function init()
{
$this->serversTable = $this->getTable('NeatlineMapsServer');
}

/**
* Show servers.
*
* @return void
*/
public function browseAction()
{
$this->view->servers = $this->serversTable->findAll();
$modelName = 'NeatlineMapsServer';
if (version_compare(OMEKA_VERSION, '2.0-dev', '>=')) {
$this->_helper->db->setDefaultModelName($modelName);
} else {
$this->_modelClass = $modelName;
}

try {
$this->_table = $this->getTable($modelName);
$this->aclResource = $this->findById();
} catch (Omeka_Controller_Exception_404 $e) {}

}

/**
Expand All @@ -57,7 +59,7 @@ public function addAction()
if ($form->isValid($post)) {

// Create server.
$this->serversTable->updateServer($server, $post);
$this->_table->updateServer($server, $post);

// Redirect to browse.
$this->redirect->goto('browse');
Expand Down Expand Up @@ -85,9 +87,7 @@ public function editAction()
{

// Get server.
$server = $this->serversTable->find(
$this->_request->getParam('id')
);
$server = $this->findById();

// Get form.
$form = new ServerForm;
Expand All @@ -112,7 +112,7 @@ public function editAction()
if ($form->isValid($post)) {

// Create server.
$this->serversTable->updateServer($server, $post);
$this->_table->updateServer($server, $post);

// Redirect to browse.
$this->redirect->goto('browse');
Expand All @@ -131,30 +131,6 @@ public function editAction()

}

/**
* Delete server.
*
* @return void
*/
public function deleteAction()
{

// Get server.
$server = $this->serversTable->find(
$this->_request->getParam('id')
);

// If a form as been posted.
if ($this->_request->isPost()) {
$server->delete();
$this->redirect->goto('browse');
}

// Push server to view.
$this->view->server = $server;

}

/**
* Set server active.
*
Expand All @@ -164,9 +140,7 @@ public function activeAction()
{

// Get server.
$server = $this->serversTable->find(
$this->_request->getParam('id')
);
$server = $this->findById();

// Set active and save.
$server->active = 1;
Expand All @@ -177,4 +151,11 @@ public function activeAction()

}

/**
* Sets the delete confirm message
*/
protected function _getDeleteConfirmMessage($server)
{
return __('This will permanently delete the %s server.', $server->name);
}
}
2 changes: 1 addition & 1 deletion forms/ServerForm.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4; */
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
* Server form.
Expand Down
2 changes: 1 addition & 1 deletion forms/Validate/isUrl.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4; */
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
* Copied with small modifications from https://github.com/rondobley/Zend-Framework-Validate-URL.
Expand Down
2 changes: 1 addition & 1 deletion helpers/NeatlineMapsFunctions.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4; */
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
* Helpers.
Expand Down
Binary file added languages/de_DE.mo
Binary file not shown.
Loading

0 comments on commit d8b1fcf

Please sign in to comment.