summaryrefslogtreecommitdiff
path: root/library/WT/Controller/Source.php
diff options
context:
space:
mode:
Diffstat (limited to 'library/WT/Controller/Source.php')
-rw-r--r--library/WT/Controller/Source.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/library/WT/Controller/Source.php b/library/WT/Controller/Source.php
index e4a73c3dc3..2fca4cf32d 100644
--- a/library/WT/Controller/Source.php
+++ b/library/WT/Controller/Source.php
@@ -2,7 +2,7 @@
// Controller for the source page
//
// webtrees: Web based Family History software
-// Copyright (C) 2013 webtrees development team.
+// Copyright (C) 2014 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved.
@@ -19,7 +19,7 @@
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
@@ -53,7 +53,13 @@ class WT_Controller_Source extends WT_Controller_GedcomRecord {
if (WT_USER_CAN_EDIT) {
$fact = $this->record->getFirstFact('TITL');
$submenu = new WT_Menu(WT_I18N::translate('Edit source'), '#', 'menu-sour-edit');
- $submenu->addOnclick('return edit_record(\''.$this->record->getXref().'\', \'' . $fact->getFactId() . '\');');
+ if ($fact) {
+ // Edit existing name
+ $submenu->addOnclick('return edit_record(\''.$this->record->getXref().'\', \'' . $fact->getFactId() . '\');');
+ } else {
+ // Add new name
+ $submenu->addOnclick('return add_fact(\''.$this->record->getXref().'\', \'TITL\');');
+ }
$menu->addSubmenu($submenu);
}