Skip to content

Commit

Permalink
Merge pull request #1 from qcovery/vufind9
Browse files Browse the repository at this point in the history
Vufind9
  • Loading branch information
jschultze authored Mar 5, 2024
2 parents 069affc + 8d27364 commit 9f6b9ad
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 12 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions Module.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
* @link https://github.com/dmj/vf2-proxy
*/
namespace ResultFeedback;
use Zend\ModuleManager\ModuleManager,
Zend\Mvc\MvcEvent;
use Laminas\ModuleManager\ModuleManager,
Laminas\Mvc\MvcEvent;

/**
* Template for ZF2 module for storing local overrides.
Expand Down Expand Up @@ -58,7 +58,7 @@ public function getConfig()
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\StandardAutoloader' => array(
'Laminas\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ResultFeedback
This module adds an enhanced feedback form that can be configured via config file.

## Usage
Integrate the module in the `modules` directory of VuFind and activate it by adding `ResultFeedback` to `VUFIND_LOCAL_MODULES`.
When adding the module manually make sure to copy and adapt the config file and copy/symlink the theme.

Add the following line to your template to link to the feedback form:
```php
<a href="<?=$this->url('resultfeedback-email').'?id='.$this->driver->getUniqueId().'&searchclassid='.$this->searchClassId?>">Contact us about this title</a>
```

Empty file modified composer.json
100644 → 100755
Empty file.
4 changes: 1 addition & 3 deletions config/module.config.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@
];

$routeGenerator = new \VuFind\Route\RouteGenerator();
$routeGenerator->addRecordRoutes($config, $recordRoutes);
$routeGenerator->addDynamicRoutes($config, $dynamicRoutes);
$routeGenerator->addStaticRoutes($config, $staticRoutes);

// Add the home route last
$config['router']['routes']['home'] = [
'type' => 'Zend\Router\Http\Literal',
'type' => 'Laminas\Router\Http\Literal',
'options' => [
'route' => '/',
'defaults' => [
Expand Down
17 changes: 17 additions & 0 deletions config/vufind/resultFeedback.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[resultFeedback]
user_types[] = User type 1
user_types[] = User type 2

recipient_email = "[email protected]"
recipient_name = "Example Host"
email_subject = "Mail from result feedback form"
sender_email = "[email protected]"
sender_name = "Example Host"

set_user_email_as_reply_to = true
set_user_email_as_cc = true

base_url_Solr = "https://example.com/vufind/Record/"
base_url_Search2 = "https://example.com/vufind/Search2Record/"

ip_local_network[] = 192.168.178
10 changes: 5 additions & 5 deletions src/ResultFeedback/Controller/ResultFeedbackController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace ResultFeedback\Controller;

use VuFind\Exception\Mail as MailException;
use Zend\Mail\Address;
use Laminas\Mail\Address;

/**
* Feedback Class
Expand All @@ -31,7 +31,7 @@ class ResultFeedbackController extends \VuFind\Controller\AbstractBase
/**
* Display Feedback home form.
*
* @return \Zend\View\Model\ViewModel
* @return \Laminas\View\Model\ViewModel
*/
public function homeAction()
{
Expand All @@ -46,10 +46,10 @@ public function homeAction()
*/
public function emailAction()
{
$translator = $this->serviceLocator->get('Zend\Mvc\I18n\Translator');
$translator = $this->serviceLocator->get('Laminas\Mvc\I18n\Translator');

$view = $this->createViewModel();
$view->useRecaptcha = $this->recaptcha()->active('feedback');
$view->useCaptcha = $this->captcha()->active('feedback');
$view->name = $this->params()->fromPost('name');
$view->email = $this->params()->fromPost('email');
$view->comments = $this->params()->fromPost('comments');
Expand Down Expand Up @@ -84,7 +84,7 @@ public function emailAction()

// Process form submission:
$view->hideForm = false;
if ($this->formWasSubmitted('submit', $view->useRecaptcha)) {
if ($this->formWasSubmitted('submit', $view->useCaptcha)) {
if (empty($view->email) || empty($view->comments)) {
$this->flashMessenger()->addMessage('bulk_error_missing', 'error');
return;
Expand Down
Empty file modified theme/css/resultfeedback.css
100644 → 100755
Empty file.
Empty file modified theme/mixin.config.php
100644 → 100755
Empty file.
Empty file modified theme/templates/resultfeedback/email.phtml
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion theme/templates/resultfeedback/form.phtml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<input type="checkbox" name="privacy" required />
<label class="control-label privacy" for="privacy"><?=$this->translate("I Accept The Privacy Policy")?></label>
</div>
<?=$this->recaptcha()->html($this->useRecaptcha) ?>
<?=$this->captcha()->html($this->useCaptcha) ?>
<div class="form-group">
<input type="submit" name="submit" class="btn btn-primary" value="<?=$this->transEsc("Send")?>" />
</div>
Expand Down
Empty file modified theme/templates/resultfeedback/user-is-in-local-network.phtml
100644 → 100755
Empty file.
Empty file.

0 comments on commit 9f6b9ad

Please sign in to comment.