diff --git a/languages/en.ini b/languages/en.ini index b6abac3f1d6b55719d5b7f9c3d0eec3bb8c614b5..fcaa07c695fffd6f42a27cc69f4eef99414b610b 100644 --- a/languages/en.ini +++ b/languages/en.ini @@ -696,7 +696,8 @@ Selected = "Selected" select_page = "Select Page" select_pickup_location = "Select Pick Up Location" Send = Send -Send a copy to me = "Send a copy to me" +send_an_email_copy = "Send a copy to this address" +send_email_copy_to_me = "Send a copy to me" Send us your feedback! = "Send us your feedback!" Sensor Image = "Sensor Image" Serial = Serial diff --git a/module/VuFind/src/VuFind/Controller/AbstractBase.php b/module/VuFind/src/VuFind/Controller/AbstractBase.php index ae206fcaa474c6913d0c4813f7b1a0f9b361676b..9a0daade289db6a93154eec05d727a8c4dd1dd31 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractBase.php +++ b/module/VuFind/src/VuFind/Controller/AbstractBase.php @@ -101,6 +101,7 @@ class AbstractBase extends AbstractActionController if ($user && isset($config->Mail->user_email_in_from) && $config->Mail->user_email_in_from ) { + $view->userEmailInFrom = true; $view->from = $user->email; } else if (isset($config->Mail->default_from) && $config->Mail->default_from diff --git a/module/VuFind/src/VuFind/Controller/AbstractRecord.php b/module/VuFind/src/VuFind/Controller/AbstractRecord.php index 8173e2d6ad8193bf39bda521884ccb722b05eee3..f3b9461ea1a1dc17d8a4c1b16ef7d6e28f5bdbdb 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractRecord.php +++ b/module/VuFind/src/VuFind/Controller/AbstractRecord.php @@ -373,7 +373,9 @@ class AbstractRecord extends AbstractBase $view->to, $view->from, $view->message, $driver, $this->getViewRenderer() ); - if ($this->params()->fromPost('ccself')) { + if ($this->params()->fromPost('ccself') + && $view->from != $view->to + ) { $this->getServiceLocator()->get('VuFind\Mailer')->sendRecord( $view->from, $view->from, $view->message, $driver, $this->getViewRenderer() diff --git a/module/VuFind/src/VuFind/Controller/AjaxController.php b/module/VuFind/src/VuFind/Controller/AjaxController.php index ee6648e06d547d1d68a28e029df0b015edecfd7b..331f35a52725d6116d08fc970bc264cfb9fc790b 100644 --- a/module/VuFind/src/VuFind/Controller/AjaxController.php +++ b/module/VuFind/src/VuFind/Controller/AjaxController.php @@ -1003,6 +1003,14 @@ class AjaxController extends AbstractBase $view->to, $view->from, $view->message, $record, $this->getViewRenderer() ); + if ($this->params()->fromPost('ccself') + && $view->from != $view->to + ) { + $this->getServiceLocator()->get('VuFind\Mailer')->sendRecord( + $view->from, $view->from, $view->message, $record, + $this->getViewRenderer() + ); + } return $this->output( $this->translate('email_success'), self::STATUS_OK ); diff --git a/themes/blueprint/templates/record/email.phtml b/themes/blueprint/templates/record/email.phtml index df06fefdd2d28fce9565689a5aecbfb98a9e5348..41dd0b6f12499210fb08ad94d755919fb11e3d79 100644 --- a/themes/blueprint/templates/record/email.phtml +++ b/themes/blueprint/templates/record/email.phtml @@ -15,12 +15,13 @@ <? if (!$this->disableFrom): ?> <label class="displayBlock" for="email_from"><?=$this->transEsc('From')?>:</label> <input id="email_from" type="text" name="from" value="<?=isset($this->from) ? $this->from : ''?>" size="40" class="<?=$this->jqueryValidation(array('required'=>'This field is required', 'email'=>'Email address is invalid'))?>"/> + <input type="checkbox" id="ccself" name="ccself"/><label for="ccself"><?=$this->translate('send_an_email_copy'); ?></label> <? endif; ?> <label class="displayBlock" for="email_message"><?=$this->transEsc('Message')?>:</label> <textarea id="email_message" name="message" rows="3" cols="40"><?=isset($this->message) ? $this->message : ''?></textarea> <br/> <input class="button" type="submit" name="submit" value="<?=$this->transEsc('Send')?>"/> - <? if (!$this->disableFrom): ?> - <input type="checkbox" id="ccself" name="ccself"/><label for="ccself"><?=$this->translate('Send a copy to me'); ?></label> + <? if ($this->disableFrom && $this->userEmailInFrom): ?> + <input type="checkbox" id="ccme" name="ccself"/><label for="ccme"><?=$this->translate('send_email_copy_to_me'); ?></label> <? endif; ?> </form> diff --git a/themes/bootstrap/js/vudl/record.js b/themes/bootstrap/js/vudl/record.js index 53b5d89ba9715b41934f191bfe55a79d52e1ce19..697c3318010b45396164559b9f153a0c0b7c0293 100644 --- a/themes/bootstrap/js/vudl/record.js +++ b/themes/bootstrap/js/vudl/record.js @@ -120,7 +120,9 @@ function nextPage() { scrollToSelected(); } function scrollToSelected() { - $('#collapse1').scrollTop($('#collapse1').scrollTop()+$('#collapse1 .selected').position().top-vudlSettings.scroll.selected); + $('#collapse1').animate({ + scrollTop: $('#collapse1 .selected').offset().top-$('#collapse1').offset().top+$('#collapse1').scrollTop()-12 + }); } // Accordion size function resizeAccordions(offset) { diff --git a/themes/bootstrap/templates/record/email.phtml b/themes/bootstrap/templates/record/email.phtml index e9fc0ad5d2b878e3fb5024034e8b06ce51eebbe0..04ca918e3c1d77de1710eb5fdc959b832f76681e 100644 --- a/themes/bootstrap/templates/record/email.phtml +++ b/themes/bootstrap/templates/record/email.phtml @@ -24,6 +24,13 @@ <input type="email" id="email_from" class="input-xlarge" oninvalid="$('#modal .icon-spinner').remove()" name="from" value="<?=isset($this->from) ? $this->from : ''?>" size="40"/> </div> </div> + <div class="control-group"> + <div class="controls"> + <label class="checkbox"> + <input type="checkbox" name="ccself"/> <?=$this->translate('send_an_email_copy'); ?> + </label> + </div> + </div> <? endif; ?> <div class="control-group"> <label class="control-label" for="email_message"><?=$this->transEsc('Message')?>:</label> @@ -31,11 +38,11 @@ <textarea id="email_message" class="input-xlarge" name="message" rows="4"><?=isset($this->message) ? $this->message : ''?></textarea> </div> </div> - <? if (!$this->disableFrom): ?> + <? if ($this->disableFrom && $this->userEmailInFrom): ?> <div class="control-group"> <div class="controls"> <label class="checkbox"> - <input type="checkbox" name="ccself"/> <?=$this->translate('Send a copy to me'); ?> + <input type="checkbox" name="ccself"/> <?=$this->translate('send_email_copy_to_me'); ?> </label> </div> </div> diff --git a/themes/jquerymobile/templates/record/email.phtml b/themes/jquerymobile/templates/record/email.phtml index ad0acd9bc164d9f2002db0adcc13bc62551cd870..6543ca6bebc7cf630967496aff8649fb3f658627 100644 --- a/themes/jquerymobile/templates/record/email.phtml +++ b/themes/jquerymobile/templates/record/email.phtml @@ -15,6 +15,7 @@ <? if (!$this->disableFrom): ?> <label for="email_from"><?=$this->transEsc('From')?>:</label> <input id="email_from" type="text" name="from" value="<?=isset($this->from) ? $this->from : ''?>" size="40" class="<?=$this->jqueryValidation(array('required'=>'This field is required', 'email'=>'Email address is invalid'))?>"/> + <input type="checkbox" id="ccself" name="ccself"/><label for="ccself"><?=$this->translate('send_an_email_copy'); ?></label> <? endif; ?> <label for="email_message"><?=$this->transEsc('Message')?>:</label> <textarea id="email_message" name="message"><?=isset($this->message) ? $this->message : ''?></textarea> @@ -22,6 +23,9 @@ <div data-role="fieldcontain"> <input class="button" type="submit" name="submit" value="<?=$this->transEsc('Send')?>"/> </div> + <? if ($this->disableFrom && $this->userEmailInFrom): ?> + <input type="checkbox" id="ccme" name="ccself"/><label for="ccme"><?=$this->translate('send_email_copy_to_me'); ?></label> + <? endif; ?> </form> </div> <?=$this->mobileMenu()->footer()?>