mirror of
https://github.com/salesagility/SuiteCRM.git
synced 2025-02-18 19:52:30 +00:00

# Conflicts: # README.md # Zend/Exception.php # Zend/Gdata.php # Zend/Gdata/App.php # Zend/Gdata/App/Base.php # Zend/Gdata/App/BaseMediaSource.php # Zend/Gdata/App/CaptchaRequiredException.php # Zend/Gdata/App/Entry.php # Zend/Gdata/App/Extension/Author.php # Zend/Gdata/App/Extension/Category.php # Zend/Gdata/App/Extension/Content.php # Zend/Gdata/App/Extension/Contributor.php # Zend/Gdata/App/Extension/Control.php # Zend/Gdata/App/Extension/Draft.php # Zend/Gdata/App/Extension/Edited.php # Zend/Gdata/App/Extension/Element.php # Zend/Gdata/App/Extension/Email.php # Zend/Gdata/App/Extension/Generator.php # Zend/Gdata/App/Extension/Icon.php # Zend/Gdata/App/Extension/Id.php # Zend/Gdata/App/Extension/Link.php # Zend/Gdata/App/Extension/Logo.php # Zend/Gdata/App/Extension/Name.php # Zend/Gdata/App/Extension/Person.php # Zend/Gdata/App/Extension/Published.php # Zend/Gdata/App/Extension/Rights.php # Zend/Gdata/App/Extension/Source.php # Zend/Gdata/App/Extension/Subtitle.php # Zend/Gdata/App/Extension/Summary.php # Zend/Gdata/App/Extension/Text.php # Zend/Gdata/App/Extension/Title.php # Zend/Gdata/App/Extension/Updated.php # Zend/Gdata/App/Extension/Uri.php # Zend/Gdata/App/Feed.php # Zend/Gdata/App/FeedEntryParent.php # Zend/Gdata/App/FeedSourceParent.php # Zend/Gdata/App/HttpException.php # Zend/Gdata/App/LoggingHttpClientAdapterSocket.php # Zend/Gdata/App/MediaEntry.php # Zend/Gdata/App/MediaFileSource.php # Zend/Gdata/App/Util.php # Zend/Gdata/AuthSub.php # Zend/Gdata/Books.php # Zend/Gdata/Books/CollectionEntry.php # Zend/Gdata/Books/CollectionFeed.php # Zend/Gdata/Books/Extension/AnnotationLink.php # Zend/Gdata/Books/Extension/BooksCategory.php # Zend/Gdata/Books/Extension/BooksLink.php # Zend/Gdata/Books/Extension/Embeddability.php # Zend/Gdata/Books/Extension/InfoLink.php # Zend/Gdata/Books/Extension/PreviewLink.php # Zend/Gdata/Books/Extension/Review.php # Zend/Gdata/Books/Extension/ThumbnailLink.php # Zend/Gdata/Books/Extension/Viewability.php # Zend/Gdata/Books/VolumeEntry.php # Zend/Gdata/Books/VolumeFeed.php # Zend/Gdata/Books/VolumeQuery.php # Zend/Gdata/Calendar.php # Zend/Gdata/Calendar/EventEntry.php # Zend/Gdata/Calendar/EventFeed.php # Zend/Gdata/Calendar/EventQuery.php # Zend/Gdata/Calendar/Extension/AccessLevel.php # Zend/Gdata/Calendar/Extension/Color.php # Zend/Gdata/Calendar/Extension/Hidden.php # Zend/Gdata/Calendar/Extension/Link.php # Zend/Gdata/Calendar/Extension/QuickAdd.php # Zend/Gdata/Calendar/Extension/Selected.php # Zend/Gdata/Calendar/Extension/SendEventNotifications.php # Zend/Gdata/Calendar/Extension/Timezone.php # Zend/Gdata/Calendar/Extension/WebContent.php # Zend/Gdata/Calendar/ListEntry.php # Zend/Gdata/Calendar/ListFeed.php # Zend/Gdata/ClientLogin.php # Zend/Gdata/Contacts.php # Zend/Gdata/Contacts/Extension/Address.php # Zend/Gdata/Contacts/Extension/Birthday.php # Zend/Gdata/Contacts/Extension/Email.php # Zend/Gdata/Contacts/Extension/Name.php # Zend/Gdata/Contacts/Extension/Organization.php # Zend/Gdata/Contacts/Extension/PhoneNumber.php # Zend/Gdata/Contacts/ListEntry.php # Zend/Gdata/Docs.php # Zend/Gdata/Docs/DocumentListEntry.php # Zend/Gdata/Docs/DocumentListFeed.php # Zend/Gdata/Docs/Query.php # Zend/Gdata/DublinCore.php # Zend/Gdata/DublinCore/Extension/Creator.php # Zend/Gdata/DublinCore/Extension/Date.php # Zend/Gdata/DublinCore/Extension/Description.php # Zend/Gdata/DublinCore/Extension/Format.php # Zend/Gdata/DublinCore/Extension/Identifier.php # Zend/Gdata/DublinCore/Extension/Language.php # Zend/Gdata/DublinCore/Extension/Publisher.php # Zend/Gdata/DublinCore/Extension/Rights.php # Zend/Gdata/DublinCore/Extension/Subject.php # Zend/Gdata/DublinCore/Extension/Title.php # Zend/Gdata/Entry.php # Zend/Gdata/Exif.php # Zend/Gdata/Exif/Entry.php # Zend/Gdata/Exif/Extension/Distance.php # Zend/Gdata/Exif/Extension/Exposure.php # Zend/Gdata/Exif/Extension/FStop.php # Zend/Gdata/Exif/Extension/Flash.php # Zend/Gdata/Exif/Extension/FocalLength.php # Zend/Gdata/Exif/Extension/ImageUniqueId.php # Zend/Gdata/Exif/Extension/Iso.php # Zend/Gdata/Exif/Extension/Make.php # Zend/Gdata/Exif/Extension/Model.php # Zend/Gdata/Exif/Extension/Tags.php # Zend/Gdata/Exif/Extension/Time.php # Zend/Gdata/Exif/Feed.php # Zend/Gdata/Extension.php # Zend/Gdata/Extension/AttendeeStatus.php # Zend/Gdata/Extension/AttendeeType.php # Zend/Gdata/Extension/Comments.php # Zend/Gdata/Extension/EntryLink.php # Zend/Gdata/Extension/EventStatus.php # Zend/Gdata/Extension/ExtendedProperty.php # Zend/Gdata/Extension/FeedLink.php # Zend/Gdata/Extension/OpenSearchItemsPerPage.php # Zend/Gdata/Extension/OpenSearchStartIndex.php # Zend/Gdata/Extension/OpenSearchTotalResults.php # Zend/Gdata/Extension/OriginalEvent.php # Zend/Gdata/Extension/Rating.php # Zend/Gdata/Extension/Recurrence.php # Zend/Gdata/Extension/RecurrenceException.php # Zend/Gdata/Extension/Reminder.php # Zend/Gdata/Extension/Transparency.php # Zend/Gdata/Extension/Visibility.php # Zend/Gdata/Extension/When.php # Zend/Gdata/Extension/Where.php # Zend/Gdata/Extension/Who.php # Zend/Gdata/Feed.php # Zend/Gdata/Gapps.php # Zend/Gdata/Gapps/EmailListEntry.php # Zend/Gdata/Gapps/EmailListFeed.php # Zend/Gdata/Gapps/EmailListQuery.php # Zend/Gdata/Gapps/EmailListRecipientEntry.php # Zend/Gdata/Gapps/EmailListRecipientFeed.php # Zend/Gdata/Gapps/EmailListRecipientQuery.php # Zend/Gdata/Gapps/Error.php # Zend/Gdata/Gapps/Extension/EmailList.php # Zend/Gdata/Gapps/Extension/Login.php # Zend/Gdata/Gapps/Extension/Name.php # Zend/Gdata/Gapps/Extension/Nickname.php # Zend/Gdata/Gapps/Extension/Property.php # Zend/Gdata/Gapps/Extension/Quota.php # Zend/Gdata/Gapps/GroupEntry.php # Zend/Gdata/Gapps/GroupFeed.php # Zend/Gdata/Gapps/GroupQuery.php # Zend/Gdata/Gapps/MemberEntry.php # Zend/Gdata/Gapps/MemberFeed.php # Zend/Gdata/Gapps/MemberQuery.php # Zend/Gdata/Gapps/NicknameEntry.php # Zend/Gdata/Gapps/NicknameFeed.php # Zend/Gdata/Gapps/NicknameQuery.php # Zend/Gdata/Gapps/OwnerEntry.php # Zend/Gdata/Gapps/OwnerFeed.php # Zend/Gdata/Gapps/OwnerQuery.php # Zend/Gdata/Gapps/Query.php # Zend/Gdata/Gapps/ServiceException.php # Zend/Gdata/Gapps/UserEntry.php # Zend/Gdata/Gapps/UserFeed.php # Zend/Gdata/Gapps/UserQuery.php # Zend/Gdata/Gbase.php # Zend/Gdata/Gbase/Entry.php # Zend/Gdata/Gbase/Extension/BaseAttribute.php # Zend/Gdata/Gbase/ItemEntry.php # Zend/Gdata/Gbase/ItemQuery.php # Zend/Gdata/Gbase/Query.php # Zend/Gdata/Gbase/SnippetQuery.php # Zend/Gdata/Geo.php # Zend/Gdata/Geo/Entry.php # Zend/Gdata/Geo/Extension/GeoRssWhere.php # Zend/Gdata/Geo/Extension/GmlPoint.php # Zend/Gdata/Geo/Extension/GmlPos.php # Zend/Gdata/Geo/Feed.php # Zend/Gdata/Health.php # Zend/Gdata/Health/ProfileEntry.php # Zend/Gdata/Health/ProfileListEntry.php # Zend/Gdata/Health/Query.php # Zend/Gdata/HttpAdapterStreamingProxy.php # Zend/Gdata/HttpAdapterStreamingSocket.php # Zend/Gdata/HttpClient.php # Zend/Gdata/Kind/EventEntry.php # Zend/Gdata/Media.php # Zend/Gdata/Media/Entry.php # Zend/Gdata/Media/Extension/MediaCategory.php # Zend/Gdata/Media/Extension/MediaContent.php # Zend/Gdata/Media/Extension/MediaCopyright.php # Zend/Gdata/Media/Extension/MediaCredit.php # Zend/Gdata/Media/Extension/MediaDescription.php # Zend/Gdata/Media/Extension/MediaGroup.php # Zend/Gdata/Media/Extension/MediaHash.php # Zend/Gdata/Media/Extension/MediaKeywords.php # Zend/Gdata/Media/Extension/MediaPlayer.php # Zend/Gdata/Media/Extension/MediaRating.php # Zend/Gdata/Media/Extension/MediaRestriction.php # Zend/Gdata/Media/Extension/MediaText.php # Zend/Gdata/Media/Extension/MediaThumbnail.php # Zend/Gdata/Media/Extension/MediaTitle.php # Zend/Gdata/Media/Feed.php # Zend/Gdata/MediaMimeStream.php # Zend/Gdata/MimeBodyString.php # Zend/Gdata/MimeFile.php # Zend/Gdata/Photos.php # Zend/Gdata/Photos/AlbumEntry.php # Zend/Gdata/Photos/AlbumFeed.php # Zend/Gdata/Photos/AlbumQuery.php # Zend/Gdata/Photos/CommentEntry.php # Zend/Gdata/Photos/Extension/Access.php # Zend/Gdata/Photos/Extension/AlbumId.php # Zend/Gdata/Photos/Extension/BytesUsed.php # Zend/Gdata/Photos/Extension/Checksum.php # Zend/Gdata/Photos/Extension/Client.php # Zend/Gdata/Photos/Extension/CommentCount.php # Zend/Gdata/Photos/Extension/CommentingEnabled.php # Zend/Gdata/Photos/Extension/Height.php # Zend/Gdata/Photos/Extension/Id.php # Zend/Gdata/Photos/Extension/Location.php # Zend/Gdata/Photos/Extension/MaxPhotosPerAlbum.php # Zend/Gdata/Photos/Extension/Name.php # Zend/Gdata/Photos/Extension/Nickname.php # Zend/Gdata/Photos/Extension/NumPhotos.php # Zend/Gdata/Photos/Extension/NumPhotosRemaining.php # Zend/Gdata/Photos/Extension/PhotoId.php # Zend/Gdata/Photos/Extension/Position.php # Zend/Gdata/Photos/Extension/QuotaCurrent.php # Zend/Gdata/Photos/Extension/QuotaLimit.php # Zend/Gdata/Photos/Extension/Rotation.php # Zend/Gdata/Photos/Extension/Size.php # Zend/Gdata/Photos/Extension/Thumbnail.php # Zend/Gdata/Photos/Extension/Timestamp.php # Zend/Gdata/Photos/Extension/User.php # Zend/Gdata/Photos/Extension/Version.php # Zend/Gdata/Photos/Extension/Weight.php # Zend/Gdata/Photos/Extension/Width.php # Zend/Gdata/Photos/PhotoEntry.php # Zend/Gdata/Photos/PhotoFeed.php # Zend/Gdata/Photos/PhotoQuery.php # Zend/Gdata/Photos/TagEntry.php # Zend/Gdata/Photos/UserEntry.php # Zend/Gdata/Photos/UserFeed.php # Zend/Gdata/Photos/UserQuery.php # Zend/Gdata/Query.php # Zend/Gdata/Spreadsheets.php # Zend/Gdata/Spreadsheets/CellEntry.php # Zend/Gdata/Spreadsheets/CellFeed.php # Zend/Gdata/Spreadsheets/CellQuery.php # Zend/Gdata/Spreadsheets/DocumentQuery.php # Zend/Gdata/Spreadsheets/Extension/Cell.php # Zend/Gdata/Spreadsheets/Extension/ColCount.php # Zend/Gdata/Spreadsheets/Extension/Custom.php # Zend/Gdata/Spreadsheets/Extension/RowCount.php # Zend/Gdata/Spreadsheets/ListEntry.php # Zend/Gdata/Spreadsheets/ListFeed.php # Zend/Gdata/Spreadsheets/ListQuery.php # Zend/Gdata/Spreadsheets/SpreadsheetEntry.php # Zend/Gdata/Spreadsheets/SpreadsheetFeed.php # Zend/Gdata/Spreadsheets/WorksheetEntry.php # Zend/Gdata/Spreadsheets/WorksheetFeed.php # Zend/Gdata/YouTube.php # Zend/Gdata/YouTube/ActivityEntry.php # Zend/Gdata/YouTube/ActivityFeed.php # Zend/Gdata/YouTube/CommentEntry.php # Zend/Gdata/YouTube/CommentFeed.php # Zend/Gdata/YouTube/ContactEntry.php # Zend/Gdata/YouTube/ContactFeed.php # Zend/Gdata/YouTube/Extension/AboutMe.php # Zend/Gdata/YouTube/Extension/Age.php # Zend/Gdata/YouTube/Extension/Books.php # Zend/Gdata/YouTube/Extension/Company.php # Zend/Gdata/YouTube/Extension/Control.php # Zend/Gdata/YouTube/Extension/CountHint.php # Zend/Gdata/YouTube/Extension/Description.php # Zend/Gdata/YouTube/Extension/Duration.php # Zend/Gdata/YouTube/Extension/FirstName.php # Zend/Gdata/YouTube/Extension/Gender.php # Zend/Gdata/YouTube/Extension/Hobbies.php # Zend/Gdata/YouTube/Extension/Hometown.php # Zend/Gdata/YouTube/Extension/LastName.php # Zend/Gdata/YouTube/Extension/Link.php # Zend/Gdata/YouTube/Extension/Location.php # Zend/Gdata/YouTube/Extension/MediaContent.php # Zend/Gdata/YouTube/Extension/MediaCredit.php # Zend/Gdata/YouTube/Extension/MediaGroup.php # Zend/Gdata/YouTube/Extension/MediaRating.php # Zend/Gdata/YouTube/Extension/Movies.php # Zend/Gdata/YouTube/Extension/Music.php # Zend/Gdata/YouTube/Extension/NoEmbed.php # Zend/Gdata/YouTube/Extension/Occupation.php # Zend/Gdata/YouTube/Extension/PlaylistId.php # Zend/Gdata/YouTube/Extension/PlaylistTitle.php # Zend/Gdata/YouTube/Extension/Position.php # Zend/Gdata/YouTube/Extension/Private.php # Zend/Gdata/YouTube/Extension/QueryString.php # Zend/Gdata/YouTube/Extension/Racy.php # Zend/Gdata/YouTube/Extension/Recorded.php # Zend/Gdata/YouTube/Extension/Relationship.php # Zend/Gdata/YouTube/Extension/ReleaseDate.php # Zend/Gdata/YouTube/Extension/School.php # Zend/Gdata/YouTube/Extension/State.php # Zend/Gdata/YouTube/Extension/Statistics.php # Zend/Gdata/YouTube/Extension/Status.php # Zend/Gdata/YouTube/Extension/Token.php # Zend/Gdata/YouTube/Extension/Uploaded.php # Zend/Gdata/YouTube/Extension/Username.php # Zend/Gdata/YouTube/Extension/VideoId.php # Zend/Gdata/YouTube/InboxEntry.php # Zend/Gdata/YouTube/InboxFeed.php # Zend/Gdata/YouTube/MediaEntry.php # Zend/Gdata/YouTube/PlaylistListEntry.php # Zend/Gdata/YouTube/PlaylistListFeed.php # Zend/Gdata/YouTube/PlaylistVideoEntry.php # Zend/Gdata/YouTube/PlaylistVideoFeed.php # Zend/Gdata/YouTube/SubscriptionEntry.php # Zend/Gdata/YouTube/SubscriptionFeed.php # Zend/Gdata/YouTube/UserProfileEntry.php # Zend/Gdata/YouTube/VideoEntry.php # Zend/Gdata/YouTube/VideoFeed.php # Zend/Gdata/YouTube/VideoQuery.php # Zend/Http/Client.php # Zend/Http/Client/Adapter/Curl.php # Zend/Http/Client/Adapter/Proxy.php # Zend/Http/Client/Adapter/Socket.php # Zend/Http/Client/Adapter/Stream.php # Zend/Http/Client/Adapter/Test.php # Zend/Http/Client/Exception.php # Zend/Http/Exception.php # Zend/Http/Response.php # Zend/Http/Response/Stream.php # Zend/Loader.php # Zend/Oauth/Client.php # Zend/Oauth/Config.php # Zend/Oauth/Consumer.php # Zend/Oauth/Exception.php # Zend/Oauth/Http.php # Zend/Oauth/Http/AccessToken.php # Zend/Oauth/Http/RequestToken.php # Zend/Oauth/Http/Utility.php # Zend/Oauth/Provider.php # Zend/Oauth/Signature/Hmac.php # Zend/Oauth/Signature/Plaintext.php # Zend/Oauth/Signature/Rsa.php # Zend/Oauth/Signature/SignatureAbstract.php # Zend/Oauth/Token.php # Zend/Oauth/Token/Access.php # Zend/Oauth/Token/AuthorizedRequest.php # Zend/Registry.php # Zend/Uri.php # Zend/Uri/Http.php # Zend/Validate/Abstract.php # Zend/Validate/Hostname.php # Zend/Validate/Hostname/Com.php # Zend/Validate/Ip.php # composer.json # composer.lock # files.md5 # include/InlineEditing/inlineEditing.js # include/Smarty/Config_File.class.php # include/Smarty/internals/core.assemble_plugin_filepath.php # include/Smarty/internals/core.assign_smarty_interface.php # include/Smarty/internals/core.create_dir_structure.php # include/Smarty/internals/core.display_debug_console.php # include/Smarty/internals/core.get_include_path.php # include/Smarty/internals/core.get_microtime.php # include/Smarty/internals/core.is_secure.php # include/Smarty/internals/core.load_plugins.php # include/Smarty/internals/core.load_resource_plugin.php # include/Smarty/internals/core.rm_auto.php # include/Smarty/internals/core.rmdir.php # include/Smarty/internals/core.run_insert_handler.php # include/Smarty/internals/core.smarty_include_php.php # include/Smarty/internals/core.write_compiled_resource.php # include/Smarty/internals/core.write_file.php # include/SugarCharts/SugarChartFactory.php # include/SugarOAuthServer.php # include/Sugar_Smarty.php # modules/Users/User.php # suitecrm_version.php # themes/SuiteP/css/Dawn/style.css # themes/SuiteP/css/Day/style.css # themes/SuiteP/css/Dusk/style.css # themes/SuiteP/css/Night/style.css
659 lines
23 KiB
JavaScript
659 lines
23 KiB
JavaScript
/**
|
|
*
|
|
* SugarCRM Community Edition is a customer relationship management program developed by
|
|
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
|
|
*
|
|
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
|
|
* Copyright (C) 2011 - 2018 SalesAgility Ltd.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it under
|
|
* the terms of the GNU Affero General Public License version 3 as published by the
|
|
* Free Software Foundation with the addition of the following permission added
|
|
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
|
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
|
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
* details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License along with
|
|
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
|
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
* 02110-1301 USA.
|
|
*
|
|
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
|
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
|
*
|
|
* The interactive user interfaces in modified source and object code versions
|
|
* of this program must display Appropriate Legal Notices, as required under
|
|
* Section 5 of the GNU Affero General Public License version 3.
|
|
*
|
|
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
|
* these Appropriate Legal Notices must retain the display of the "Powered by
|
|
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
|
|
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
|
|
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
|
|
*/
|
|
|
|
buildEditField();
|
|
|
|
//Global Variables.
|
|
|
|
var inlineEditSaveButtonImg = "themes/" + SUGAR.themes.theme_name + "/images/inline_edit_save_icon.svg";
|
|
|
|
if ($("#inline_edit_icon").length) {
|
|
var inlineEditIcon = $("#inline_edit_icon")[0].outerHTML;
|
|
} else {
|
|
var inlineEditIcon = "";
|
|
}
|
|
|
|
var view = action_sugar_grp1;
|
|
var currentModule = module_sugar_grp1;
|
|
|
|
var clicks = 0;
|
|
timer = null;
|
|
|
|
function buildEditField() {
|
|
$(".inlineEdit a").click(function(e) {
|
|
if (e.which !== undefined && e.which === 2) {
|
|
return;
|
|
}
|
|
|
|
if (this.id != "inlineEditSaveButton") {
|
|
var linkUrl = $(this).attr("href");
|
|
var linkTarget = $(this).attr("target");
|
|
|
|
if (typeof clicks == "undefined") {
|
|
clicks = 0;
|
|
}
|
|
|
|
// Fix for Issue #3148, force it so clicks is only ever = 1 when clicked, never higher.
|
|
if (clicks == 0) {
|
|
clicks++;
|
|
}
|
|
|
|
if (e.ctrlKey && clicks == 1) {
|
|
return;
|
|
}
|
|
|
|
e.preventDefault();
|
|
// if single click just want default action of following link, but want to wait in case user is actually trying to double click to edit field
|
|
// Proposed fix for issue #364 (click X icon to close redirects to bad url /undefined causing a 404 http error).
|
|
// Fix issue when click a close ( X ) button
|
|
if (typeof linkUrl === "undefined") {
|
|
return false;
|
|
}
|
|
if (clicks == 1) {
|
|
timer = setTimeout(function() {
|
|
// if reaches end of timeout without another click follow link
|
|
if (linkTarget) {
|
|
window.open(linkUrl, linkTarget);
|
|
} else {
|
|
window.location.href = linkUrl;
|
|
}
|
|
clicks = 0; //after action performed, reset counter
|
|
}, 500);
|
|
} else {
|
|
clearTimeout(timer); //prevent single-click action
|
|
clicks = 0;
|
|
}
|
|
}
|
|
});
|
|
|
|
var onInlineEditDblClick = function(elem, e) {
|
|
var _this = elem;
|
|
e.preventDefault();
|
|
// depending on what view you are using will find the id,module,type of field, and field name from the view
|
|
|
|
if (view == "view_GanttChart") {
|
|
view = "DetailView";
|
|
}
|
|
|
|
if (view == "DetailView") {
|
|
var field = $(_this).attr("field");
|
|
var type = $(_this).attr("type");
|
|
|
|
if (currentModule) {
|
|
var module = currentModule;
|
|
} else {
|
|
var module = module_sugar_grp1;
|
|
}
|
|
|
|
var id = $("input[name=record]").attr("value");
|
|
} else {
|
|
var field = $(_this).attr("field");
|
|
var type = $(_this).attr("type");
|
|
var module = $("#displayMassUpdate input[name=module]").val();
|
|
var id = $(_this)
|
|
.closest("tr")
|
|
.find("[type=checkbox]")
|
|
.attr("value");
|
|
}
|
|
|
|
if (
|
|
$('[field="' + field + '"]')
|
|
.attr("class")
|
|
.indexOf("fix-inlineEdit-textarea") > 0
|
|
) {
|
|
$('[field="' + field + '"]').removeClass("fix-inlineEdit-textarea");
|
|
}
|
|
|
|
//If we find all the required variables to do inline editing.
|
|
if (field && id && module) {
|
|
//Do ajax call to retrieve the validation for the field.
|
|
var validation = getValidationRules(field, module, id);
|
|
//Do ajax call to retrieve the html elements of the field.
|
|
var html = loadFieldHTML(field, module, id);
|
|
|
|
//If we have the field html append it to the div we clicked.
|
|
if (html) {
|
|
$(_this).html(
|
|
validation +
|
|
"<form name='EditView' id='EditView'><div id='inline_edit_field'>" +
|
|
html +
|
|
"</div><a id='inlineEditSaveButton'></a></form>"
|
|
);
|
|
$("#inlineEditSaveButton").html(
|
|
'<span class="suitepicon suitepicon-action-confirm"></span>'
|
|
);
|
|
//If the field is a relate field we will need to retrieve the extra js required to make the field work.
|
|
if (type == "relate" || type == "parent") {
|
|
var relate_js = getRelateFieldJS(field, module, id);
|
|
$(_this).append(relate_js);
|
|
SUGAR.util.evalScript($(_this).html());
|
|
// Issue 2344 and 2499 changes - Dump existing QSProcessedFieldsArray to enable multiple QS on multiple rows.
|
|
var fieldToCheck = "EditView_" + field + "_display";
|
|
if (fieldToCheck in QSProcessedFieldsArray) {
|
|
delete QSProcessedFieldsArray[fieldToCheck];
|
|
}
|
|
//Needs to be called to enable quicksearch/typeahead functionality on the field.
|
|
enableQS(true);
|
|
}
|
|
|
|
//Add the active class so we know which td we are editing as they all have the inlineEdit class.
|
|
$(_this).addClass("inlineEditActive");
|
|
|
|
//Put the cursor in the field if possible.
|
|
$("#" + field).focus();
|
|
if (type == "name" || type == "text") {
|
|
// move focus to end of text (multiply by 2 to make absolute certain its end as some browsers count carriage return as more than 1 character)
|
|
var strLength = $("#" + field).val().length * 2;
|
|
$("#" + field)[0].setSelectionRange(strLength, strLength);
|
|
}
|
|
|
|
//We can only edit one field at a time currently so turn off the on dblclick event
|
|
$(".inlineEdit").off("click");
|
|
$(".inlineEdit").off("dblclick");
|
|
|
|
//Call the click away function to handle if the user has clicked off the field, if they have it will close the form.
|
|
clickedawayclose(field, id, module, type);
|
|
|
|
//Make sure the data is valid and save the details to the bean.
|
|
validateFormAndSave(field, id, module, type);
|
|
}
|
|
}
|
|
};
|
|
|
|
var touchtime = 0;
|
|
$(".inlineEdit").dblclick(function(e) {
|
|
if (touchtime == 0) {
|
|
//set first click
|
|
touchtime = new Date().getTime();
|
|
} else {
|
|
//compare first click to this click and see if they occurred within double click threshold
|
|
if (new Date().getTime() - touchtime < 800) {
|
|
//double click occurred
|
|
//alert("double clicked");
|
|
touchtime = 0;
|
|
onInlineEditDblClick(this, e);
|
|
} else {
|
|
//not a double click so set as a new first click
|
|
touchtime = new Date().getTime();
|
|
}
|
|
}
|
|
});
|
|
|
|
$(".inlineEdit").dblclick(function(e) {
|
|
onInlineEditDblClick(this, e);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* On click event to check if form is valid then submit the form if it is or returns false.
|
|
* @param field - name of the field we are editing
|
|
* @param id - the id of the record we are editing
|
|
* @param module - the module we are editing
|
|
* @param type - the type of the field we are editing.
|
|
*/
|
|
function validateFormAndSave(field, id, module, type) {
|
|
$("#inlineEditSaveButton").on("click", function() {
|
|
var valid_form = check_form("EditView");
|
|
if (valid_form) {
|
|
handleSave(field, id, module, type);
|
|
clickListenerActive = false;
|
|
$('[field="' + field + '"]').addClass("fix-inlineEdit-textarea");
|
|
} else {
|
|
$('[field="' + field + '"]').removeClass("fix-inlineEdit-textarea");
|
|
return false;
|
|
}
|
|
});
|
|
// also want to save on enter/return being pressed
|
|
$(document).keypress(function(e) {
|
|
if (e.which == 13 && !e.shiftKey) {
|
|
e.preventDefault();
|
|
$("#inlineEditSaveButton").click();
|
|
}
|
|
});
|
|
}
|
|
|
|
var ie_field, ie_id, ie_module, ie_type, ie_message_field;
|
|
var clickListenerActive = false;
|
|
|
|
/**
|
|
* Checks if any of the parent elemenets of the current element have the class inlineEditActive this means they are within
|
|
* the current element and have not clicked away from the field. Note we need to check on .cal_panel too for the calendar popup.
|
|
* @param field - name of the field we are editing
|
|
* @param id - the id of the record we are editing
|
|
* @param module - the module we are editing
|
|
*/
|
|
function clickedawayclose(field, id, module, type) {
|
|
// Fix for issue #373 get name from system field name.
|
|
message_field = "LBL_" + field.toUpperCase();
|
|
message_field = SUGAR.language.get(module, message_field);
|
|
|
|
// Fix for issue #373 remove ':'
|
|
var last_character = message_field.substring(
|
|
message_field.length,
|
|
message_field.length - 1
|
|
);
|
|
if (":".toUpperCase() === last_character.toUpperCase()) {
|
|
message_field = message_field.substring(0, message_field.length - 1);
|
|
}
|
|
ie_field = field;
|
|
ie_id = id;
|
|
ie_module = module;
|
|
ie_type = type;
|
|
ie_message_field = message_field;
|
|
clickListenerActive = true;
|
|
}
|
|
|
|
$(document).on("click", function(e) {
|
|
if (clickListenerActive) {
|
|
var field = ie_field;
|
|
var id = ie_id;
|
|
var module = ie_module;
|
|
var type = ie_type;
|
|
var message_field = ie_message_field;
|
|
|
|
if (
|
|
!$(e.target)
|
|
.parents()
|
|
.is(".inlineEditActive, .cal_panel") &&
|
|
!$(e.target).hasClass("inlineEditActive")
|
|
) {
|
|
var output_value = loadFieldHTMLValue(field, id, module);
|
|
|
|
// Resolve issues with telephone number throwing exception.
|
|
if (/<[a-z][\s\S]*>/i.test(output_value)) {
|
|
var outputValueParse = $(output_value).text();
|
|
} else {
|
|
var outputValueParse = output_value;
|
|
}
|
|
|
|
var user_value = getInputValue(field, type);
|
|
|
|
/**
|
|
* A flag to fix Issue 2545, some parts of the site were comparing HTML to plain text, this flag checks
|
|
* against Plain Text and normal HTML to trigger the alert/confirm dialogue box.
|
|
*/
|
|
|
|
// Return user value to empty string for comparison if undefined at this stage (empty field check fix)
|
|
if (typeof user_value === "undefined") {
|
|
user_value = "";
|
|
}
|
|
|
|
// QS Fields have '_display' in their field names. An additional check for the this field name pattern.
|
|
if (outputValueParse != user_value && output_value != user_value) {
|
|
var fieldName = field + "_display";
|
|
var replacementUserValue = $("#" + fieldName).val();
|
|
|
|
// Parsing empty text returns undefined, if the string returns anything other than undefined, replace
|
|
// user_value with this value.
|
|
if (replacementUserValue != undefined) {
|
|
user_value = replacementUserValue;
|
|
}
|
|
}
|
|
|
|
var date_compare = false;
|
|
var output_value_compare = "";
|
|
if (
|
|
type == "datetimecombo" ||
|
|
type == "datetime" ||
|
|
type == "date"
|
|
) {
|
|
if (output_value == user_value) {
|
|
output_value_compare = user_value;
|
|
date_compare = true;
|
|
}
|
|
} else {
|
|
output_value_compare = output_value;
|
|
}
|
|
if (user_value != output_value_compare) {
|
|
message_field =
|
|
message_field != "undefined" ? message_field : "";
|
|
var r = confirm(
|
|
SUGAR.language.translate(
|
|
"app_strings",
|
|
"LBL_CONFIRM_CANCEL_INLINE_EDITING"
|
|
) + " " + message_field
|
|
);
|
|
if (r == true) {
|
|
var output = setValueClose(output_value);
|
|
clickListenerActive = false;
|
|
} else {
|
|
$("#" + field).focus();
|
|
e.preventDefault();
|
|
}
|
|
} else {
|
|
// user hasn't changed value so can close field without warning them first
|
|
var output = date_compare
|
|
? setValueClose(user_value)
|
|
: setValueClose(output_value);
|
|
clickListenerActive = false;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
/**
|
|
* Depending on what type of field we are editing the parts of the field may differ and need different jquery to pickup the values
|
|
* and format them, for example a date time field.
|
|
*
|
|
* This function will take a field and its type and try find the revlevent parts of the field required to save the value correctly.
|
|
* @param field - name of the field we are editing
|
|
* @param type - the type of the field we are editing.
|
|
* @returns {*}
|
|
*/
|
|
function getInputValue(field, type) {
|
|
if ($("#" + field).length > 0 && type) {
|
|
switch (type) {
|
|
case "relate":
|
|
case "phone":
|
|
case "name":
|
|
case "varchar":
|
|
if ($("#" + field).val().length > 0) {
|
|
return $("#" + field).val();
|
|
}
|
|
break;
|
|
case "enum":
|
|
if ($("#" + field + " :selected").text().length > 0) {
|
|
return $("#" + field + " :selected").val();
|
|
}
|
|
break;
|
|
case "datetime":
|
|
case "datetimecombo":
|
|
if ($("#" + field + "_date").val().length > 0) {
|
|
var date = $("#" + field + "_date").val();
|
|
} else {
|
|
var date = 00;
|
|
}
|
|
if ($("#" + field + "_hours :selected").text().length > 0) {
|
|
var hours = $("#" + field + "_hours :selected").text();
|
|
} else {
|
|
var hours = 00;
|
|
}
|
|
if ($("#" + field + "_minutes :selected").text().length > 0) {
|
|
var minutes = $("#" + field + "_minutes :selected").text();
|
|
} else {
|
|
var minutes = 00;
|
|
}
|
|
if ($("#" + field + "_meridiem :selected").text().length > 0) {
|
|
var meridiem = $("#" + field + "_meridiem :selected").text();
|
|
} else {
|
|
var meridiem = "";
|
|
}
|
|
return date + " " + hours + ":" + minutes + meridiem;
|
|
break;
|
|
case "date":
|
|
//if($('#'+ field + ' :selected').text().length > 0){
|
|
if ($("#" + field).val().length > 0) {
|
|
return $("#" + field).val();
|
|
}
|
|
break;
|
|
case "multienum":
|
|
if ($("#" + field + " :selected").text().length > 0) {
|
|
return $("select#" + field).val();
|
|
}
|
|
break;
|
|
case "bool":
|
|
if ($("#" + field).is(":checked")) {
|
|
return "on";
|
|
} else {
|
|
return "off";
|
|
}
|
|
break;
|
|
case "radioenum":
|
|
if ($("input[name=" + field + "]:checked").val()) {
|
|
return $("input[name=" + field + "]:checked").val();
|
|
}
|
|
break;
|
|
default:
|
|
if ($("#" + field).val().length > 0) {
|
|
return $("#" + field).val();
|
|
}
|
|
}
|
|
} else if (type == "parent" && $("#parent_id").val().length > 0) {
|
|
return $("#parent_id").val();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Handles the submit of the form.
|
|
* If we have value set pass it through if we don't then send a blank value this is so we can set a field to blank.
|
|
* Save the value to the bean via an ajax call.
|
|
* set the returned value from the ajax call to the td inner html.
|
|
*
|
|
* @param field - name of the field we are editing
|
|
* @param id - the id of the record we are editing
|
|
* @param module - the module we are editing
|
|
* @param type - the type of the field we are editing.
|
|
*/
|
|
function handleSave(field, id, module, type) {
|
|
var value = getInputValue(field, type);
|
|
var parent_type = "";
|
|
|
|
if (typeof value === "undefined") {
|
|
var value = "";
|
|
}
|
|
|
|
if (type == "parent") {
|
|
parent_type = $("#parent_type").val();
|
|
}
|
|
var output_value = saveFieldHTML(field, module, id, value, parent_type);
|
|
// If the field type is email, we don't want to handle linebreaks in the output.
|
|
if (field === "email1") {
|
|
setValueClose(output_value, false);
|
|
} else {
|
|
setValueClose(output_value);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Takes the value and places it inside the td, also inputs the edit icon stuff as this was removed when the field was retrieved.
|
|
* Calls buildEditField() to re add the on dblclick event.
|
|
* @param value
|
|
* @param replaceLinebreaks Whether or not to replace linebreaks in the value with <br> elements.
|
|
*/
|
|
function setValueClose(value, replaceLinebreaks = true) {
|
|
$.get(
|
|
"themes/" + SUGAR.themes.theme_name + "/images/inline_edit_icon.svg",
|
|
function(data) {
|
|
// Fix for #3136 - replace new line characters with <br /> for html on close.
|
|
if (replaceLinebreaks) {
|
|
value = value.replace(/(?:\r\n|\r|\n)/g, "<br />");
|
|
}
|
|
|
|
$(".inlineEditActive").html("");
|
|
$(".inlineEditActive").html(
|
|
value +
|
|
'<div class="inlineEditIcon">' +
|
|
inlineEditIcon +
|
|
"</div>"
|
|
);
|
|
$(".inlineEditActive").removeClass("inlineEditActive");
|
|
}
|
|
);
|
|
|
|
buildEditField();
|
|
}
|
|
|
|
/**
|
|
* Ajax call to save the field to the sugar bean.
|
|
* Calls a controller action in /modules/Home/controller.
|
|
* Returns the formatted output value of the field.
|
|
* @param field
|
|
* @param module
|
|
* @param id
|
|
* @param value
|
|
* @returns {*}
|
|
*/
|
|
function saveFieldHTML(field, module, id, value, parent_type) {
|
|
$.ajaxSetup({ async: false });
|
|
var result = $.getJSON("index.php", {
|
|
module: "Home",
|
|
action: "saveHTMLField",
|
|
field: field,
|
|
current_module: module,
|
|
id: id,
|
|
value: value,
|
|
view: view,
|
|
parent_type: parent_type,
|
|
to_pdf: true
|
|
});
|
|
$.ajaxSetup({ async: true });
|
|
return result.responseText;
|
|
}
|
|
|
|
/**
|
|
* Ajax call to retrieve the html for a field.
|
|
* Calls a controller action in /modules/Home/controller.
|
|
* Returns the edit view field.
|
|
* @param field
|
|
* @param module
|
|
* @param id
|
|
* @param value
|
|
* @returns {*}
|
|
*/
|
|
function loadFieldHTML(field, module, id) {
|
|
$.ajaxSetup({ async: false });
|
|
var result = $.getJSON("index.php", {
|
|
module: "Home",
|
|
action: "getEditFieldHTML",
|
|
field: field,
|
|
current_module: module,
|
|
id: id,
|
|
view: view,
|
|
to_pdf: true
|
|
});
|
|
$.ajaxSetup({ async: true });
|
|
if (result.responseText) {
|
|
try {
|
|
return JSON.parse(result.responseText);
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Ajax call retrieve the field value from the bean used for closing the input.
|
|
* Calls a controller action in /modules/Home/controller.
|
|
* Returns the formatted output value of the field.
|
|
* @param field
|
|
* @param module
|
|
* @param id
|
|
* @returns {*}
|
|
*/
|
|
function loadFieldHTMLValue(field, id, module) {
|
|
$.ajaxSetup({ async: false });
|
|
var result = $.getJSON("index.php", {
|
|
module: "Home",
|
|
action: "getDisplayValue",
|
|
field: field,
|
|
current_module: module,
|
|
view: view,
|
|
id: id,
|
|
to_pdf: true
|
|
});
|
|
$.ajaxSetup({ async: true });
|
|
|
|
return result.responseText;
|
|
}
|
|
|
|
/**
|
|
* Ajax call to retrieve the field validation js this needs to be done separately as you can't json_encode javascript.
|
|
* Calls a controller action in /modules/Home/controller.
|
|
* Returns the add to validate call for the field..
|
|
* @param field
|
|
* @param module
|
|
* @param id
|
|
* @returns {*}
|
|
*/
|
|
function getValidationRules(field, module, id) {
|
|
$.ajaxSetup({ async: false });
|
|
var result = $.getJSON("index.php", {
|
|
module: "Home",
|
|
action: "getValidationRules",
|
|
field: field,
|
|
current_module: module,
|
|
id: id,
|
|
to_pdf: true
|
|
});
|
|
$.ajaxSetup({ async: true });
|
|
|
|
try {
|
|
var validation = JSON.parse(result.responseText);
|
|
} catch (e) {
|
|
alert(
|
|
SUGAR.language.translate(
|
|
"app_strings",
|
|
"LBL_LOADING_ERROR_INLINE_EDITING"
|
|
)
|
|
);
|
|
return false;
|
|
}
|
|
|
|
return (
|
|
"<script type='text/javascript'>addToValidate('EditView', \"" + field + '", "' + validation["type"] + '", ' + validation["required"] + ',"' + validation["label"] + '");</script>'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Ajax call to retrieve js needed for relate fields..
|
|
* Calls a controller action in /modules/Home/controller.
|
|
* Returns the javascript.
|
|
* @param field
|
|
* @param module
|
|
* @param id
|
|
* @returns {*}
|
|
*/
|
|
function getRelateFieldJS(field, module, id) {
|
|
$.ajaxSetup({ async: false });
|
|
var result = $.getJSON("index.php", {
|
|
module: "Home",
|
|
action: "getRelateFieldJS",
|
|
field: field,
|
|
current_module: module,
|
|
id: id,
|
|
to_pdf: true
|
|
});
|
|
$.ajaxSetup({ async: true });
|
|
|
|
SUGAR.util.evalScript(result.responseText);
|
|
|
|
return result.responseText;
|
|
}
|