From a84f4a930b0ca7e79f37cbef041669203c13829b Mon Sep 17 00:00:00 2001 From: John Mertic Date: Wed, 1 Jun 2011 15:58:24 -0400 Subject: [PATCH] Release 6.2.0 --- HandleAjaxCall.php | 2 +- ModuleInstall/ModuleInstaller.php | 39 +- ModuleInstall/ModuleScanner.php | 5 +- .../PackageManager/ListViewPackages.php | 2 +- .../PackageManager/PackageController.php | 2 +- .../PackageManager/PackageManager.php | 34 +- .../PackageManager/PackageManagerComm.php | 2 +- .../PackageManager/PackageManagerDisplay.php | 6 +- .../PackageManagerDownloader.php | 2 +- .../PackageManager/metadata/listviewdefs.php | 2 +- .../tpls/ModuleLoaderListView.tpl | 2 +- .../PackageManager/tpls/PackageForm.tpl | 2 +- .../tpls/PackageManagerLicense.tpl | 2 +- .../tpls/PackageManagerScripts.tpl | 4 +- SugarSecurity.php | 2 +- TreeData.php | 2 +- WebToLeadCapture.php | 2 +- Zend/Crypt.php | 167 + Zend/Crypt/DiffieHellman.php | 380 + Zend/Crypt/DiffieHellman/Exception.php | 36 + Zend/Crypt/Exception.php | 35 + Zend/Crypt/Hmac.php | 181 + Zend/Crypt/Hmac/Exception.php | 36 + Zend/Crypt/Math.php | 102 + Zend/Crypt/Math/BigInteger.php | 117 + Zend/Crypt/Math/BigInteger/Bcmath.php | 203 + Zend/Crypt/Math/BigInteger/Exception.php | 36 + Zend/Crypt/Math/BigInteger/Gmp.php | 196 + Zend/Crypt/Math/BigInteger/Interface.php | 51 + Zend/Crypt/Math/Exception.php | 36 + Zend/Crypt/Rsa.php | 309 + Zend/Crypt/Rsa/Key.php | 95 + Zend/Crypt/Rsa/Key/Private.php | 75 + Zend/Crypt/Rsa/Key/Public.php | 74 + Zend/Exception.php | 95 + Zend/Gdata.php | 241 + Zend/Gdata/App.php | 1234 + Zend/Gdata/App/AuthException.php | 41 + Zend/Gdata/App/BadMethodCallException.php | 42 + Zend/Gdata/App/Base.php | 572 + Zend/Gdata/App/BaseMediaSource.php | 179 + Zend/Gdata/App/CaptchaRequiredException.php | 94 + Zend/Gdata/App/Entry.php | 389 + Zend/Gdata/App/Exception.php | 43 + Zend/Gdata/App/Extension.php | 40 + Zend/Gdata/App/Extension/Author.php | 43 + Zend/Gdata/App/Extension/Category.php | 140 + Zend/Gdata/App/Extension/Content.php | 88 + Zend/Gdata/App/Extension/Contributor.php | 43 + Zend/Gdata/App/Extension/Control.php | 98 + Zend/Gdata/App/Extension/Draft.php | 50 + Zend/Gdata/App/Extension/Edited.php | 49 + Zend/Gdata/App/Extension/Element.php | 58 + Zend/Gdata/App/Extension/Email.php | 49 + Zend/Gdata/App/Extension/Generator.php | 115 + Zend/Gdata/App/Extension/Icon.php | 49 + Zend/Gdata/App/Extension/Id.php | 49 + Zend/Gdata/App/Extension/Link.php | 219 + Zend/Gdata/App/Extension/Logo.php | 49 + Zend/Gdata/App/Extension/Name.php | 48 + Zend/Gdata/App/Extension/Person.php | 163 + Zend/Gdata/App/Extension/Published.php | 49 + Zend/Gdata/App/Extension/Rights.php | 49 + Zend/Gdata/App/Extension/Source.php | 46 + Zend/Gdata/App/Extension/Subtitle.php | 43 + Zend/Gdata/App/Extension/Summary.php | 43 + Zend/Gdata/App/Extension/Text.php | 90 + Zend/Gdata/App/Extension/Title.php | 43 + Zend/Gdata/App/Extension/Updated.php | 49 + Zend/Gdata/App/Extension/Uri.php | 49 + Zend/Gdata/App/Feed.php | 352 + Zend/Gdata/App/FeedEntryParent.php | 681 + Zend/Gdata/App/FeedSourceParent.php | 267 + Zend/Gdata/App/HttpException.php | 121 + Zend/Gdata/App/IOException.php | 43 + Zend/Gdata/App/InvalidArgumentException.php | 42 + .../App/LoggingHttpClientAdapterSocket.php | 119 + Zend/Gdata/App/MediaEntry.php | 119 + Zend/Gdata/App/MediaFileSource.php | 146 + Zend/Gdata/App/MediaSource.php | 73 + Zend/Gdata/App/Util.php | 112 + Zend/Gdata/App/VersionException.php | 42 + Zend/Gdata/AuthSub.php | 246 + Zend/Gdata/Books.php | 204 + Zend/Gdata/Books/CollectionEntry.php | 56 + Zend/Gdata/Books/CollectionFeed.php | 62 + Zend/Gdata/Books/Extension/AnnotationLink.php | 63 + Zend/Gdata/Books/Extension/BooksCategory.php | 59 + Zend/Gdata/Books/Extension/BooksLink.php | 61 + Zend/Gdata/Books/Extension/Embeddability.php | 122 + Zend/Gdata/Books/Extension/InfoLink.php | 59 + Zend/Gdata/Books/Extension/PreviewLink.php | 60 + Zend/Gdata/Books/Extension/Review.php | 152 + Zend/Gdata/Books/Extension/ThumbnailLink.php | 60 + Zend/Gdata/Books/Extension/Viewability.php | 123 + Zend/Gdata/Books/VolumeEntry.php | 687 + Zend/Gdata/Books/VolumeFeed.php | 62 + Zend/Gdata/Books/VolumeQuery.php | 112 + Zend/Gdata/Calendar.php | 169 + Zend/Gdata/Calendar/EventEntry.php | 164 + Zend/Gdata/Calendar/EventFeed.php | 106 + Zend/Gdata/Calendar/EventQuery.php | 491 + Zend/Gdata/Calendar/Extension/AccessLevel.php | 125 + Zend/Gdata/Calendar/Extension/Color.php | 125 + Zend/Gdata/Calendar/Extension/Hidden.php | 134 + Zend/Gdata/Calendar/Extension/Link.php | 125 + Zend/Gdata/Calendar/Extension/QuickAdd.php | 132 + Zend/Gdata/Calendar/Extension/Selected.php | 133 + .../Extension/SendEventNotifications.php | 132 + Zend/Gdata/Calendar/Extension/Timezone.php | 124 + Zend/Gdata/Calendar/Extension/WebContent.php | 177 + Zend/Gdata/Calendar/ListEntry.php | 246 + Zend/Gdata/Calendar/ListFeed.php | 106 + Zend/Gdata/ClientLogin.php | 182 + Zend/Gdata/Docs.php | 319 + Zend/Gdata/Docs/DocumentListEntry.php | 54 + Zend/Gdata/Docs/DocumentListFeed.php | 68 + Zend/Gdata/Docs/Query.php | 228 + Zend/Gdata/DublinCore.php | 65 + Zend/Gdata/DublinCore/Extension/Creator.php | 58 + Zend/Gdata/DublinCore/Extension/Date.php | 60 + .../DublinCore/Extension/Description.php | 58 + Zend/Gdata/DublinCore/Extension/Format.php | 58 + .../Gdata/DublinCore/Extension/Identifier.php | 58 + Zend/Gdata/DublinCore/Extension/Language.php | 58 + Zend/Gdata/DublinCore/Extension/Publisher.php | 58 + Zend/Gdata/DublinCore/Extension/Rights.php | 58 + Zend/Gdata/DublinCore/Extension/Subject.php | 58 + Zend/Gdata/DublinCore/Extension/Title.php | 58 + Zend/Gdata/Entry.php | 132 + Zend/Gdata/Exif.php | 65 + Zend/Gdata/Exif/Entry.php | 145 + Zend/Gdata/Exif/Extension/Distance.php | 61 + Zend/Gdata/Exif/Extension/Exposure.php | 61 + Zend/Gdata/Exif/Extension/FStop.php | 61 + Zend/Gdata/Exif/Extension/Flash.php | 61 + Zend/Gdata/Exif/Extension/FocalLength.php | 61 + Zend/Gdata/Exif/Extension/ImageUniqueId.php | 61 + Zend/Gdata/Exif/Extension/Iso.php | 61 + Zend/Gdata/Exif/Extension/Make.php | 61 + Zend/Gdata/Exif/Extension/Model.php | 61 + Zend/Gdata/Exif/Extension/Tags.php | 549 + Zend/Gdata/Exif/Extension/Time.php | 61 + Zend/Gdata/Exif/Feed.php | 70 + Zend/Gdata/Extension.php | 58 + Zend/Gdata/Extension/AttendeeStatus.php | 123 + Zend/Gdata/Extension/AttendeeType.php | 123 + Zend/Gdata/Extension/Comments.php | 117 + Zend/Gdata/Extension/EntryLink.php | 167 + Zend/Gdata/Extension/EventStatus.php | 101 + Zend/Gdata/Extension/ExtendedProperty.php | 106 + Zend/Gdata/Extension/FeedLink.php | 175 + .../Extension/OpenSearchItemsPerPage.php | 50 + Zend/Gdata/Extension/OpenSearchStartIndex.php | 50 + .../Extension/OpenSearchTotalResults.php | 50 + Zend/Gdata/Extension/OriginalEvent.php | 142 + Zend/Gdata/Extension/Rating.php | 240 + Zend/Gdata/Extension/Recurrence.php | 49 + Zend/Gdata/Extension/RecurrenceException.php | 215 + Zend/Gdata/Extension/Reminder.php | 171 + Zend/Gdata/Extension/Transparency.php | 123 + Zend/Gdata/Extension/Visibility.php | 123 + Zend/Gdata/Extension/When.php | 169 + Zend/Gdata/Extension/Where.php | 171 + Zend/Gdata/Extension/Who.php | 299 + Zend/Gdata/Feed.php | 251 + Zend/Gdata/Gapps.php | 1683 ++ Zend/Gdata/Gapps/EmailListEntry.php | 214 + Zend/Gdata/Gapps/EmailListFeed.php | 53 + Zend/Gdata/Gapps/EmailListQuery.php | 187 + Zend/Gdata/Gapps/EmailListRecipientEntry.php | 146 + Zend/Gdata/Gapps/EmailListRecipientFeed.php | 53 + Zend/Gdata/Gapps/EmailListRecipientQuery.php | 153 + Zend/Gdata/Gapps/Error.php | 233 + Zend/Gdata/Gapps/Extension/EmailList.php | 144 + Zend/Gdata/Gapps/Extension/Login.php | 485 + Zend/Gdata/Gapps/Extension/Name.php | 181 + Zend/Gdata/Gapps/Extension/Nickname.php | 142 + Zend/Gdata/Gapps/Extension/Property.php | 180 + Zend/Gdata/Gapps/Extension/Quota.php | 142 + Zend/Gdata/Gapps/GroupEntry.php | 158 + Zend/Gdata/Gapps/GroupFeed.php | 53 + Zend/Gdata/Gapps/GroupQuery.php | 226 + Zend/Gdata/Gapps/MemberEntry.php | 159 + Zend/Gdata/Gapps/MemberFeed.php | 53 + Zend/Gdata/Gapps/MemberQuery.php | 194 + Zend/Gdata/Gapps/NicknameEntry.php | 189 + Zend/Gdata/Gapps/NicknameFeed.php | 53 + Zend/Gdata/Gapps/NicknameQuery.php | 186 + Zend/Gdata/Gapps/OwnerEntry.php | 158 + Zend/Gdata/Gapps/OwnerFeed.php | 53 + Zend/Gdata/Gapps/OwnerQuery.php | 147 + Zend/Gdata/Gapps/Query.php | 123 + Zend/Gdata/Gapps/ServiceException.php | 208 + Zend/Gdata/Gapps/UserEntry.php | 295 + Zend/Gdata/Gapps/UserFeed.php | 53 + Zend/Gdata/Gapps/UserQuery.php | 147 + Zend/Gdata/Gbase.php | 209 + Zend/Gdata/Gbase/Entry.php | 151 + Zend/Gdata/Gbase/Extension/BaseAttribute.php | 115 + Zend/Gdata/Gbase/Feed.php | 60 + Zend/Gdata/Gbase/ItemEntry.php | 161 + Zend/Gdata/Gbase/ItemFeed.php | 48 + Zend/Gdata/Gbase/ItemQuery.php | 101 + Zend/Gdata/Gbase/Query.php | 268 + Zend/Gdata/Gbase/SnippetEntry.php | 48 + Zend/Gdata/Gbase/SnippetFeed.php | 48 + Zend/Gdata/Gbase/SnippetQuery.php | 74 + Zend/Gdata/Geo.php | 70 + Zend/Gdata/Geo/Entry.php | 97 + Zend/Gdata/Geo/Extension/GeoRssWhere.php | 135 + Zend/Gdata/Geo/Extension/GmlPoint.php | 136 + Zend/Gdata/Geo/Extension/GmlPos.php | 61 + Zend/Gdata/Geo/Feed.php | 64 + Zend/Gdata/Health.php | 274 + Zend/Gdata/Health/Extension/Ccr.php | 124 + Zend/Gdata/Health/ProfileEntry.php | 135 + Zend/Gdata/Health/ProfileFeed.php | 67 + Zend/Gdata/Health/ProfileListEntry.php | 100 + Zend/Gdata/Health/ProfileListFeed.php | 53 + Zend/Gdata/Health/Query.php | 285 + Zend/Gdata/HttpAdapterStreamingProxy.php | 127 + Zend/Gdata/HttpAdapterStreamingSocket.php | 111 + Zend/Gdata/HttpClient.php | 352 + Zend/Gdata/Kind/EventEntry.php | 428 + Zend/Gdata/Media.php | 65 + Zend/Gdata/Media/Entry.php | 134 + Zend/Gdata/Media/Extension/MediaCategory.php | 148 + Zend/Gdata/Media/Extension/MediaContent.php | 522 + Zend/Gdata/Media/Extension/MediaCopyright.php | 116 + Zend/Gdata/Media/Extension/MediaCredit.php | 149 + .../Media/Extension/MediaDescription.php | 116 + Zend/Gdata/Media/Extension/MediaGroup.php | 566 + Zend/Gdata/Media/Extension/MediaHash.php | 115 + Zend/Gdata/Media/Extension/MediaKeywords.php | 52 + Zend/Gdata/Media/Extension/MediaPlayer.php | 178 + Zend/Gdata/Media/Extension/MediaRating.php | 118 + .../Media/Extension/MediaRestriction.php | 149 + Zend/Gdata/Media/Extension/MediaText.php | 211 + Zend/Gdata/Media/Extension/MediaThumbnail.php | 210 + Zend/Gdata/Media/Extension/MediaTitle.php | 118 + Zend/Gdata/Media/Feed.php | 70 + Zend/Gdata/MediaMimeStream.php | 190 + Zend/Gdata/MimeBodyString.php | 92 + Zend/Gdata/MimeFile.php | 66 + Zend/Gdata/Photos.php | 576 + Zend/Gdata/Photos/AlbumEntry.php | 610 + Zend/Gdata/Photos/AlbumFeed.php | 509 + Zend/Gdata/Photos/AlbumQuery.php | 149 + Zend/Gdata/Photos/CommentEntry.php | 195 + Zend/Gdata/Photos/Extension/Access.php | 63 + Zend/Gdata/Photos/Extension/AlbumId.php | 63 + Zend/Gdata/Photos/Extension/BytesUsed.php | 62 + Zend/Gdata/Photos/Extension/Checksum.php | 63 + Zend/Gdata/Photos/Extension/Client.php | 63 + Zend/Gdata/Photos/Extension/CommentCount.php | 63 + .../Photos/Extension/CommentingEnabled.php | 64 + Zend/Gdata/Photos/Extension/Height.php | 62 + Zend/Gdata/Photos/Extension/Id.php | 62 + Zend/Gdata/Photos/Extension/Location.php | 62 + .../Photos/Extension/MaxPhotosPerAlbum.php | 63 + Zend/Gdata/Photos/Extension/Name.php | 62 + Zend/Gdata/Photos/Extension/Nickname.php | 62 + Zend/Gdata/Photos/Extension/NumPhotos.php | 62 + .../Photos/Extension/NumPhotosRemaining.php | 62 + Zend/Gdata/Photos/Extension/PhotoId.php | 61 + Zend/Gdata/Photos/Extension/Position.php | 62 + Zend/Gdata/Photos/Extension/QuotaCurrent.php | 62 + Zend/Gdata/Photos/Extension/QuotaLimit.php | 63 + Zend/Gdata/Photos/Extension/Rotation.php | 63 + Zend/Gdata/Photos/Extension/Size.php | 62 + Zend/Gdata/Photos/Extension/Thumbnail.php | 62 + Zend/Gdata/Photos/Extension/Timestamp.php | 63 + Zend/Gdata/Photos/Extension/User.php | 62 + Zend/Gdata/Photos/Extension/Version.php | 63 + Zend/Gdata/Photos/Extension/Weight.php | 63 + Zend/Gdata/Photos/Extension/Width.php | 62 + Zend/Gdata/Photos/PhotoEntry.php | 691 + Zend/Gdata/Photos/PhotoFeed.php | 559 + Zend/Gdata/Photos/PhotoQuery.php | 98 + Zend/Gdata/Photos/TagEntry.php | 140 + Zend/Gdata/Photos/UserEntry.php | 366 + Zend/Gdata/Photos/UserFeed.php | 247 + Zend/Gdata/Photos/UserQuery.php | 355 + Zend/Gdata/Query.php | 418 + Zend/Gdata/Spreadsheets.php | 445 + Zend/Gdata/Spreadsheets/CellEntry.php | 103 + Zend/Gdata/Spreadsheets/CellFeed.php | 158 + Zend/Gdata/Spreadsheets/CellQuery.php | 417 + Zend/Gdata/Spreadsheets/DocumentQuery.php | 288 + Zend/Gdata/Spreadsheets/Extension/Cell.php | 201 + .../Gdata/Spreadsheets/Extension/ColCount.php | 59 + Zend/Gdata/Spreadsheets/Extension/Custom.php | 100 + .../Gdata/Spreadsheets/Extension/RowCount.php | 60 + Zend/Gdata/Spreadsheets/ListEntry.php | 208 + Zend/Gdata/Spreadsheets/ListFeed.php | 64 + Zend/Gdata/Spreadsheets/ListQuery.php | 305 + Zend/Gdata/Spreadsheets/SpreadsheetEntry.php | 64 + Zend/Gdata/Spreadsheets/SpreadsheetFeed.php | 64 + Zend/Gdata/Spreadsheets/WorksheetEntry.php | 187 + Zend/Gdata/Spreadsheets/WorksheetFeed.php | 64 + Zend/Gdata/YouTube.php | 874 + Zend/Gdata/YouTube/ActivityEntry.php | 232 + Zend/Gdata/YouTube/ActivityFeed.php | 66 + Zend/Gdata/YouTube/CommentEntry.php | 59 + Zend/Gdata/YouTube/CommentFeed.php | 66 + Zend/Gdata/YouTube/ContactEntry.php | 136 + Zend/Gdata/YouTube/ContactFeed.php | 68 + Zend/Gdata/YouTube/Extension/AboutMe.php | 51 + Zend/Gdata/YouTube/Extension/Age.php | 51 + Zend/Gdata/YouTube/Extension/Books.php | 51 + Zend/Gdata/YouTube/Extension/Company.php | 51 + Zend/Gdata/YouTube/Extension/Control.php | 133 + Zend/Gdata/YouTube/Extension/CountHint.php | 51 + Zend/Gdata/YouTube/Extension/Description.php | 51 + Zend/Gdata/YouTube/Extension/Duration.php | 126 + Zend/Gdata/YouTube/Extension/FirstName.php | 51 + Zend/Gdata/YouTube/Extension/Gender.php | 51 + Zend/Gdata/YouTube/Extension/Hobbies.php | 51 + Zend/Gdata/YouTube/Extension/Hometown.php | 51 + Zend/Gdata/YouTube/Extension/LastName.php | 51 + Zend/Gdata/YouTube/Extension/Link.php | 133 + Zend/Gdata/YouTube/Extension/Location.php | 51 + Zend/Gdata/YouTube/Extension/MediaContent.php | 120 + Zend/Gdata/YouTube/Extension/MediaCredit.php | 189 + Zend/Gdata/YouTube/Extension/MediaGroup.php | 336 + Zend/Gdata/YouTube/Extension/MediaRating.php | 150 + Zend/Gdata/YouTube/Extension/Movies.php | 51 + Zend/Gdata/YouTube/Extension/Music.php | 51 + Zend/Gdata/YouTube/Extension/NoEmbed.php | 54 + Zend/Gdata/YouTube/Extension/Occupation.php | 51 + Zend/Gdata/YouTube/Extension/PlaylistId.php | 51 + .../Gdata/YouTube/Extension/PlaylistTitle.php | 51 + Zend/Gdata/YouTube/Extension/Position.php | 90 + Zend/Gdata/YouTube/Extension/Private.php | 81 + Zend/Gdata/YouTube/Extension/QueryString.php | 51 + Zend/Gdata/YouTube/Extension/Racy.php | 124 + Zend/Gdata/YouTube/Extension/Recorded.php | 51 + Zend/Gdata/YouTube/Extension/Relationship.php | 51 + Zend/Gdata/YouTube/Extension/ReleaseDate.php | 51 + Zend/Gdata/YouTube/Extension/School.php | 51 + Zend/Gdata/YouTube/Extension/State.php | 193 + Zend/Gdata/YouTube/Extension/Statistics.php | 309 + Zend/Gdata/YouTube/Extension/Status.php | 51 + Zend/Gdata/YouTube/Extension/Token.php | 70 + Zend/Gdata/YouTube/Extension/Uploaded.php | 51 + Zend/Gdata/YouTube/Extension/Username.php | 51 + Zend/Gdata/YouTube/Extension/VideoId.php | 51 + Zend/Gdata/YouTube/InboxEntry.php | 281 + Zend/Gdata/YouTube/InboxFeed.php | 68 + Zend/Gdata/YouTube/MediaEntry.php | 81 + Zend/Gdata/YouTube/PlaylistListEntry.php | 300 + Zend/Gdata/YouTube/PlaylistListFeed.php | 68 + Zend/Gdata/YouTube/PlaylistVideoEntry.php | 132 + Zend/Gdata/YouTube/PlaylistVideoFeed.php | 68 + Zend/Gdata/YouTube/SubscriptionEntry.php | 446 + Zend/Gdata/YouTube/SubscriptionFeed.php | 68 + Zend/Gdata/YouTube/UserProfileEntry.php | 1041 + Zend/Gdata/YouTube/VideoEntry.php | 1095 + Zend/Gdata/YouTube/VideoFeed.php | 65 + Zend/Gdata/YouTube/VideoQuery.php | 540 + Zend/Http/Client.php | 1453 ++ Zend/Http/Client/Adapter/Curl.php | 507 + Zend/Http/Client/Adapter/Exception.php | 38 + Zend/Http/Client/Adapter/Interface.php | 78 + Zend/Http/Client/Adapter/Proxy.php | 284 + Zend/Http/Client/Adapter/Socket.php | 544 + Zend/Http/Client/Adapter/Stream.php | 46 + Zend/Http/Client/Adapter/Test.php | 238 + Zend/Http/Client/Exception.php | 36 + Zend/Http/Exception.php | 36 + Zend/Http/Response.php | 667 + Zend/Http/Response/Stream.php | 235 + Zend/Loader.php | 329 + Zend/Oauth.php | 89 + Zend/Oauth/Client.php | 336 + Zend/Oauth/Config/ConfigInterface.php | 75 + Zend/Oauth/Consumer.php | 273 + Zend/Oauth/Exception.php | 33 + Zend/Oauth/Http.php | 266 + Zend/Oauth/Http/AccessToken.php | 189 + Zend/Oauth/Http/RequestToken.php | 162 + Zend/Oauth/Http/UserAuthorization.php | 78 + Zend/Oauth/Http/Utility.php | 217 + Zend/Oauth/Signature/Hmac.php | 54 + Zend/Oauth/Signature/Plaintext.php | 49 + Zend/Oauth/Signature/Rsa.php | 65 + Zend/Oauth/Signature/SignatureAbstract.php | 183 + Zend/Oauth/Token.php | 285 + Zend/Oauth/Token/Access.php | 99 + Zend/Oauth/Token/AuthorizedRequest.php | 102 + Zend/Oauth/Token/Request.php | 50 + Zend/Registry.php | 209 + Zend/Uri.php | 202 + Zend/Uri/Exception.php | 37 + Zend/Uri/Http.php | 769 + Zend/Validate/Abstract.php | 456 + Zend/Validate/Hostname.php | 740 + Zend/Validate/Hostname/Biz.php | 2917 +++ Zend/Validate/Hostname/Cn.php | 2199 ++ Zend/Validate/Hostname/Com.php | 198 + Zend/Validate/Hostname/Jp.php | 739 + Zend/Validate/Interface.php | 54 + Zend/Validate/Ip.php | 191 + Zend/Version.php | 53 + acceptDecline.php | 2 +- campaign_tracker.php | 2 +- campaign_trackerv2.php | 2 +- cron.php | 2 +- crossdomain.xml | 2 +- data/Link.php | 142 +- data/SugarBean.php | 6875 ++--- data/Tracker.php | 2 +- demoData.en_us.php | 21668 ---------------- demoData.ja_jp.php | 555 - demoData.zh_cn.php | 880 - dictionary.php | 2 +- download.php | 46 +- emailmandelivery.php | 2 +- examples/ExampleLeadCapture.php | 2 +- examples/FormValidationTest.php | 2 +- examples/ProgressBarTest.php | 2 +- examples/SoapTest.php | 6 +- examples/SoapTestPortal.php | 2 +- examples/SoapTestPortal2.php | 6 +- export.php | 10 +- files.md5 | 5700 ++-- image.php | 2 +- include/Dashlets/Dashlet.php | 217 +- include/Dashlets/DashletCacheBuilder.php | 2 +- include/Dashlets/DashletGeneric.php | 40 +- .../Dashlets/DashletGenericAutoRefresh.tpl | 58 + .../DashletGenericAutoRefreshDynamic.tpl | 64 + include/Dashlets/DashletGenericChart.php | 93 +- .../Dashlets/DashletGenericChartConfigure.tpl | 14 +- include/Dashlets/DashletGenericConfigure.tpl | 14 +- include/Dashlets/DashletGenericDisplay.tpl | 6 +- include/DetailView/DetailView.php | 2 +- include/DetailView/DetailView.tpl | 72 +- include/DetailView/DetailView2.php | 2 +- include/DetailView/footer.tpl | 2 +- include/DetailView/header.tpl | 10 +- include/EditView/EditView.php | 2 +- include/EditView/EditView.tpl | 55 +- include/EditView/EditView2.php | 80 +- include/EditView/PopupQuickCreate.php | 2 +- include/EditView/QuickCreate.php | 2 +- include/EditView/QuickCreate.tpl | 2 +- include/EditView/SubpanelQuickCreate.php | 2 +- include/EditView/SugarVCR.php | 2 +- include/EditView/footer.tpl | 8 +- include/EditView/header.tpl | 6 +- include/GroupedTabs/GroupedTabStructure.php | 2 +- include/HTTP_WebDAV_Server/Server.php | 6 +- include/JSON.js | 2 +- include/JSON.php | 914 +- include/ListView/ListView.php | 2547 +- include/ListView/ListViewDCMenu.tpl | 189 + include/ListView/ListViewData.php | 42 +- include/ListView/ListViewDisplay.php | 143 +- include/ListView/ListViewFacade.php | 2 +- include/ListView/ListViewGeneric.tpl | 11 +- include/ListView/ListViewNoMassUpdate.tpl | 2 +- include/ListView/ListViewPagination.tpl | 2 +- include/ListView/ListViewSmarty.php | 19 +- include/ListView/ListViewXTPL.php | 2 +- include/Localization/Localization.php | 42 +- include/MVC/Controller/ControllerFactory.php | 2 +- include/MVC/Controller/SugarController.php | 11 +- include/MVC/Controller/action_file_map.php | 2 +- include/MVC/Controller/action_view_map.php | 2 +- .../MVC/Controller/entry_point_registry.php | 2 +- .../Controller/file_access_control_map.php | 2 +- include/MVC/SugarApplication.php | 136 +- include/MVC/SugarModule.php | 30 +- include/MVC/View/SugarView.php | 712 +- include/MVC/View/ViewFactory.php | 2 +- include/MVC/View/tpls/Importvcard.tpl | 4 +- include/MVC/View/tpls/modulelistmenu.tpl | 4 +- include/MVC/View/tpls/xsrf.tpl | 61 + include/MVC/View/views/view.ajax.php | 20 +- .../MVC/View/views/view.classic.config.php | 2 +- include/MVC/View/views/view.classic.php | 24 +- include/MVC/View/views/view.config.php | 2 +- include/MVC/View/views/view.detail.php | 2 +- include/MVC/View/views/view.edit.php | 7 +- include/MVC/View/views/view.html.php | 2 +- include/MVC/View/views/view.importvcard.php | 15 +- .../MVC/View/views/view.importvcardsave.php | 2 +- include/MVC/View/views/view.json.php | 2 +- include/MVC/View/views/view.list.php | 175 +- .../MVC/View/views/view.modulelistmenu.php | 2 +- include/MVC/View/views/view.multiedit.php | 2 +- include/MVC/View/views/view.noaccess.php | 20 +- include/MVC/View/views/view.popup.php | 2 +- include/MVC/View/views/view.quick.php | 2 +- include/MVC/View/views/view.quickcreate.php | 51 +- include/MVC/View/views/view.serialized.php | 2 +- .../MVC/View/views/view.sugarpdf.config.php | 2 +- include/MVC/View/views/view.sugarpdf.php | 2 +- include/MVC/View/views/view.vcard.php | 9 +- include/MVC/View/views/view.xml.php | 2 +- include/MassUpdate.php | 77 +- .../MySugar/DashletsDialog/DashletsDialog.php | 6 +- include/MySugar/MySugar.php | 219 +- include/MySugar/javascript/MySugar.js | 12 +- include/MySugar/tpls/MySugar.tpl | 17 +- include/MySugar/tpls/addDashletsDialog.tpl | 2 +- .../tpls/chartDashletsSearchResults.tpl | 4 +- .../MySugar/tpls/dashletsSearchResults.tpl | 4 +- include/MySugar/tpls/retrievePage.tpl | 2 +- include/MySugar/tpls/retrieveReportCharts.tpl | 4 +- include/OutboundEmail/OutboundEmail.php | 2 +- include/Popups/PopupSmarty.php | 7 +- include/Popups/Popup_picker.php | 2 +- include/Popups/tpls/PopupGeneric.tpl | 2 +- include/Popups/tpls/footer.tpl | 2 +- include/Popups/tpls/header.tpl | 2 +- include/QuickSearchDefaults.php | 2 +- include/SearchForm/SearchForm.php | 2 +- include/SearchForm/SearchForm2.php | 379 +- include/SearchForm/SugarSpot.php | 385 +- include/SearchForm/tpls/SearchFormGeneric.tpl | 21 +- .../tpls/SearchFormGenericAdvanced.tpl | 2 +- include/SearchForm/tpls/footer.tpl | 2 +- include/SearchForm/tpls/header.tpl | 2 +- include/Smarty/Config_File.class.php | 9 +- .../plugins/function.html_select_date.php | 6 +- .../Smarty/plugins/function.sugar_button.php | 14 +- .../function.sugar_connector_display.php | 2 +- .../Smarty/plugins/function.sugar_link.php | 2 +- .../Smarty/plugins/function.sugar_phone.php | 2 +- include/Smarty/plugins/function.sugarvar.php | 22 +- .../plugins/function.sugarvar_connector.php | 2 +- .../plugins/modifier.default_date_value.php | 5 +- include/Smarty/plugins/modifier.to_url.php | 2 +- include/SubPanel/SubPanel.php | 3 +- include/SubPanel/SubPanelDefinitions.php | 2 +- include/SubPanel/SubPanelDynamic.html | 2 +- include/SubPanel/SubPanelTiles.js | 2 +- include/SubPanel/SubPanelTiles.php | 2 +- include/SubPanel/SubPanelTilesTabs.php | 2 +- include/SubPanel/SubPanelViewer.php | 2 +- include/SubPanel/SugarTab.php | 42 +- include/SubPanel/registered_layout_defs.php | 2 +- include/SubPanel/subpanels.txt | 2 +- include/SubPanel/tpls/singletabmenu.tpl | 2 +- include/SugarCache/SugarCache.php | 181 + include/SugarCache/SugarCacheAPC.php | 104 + include/SugarCache/SugarCacheAbstract.php | 315 + include/SugarCache/SugarCacheFile.php | 149 + include/SugarCache/SugarCacheMemcache.php | 154 + include/SugarCache/SugarCacheMemcached.php | 143 + include/SugarCache/SugarCacheMemory.php | 98 + include/SugarCache/SugarCacheRedis.php | 175 + include/SugarCache/SugarCacheWincache.php | 104 + .../SugarCacheZend.php} | 99 +- include/SugarCache/SugarCachesMash.php | 100 + .../SugarCharts/Jit/FlashCanvas/canvas2png.js | 9 + .../Jit/FlashCanvas/flashcanvas.js | 8 + .../Jit/FlashCanvas/flashcanvas.swf | Bin 0 -> 21235 bytes include/SugarCharts/Jit/FlashCanvas/proxy.php | 73 + include/SugarCharts/Jit/FlashCanvas/save.php | 49 + include/SugarCharts/Jit/Jit.php | 88 + include/SugarCharts/Jit/JitReports.php | 217 + .../Jit/css/base.css} | 120 +- include/SugarCharts/Jit/js/Jit/jit.js | 501 + include/SugarCharts/Jit/js/mySugarCharts.js | 38 + include/SugarCharts/Jit/js/sugarCharts.js | 81 + .../Jit/tpls}/DashletGenericChartScript.tpl | 20 +- include/SugarCharts/Jit/tpls/chart.tpl | 76 + include/SugarCharts/JsChart.php | 678 + include/SugarCharts/SugarChart.php | 125 +- include/SugarCharts/SugarChartFactory.php | 94 + include/SugarCharts/tpls/chart.tpl | 72 - include/SugarDateTime.php | 598 + .../SugarDependentDropdown.php | 2 +- .../javascript/SugarDependentDropdown.js | 2 +- .../metadata/dependentDropdown.php | 2 +- .../SugarEmailAddress/SugarEmailAddress.js | 2 +- .../SugarEmailAddress/SugarEmailAddress.php | 50 +- .../templates/forDetailView.tpl | 14 +- .../templates/forDuplicatesView.tpl | 2 +- .../templates/forEditView.tpl | 2 +- .../templates/forWideFormBodyView.tpl | 2 +- .../SugarFields/Fields/Address/DetailView.tpl | 12 +- .../SugarFields/Fields/Address/EditView.tpl | 4 +- .../Fields/Address/SugarFieldAddress.js | 10 +- .../Fields/Address/SugarFieldAddress.php | 17 +- .../Fields/Address/en_us.DetailView.tpl | 14 +- .../Fields/Address/en_us.EditView.tpl | 4 +- .../Assigned_user_name/EditViewFunction.tpl | 38 + .../Fields/Assigned_user_name/SearchView.tpl | 2 +- .../SugarFieldAssigned_user_name.php | 6 +- .../SugarFields/Fields/Base/DetailView.tpl | 13 +- .../Fields/Base/DetailViewFunction.tpl | 2 +- include/SugarFields/Fields/Base/EditView.tpl | 2 +- .../Fields/Base/EditViewFunction.tpl | 2 +- .../Fields/Base/ImportViewFunction.tpl | 2 +- .../SugarFields/Fields/Base/InlineEdit.tpl | 2 +- .../Fields/Base/InlineEditView.tpl | 2 +- include/SugarFields/Fields/Base/ListView.tpl | 2 +- .../SugarFields/Fields/Base/SearchForm.tpl | 2 +- .../Fields/Base/SugarFieldBase.php | 135 +- .../SugarFields/Fields/Bool/DetailView.tpl | 4 +- include/SugarFields/Fields/Bool/EditView.tpl | 2 +- .../SugarFields/Fields/Bool/InlineEdit.tpl | 2 +- .../Fields/Bool/InlineEditView.tpl | 2 +- include/SugarFields/Fields/Bool/ListView.tpl | 5 +- .../SugarFields/Fields/Bool/SearchView.tpl | 2 +- .../Fields/Bool/SugarFieldBool.php | 49 +- .../Collection/CollectionDetailView.tpl | 2 +- .../Fields/Collection/CollectionEditView.tpl | 2 +- .../Collection/CollectionEditViewRow.tpl | 2 +- .../Fields/Collection/DetailView.tpl | 2 +- .../Fields/Collection/EditView.tpl | 2 +- .../Fields/Collection/SugarFieldCollection.js | 2 +- .../Collection/SugarFieldCollection.php | 6 +- .../Collection/ViewSugarFieldCollection.php | 51 +- .../Collection/view.sugarfieldcollection.php | 2 +- .../Fields/Currency/DetailView.tpl | 4 +- .../SugarFields/Fields/Currency/EditView.tpl | 2 +- .../SugarFields/Fields/Currency/ListView.tpl | 2 +- .../Fields/Currency/SugarFieldCurrency.php | 20 +- .../SugarFields/Fields/Datetime/EditView.tpl | 8 +- .../Fields/Datetime/SugarFieldDatetime.php | 141 +- .../Fields/Datetimecombo/Datetimecombo.js | 17 +- .../Fields/Datetimecombo/EditView.tpl | 26 +- .../Fields/Datetimecombo/RangeSearchForm.tpl | 167 + .../Fields/Datetimecombo/SearchView.tpl | 4 +- .../Datetimecombo/SugarFieldDatetimecombo.php | 91 +- .../Fields/Download/DetailView.tpl | 8 +- .../Fields/Download/SugarFieldDownload.php | 4 +- .../SugarFields/Fields/Enum/DetailView.tpl | 8 +- .../Fields/Enum/DetailViewFunction.tpl | 4 +- include/SugarFields/Fields/Enum/EditView.tpl | 2 +- .../Fields/Enum/EditViewFunction.tpl | 2 +- .../SugarFields/Fields/Enum/SearchView.tpl | 2 +- .../Fields/Enum/SugarFieldEnum.php | 55 +- .../SugarFields/Fields/File/DetailView.tpl | 16 +- include/SugarFields/Fields/File/EditView.tpl | 183 +- include/SugarFields/Fields/File/ListView.tpl | 48 + .../SugarFields/Fields/File/SearchView.tpl | 39 + .../SugarFields/Fields/File/SugarFieldFile.js | 45 + .../Fields/File/SugarFieldFile.php | 131 +- .../SugarFields/Fields/Float/DetailView.tpl | 4 +- include/SugarFields/Fields/Float/EditView.tpl | 2 +- .../Fields/Float/SugarFieldFloat.php | 26 +- .../Fields/Fullname/DetailView.tpl | 11 +- .../Fields/Fullname/SugarFieldFullname.php | 44 +- .../SugarFields/Fields/Html/DetailView.tpl | 6 +- .../Fields/Html/SugarFieldHtml.php | 8 +- .../SugarFields/Fields/Id/SugarFieldId.php | 46 +- .../SugarFields/Fields/Iframe/DetailView.tpl | 3 +- .../SugarFields/Fields/Iframe/EditView.tpl | 2 +- include/SugarFields/Fields/Int/DetailView.tpl | 4 +- include/SugarFields/Fields/Int/EditView.tpl | 2 +- .../Fields/Int/RangeSearchForm.tpl | 107 + include/SugarFields/Fields/Int/SearchForm.tpl | 2 +- .../SugarFields/Fields/Int/SugarFieldInt.php | 41 +- .../SugarFields/Fields/Link/DetailView.tpl | 10 +- include/SugarFields/Fields/Link/EditView.tpl | 2 +- include/SugarFields/Fields/Link/ListView.tpl | 2 +- .../Fields/Multienum/DetailView.tpl | 8 +- .../SugarFields/Fields/Multienum/EditView.tpl | 4 +- .../Fields/Multienum/EditViewFunction.tpl | 2 +- .../SugarFields/Fields/Multienum/ListView.tpl | 2 +- .../Fields/Multienum/SearchView.tpl | 2 +- .../Fields/Multienum/SugarFieldMultienum.php | 50 +- .../SugarFields/Fields/Parent/DetailView.tpl | 12 +- .../SugarFields/Fields/Parent/EditView.tpl | 2 +- .../SugarFields/Fields/Parent/SearchView.tpl | 2 +- .../Fields/Parent/SugarFieldParent.php | 38 +- .../SugarFields/Fields/Password/EditView.tpl | 2 +- .../Fields/Password/SugarFieldPassword.php | 56 + .../SugarFields/Fields/Phone/DetailView.tpl | 12 +- include/SugarFields/Fields/Phone/EditView.tpl | 50 + include/SugarFields/Fields/Phone/ListView.tpl | 5 +- .../Fields/Phone/SugarFieldPhone.php | 52 + .../Fields/Radioenum/DetailView.tpl | 8 +- .../SugarFields/Fields/Radioenum/EditView.tpl | 2 +- .../Fields/Readonly/SugarFieldReadonly.php | 2 +- .../SugarFields/Fields/Relate/DetailView.tpl | 4 +- .../SugarFields/Fields/Relate/EditView.tpl | 2 +- .../SugarFields/Fields/Relate/SearchView.tpl | 2 +- .../Fields/Relate/SugarFieldRelate.php | 125 +- .../Fields/Text/ClassicEditView.tpl | 2 +- .../SugarFields/Fields/Text/DetailView.tpl | 11 +- include/SugarFields/Fields/Text/EditView.tpl | 2 +- .../Fields/Text/SugarFieldText.php | 18 +- include/SugarFields/Fields/URL/DetailView.tpl | 12 +- include/SugarFields/Fields/URL/EditView.tpl | 2 +- include/SugarFields/Fields/URL/ListView.tpl | 2 +- .../Fields/Username/DetailView.tpl | 6 +- .../Fields/Username/SugarFieldUsername.php | 9 +- .../Parsers/DetailViewMetaParser.php | 2 +- .../Parsers/EditViewMetaParser.php | 2 +- include/SugarFields/Parsers/MetaParser.php | 5 +- .../Parsers/QuickCreateMetaParser.php | 2 +- .../Parsers/Rules/AccountsParseRule.php | 2 +- .../Parsers/Rules/ActivitiesParseRule.php | 2 +- .../SugarFields/Parsers/Rules/AddressRule.php | 2 +- .../SugarFields/Parsers/Rules/BaseRule.php | 2 +- .../Parsers/Rules/BugsParseRule.php | 2 +- .../Parsers/Rules/CallsParseRule.php | 2 +- .../Parsers/Rules/CampaignsParseRule.php | 2 +- .../Parsers/Rules/ContactsParseRule.php | 2 +- .../Parsers/Rules/ContractsParseRule.php | 2 +- .../Parsers/Rules/DocumentsParseRule.php | 2 +- .../Parsers/Rules/EmailAddressRule.php | 2 +- .../Parsers/Rules/EmptyRowRule.php | 2 +- .../Parsers/Rules/LeadsParseRule.php | 2 +- .../Parsers/Rules/MeetingsParseRule.php | 2 +- .../Parsers/Rules/NotesParseRule.php | 2 +- .../Parsers/Rules/OpportunitiesParseRule.php | 2 +- .../SugarFields/Parsers/Rules/ParseRules.php | 2 +- .../Parsers/Rules/ProductsParseRule.php | 2 +- .../Parsers/Rules/QuotesParseRule.php | 2 +- .../Parsers/Rules/UndefinedVardefRule.php | 2 +- .../Parsers/Rules/VariableCleanupRule.php | 2 +- .../Rules/VariableSubstitutionRule.php | 2 +- .../Parsers/SearchFormMetaParser.php | 2 +- include/SugarFields/SugarFieldHandler.php | 2 +- include/SugarFolders/SugarFolders.php | 66 +- include/SugarLogger/LoggerManager.php | 2 +- include/SugarLogger/LoggerTemplate.php | 2 +- include/SugarLogger/SugarLogger.php | 2 +- include/SugarOauth.php | 153 + include/SugarObjects/LanguageManager.php | 21 +- include/SugarObjects/SugarConfig.php | 2 +- include/SugarObjects/SugarRegistry.php | 2 +- include/SugarObjects/SugarSession.php | 2 +- include/SugarObjects/VardefManager.php | 66 +- .../assignable/language/en_us.lang.php | 2 +- .../implements/assignable/vardefs.php | 2 +- .../team_security/language/en_us.lang.php | 2 +- .../implements/team_security/vardefs.php | 4 +- .../SugarObjects/templates/basic/Basic.php | 22 +- .../Dashlets/Dashlet/m-n-Dashlet.meta.php | 2 +- .../basic/Dashlets/Dashlet/m-n-Dashlet.php | 2 +- .../templates/basic/language/en_us.lang.php | 2 +- .../templates/basic/metadata/SearchFields.php | 11 +- .../basic/metadata/dashletviewdefs.php | 2 +- .../basic/metadata/detailviewdefs.php | 2 +- .../templates/basic/metadata/editviewdefs.php | 2 +- .../templates/basic/metadata/listviewdefs.php | 2 +- .../templates/basic/metadata/metafiles.php | 2 +- .../templates/basic/metadata/popupdefs.php | 2 +- .../basic/metadata/quickcreatedefs.php | 2 +- .../templates/basic/metadata/searchdefs.php | 5 +- .../basic/metadata/subpanels/default.php | 2 +- .../SugarObjects/templates/basic/vardefs.php | 6 +- .../templates/company/Company.php | 2 +- .../SugarObjects/templates/company/config.php | 2 +- .../language/application/en_us.lang.php | 2 +- .../templates/company/language/en_us.lang.php | 14 +- .../company/metadata/SearchFields.php | 21 +- .../company/metadata/dashletviewdefs.php | 2 +- .../company/metadata/detailviewdefs.php | 2 +- .../company/metadata/editviewdefs.php | 2 +- .../company/metadata/listviewdefs.php | 2 +- .../templates/company/metadata/metafiles.php | 2 +- .../templates/company/metadata/popupdefs.php | 2 +- .../company/metadata/quickcreatedefs.php | 2 +- .../templates/company/metadata/searchdefs.php | 3 +- .../company/metadata/subpanels/default.php | 2 +- .../templates/company/vardefs.php | 2 +- include/SugarObjects/templates/file/File.php | 75 +- .../templates/file/controller.php | 2 +- .../file/language/application/en_us.lang.php | 2 +- .../templates/file/language/en_us.lang.php | 6 +- .../templates/file/metadata/SearchFields.php | 15 +- .../file/metadata/dashletviewdefs.php | 2 +- .../file/metadata/detailviewdefs.php | 2 +- .../templates/file/metadata/editviewdefs.php | 15 +- .../templates/file/metadata/listviewdefs.php | 2 +- .../templates/file/metadata/metafiles.php | 2 +- .../file/metadata/quickcreatedefs.php | 8 +- .../templates/file/metadata/searchdefs.php | 4 +- .../file/metadata/subpanels/default.php | 2 +- .../SugarObjects/templates/file/vardefs.php | 7 +- .../templates/file/views/view.edit.php | 4 +- .../SugarObjects/templates/issue/Issue.php | 2 +- .../SugarObjects/templates/issue/config.php | 2 +- .../issue/language/application/en_us.lang.php | 7 +- .../templates/issue/language/en_us.lang.php | 2 +- .../templates/issue/metadata/SearchFields.php | 17 +- .../issue/metadata/dashletviewdefs.php | 2 +- .../issue/metadata/detailviewdefs.php | 11 +- .../templates/issue/metadata/editviewdefs.php | 2 +- .../templates/issue/metadata/listviewdefs.php | 2 +- .../templates/issue/metadata/metafiles.php | 2 +- .../templates/issue/metadata/popupdefs.php | 2 +- .../issue/metadata/quickcreatedefs.php | 2 +- .../templates/issue/metadata/searchdefs.php | 4 +- .../issue/metadata/subpanels/default.php | 2 +- .../SugarObjects/templates/issue/vardefs.php | 2 +- .../SugarObjects/templates/person/Person.php | 2 +- .../SugarObjects/templates/person/config.php | 2 +- .../templates/person/language/en_us.lang.php | 3 +- .../person/metadata/SearchFields.php | 20 +- .../person/metadata/dashletviewdefs.php | 2 +- .../person/metadata/detailviewdefs.php | 2 +- .../person/metadata/editviewdefs.php | 2 +- .../person/metadata/listviewdefs.php | 2 +- .../templates/person/metadata/metafiles.php | 2 +- .../templates/person/metadata/popupdefs.php | 2 +- .../person/metadata/quickcreatedefs.php | 2 +- .../templates/person/metadata/searchdefs.php | 4 +- .../person/metadata/subpanels/default.php | 2 +- .../SugarObjects/templates/person/vardefs.php | 2 +- .../SugarObjects/templates/sale/Chance.php | 2 +- include/SugarObjects/templates/sale/Sale.php | 2 +- .../SugarObjects/templates/sale/config.php | 2 +- .../sale/language/application/en_us.lang.php | 2 +- .../templates/sale/language/en_us.lang.php | 2 +- .../templates/sale/metadata/SearchFields.php | 20 +- .../sale/metadata/dashletviewdefs.php | 2 +- .../sale/metadata/detailviewdefs.php | 11 +- .../templates/sale/metadata/editviewdefs.php | 2 +- .../templates/sale/metadata/listviewdefs.php | 2 +- .../templates/sale/metadata/metafiles.php | 2 +- .../templates/sale/metadata/popupdefs.php | 2 +- .../sale/metadata/quickcreatedefs.php | 2 +- .../templates/sale/metadata/searchdefs.php | 5 +- .../sale/metadata/subpanels/default.php | 2 +- .../SugarObjects/templates/sale/vardefs.php | 7 +- include/SugarPHPMailer.php | 2 +- include/SugarTabs/SugarTab.php | 101 - include/SugarTabs/tpls/singletabmenu.tpl | 220 - include/SugarTheme/SugarTheme.php | 100 +- include/SugarTheme/getImage.php | 26 +- include/SugarTinyMCE.php | 3 +- include/Sugar_Smarty.php | 2 +- include/Sugarpdf/FontManager.php | 2 +- include/Sugarpdf/Sugarpdf.php | 2 +- include/Sugarpdf/SugarpdfFactory.php | 2 +- include/Sugarpdf/SugarpdfHelper.php | 2 +- include/Sugarpdf/sugarpdf/sugarpdf.smarty.php | 2 +- include/Sugarpdf/sugarpdf_config.php | 2 +- include/Sugarpdf/sugarpdf_default.php | 2 +- include/TemplateHandler/TemplateHandler.php | 17 +- include/TimeDate.php | 2659 +- include/VarDefHandler/SugarTabs/SugarTab.php | 101 - .../SugarTabs/tpls/singletabmenu.tpl | 220 - include/VarDefHandler/VarDefHandler.php | 2 +- include/VarDefHandler/listvardefoverride.php | 2 +- include/VarDefHandler/vardef_meta_arrays.php | 4 +- include/charts/Charts.php | 127 - include/charts/hBarF.swf | Bin 6517 -> 0 bytes include/charts/hBarS.swf | Bin 5844 -> 0 bytes include/charts/lineF.swf | Bin 8187 -> 0 bytes include/charts/pieF.swf | Bin 5805 -> 0 bytes include/charts/vBarF.swf | Bin 6814 -> 0 bytes include/connectors/ConnectorFactory.php | 2 +- include/connectors/component.php | 96 +- include/connectors/filters/FilterFactory.php | 2 +- include/connectors/filters/default/filter.php | 2 +- .../formatters/FormatterFactory.php | 2 +- .../formatters/default/company_detail.js | 2 +- .../formatters/default/formatter.php | 2 +- .../formatters/ext/rest/tpls/default.tpl | 2 +- .../formatters/ext/soap/tpls/default.tpl | 2 +- include/connectors/sources/SourceFactory.php | 2 +- include/connectors/sources/default/source.php | 30 +- include/connectors/sources/ext/rest/rest.php | 2 +- include/connectors/sources/ext/soap/soap.php | 2 +- include/connectors/sources/loc/xml.php | 2 +- include/connectors/utils/ConnectorUtils.php | 468 +- include/contextMenus/contextMenu.php | 2 +- .../contextMenus/menuDefs/sugarAccount.php | 2 +- include/contextMenus/menuDefs/sugarObject.php | 2 +- include/contextMenus/menuDefs/sugarPerson.php | 2 +- include/controller/Controller.php | 2 +- include/database/DBHelper.php | 9 +- include/database/DBManager.php | 14 +- include/database/DBManagerFactory.php | 6 +- include/database/FreeTDSHelper.php | 2 +- include/database/FreeTDSManager.php | 2 +- include/database/MssqlHelper.php | 32 +- include/database/MssqlManager.php | 46 +- include/database/MysqlHelper.php | 125 +- include/database/MysqlManager.php | 143 +- include/database/MysqliHelper.php | 2 +- include/database/MysqliManager.php | 14 +- include/database/PearDatabase.php | 2 +- include/database/SqlsrvHelper.php | 94 +- include/database/SqlsrvManager.php | 124 +- include/dir_inc.php | 28 +- include/entryPoint.php | 13 +- include/export_utils.php | 2 +- include/externalAPI/Base/ExternalAPIBase.php | 243 + .../externalAPI/Base/ExternalAPIPlugin.php | 61 + .../Base/ExternalOAuthAPIPlugin.php | 59 + include/externalAPI/Base/OAuthPluginBase.php | 199 + include/externalAPI/Base/WebDocument.php | 44 + include/externalAPI/Base/WebFeed.php | 40 + include/externalAPI/Base/WebMeeting.php | 45 + include/externalAPI/ExternalAPIFactory.php | 291 + include/formbase.php | 2 +- include/generic/DeleteRelationship.php | 20 +- include/generic/LayoutManager.php | 11 +- include/generic/Save2.php | 2 +- include/generic/SugarWidgets/SugarWidget.php | 2 +- .../generic/SugarWidgets/SugarWidgetField.php | 15 +- .../SugarWidgets/SugarWidgetFieldbool.php | 28 +- .../SugarWidgets/SugarWidgetFieldchar.php | 2 +- .../SugarWidgets/SugarWidgetFieldcurrency.php | 35 +- .../SugarWidgets/SugarWidgetFielddate.php | 2 +- .../SugarWidgetFielddatepicker.php | 2 +- .../SugarWidgets/SugarWidgetFielddatetime.php | 120 +- .../SugarWidgetFielddatetimecombo.php | 4 +- .../SugarWidgets/SugarWidgetFielddecimal.php | 2 +- .../SugarWidgets/SugarWidgetFielddouble.php | 2 +- .../SugarWidgets/SugarWidgetFieldemail.php | 2 +- .../SugarWidgets/SugarWidgetFieldenum.php | 2 +- .../SugarWidgets/SugarWidgetFieldfile.php | 14 +- .../SugarWidgets/SugarWidgetFieldfloat.php | 2 +- .../SugarWidgets/SugarWidgetFieldfullname.php | 2 +- .../SugarWidgets/SugarWidgetFieldid.php | 2 +- .../SugarWidgets/SugarWidgetFieldimage.php | 2 +- .../SugarWidgets/SugarWidgetFieldint.php | 2 +- .../SugarWidgets/SugarWidgetFieldlongtext.php | 2 +- .../SugarWidgetFieldmultienum.php | 2 +- .../SugarWidgets/SugarWidgetFieldname.php | 2 +- .../SugarWidgets/SugarWidgetFieldnum.php | 2 +- .../SugarWidgetFieldparent_type.php | 2 +- .../SugarWidgets/SugarWidgetFieldphone.php | 2 +- .../SugarWidgetFieldradioenum.php | 2 +- .../SugarWidgets/SugarWidgetFieldrelate.php | 2 +- .../SugarWidgetFieldsingleenum.php | 2 +- .../SugarWidgets/SugarWidgetFieldtext.php | 2 +- .../SugarWidgets/SugarWidgetFieldtime.php | 2 +- .../SugarWidgets/SugarWidgetFieldurl.php | 2 +- .../SugarWidgetFielduser_name.php | 2 +- .../SugarWidgets/SugarWidgetFieldvarchar.php | 2 +- .../SugarWidgets/SugarWidgetReportField.php | 2 +- ...garWidgetSubPanelActivitiesStatusField.php | 2 +- .../SugarWidgetSubPanelCloseButton.php | 2 +- .../SugarWidgetSubPanelConcat.php | 2 +- .../SugarWidgetSubPanelDetailViewLink.php | 2 +- .../SugarWidgetSubPanelEditButton.php | 2 +- .../SugarWidgetSubPanelEditRoleButton.php | 2 +- .../SugarWidgetSubPanelEmailLink.php | 33 +- .../SugarWidgetSubPanelGetLatestButton.php | 2 +- .../SugarWidgets/SugarWidgetSubPanelIcon.php | 66 +- .../SugarWidgetSubPanelLoadSignedButton.php | 2 +- .../SugarWidgetSubPanelRemoveButton.php | 11 +- ...ugarWidgetSubPanelRemoveButtonMeetings.php | 2 +- ...ugarWidgetSubPanelRemoveButtonProjects.php | 2 +- ...garWidgetSubPanelTopArchiveEmailButton.php | 2 +- .../SugarWidgetSubPanelTopButton.php | 92 +- ...ugarWidgetSubPanelTopButtonQuickCreate.php | 2 +- ...garWidgetSubPanelTopComposeEmailButton.php | 2 +- ...dgetSubPanelTopCreateAccountNameButton.php | 2 +- ...ubPanelTopCreateCampaignLogEntryButton.php | 2 +- ...rWidgetSubPanelTopCreateLeadNameButton.php | 2 +- ...SugarWidgetSubPanelTopCreateNoteButton.php | 12 +- ...SugarWidgetSubPanelTopCreateTaskButton.php | 12 +- ...garWidgetSubPanelTopScheduleCallButton.php | 11 +- ...WidgetSubPanelTopScheduleMeetingButton.php | 12 +- .../SugarWidgetSubPanelTopSelectButton.php | 2 +- ...rWidgetSubPanelTopSelectContactsButton.php | 2 +- ...ugarWidgetSubPanelTopSelectUsersButton.php | 7 +- .../SugarWidgetSubPanelTopSummaryButton.php | 2 +- include/globalControlLinks.php | 14 +- include/images/1.gif | Bin 0 -> 2603 bytes include/images/default_user_feed_picture.png | Bin 0 -> 3821 bytes include/images/seed_chris_id.gif | Bin 0 -> 3037 bytes include/images/seed_jim_id.gif | Bin 0 -> 2885 bytes include/images/seed_max_id.gif | Bin 0 -> 3090 bytes include/images/seed_sally_id.gif | Bin 0 -> 3315 bytes include/images/seed_sarah_id.gif | Bin 0 -> 3015 bytes include/images/seed_will_id.gif | Bin 0 -> 3210 bytes include/javascript/calendar.js | 79 + include/javascript/cookie.js | 2 +- include/javascript/dashlets.js | 5 +- include/javascript/getYUIComboFile.php | 16 +- include/javascript/iscroll.js | 66 + include/javascript/javascript.php | 50 +- include/javascript/jsAlerts.php | 139 +- include/javascript/jsclass_async.js | 2 +- include/javascript/jsclass_base.js | 2 +- include/javascript/menu.js | 2 +- include/javascript/popup_helper.js | 2 +- include/javascript/popup_parent_helper.js | 4 +- include/javascript/quicksearch.js | 17 +- include/javascript/report_additionals.js | 2 +- include/javascript/sugar_3.js | 49 +- .../sugar_connection_event_listener.js | 2 +- include/javascript/sugar_grp1.js | 535 +- include/javascript/sugar_grp1_yui.js | 7315 +++++- include/javascript/sugar_grp_emails.js | 82 +- include/javascript/sugar_grp_quickcomp.js | 33 +- include/javascript/sugar_grp_yui_widgets.css | 10 + include/javascript/sugar_grp_yui_widgets.js | 21 +- .../javascript/sugarwidgets/SugarYUILoader.js | 2 +- .../sugarwidgets/SugarYUIWidgets.js | 2 +- include/javascript/swfobject.js | 4 +- .../yui/build/calendar/assets/calendar.css | 5 +- .../assets/skins/sam/calendar-skin.css | 1 + include/json_config.php | 72 +- include/language/en_us.lang.php | 158 +- include/language/en_us.notify_template.html | 5 +- include/language/jsLanguage.php | 2 +- include/modules.php | 31 +- include/nusoap/class.wsdl.php | 297 +- include/nusoap/nusoap.php | 589 +- include/nusoap/nusoapmime.php | 54 +- include/pdf/LICENSE | 21 - include/pdf/class.ezpdf.php | 1666 -- include/pdf/class.pdf.php | 3082 --- .../resource/Observers/ResourceObserver.php | 2 +- .../Observers/SoapResourceObserver.php | 2 +- .../Observers/WebResourceObserver.php | 2 +- include/resource/ResourceManager.php | 2 +- include/tabConfig.php | 12 +- include/tabs.php | 2 +- include/tcpdf/fonts/utils/makefont.php | 12 +- include/templates/Template.php | 2 +- include/templates/TemplateDragDropChooser.php | 4 +- include/templates/TemplateGroupChooser.php | 2 +- include/timezone/timezones.php | 2 +- include/upload_file.php | 55 +- include/utils.php | 95 +- include/utils/LogicHook.php | 39 +- include/utils/activity_utils.php | 2 +- include/utils/array_utils.php | 12 +- include/utils/autoloader.php | 2 +- include/utils/db_utils.php | 51 +- include/utils/encryption_utils.php | 2 +- include/utils/external_cache.php | 223 +- include/utils/external_cache/SugarCache.php | 229 - .../utils/external_cache/SugarCache_Base.php | 151 - .../SugarCache_ExternalAbstract.php | 146 - .../external_cache/SugarCache_Memcache.php | 129 - include/utils/file_utils.php | 103 +- include/utils/layout_utils.php | 114 +- include/utils/logic_utils.php | 2 +- include/utils/mvc_utils.php | 4 +- include/utils/php_zip_utils.php | 136 + include/utils/progress_bar_utils.php | 2 +- include/utils/security_utils.php | 2 +- include/utils/sugar_file_utils.php | 61 +- include/utils/zip_utils.php | 67 +- include/vCard.php | 173 +- include/ytree/ExtNode.php | 2 +- include/ytree/Node.php | 2 +- include/ytree/Tree.php | 2 +- include/ytree/treeutil.js | 2 +- index.php | 2 +- install.php | 8 +- install/TeamDemoData.php | 2 +- install/UploadLangFileCheck.php | 6 +- install/UserDemoData.php | 18 +- install/checkDBSettings.php | 2 +- install/confirmSettings.php | 154 +- install/data/disc_client.php | 2 +- install/dbConfig.js | 2 +- install/dbConfig_a.php | 4 +- install/demoData.en_us.php | 48 +- install/download_modules.php | 2 +- install/download_patches.php | 2 +- install/install.css | 2 +- install/installCommon.js | 2 +- install/installDisabled.php | 2 +- install/installHelp.php | 2 +- install/installSystemCheck.php | 16 +- install/installType.php | 2 +- install/install_defaults.php | 2 +- install/install_utils.php | 152 +- install/language/en_us.lang.php | 37 +- install/license.js | 2 +- install/license.php | 2 +- install/licensePrint.php | 2 +- install/oc_convert.js | 2 +- install/oc_install.js | 2 +- install/performSetup.php | 10 +- install/populateSeedData.php | 68 +- install/ready.php | 2 +- install/register.js | 2 +- install/register.php | 2 +- .../seed_data/Advanced_Password_SeedData.php | 76 +- install/seed_data/basicSeedData.php | 87 - install/seed_data/quotes_SeedData.php | 2 +- install/siteConfig.js | 2 +- install/siteConfig_a.php | 2 +- install/siteConfig_b.php | 2 +- install/systemOptions.php | 2 +- install/welcome.php | 2 +- jscalendar/calendar-setup_3.js | 51 - jscalendar/calendar-win2k-cold-1.css | 291 - jscalendar/calendar.js | 202 - jscalendar/img.gif | Bin 223 -> 0 bytes jscalendar/lang/calendar-af.js | 65 - jscalendar/lang/calendar-bg.js | 134 - jscalendar/lang/calendar-br.js | 73 - jscalendar/lang/calendar-ca.js | 73 - jscalendar/lang/calendar-cs-win.js | 62 - jscalendar/lang/calendar-da.js | 91 - jscalendar/lang/calendar-de.js | 131 - jscalendar/lang/calendar-du.js | 71 - jscalendar/lang/calendar-el.js | 117 - jscalendar/lang/calendar-en.js | 149 - jscalendar/lang/calendar-es.js | 160 - jscalendar/lang/calendar-fi.js | 126 - jscalendar/lang/calendar-fr.js | 152 - jscalendar/lang/calendar-hr-utf8.js | 75 - jscalendar/lang/calendar-hr.js | 77 - jscalendar/lang/calendar-hu.js | 73 - jscalendar/lang/calendar-it.js | 110 - jscalendar/lang/calendar-ja.js | 114 - jscalendar/lang/calendar-jp.js | 134 - jscalendar/lang/calendar-ko-utf8.js | 146 - jscalendar/lang/calendar-ko.js | 148 - jscalendar/lang/calendar-lt-utf8.js | 140 - jscalendar/lang/calendar-lt.js | 142 - jscalendar/lang/calendar-nl.js | 71 - jscalendar/lang/calendar-no.js | 73 - jscalendar/lang/calendar-pl-utf8.js | 119 - jscalendar/lang/calendar-pl.js | 82 - jscalendar/lang/calendar-pt.js | 76 - jscalendar/lang/calendar-ro.js | 92 - jscalendar/lang/calendar-ru.js | 101 - jscalendar/lang/calendar-si.js | 120 - jscalendar/lang/calendar-sk.js | 125 - jscalendar/lang/calendar-sp.js | 91 - jscalendar/lang/calendar-sv.js | 121 - jscalendar/lang/calendar-tr.js | 86 - jscalendar/lang/calendar-zh.js | 152 - jscalendar/license.txt | 461 - jscalendar/menuarrow.gif | Bin 68 -> 0 bytes jscalendar/menuarrow2.gif | Bin 49 -> 0 bytes json.php | 2 +- json_server.php | 140 +- jssource/JSGroupings.php | 11 +- jssource/minify_utils.php | 3 +- jssource/src_files/include/JSON.js | 2 +- .../include/MySugar/javascript/MySugar.js | 60 +- .../include/SubPanel/SubPanelTiles.js | 2 +- .../SugarCharts/Jit/FlashCanvas/canvas2png.js | 42 + .../Jit/FlashCanvas/flashcanvas.js | 28 + .../include/SugarCharts/Jit/js/Jit/jit.js | 20763 +++++++++++++++ .../SugarCharts/Jit/js/mySugarCharts.js | 112 + .../include/SugarCharts/Jit/js/sugarCharts.js | 832 + .../javascript/SugarDependentDropdown.js | 2 +- .../SugarEmailAddress/SugarEmailAddress.js | 2 +- .../Fields/Address/SugarFieldAddress.js | 15 +- .../Fields/Collection/SugarFieldCollection.js | 2 +- .../Fields/Datetimecombo/Datetimecombo.js | 28 +- .../SugarFields/Fields/File/SugarFieldFile.js | 212 + .../formatters/default/company_detail.js | 2 +- .../src_files/include/javascript/calendar.js | 294 + .../src_files/include/javascript/cookie.js | 2 +- .../src_files/include/javascript/dashlets.js | 15 +- .../src_files/include/javascript/iscroll.js | 725 + .../include/javascript/jsclass_async.js | 2 +- .../include/javascript/jsclass_base.js | 2 +- jssource/src_files/include/javascript/menu.js | 2 +- .../include/javascript/popup_helper.js | 2 +- .../include/javascript/popup_parent_helper.js | 7 +- .../include/javascript/quicksearch.js | 100 +- .../include/javascript/report_additionals.js | 2 +- .../src_files/include/javascript/sugar_3.js | 128 +- .../sugar_connection_event_listener.js | 2 +- .../javascript/sugarwidgets/SugarYUILoader.js | 2 +- .../sugarwidgets/SugarYUIWidgets.js | 2 +- .../src_files/include/javascript/swfobject.js | 4 +- jssource/src_files/include/ytree/treeutil.js | 2 +- jssource/src_files/install/dbConfig.js | 2 +- jssource/src_files/install/installCommon.js | 2 +- jssource/src_files/install/license.js | 2 +- jssource/src_files/install/oc_convert.js | 2 +- jssource/src_files/install/oc_install.js | 2 +- jssource/src_files/install/register.js | 2 +- jssource/src_files/install/siteConfig.js | 2 +- .../src_files/jscalendar/calendar-setup_3.js | 239 - jssource/src_files/jscalendar/calendar.js | 1778 -- .../src_files/modules/ACLRoles/ACLRoles.js | 2 +- .../src_files/modules/Accounts/Account.js | 2 +- .../javascript/Administration.js | 2 +- .../Administration/javascript/Async.js | 2 +- .../src_files/modules/Campaigns/DetailView.js | 2 +- .../src_files/modules/Campaigns/WebToLead.js | 2 +- .../src_files/modules/Campaigns/wizard.js | 2 +- .../src_files/modules/Connectors/Connector.js | 2 +- .../src_files/modules/Contacts/Contact.js | 2 +- .../src_files/modules/Currencies/EditView.js | 2 +- .../src_files/modules/Documents/documents.js | 10 +- jssource/src_files/modules/EAPM/EAPMEdit.js | 147 + .../modules/EmailTemplates/EmailTemplate.js | 30 +- jssource/src_files/modules/Home/about.js | 2 +- .../modules/InboundEmail/InboundEmail.js | 7 +- jssource/src_files/modules/Leads/Lead.js | 2 +- .../modules/Meetings/jsclass_scheduler.js | 2 +- .../src_files/modules/MergeRecords/Merge.js | 2 +- jssource/src_files/modules/Project/Project.js | 2 +- .../modules/ProjectTask/ProjectTask.js | 2 +- .../src_files/modules/Studio/JSTransaction.js | 2 +- jssource/src_files/modules/Studio/studio.js | 2 +- jssource/src_files/modules/Studio/studiodd.js | 2 +- .../modules/Studio/studiotabgroups.js | 2 +- .../modules/Studio/ygDDListStudio.js | 2 +- .../modules/UpgradeWizard/upgradeWizard.js | 2 +- .../src_files/modules/Users/DetailView.js | 2 +- .../modules/Users/PasswordRequirementBox.js | 2 +- jssource/src_files/modules/Users/User.js | 2 +- jssource/src_files/modules/Users/login.js | 2 +- jssource/src_files/service/utils/SugarRest.js | 2 +- jssource/src_files/themes/Sugar5/js/style.js | 152 +- jssource/src_files/themes/default/js/style.js | 2 +- leadCapture.php | 2 +- log_file_restricted.html | 2 +- maintenance.php | 2 +- metadata/accounts_bugsMetaData.php | 2 +- metadata/accounts_casesMetaData.php | 2 +- metadata/accounts_contactsMetaData.php | 2 +- metadata/accounts_opportunitiesMetaData.php | 2 +- metadata/acl_roles_actionsMetaData.php | 2 +- metadata/acl_roles_usersMetaData.php | 2 +- metadata/addressBookMetaData.php | 2 +- metadata/audit_templateMetaData.php | 2 +- metadata/calls_contactsMetaData.php | 2 +- metadata/calls_leadsMetaData.php | 2 +- metadata/calls_usersMetaData.php | 2 +- metadata/cases_bugsMetaData.php | 2 +- metadata/configMetaData.php | 2 +- metadata/contacts_bugsMetaData.php | 2 +- metadata/contacts_casesMetaData.php | 2 +- metadata/contacts_usersMetaData.php | 2 +- metadata/custom_fieldsMetaData.php | 2 +- metadata/documents_accountsMetaData.php | 124 + metadata/documents_bugsMetaData.php | 124 + metadata/documents_casesMetaData.php | 124 + metadata/documents_contactsMetaData.php | 124 + metadata/documents_opportunitiesMetaData.php | 124 + metadata/email_addressesMetaData.php | 4 +- metadata/email_cacheMetaData.php | 2 +- ...email_marketing_prospect_listsMetaData.php | 2 +- metadata/emails_beansMetaData.php | 4 +- metadata/fields_meta_dataMetaData.php | 2 +- metadata/foldersMetaData.php | 2 +- metadata/import_mapsMetaData.php | 2 +- metadata/inboundEmail_autoreplyMetaData.php | 2 +- .../inboundEmail_cacheTimestampMetaData.php | 2 +- .../kbdocuments_views_ratingsMetaData.php | 2 +- metadata/linked_documentsMetaData.php | 2 +- metadata/meetings_contactsMetaData.php | 2 +- metadata/meetings_leadsMetaData.php | 2 +- metadata/meetings_usersMetaData.php | 2 +- metadata/opportunities_contactsMetaData.php | 2 +- metadata/outboundEmailMetaData.php | 2 +- metadata/project_bugsMetaData.php | 2 +- metadata/project_casesMetaData.php | 2 +- metadata/project_productsMetaData.php | 2 +- metadata/project_relationMetaData.php | 2 +- .../project_task_project_tasksMetaData.php | 2 +- metadata/projects_accountsMetaData.php | 2 +- metadata/projects_contactsMetaData.php | 2 +- metadata/projects_opportunitiesMetaData.php | 2 +- metadata/projects_quotesMetaData.php | 2 +- metadata/prospect_list_campaignsMetaData.php | 2 +- metadata/prospect_lists_prospectsMetaData.php | 2 +- metadata/queues_beansMetaData.php | 2 +- metadata/queues_queueMetaData.php | 2 +- metadata/roles_modulesMetaData.php | 2 +- metadata/roles_usersMetaData.php | 2 +- metadata/schedulers_timesMetaData.php | 2 +- metadata/user_feedsMetaData.php | 2 +- metadata/usersMetaData.php | 2 +- metadata/users_last_importMetaData.php | 2 +- metadata/users_passwordLinkMetaData.php | 2 +- metadata/users_signaturesMetaData.php | 2 +- metagen.php | 2 +- modules/ACL/ACLController.php | 66 +- modules/ACL/ACLJSController.php | 2 +- modules/ACL/List.php | 2 +- modules/ACL/Menu.php | 2 +- modules/ACL/Save.php | 2 +- modules/ACL/install_actions.php | 48 +- modules/ACL/language/en_us.lang.php | 2 +- modules/ACL/metadata/subpaneldefs.php | 2 +- modules/ACL/remove_actions.php | 2 +- modules/ACL/vardefs.php | 2 +- modules/ACLActions/ACLAction.php | 848 +- modules/ACLActions/Menu.php | 2 +- modules/ACLActions/actiondefs.php | 2 +- modules/ACLActions/language/en_us.lang.php | 2 +- modules/ACLActions/metadata/subpaneldefs.php | 2 +- modules/ACLActions/vardefs.php | 2 +- modules/ACLRoles/ACLRole.php | 335 +- modules/ACLRoles/ACLRoles.js | 2 +- modules/ACLRoles/Delete.php | 2 +- modules/ACLRoles/DetailUserRole.php | 92 +- modules/ACLRoles/DetailView.php | 2 +- modules/ACLRoles/DetailView.tpl | 2 +- modules/ACLRoles/DetailViewBody.tpl | 2 +- modules/ACLRoles/DetailViewUser.tpl | 2 +- modules/ACLRoles/EditAllBody.tpl | 4 +- modules/ACLRoles/EditRole.php | 4 +- modules/ACLRoles/EditRole.tpl | 4 +- modules/ACLRoles/EditView.php | 2 +- modules/ACLRoles/EditView.tpl | 2 +- modules/ACLRoles/EditViewBody.tpl | 2 +- modules/ACLRoles/ListUsers.php | 4 +- modules/ACLRoles/Menu.php | 2 +- modules/ACLRoles/Popup_picker.html | 2 +- modules/ACLRoles/Popup_picker.php | 2 +- modules/ACLRoles/Save.php | 2 +- modules/ACLRoles/language/en_us.lang.php | 3 +- modules/ACLRoles/metadata/SearchFields.php | 2 +- modules/ACLRoles/metadata/listviewdefs.php | 2 +- modules/ACLRoles/metadata/popupdefs.php | 2 +- modules/ACLRoles/metadata/searchdefs.php | 3 +- modules/ACLRoles/metadata/subpaneldefs.php | 6 +- modules/ACLRoles/metadata/subpanels/admin.php | 2 +- .../ACLRoles/metadata/subpanels/default.php | 2 +- modules/ACLRoles/popup.tpl | 2 +- modules/ACLRoles/vardefs.php | 2 +- modules/ACLRoles/views/view.list.php | 2 +- modules/Accounts/Account.js | 2 +- modules/Accounts/Account.php | 73 +- modules/Accounts/AccountFormBase.php | 19 +- modules/Accounts/AccountsQuickCreate.php | 2 +- .../MyAccountsDashlet.data.php | 2 +- .../MyAccountsDashlet.meta.php | 2 +- .../MyAccountsDashlet/MyAccountsDashlet.php | 2 +- modules/Accounts/Menu.php | 2 +- modules/Accounts/Popup_picker.html | 2 +- modules/Accounts/Save.php | 2 +- modules/Accounts/ShowDuplicates.html | 2 +- modules/Accounts/ShowDuplicates.php | 12 +- modules/Accounts/field_arrays.php | 2 +- modules/Accounts/language/en_us.lang.php | 7 +- modules/Accounts/metadata/SearchFields.php | 12 +- modules/Accounts/metadata/acldefs.php | 2 +- .../Accounts/metadata/additionalDetails.php | 6 +- modules/Accounts/metadata/detailviewdefs.php | 17 +- modules/Accounts/metadata/editviewdefs.php | 4 +- modules/Accounts/metadata/fieldGroups.php | 2 +- modules/Accounts/metadata/listviewdefs.php | 14 +- modules/Accounts/metadata/metafiles.php | 2 +- modules/Accounts/metadata/popupdefs.php | 27 +- modules/Accounts/metadata/quickcreatedefs.php | 2 +- modules/Accounts/metadata/searchdefs.php | 3 +- modules/Accounts/metadata/studio.php | 2 +- modules/Accounts/metadata/subpaneldefs.php | 35 +- .../Accounts/metadata/subpanels/ForEmails.php | 2 +- .../metadata/subpanels/ForProspectLists.php | 2 +- .../Accounts/metadata/subpanels/default.php | 2 +- modules/Accounts/tpls/QuickCreate.tpl | 2 +- modules/Accounts/vardefs.php | 56 +- modules/Accounts/views/view.detail.php | 6 +- modules/Accounts/views/view.list.php | 48 + modules/Activities/Forms.php | 2 +- modules/Activities/Menu.php | 2 +- modules/Activities/OpenListView.html | 2 +- modules/Activities/OpenListView.php | 70 +- modules/Activities/Popup_picker.html | 40 +- modules/Activities/Popup_picker.php | 202 +- modules/Activities/SetAcceptStatus.php | 2 +- modules/Activities/SubPanelView.html | 2 +- modules/Activities/SubPanelView.php | 2 +- modules/Activities/SubPanelViewContacts.html | 2 +- modules/Activities/config.php | 2 +- modules/Activities/language/en_us.lang.php | 3 +- modules/Activities/metadata/subpaneldefs.php | 2 +- modules/Activities/views/view.list.php | 2 +- .../Activities/views/view.modulelistmenu.php | 2 +- modules/Administration/Administration.php | 178 +- modules/Administration/Async.php | 2 +- modules/Administration/Backups.php | 155 - modules/Administration/Common.php | 56 +- .../Administration/ConfigureShortcutBar.php | 127 - modules/Administration/CustomizeFields.php | 5 +- modules/Administration/Development.php | 4 +- modules/Administration/Diagnostic.php | 47 +- .../{Diagnostic.html => Diagnostic.tpl} | 63 +- modules/Administration/DiagnosticDelete.php | 2 +- modules/Administration/DiagnosticDownload.php | 2 +- modules/Administration/DiagnosticRun.php | 4 +- modules/Administration/DisplayWarnings.php | 2 +- modules/Administration/DstFix.php | 126 +- .../ExportCustomFieldStructure.php | 6 +- modules/Administration/Forms.php | 2 +- .../ImportCustomFieldStructure.php | 2 +- modules/Administration/Locale.php | 6 +- modules/Administration/Locale.tpl | 2 +- modules/Administration/Menu.php | 2 +- modules/Administration/PasswordManager.php | 15 +- modules/Administration/PasswordManager.tpl | 2 +- .../Administration/QuickRepairAndRebuild.php | 85 +- modules/Administration/RebuildAudit.php | 2 +- modules/Administration/RebuildConfig.html | 2 +- modules/Administration/RebuildConfig.php | 2 +- modules/Administration/RebuildDashlets.php | 2 +- .../RebuildExpressionPlugins.php | 2 +- .../Administration/RebuildFulltextIndices.php | 2 +- modules/Administration/RebuildJSLang.php | 2 +- .../Administration/RebuildRelationship.php | 12 +- modules/Administration/RebuildSchedulers.php | 4 +- modules/Administration/RepairActivities.php | 14 +- modules/Administration/RepairFieldCasing.php | 12 +- modules/Administration/RepairIE.php | 2 +- modules/Administration/RepairIndex.php | 2 +- modules/Administration/RepairJSFile.php | 2 +- modules/Administration/RepairSeedUsers.php | 2 +- modules/Administration/RepairXSS.php | 4 +- modules/Administration/Save.php | 2 +- modules/Administration/SupportPortal.php | 14 +- modules/Administration/SupportPortal.tpl | 2 +- modules/Administration/Updater.html | 10 +- modules/Administration/Updater.php | 12 +- modules/Administration/Upgrade.php | 4 +- modules/Administration/UpgradeAccess.php | 10 +- modules/Administration/UpgradeFields.php | 2 +- modules/Administration/UpgradeHistory.php | 297 +- modules/Administration/UpgradeIISAccess.php | 2 +- modules/Administration/UpgradeWizard.php | 6 +- .../Administration/UpgradeWizardCommon.php | 4 +- .../Administration/UpgradeWizard_commit.php | 4 +- .../Administration/UpgradeWizard_prepare.php | 50 +- modules/Administration/action_view_map.php | 8 +- modules/Administration/callJSRepair.php | 2 +- modules/Administration/clear_chart_cache.php | 2 +- modules/Administration/controller.php | 105 +- modules/Administration/expandDatabase.php | 56 +- modules/Administration/index.html | 2 +- modules/Administration/index.php | 6 +- modules/Administration/index.tpl | 2 +- .../javascript/Administration.js | 2 +- modules/Administration/javascript/Async.js | 2 +- .../Administration/language/en_us.lang.php | 54 +- .../Administration/metadata/SearchFields.php | 2 +- .../metadata/adminpaneldefs.php | 24 +- modules/Administration/ncc_config.php | 2 +- modules/Administration/repairDatabase.php | 21 +- modules/Administration/repairSelectModule.php | 2 +- modules/Administration/repairUniSearch.php | 2 +- .../templates/ConfigureTabs.tpl | 53 +- .../templates/GlobalSearchSettings.tpl | 154 + .../Administration/templates/Languages.tpl | 152 + .../templates/QuickRepairAndRebuild.tpl | 2 +- .../templates/RepairDatabase.tpl | 2 +- .../Administration/templates/RepairXSS.tpl | 2 +- .../Administration/templates/ShortcutBar.tpl | 4 +- .../templates/themeSettings.tpl | 23 +- modules/Administration/undoupdateclass.php | 2 +- .../Administration/updateTimezonePrefs.php | 2 +- modules/Administration/updateclass.php | 4 +- modules/Administration/updater_utils.php | 70 +- .../upgrade_custom_relationships.php | 2 +- modules/Administration/vardefs.php | 2 +- modules/Administration/views/view.backups.php | 189 + .../views/view.configuretabs.php | 6 +- .../views/view.globalsearchsettings.php | 85 + .../views/view.languages.php} | 115 +- modules/Administration/views/view.repair.php | 2 +- .../views/view.themesettings.php | 9 +- modules/Audit/Audit.php | 2 +- modules/Audit/Popup_picker.html | 35 +- modules/Audit/Popup_picker.php | 2 +- modules/Audit/field_assoc.php | 2 +- modules/Audit/language/en_us.lang.php | 2 +- modules/Audit/vardefs.php | 2 +- modules/BeanDictionary.php | 2 +- modules/Bugs/Bug.php | 2 +- modules/Bugs/BugsQuickCreate.php | 2 +- .../MyBugsDashlet/MyBugsDashlet.data.php | 2 +- .../MyBugsDashlet/MyBugsDashlet.meta.php | 2 +- .../Dashlets/MyBugsDashlet/MyBugsDashlet.php | 2 +- modules/Bugs/Menu.php | 2 +- modules/Bugs/field_arrays.php | 2 +- modules/Bugs/language/en_us.lang.php | 3 +- modules/Bugs/metadata/SearchFields.php | 17 +- modules/Bugs/metadata/additionalDetails.php | 2 +- modules/Bugs/metadata/detailviewdefs.php | 49 +- modules/Bugs/metadata/editviewdefs.php | 46 +- modules/Bugs/metadata/listviewdefs.php | 2 +- modules/Bugs/metadata/metafiles.php | 2 +- modules/Bugs/metadata/popupdefs.php | 2 +- modules/Bugs/metadata/quickcreatedefs.php | 2 +- modules/Bugs/metadata/searchdefs.php | 4 +- modules/Bugs/metadata/studio.php | 2 +- modules/Bugs/metadata/subpaneldefs.php | 23 +- modules/Bugs/metadata/subpanels/ForEmails.php | 2 +- modules/Bugs/metadata/subpanels/default.php | 2 +- modules/Bugs/tpls/QuickCreate.tpl | 2 +- modules/Bugs/vardefs.php | 10 +- modules/Bugs/views/view.detail.php | 2 +- modules/Bugs/views/view.edit.php | 2 +- modules/Calendar/Calendar.php | 194 +- modules/Calendar/DateTimeUtil.php | 6 +- modules/Calendar/Forms.php | 2 +- modules/Calendar/Menu.php | 9 +- modules/Calendar/SubPanelSharedCalendar.php | 2 +- modules/Calendar/TasksListView.html | 2 +- modules/Calendar/TasksListView.php | 10 +- modules/Calendar/index.php | 22 +- modules/Calendar/language/en_us.lang.php | 4 +- modules/Calendar/metadata/listviewdefs.php | 2 +- modules/Calendar/small_month.php | 2 +- .../templates/template_shared_calendar.php | 2 +- .../Calendar/templates/templates_calendar.php | 106 +- modules/Calendar/views/view.list.php | 2 +- modules/Calls/Call.php | 93 +- modules/Calls/CallFormBase.php | 64 +- modules/Calls/CallHelper.php | 2 +- modules/Calls/CallsQuickCreate.php | 42 +- .../MyCallsDashlet/MyCallsDashlet.data.php | 2 +- .../MyCallsDashlet/MyCallsDashlet.meta.php | 2 +- .../MyCallsDashlet/MyCallsDashlet.php | 6 +- modules/Calls/Menu.php | 2 +- modules/Calls/Save.php | 2 +- modules/Calls/SubPanelViewInvitees.html | 2 +- modules/Calls/SubPanelViewInvitees.php | 2 +- modules/Calls/field_arrays.php | 2 +- modules/Calls/language/en_us.lang.php | 7 +- modules/Calls/metadata/SearchFields.php | 24 +- modules/Calls/metadata/additionalDetails.php | 32 +- modules/Calls/metadata/detailviewdefs.php | 2 +- modules/Calls/metadata/editviewdefs.php | 22 +- modules/Calls/metadata/listviewdefs.php | 7 +- modules/Calls/metadata/quickcreatedefs.php | 2 +- modules/Calls/metadata/searchdefs.php | 5 +- modules/Calls/metadata/studio.php | 2 +- modules/Calls/metadata/subpaneldefs.php | 4 +- .../metadata/subpanels/ForActivities.php | 2 +- .../Calls/metadata/subpanels/ForHistory.php | 2 +- modules/Calls/metadata/subpanels/default.php | 2 +- modules/Calls/tpls/QuickCreate.tpl | 2 +- modules/Calls/tpls/footer.tpl | 2 +- modules/Calls/vardefs.php | 13 +- modules/Calls/views/view.edit.php | 22 +- modules/CampaignLog/CampaignLog.php | 139 +- modules/CampaignLog/Menu.php | 2 +- modules/CampaignLog/Popup_picker.html | 2 +- modules/CampaignLog/Popup_picker.php | 2 +- modules/CampaignLog/language/en_us.lang.php | 2 +- .../metadata/subpanels/ForTargets.php | 2 +- .../metadata/subpanels/default.php | 2 +- modules/CampaignLog/vardefs.php | 56 +- modules/CampaignTrackers/CampaignTracker.php | 221 +- modules/CampaignTrackers/DetailView.html | 2 +- modules/CampaignTrackers/DetailView.php | 4 +- modules/CampaignTrackers/EditView.html | 2 +- modules/CampaignTrackers/EditView.php | 8 +- modules/CampaignTrackers/Forms.html | 2 +- modules/CampaignTrackers/Forms.php | 2 +- modules/CampaignTrackers/Menu.php | 2 +- modules/CampaignTrackers/Save.php | 2 +- .../CampaignTrackers/language/en_us.lang.php | 2 +- .../metadata/subpanels/default.php | 2 +- modules/CampaignTrackers/vardefs.php | 2 +- modules/Campaigns/Campaign.php | 2 +- modules/Campaigns/CampaignDiagnostic.html | 2 +- modules/Campaigns/CampaignDiagnostic.php | 3 +- modules/Campaigns/CaptchaValidate.php | 2 +- modules/Campaigns/Charts.php | 99 +- modules/Campaigns/Charts1.php | 4 +- .../TopCampaignsDashlet.meta.php | 2 +- .../TopCampaignsDashlet.php | 72 +- .../TopCampaignsDashlet.tpl | 2 +- .../TopCampaignsDashletConfigure.tpl | 74 + modules/Campaigns/Delete.php | 25 +- modules/Campaigns/DetailView.js | 2 +- modules/Campaigns/EmailQueue.php | 2 +- modules/Campaigns/GenerateWebToLeadForm.php | 6 +- modules/Campaigns/MailMerge.php | 2 +- modules/Campaigns/Menu.php | 27 +- modules/Campaigns/PopupCampaignRoi.html | 18 +- modules/Campaigns/PopupCampaignRoi.php | 5 +- modules/Campaigns/Popup_picker.html | 2 +- modules/Campaigns/Popup_picker.php | 2 +- modules/Campaigns/ProcessBouncedEmails.php | 4 +- modules/Campaigns/QueueCampaign.php | 60 +- modules/Campaigns/RemoveMe.php | 2 +- modules/Campaigns/RoiDetailView.php | 98 +- .../{RoiDetailView.html => RoiDetailView.tpl} | 110 +- modules/Campaigns/Save.php | 2 +- modules/Campaigns/Schedule.html | 2 +- modules/Campaigns/Schedule.php | 6 +- modules/Campaigns/SearchForm_NewsLetter.html | 2 +- modules/Campaigns/SubPanelViewer.php | 2 +- modules/Campaigns/Subscriptions.html | 2 +- modules/Campaigns/Subscriptions.php | 10 +- modules/Campaigns/Subscriptions.tpl | 2 +- modules/Campaigns/TrackDetailView.php | 85 +- ...ackDetailView.html => TrackDetailView.tpl} | 105 +- modules/Campaigns/Tracker.php | 2 +- modules/Campaigns/WebToLead.js | 2 +- modules/Campaigns/WebToLeadCapture.php | 12 +- modules/Campaigns/WebToLeadCreation.html | 2 +- modules/Campaigns/WebToLeadCreation.php | 2 +- modules/Campaigns/WebToLeadDownloadForm.html | 2 +- modules/Campaigns/WebToLeadForm.html | 2 +- modules/Campaigns/WebToLeadFormSave.php | 2 +- modules/Campaigns/WizardEmailSetup.html | 2 +- modules/Campaigns/WizardEmailSetup.php | 2 +- modules/Campaigns/WizardEmailSetupSave.php | 2 +- modules/Campaigns/WizardHome.html | 2 +- modules/Campaigns/WizardHome.php | 8 +- modules/Campaigns/WizardMarketing.html | 2 +- modules/Campaigns/WizardMarketing.php | 6 +- modules/Campaigns/WizardMarketingSave.php | 4 +- modules/Campaigns/WizardNewsletter.html | 2 +- modules/Campaigns/WizardNewsletter.php | 6 +- modules/Campaigns/WizardNewsletterSave.php | 2 +- modules/Campaigns/action_file_map.php | 2 +- modules/Campaigns/chart.tpl | 2 +- modules/Campaigns/controller.php | 2 +- modules/Campaigns/field_arrays.php | 2 +- modules/Campaigns/image.php | 4 +- modules/Campaigns/language/en_us.lang.php | 2 +- modules/Campaigns/metadata/SearchFields.php | 22 +- .../Campaigns/metadata/additionalDetails.php | 2 +- modules/Campaigns/metadata/detailviewdefs.php | 2 +- modules/Campaigns/metadata/editviewdefs.php | 2 +- modules/Campaigns/metadata/listviewdefs.php | 8 +- modules/Campaigns/metadata/popupdefs.php | 2 +- modules/Campaigns/metadata/searchdefs.php | 5 +- modules/Campaigns/metadata/studio.php | 2 +- modules/Campaigns/metadata/subpaneldefs.php | 2 +- .../metadata/subpanels/ForEmailMarketing.php | 2 +- .../Campaigns/metadata/subpanels/default.php | 2 +- .../Campaigns/tpls/WizardCampaignBudget.tpl | 2 +- .../Campaigns/tpls/WizardCampaignHeader.tpl | 2 +- .../tpls/WizardCampaignTargetList.tpl | 2 +- ...zardCampaignTargetListForNonNewsLetter.tpl | 2 +- .../Campaigns/tpls/WizardCampaignTracker.tpl | 2 +- modules/Campaigns/tpls/WizardHomeStart.tpl | 2 +- modules/Campaigns/tpls/WizardNewsletter.tpl | 2 +- modules/Campaigns/utils.php | 18 +- modules/Campaigns/vardefs.php | 9 +- modules/Campaigns/views/view.classic.php | 29 +- modules/Campaigns/views/view.detail.php | 2 +- .../Campaigns/views/view.modulelistmenu.php | 2 +- .../Campaigns/views/view.newsletterlist.php | 2 +- modules/Campaigns/wizard.js | 2 +- modules/Cases/Case.php | 23 +- modules/Cases/CasesQuickCreate.php | 2 +- .../MyCasesDashlet/MyCasesDashlet.data.php | 2 +- .../MyCasesDashlet/MyCasesDashlet.meta.php | 2 +- .../MyCasesDashlet/MyCasesDashlet.php | 2 +- modules/Cases/Menu.php | 4 +- modules/Cases/SugarFeeds/CaseFeed.php | 2 +- modules/Cases/field_arrays.php | 2 +- modules/Cases/language/en_us.lang.php | 3 +- modules/Cases/metadata/SearchFields.php | 9 +- .../metadata/accountsquickcreatedefs.php | 2 +- modules/Cases/metadata/additionalDetails.php | 2 +- modules/Cases/metadata/detailviewdefs.php | 18 +- modules/Cases/metadata/editviewdefs.php | 34 +- modules/Cases/metadata/listviewdefs.php | 18 +- modules/Cases/metadata/popupdefs.php | 2 +- modules/Cases/metadata/quickcreatedefs.php | 2 +- modules/Cases/metadata/searchdefs.php | 5 +- modules/Cases/metadata/studio.php | 2 +- modules/Cases/metadata/subpaneldefs.php | 23 +- .../Cases/metadata/subpanels/ForAccounts.php | 2 +- .../Cases/metadata/subpanels/ForEmails.php | 2 +- modules/Cases/metadata/subpanels/default.php | 2 +- modules/Cases/tpls/QuickCreate.tpl | 2 +- modules/Cases/vardefs.php | 12 +- .../CampaignROIChartConfigure.tpl | 2 +- .../CampaignROIChartDashlet.data.php | 2 +- .../CampaignROIChartDashlet.en_us.lang.php | 5 +- .../CampaignROIChartDashlet.meta.php | 2 +- .../CampaignROIChartDashlet.php | 16 +- .../MyPipelineBySalesStageConfigure.tpl | 2 +- .../MyPipelineBySalesStageDashlet.data.php | 2 +- ...PipelineBySalesStageDashlet.en_us.lang.php | 5 +- .../MyPipelineBySalesStageDashlet.meta.php | 2 +- .../MyPipelineBySalesStageDashlet.php | 94 +- ...tunitiesByLeadSourceByOutcomeConfigure.tpl | 2 +- ...itiesByLeadSourceByOutcomeDashlet.data.php | 2 +- ...yLeadSourceByOutcomeDashlet.en_us.lang.php | 5 +- ...itiesByLeadSourceByOutcomeDashlet.meta.php | 2 +- ...ortunitiesByLeadSourceByOutcomeDashlet.php | 24 +- .../OpportunitiesByLeadSourceConfigure.tpl | 2 +- .../OpportunitiesByLeadSourceDashlet.data.php | 2 +- ...tunitiesByLeadSourceDashlet.en_us.lang.php | 5 +- .../OpportunitiesByLeadSourceDashlet.meta.php | 2 +- .../OpportunitiesByLeadSourceDashlet.php | 25 +- .../OutcomeByMonthConfigure.tpl | 2 +- .../OutcomeByMonthDashlet.data.php | 2 +- .../OutcomeByMonthDashlet.en_us.lang.php | 5 +- .../OutcomeByMonthDashlet.meta.php | 2 +- .../OutcomeByMonthDashlet.php | 57 +- .../PipelineBySalesStageConfigure.tpl | 2 +- .../PipelineBySalesStageDashlet.data.php | 2 +- ...PipelineBySalesStageDashlet.en_us.lang.php | 5 +- .../PipelineBySalesStageDashlet.meta.php | 2 +- .../PipelineBySalesStageDashlet.php | 13 +- .../Dashlets/PredefinedChartDashletScript.tpl | 4 +- modules/Charts/DynamicAction.php | 51 + modules/Charts/PredefinedChart.php | 114 +- modules/Charts/chartdefs.php | 2 +- .../code/Chart_lead_source_by_outcome.php | 32 +- .../code/Chart_my_pipeline_by_sales_stage.php | 46 +- .../Charts/code/Chart_outcome_by_month.php | 36 +- .../code/Chart_pipeline_by_lead_source.php | 24 +- .../code/Chart_pipeline_by_sales_stage.php | 60 +- modules/Charts/code/predefined_charts.php | 2 +- modules/Charts/language/en_us.lang.php | 2 +- modules/Configurator/Configurator.php | 5 +- modules/Configurator/Forms.php | 2 +- modules/Configurator/LogView.php | 2 +- modules/Configurator/Menu.php | 2 +- modules/Configurator/SugarpdfSettings.php | 174 - modules/Configurator/UploadFileCheck.php | 2 +- modules/Configurator/action_view_map.php | 4 +- modules/Configurator/controller.php | 12 +- modules/Configurator/language/en_us.lang.php | 13 +- .../metadata/SugarpdfSettingsdefs.php | 2 +- modules/Configurator/tpls/EditView.tpl | 15 +- .../Configurator/tpls/SugarpdfSettings.tpl | 2 +- .../tpls/SugarpdfSettingsFields.tpl | 2 +- modules/Configurator/tpls/addFontResult.tpl | 2 +- modules/Configurator/tpls/addFontView.tpl | 2 +- modules/Configurator/tpls/adminwizard.tpl | 18 +- modules/Configurator/tpls/fontmanager.tpl | 2 +- .../Configurator/views/view.addfontresult.php | 6 +- .../Configurator/views/view.addfontview.php | 6 +- .../Configurator/views/view.adminwizard.php | 2 +- modules/Configurator/views/view.edit.php | 8 +- .../Configurator/views/view.fontmanager.php | 6 +- .../views/view.sugarpdfsettings.php | 196 + modules/Connectors/Connector.js | 2 +- modules/Connectors/ConnectorRecord.php | 2 +- modules/Connectors/Forms.php | 2 +- .../Connectors/InstallDefaultConnectors.php | 75 +- modules/Connectors/Menu.php | 2 +- modules/Connectors/action_view_map.php | 2 +- .../formatters/ext/rest/linkedin/linkedin.php | 2 +- .../ext/rest/linkedin/tpls/default.tpl | 2 +- .../sources/ext/rest/linkedin/config.php | 2 +- .../ext/rest/linkedin/language/en_us.lang.php | 2 +- .../sources/ext/rest/linkedin/linkedin.php | 2 +- .../sources/ext/rest/linkedin/mapping.php | 2 +- .../sources/ext/rest/linkedin/vardefs.php | 2 +- modules/Connectors/controller.php | 217 +- modules/Connectors/language/en_us.lang.php | 24 +- modules/Connectors/metadata/searchdefs.php | 2 +- modules/Connectors/tpls/administration.tpl | 2 +- .../Connectors/tpls/display_properties.tpl | 234 +- modules/Connectors/tpls/listview.tpl | 2 +- .../Connectors/tpls/mapping_properties.tpl | 2 +- modules/Connectors/tpls/modify_display.tpl | 6 +- modules/Connectors/tpls/modify_mapping.tpl | 6 +- modules/Connectors/tpls/modify_properties.tpl | 6 +- modules/Connectors/tpls/modify_search.tpl | 6 +- modules/Connectors/tpls/search_form.tpl | 2 +- modules/Connectors/tpls/search_properties.tpl | 8 +- modules/Connectors/tpls/source_properties.tpl | 2 +- modules/Connectors/tpls/tabs.css | 2 +- .../views/view.connectorsettings.php | 6 +- .../views/view.displayproperties.php | 37 +- .../views/view.mappingproperties.php | 2 +- .../Connectors/views/view.modifydisplay.php | 4 +- .../Connectors/views/view.modifymapping.php | 11 +- .../views/view.modifyproperties.php | 30 +- .../Connectors/views/view.modifysearch.php | 4 +- .../views/view.searchproperties.php | 2 +- .../views/view.sourceproperties.php | 2 +- modules/Contacts/AcceptDecline.php | 2 +- modules/Contacts/Address_picker.html | 2 +- modules/Contacts/BusinessCard.html | 2 +- modules/Contacts/BusinessCard.php | 4 +- modules/Contacts/Contact.js | 2 +- modules/Contacts/Contact.php | 69 +- modules/Contacts/ContactFormBase.php | 14 +- .../ContactOpportunityRelationship.php | 2 +- .../ContactOpportunityRelationshipEdit.html | 2 +- .../ContactOpportunityRelationshipEdit.php | 4 +- modules/Contacts/ContactsQuickCreate.php | 2 +- .../MyContactsDashlet.data.php | 2 +- .../MyContactsDashlet.meta.php | 2 +- .../MyContactsDashlet/MyContactsDashlet.php | 2 +- modules/Contacts/Email_picker.html | 2 +- modules/Contacts/MailMergePicker.html | 2 +- modules/Contacts/Menu.php | 2 +- modules/Contacts/Popup_picker.php | 72 +- modules/Contacts/Save.php | 2 +- .../SaveContactOpportunityRelationship.php | 2 +- modules/Contacts/ShowDuplicates.html | 2 +- modules/Contacts/ShowDuplicates.php | 12 +- modules/Contacts/SugarFeeds/ContactFeed.php | 2 +- modules/Contacts/contactSeedData.php | 21306 --------------- modules/Contacts/contactSeedData_jp.php | 178 - modules/Contacts/controller.php | 2 +- modules/Contacts/field_arrays.php | 2 +- modules/Contacts/language/en_us.lang.php | 10 +- modules/Contacts/metadata/SearchFields.php | 10 +- .../Contacts/metadata/additionalDetails.php | 8 +- modules/Contacts/metadata/detailviewdefs.php | 56 +- modules/Contacts/metadata/editviewdefs.php | 46 +- modules/Contacts/metadata/listviewdefs.php | 9 +- modules/Contacts/metadata/metafiles.php | 2 +- modules/Contacts/metadata/popupdefs.php | 2 +- modules/Contacts/metadata/popupdefsEmail.php | 2 +- modules/Contacts/metadata/quickcreatedefs.php | 6 +- modules/Contacts/metadata/searchdefs.php | 6 +- modules/Contacts/metadata/studio.php | 2 +- modules/Contacts/metadata/subpaneldefs.php | 23 +- .../metadata/subpanels/ForAccounts.php | 2 +- .../Contacts/metadata/subpanels/ForCalls.php | 2 +- .../Contacts/metadata/subpanels/ForCases.php | 2 +- .../metadata/subpanels/ForContacts.php | 2 +- .../Contacts/metadata/subpanels/ForEmails.php | 2 +- .../metadata/subpanels/ForMeetings.php | 2 +- .../metadata/subpanels/ForOpportunities.php | 2 +- .../metadata/subpanels/ForProject.php | 2 +- .../Contacts/metadata/subpanels/default.php | 2 +- modules/Contacts/tpls/QuickCreate.tpl | 2 +- modules/Contacts/vardefs.php | 13 +- .../views/view.closecontactaddresspopup.php | 2 +- .../views/view.contactaddresspopup.php | 2 +- modules/Contacts/views/view.detail.php | 6 +- modules/Contacts/views/view.edit.php | 2 +- modules/Contacts/views/view.list.php | 48 + .../Contacts/views/view.mailmergepopup.php | 2 +- modules/Contacts/views/view.retrieveemail.php | 2 +- .../views/view.validportalusername.php | 2 +- modules/Currencies/Currency.php | 2 +- modules/Currencies/EditCurrency.php | 2 +- modules/Currencies/EditView.js | 2 +- modules/Currencies/EditView.tpl | 2 +- modules/Currencies/Forms.php | 2 +- modules/Currencies/ListCurrency.php | 2 +- modules/Currencies/ListView.html | 2 +- modules/Currencies/Menu.php | 2 +- modules/Currencies/field_arrays.php | 2 +- modules/Currencies/index.php | 23 +- modules/Currencies/iso4217.php | 2 +- modules/Currencies/language/en_us.lang.php | 3 +- modules/Currencies/vardefs.php | 2 +- modules/DocumentRevisions/DetailView.html | 90 - modules/DocumentRevisions/DetailView.php | 103 - .../DocumentRevisions/DocumentRevision.php | 67 +- modules/DocumentRevisions/EditView.html | 89 - modules/DocumentRevisions/EditView.php | 109 - modules/DocumentRevisions/Forms.php | 2 +- modules/DocumentRevisions/ListView.html | 2 +- modules/DocumentRevisions/Menu.php | 2 +- modules/DocumentRevisions/field_arrays.php | 2 +- .../DocumentRevisions/language/en_us.lang.php | 5 +- .../metadata/detailviewdefs.php | 76 + .../metadata/editviewdefs.php | 75 + .../metadata/subpanels/default.php | 2 +- .../DocumentRevisions/subpanels/default.php | 2 +- modules/DocumentRevisions/vardefs.php | 60 +- .../MyDocumentsDashlet.data.php | 102 + .../MyDocumentsDashlet.meta.php | 45 + .../MyDocumentsDashlet/MyDocumentsDashlet.php | 70 +- modules/Documents/Delete.php | 2 +- modules/Documents/Document.php | 193 +- .../Documents/DocumentExternalApiDropDown.php | 51 + modules/Documents/DocumentSoap.php | 4 +- modules/Documents/GetLatestRevision.php | 4 +- modules/Documents/Menu.php | 2 +- modules/Documents/Popup.php | 2 +- modules/Documents/Popup_picker.html | 2 +- modules/Documents/Popup_picker.php | 2 +- modules/Documents/TreeData.php | 2 +- modules/Documents/action_view_map.php | 38 + modules/Documents/documents.js | 7 +- modules/Documents/field_arrays.php | 2 +- modules/Documents/language/en_us.lang.php | 29 +- modules/Documents/metadata/SearchFields.php | 11 +- modules/Documents/metadata/detailviewdefs.php | 5 +- modules/Documents/metadata/editviewdefs.php | 17 +- modules/Documents/metadata/listviewdefs.php | 65 +- .../Documents/metadata/quickcreatedefs.php | 32 +- modules/Documents/metadata/searchdefs.php | 22 +- modules/Documents/metadata/studio.php | 2 +- modules/Documents/metadata/subpaneldefs.php | 124 +- .../metadata/subpanels/ForContractType.php | 2 +- .../Documents/metadata/subpanels/default.php | 76 +- modules/Documents/tpls/view.extdoc.tpl | 132 + modules/Documents/vardefs.php | 105 +- modules/Documents/views/view.detail.php | 6 +- modules/Documents/views/view.edit.php | 54 +- modules/Documents/views/view.extdoc.php | 187 + modules/DynamicFields/DynamicField.php | 775 +- modules/DynamicFields/FieldCases.php | 3 +- modules/DynamicFields/FieldViewer.php | 9 +- modules/DynamicFields/FieldsMetaData.php | 2 +- modules/DynamicFields/Save.php | 2 +- modules/DynamicFields/UpgradeFields.php | 2 +- modules/DynamicFields/language/en_us.lang.php | 8 +- .../templates/Fields/Forms/address.tpl | 2 +- .../templates/Fields/Forms/bool.tpl | 4 +- .../templates/Fields/Forms/coreBottom.tpl | 2 +- .../templates/Fields/Forms/coreTop.tpl | 5 +- .../templates/Fields/Forms/currency.tpl | 13 +- .../templates/Fields/Forms/date.php | 2 +- .../templates/Fields/Forms/date.tpl | 19 +- .../templates/Fields/Forms/datetimecombo.php | 2 +- .../templates/Fields/Forms/datetimecombo.tpl | 19 +- .../templates/Fields/Forms/encrypt.php | 2 +- .../templates/Fields/Forms/encrypt.tpl | 6 +- .../templates/Fields/Forms/enum.tpl | 8 +- .../templates/Fields/Forms/enum2.php | 12 +- .../templates/Fields/Forms/float.tpl | 13 +- .../templates/Fields/Forms/html.php | 8 +- .../templates/Fields/Forms/html.tpl | 2 +- .../templates/Fields/Forms/iframe.php | 2 +- .../templates/Fields/Forms/iframe.tpl | 2 +- .../templates/Fields/Forms/image.php | 2 +- .../templates/Fields/Forms/image.tpl | 2 +- .../templates/Fields/Forms/int.tpl | 11 +- .../templates/Fields/Forms/multienum.php | 2 +- .../templates/Fields/Forms/multienum.tpl | 2 +- .../templates/Fields/Forms/parent.php | 2 +- .../templates/Fields/Forms/parent.tpl | 2 +- .../templates/Fields/Forms/phone.php | 45 + .../templates/Fields/Forms/phone.tpl | 87 + .../templates/Fields/Forms/radioenum.php | 2 +- .../templates/Fields/Forms/relate.php | 8 +- .../templates/Fields/Forms/relate.tpl | 2 +- .../templates/Fields/Forms/text.tpl | 2 +- .../templates/Fields/Forms/url.php | 2 +- .../templates/Fields/Forms/url.tpl | 2 +- .../templates/Fields/Forms/varchar.tpl | 2 +- .../templates/Fields/TemplateAddress.php | 2 +- .../Fields/TemplateAddressCountry.php | 2 +- .../templates/Fields/TemplateBoolean.php | 2 +- .../templates/Fields/TemplateCurrency.php | 12 +- .../templates/Fields/TemplateCurrencyId.php | 2 +- .../templates/Fields/TemplateDate.php | 12 +- .../Fields/TemplateDatetimecombo.php | 14 +- .../templates/Fields/TemplateDecimal.php | 10 +- .../templates/Fields/TemplateEmail.php | 2 +- .../templates/Fields/TemplateEncrypt.php | 2 +- .../templates/Fields/TemplateEnum.php | 4 +- .../templates/Fields/TemplateField.php | 2 +- .../templates/Fields/TemplateFloat.php | 12 +- .../templates/Fields/TemplateHTML.php | 2 +- .../templates/Fields/TemplateIFrame.php | 2 +- .../templates/Fields/TemplateId.php | 2 +- .../templates/Fields/TemplateImage.php | 2 +- .../templates/Fields/TemplateInt.php | 8 +- .../templates/Fields/TemplateMultiEnum.php | 10 +- .../templates/Fields/TemplateParent.php | 2 +- .../templates/Fields/TemplateParentType.php | 2 +- .../templates/Fields/TemplatePhone.php | 20 +- .../templates/Fields/TemplateRadioEnum.php | 2 +- .../templates/Fields/TemplateRange.php | 292 + .../Fields/TemplateRelatedTextField.php | 2 +- .../templates/Fields/TemplateText.php | 2 +- .../templates/Fields/TemplateTextArea.php | 2 +- .../templates/Fields/TemplateURL.php | 2 +- .../templates/Files/DetailView.php | 2 +- .../templates/Files/EditView.php | 2 +- modules/DynamicFields/vardefs.php | 2 +- modules/EAPM/CheckLogins.php | 89 + modules/EAPM/EAPM.php | 228 + modules/EAPM/EAPMEdit.js | 47 + modules/EAPM/action_view_map.php | 38 + modules/EAPM/controller.php | 234 + modules/EAPM/language/en_us.lang.php | 111 + modules/EAPM/metadata/SearchFields.php | 56 + modules/EAPM/metadata/detailviewdefs.php | 73 + modules/EAPM/metadata/editviewdefs.php | 91 + modules/EAPM/metadata/listviewdefs.php | 69 + modules/EAPM/metadata/metafiles.php | 52 + modules/EAPM/metadata/popupdefs.php | 52 + modules/EAPM/metadata/quickcreatedefs.php | 64 + modules/EAPM/metadata/searchdefs.php | 62 + .../metadata/subpanels/default.php} | 55 +- modules/EAPM/tpls/DetailViewFooter.tpl | 44 + modules/EAPM/tpls/EditViewFooter.tpl | 50 + modules/EAPM/tpls/EditViewHeader.tpl | 75 + modules/EAPM/vardefs.php | 204 + modules/EAPM/views/view.detail.php | 111 + modules/EAPM/views/view.edit.php | 121 + modules/EmailAddresses/EmailAddress.php | 2 +- .../EmailAddresses/language/en_us.lang.php | 2 +- modules/EmailAddresses/vardefs.php | 2 +- modules/EmailMan/EmailMan.php | 217 +- modules/EmailMan/EmailManDelivery.php | 87 +- modules/EmailMan/Forms.php | 2 +- modules/EmailMan/Menu.php | 2 +- modules/EmailMan/Save.php | 2 +- modules/EmailMan/action_view_map.php | 2 +- modules/EmailMan/field_arrays.php | 2 +- modules/EmailMan/language/en_us.lang.php | 2 +- modules/EmailMan/metadata/SearchFields.php | 2 +- modules/EmailMan/metadata/listviewdefs.php | 5 +- modules/EmailMan/metadata/searchdefs.php | 4 +- .../EmailMan/metadata/subpanels/default.php | 2 +- modules/EmailMan/subpanels/default.php | 2 +- modules/EmailMan/testOutboundEmail.php | 2 +- modules/EmailMan/tpls/campaignconfig.tpl | 2 +- modules/EmailMan/tpls/config.tpl | 159 +- modules/EmailMan/vardefs.php | 2 +- .../EmailMan/views/view.campaignconfig.php | 8 +- modules/EmailMan/views/view.config.php | 12 +- modules/EmailMan/views/view.list.php | 10 +- modules/EmailMarketing/Delete.php | 2 +- modules/EmailMarketing/DetailView.html | 2 +- modules/EmailMarketing/DetailView.php | 3 +- modules/EmailMarketing/EditView.html | 2 +- modules/EmailMarketing/EditView.php | 3 +- modules/EmailMarketing/EmailMarketing.php | 2 +- modules/EmailMarketing/Forms.php | 2 +- modules/EmailMarketing/Menu.php | 2 +- modules/EmailMarketing/Save.php | 4 +- modules/EmailMarketing/SubPanelView.html | 2 +- modules/EmailMarketing/SubPanelView.php | 2 +- modules/EmailMarketing/field_arrays.php | 2 +- .../EmailMarketing/language/en_us.lang.php | 2 +- .../EmailMarketing/metadata/subpaneldefs.php | 2 +- .../metadata/subpanels/default.php | 2 +- modules/EmailMarketing/subpanels/default.php | 2 +- modules/EmailMarketing/vardefs.php | 2 +- modules/EmailTemplates/AttachFiles.php | 2 +- modules/EmailTemplates/CheckDeletable.php | 18 +- modules/EmailTemplates/Delete.php | 2 +- modules/EmailTemplates/DetailView.html | 9 +- modules/EmailTemplates/DetailView.php | 4 +- modules/EmailTemplates/EditView.html | 9 +- modules/EmailTemplates/EditView.php | 6 +- modules/EmailTemplates/EditViewMain.html | 9 +- modules/EmailTemplates/EmailTemplate.js | 11 +- modules/EmailTemplates/EmailTemplate.php | 6 +- .../EmailTemplates/EmailTemplateFormBase.php | 2 +- modules/EmailTemplates/Menu.php | 2 +- .../PopupDocumentsCampaignTemplate.html | 2 +- .../PopupDocumentsCampaignTemplate.php | 2 +- modules/EmailTemplates/Save.php | 2 +- modules/EmailTemplates/field_arrays.php | 2 +- .../EmailTemplates/language/en_us.lang.php | 5 +- .../EmailTemplates/metadata/SearchFields.php | 2 +- .../EmailTemplates/metadata/listviewdefs.php | 8 +- .../EmailTemplates/metadata/searchdefs.php | 3 +- modules/EmailTemplates/vardefs.php | 2 +- modules/Emails/Check.php | 2 +- modules/Emails/Compose.php | 2 +- .../MyEmailsDashlet/MyEmailsDashlet.data.php | 2 +- .../MyEmailsDashlet/MyEmailsDashlet.meta.php | 2 +- .../MyEmailsDashlet/MyEmailsDashlet.php | 2 +- modules/Emails/Delete.php | 2 +- modules/Emails/DetailView.html | 2 +- modules/Emails/DetailView.php | 24 +- modules/Emails/DetailViewSent.html | 2 +- modules/Emails/EditView.html | 4 +- modules/Emails/EditView.php | 6 +- modules/Emails/EditViewArchive.html | 4 +- modules/Emails/Email.php | 73 +- modules/Emails/EmailUI.css | 2 +- modules/Emails/EmailUI.php | 93 +- modules/Emails/EmailUIAjax.php | 3 +- modules/Emails/GenerateQuickComposeFrame.php | 2 +- modules/Emails/Grab.php | 2 +- modules/Emails/ListViewDrafts.html | 2 +- modules/Emails/ListViewGroup.php | 4 +- modules/Emails/ListViewGroupInbox.html | 2 +- modules/Emails/ListViewHome.html | 2 +- modules/Emails/ListViewHome.php | 2 +- modules/Emails/ListViewMyInbox.html | 2 +- modules/Emails/ListViewSent.html | 2 +- modules/Emails/MassDelete.php | 2 +- modules/Emails/Menu.php | 2 +- modules/Emails/PessimisticLock.php | 2 +- modules/Emails/Popup.php | 2 +- modules/Emails/PopupDocuments.html | 2 +- modules/Emails/PopupDocuments.php | 8 +- modules/Emails/Popup_picker.html | 2 +- modules/Emails/Popup_picker.php | 2 +- modules/Emails/Save.php | 20 +- modules/Emails/SearchForm.html | 2 +- modules/Emails/SearchFormGroupInbox.html | 2 +- modules/Emails/SearchFormMyInbox.html | 2 +- modules/Emails/SearchFormSent.html | 2 +- modules/Emails/Status.html | 2 +- modules/Emails/Status.php | 4 +- modules/Emails/SubPanelViewRecipients.html | 2 +- modules/Emails/SubPanelViewRecipients.php | 2 +- modules/Emails/SugarRoutingAsync.php | 2 +- modules/Emails/field_arrays.php | 2 +- modules/Emails/index.php | 2 +- modules/Emails/javascript/Email.js | 2 +- modules/Emails/javascript/EmailUI.js | 18 +- modules/Emails/javascript/EmailUICompose.js | 12 +- modules/Emails/javascript/EmailUIShared.js | 2 +- modules/Emails/javascript/ajax.js | 5 +- modules/Emails/javascript/complexLayout.js | 6 +- .../Emails/javascript/composeEmailTemplate.js | 2 +- .../javascript/displayOneEmailTemplate.js | 2 +- .../Emails/javascript/email_popup_helper.js | 2 +- modules/Emails/javascript/grid.js | 2 +- modules/Emails/javascript/init.js | 6 +- modules/Emails/javascript/vars.js | 2 +- modules/Emails/javascript/viewPrintable.js | 2 +- modules/Emails/language/en_us.lang.php | 4 +- modules/Emails/metadata/additionalDetails.php | 2 +- modules/Emails/metadata/popupdefs.php | 2 +- modules/Emails/metadata/qcmodulesdefs.php | 45 + modules/Emails/metadata/subpaneldefs.php | 2 +- .../Emails/metadata/subpanels/ForContacts.php | 2 +- .../Emails/metadata/subpanels/ForHistory.php | 2 +- .../Emails/metadata/subpanels/ForQueues.php | 2 +- .../subpanels/ForUnlinkedEmailHistory.php | 2 +- .../Emails/metadata/subpanels/ForUsers.php | 2 +- modules/Emails/subpanels/ForContacts.php | 2 +- modules/Emails/subpanels/ForHistory.php | 2 +- modules/Emails/subpanels/ForQueues.php | 2 +- modules/Emails/subpanels/ForUsers.php | 2 +- modules/Emails/templates/_baseConfigData.tpl | 2 +- modules/Emails/templates/_baseEmail.tpl | 2 +- modules/Emails/templates/_baseJsVars.tpl | 2 +- modules/Emails/templates/_blank.html | 2 +- .../Emails/templates/_createGroupFolder.tpl | 2 +- modules/Emails/templates/addressBook.tpl | 2 +- modules/Emails/templates/addressSearch.tpl | 2 +- .../Emails/templates/addressSearchContent.tpl | 2 +- modules/Emails/templates/advancedSearch.tpl | 11 +- modules/Emails/templates/assignTo.tpl | 2 +- .../Emails/templates/dceMenuQuickCreate.tpl | 2 +- .../Emails/templates/editAccountDialogue.tpl | 2 +- modules/Emails/templates/editContact.tpl | 2 +- modules/Emails/templates/editMailingList.tpl | 2 +- modules/Emails/templates/emailDetailView.tpl | 2 +- modules/Emails/templates/emailSettings.tpl | 2 +- .../templates/emailSettingsAccountDetails.tpl | 2 +- .../templates/emailSettingsAccounts.tpl | 2 +- .../Emails/templates/emailSettingsFolders.tpl | 2 +- .../Emails/templates/emailSettingsGeneral.tpl | 2 +- .../Emails/templates/emailSettingsRules.tpl | 2 +- modules/Emails/templates/importRelate.tpl | 2 +- modules/Emails/templates/outboundDialog.tpl | 5 +- .../Emails/templates/outboundDialogTest.tpl | 2 +- modules/Emails/templates/overlay.tpl | 2 +- modules/Emails/templates/successMessage.tpl | 2 +- modules/Emails/vardefs.php | 2 +- modules/Emails/views/view.classic.config.php | 2 +- modules/Emails/views/view.modulelistmenu.php | 2 +- modules/Emails/views/view.quickcreate.php | 2 +- modules/Employees/Employee.php | 5 +- modules/Employees/EmployeeStatus.php | 35 +- modules/Employees/Error.php | 2 +- modules/Employees/Forms.php | 2 +- modules/Employees/Menu.php | 2 +- modules/Employees/Popup_picker.html | 2 +- modules/Employees/Popup_picker.php | 2 +- modules/Employees/Save.php | 12 +- modules/Employees/WapAuthenticate.php | 2 +- modules/Employees/WapMenu.php | 2 +- modules/Employees/controller.php | 2 +- modules/Employees/field_arrays.php | 2 +- modules/Employees/language/en_us.lang.php | 2 +- modules/Employees/metadata/SearchFields.php | 2 +- modules/Employees/metadata/detailviewdefs.php | 2 +- modules/Employees/metadata/editviewdefs.php | 2 +- modules/Employees/metadata/listviewdefs.php | 11 +- modules/Employees/metadata/searchdefs.php | 4 +- modules/Employees/vardefs.php | 2 +- modules/Employees/views/view.detail.php | 2 +- modules/Employees/views/view.edit.php | 2 +- modules/Employees/views/view.list.php | 8 +- modules/Groups/Delete.php | 2 +- modules/Groups/DetailView.html | 2 +- modules/Groups/DetailView.php | 4 +- modules/Groups/EditView.html | 2 +- modules/Groups/EditView.php | 4 +- modules/Groups/Forms.php | 2 +- modules/Groups/Group.php | 2 +- modules/Groups/ListView.html | 2 +- modules/Groups/ListView.php | 2 +- modules/Groups/Menu.php | 2 +- modules/Groups/Save.php | 2 +- modules/Groups/index.php | 2 +- modules/Groups/language/en_us.lang.php | 2 +- modules/Groups/vardefs.php | 2 +- modules/Help/Menu.php | 2 +- modules/Help/index.php | 2 +- modules/Help/language/en_us.lang.php | 2 +- modules/History/language/en_us.lang.php | 2 +- modules/History/metadata/subpaneldefs.php | 2 +- modules/Home/About.php | 17 +- modules/Home/AddToFavorites.php | 2 +- .../ChartsDashlet.en_us.lang.php | 4 +- .../ChartsDashlet/ChartsDashlet.meta.php | 2 +- .../Dashlets/ChartsDashlet/ChartsDashlet.php | 22 +- .../ChartsDashlet/ChartsDashletScript.tpl | 4 +- .../InvadersDashlet.en_us.lang.php | 4 +- .../InvadersDashlet/InvadersDashlet.meta.php | 2 +- .../InvadersDashlet/InvadersDashlet.php | 2 +- .../InvadersDashlet/InvadersDashlet.tpl | 2 +- .../InvadersDashlet/InvadersDashletScript.tpl | 2 +- .../InvadersDashlet/InvadersOptions.tpl | 2 +- .../JotPadDashlet.en_us.lang.php | 4 +- .../JotPadDashlet/JotPadDashlet.meta.php | 2 +- .../Dashlets/JotPadDashlet/JotPadDashlet.php | 2 +- .../Dashlets/JotPadDashlet/JotPadDashlet.tpl | 2 +- .../JotPadDashlet/JotPadDashletOptions.tpl | 2 +- .../JotPadDashlet/JotPadDashletScript.tpl | 2 +- .../RSSDashlet/RSSDashlet.en_us.lang.php | 4 +- .../Dashlets/RSSDashlet/RSSDashlet.meta.php | 2 +- .../Home/Dashlets/RSSDashlet/RSSDashlet.php | 13 +- .../Home/Dashlets/RSSDashlet/RSSDashlet.tpl | 2 +- .../Dashlets/RSSDashlet/RSSDashletOptions.tpl | 14 +- .../SugarNewsDashlet.meta.php | 2 +- .../SugarNewsDashlet/SugarNewsDashlet.php | 12 +- .../Dashlets/SugarNewsDashlet/configure.tpl | 28 +- .../Home/Dashlets/iFrameDashlet/configure.tpl | 28 +- .../iFrameDashlet/iFrameDashlet.meta.php | 2 +- .../Dashlets/iFrameDashlet/iFrameDashlet.php | 14 +- modules/Home/DynamicAction.php | 2 +- modules/Home/Home.html | 2 +- modules/Home/Home.tpl | 10 +- modules/Home/LastViewed.php | 2 +- modules/Home/Menu.php | 2 +- modules/Home/PopupSugar.php | 2 +- modules/Home/SaveSubpanelLayout.php | 2 +- modules/Home/SubpanelCreates.php | 37 +- modules/Home/TrainingPortal.php | 2 +- modules/Home/TrainingPortal.tpl | 2 +- modules/Home/UnifiedSearch.php | 17 +- modules/Home/UnifiedSearchAdvanced.php | 469 +- modules/Home/UnifiedSearchAdvanced.tpl | 60 +- modules/Home/UnifiedSearchAdvancedForm.tpl | 130 +- modules/Home/UnifiedSearchAdvancedResults.tpl | 160 +- modules/Home/about.js | 2 +- modules/Home/action_view_map.php | 38 + modules/Home/dashlets.php | 2 +- modules/Home/index.php | 51 +- modules/Home/language/en_us.lang.php | 6 +- modules/Home/quicksearchQuery.php | 38 +- modules/Home/sitemap.php | 2 +- modules/Home/sitemap.tpl | 2 +- .../view.additionaldetailsretrieve.php} | 91 +- modules/Home/views/view.list.php | 2 +- modules/Home/views/view.modulelistmenu.php | 2 +- modules/Import/Forms.php | 117 +- modules/Import/ImportCacheFiles.php | 2 +- modules/Import/ImportDuplicateCheck.php | 8 +- modules/Import/ImportFieldSanitize.php | 576 +- modules/Import/ImportFile.php | 2 +- modules/Import/ImportFileSplitter.php | 2 +- modules/Import/ImportMap.php | 103 +- modules/Import/ImportMapAct.php | 2 +- modules/Import/ImportMapCsv.php | 2 +- modules/Import/ImportMapOther.php | 2 +- modules/Import/ImportMapOutlook.php | 2 +- modules/Import/ImportMapSalesforce.php | 2 +- modules/Import/ImportMapTab.php | 2 +- modules/Import/Menu.php | 2 +- modules/Import/UsersLastImport.php | 105 +- modules/Import/controller.php | 32 +- modules/Import/language/en_us.lang.php | 2 +- modules/Import/tpls/error.tpl | 2 +- modules/Import/tpls/last.tpl | 2 +- modules/Import/tpls/step1.tpl | 9 +- modules/Import/tpls/step2.tpl | 2 +- modules/Import/tpls/step3.tpl | 4 +- modules/Import/tpls/undo.tpl | 2 +- modules/Import/vardefs.php | 2 +- modules/Import/views/view.error.php | 5 +- modules/Import/views/view.last.php | 56 +- modules/Import/views/view.step1.php | 50 +- modules/Import/views/view.step2.php | 63 +- modules/Import/views/view.step3.php | 337 +- modules/Import/views/view.step4.php | 113 +- modules/Import/views/view.undo.php | 5 +- modules/InboundEmail/Delete.php | 2 +- modules/InboundEmail/DetailView.html | 2 +- modules/InboundEmail/DetailView.php | 8 +- modules/InboundEmail/EditGroupFolder.php | 2 +- modules/InboundEmail/EditView.html | 14 +- modules/InboundEmail/EditView.php | 13 +- modules/InboundEmail/InboundEmail.js | 4 +- modules/InboundEmail/InboundEmail.php | 125 +- modules/InboundEmail/InboundEmailTest.php | 2 +- modules/InboundEmail/ListView.html | 2 +- modules/InboundEmail/ListView.php | 2 +- modules/InboundEmail/Menu.php | 2 +- modules/InboundEmail/Popup.php | 2 +- modules/InboundEmail/Save.php | 6 +- modules/InboundEmail/SaveGroupFolder.php | 2 +- .../InboundEmail/ShowInboundFoldersList.php | 2 +- modules/InboundEmail/View.html | 2 +- modules/InboundEmail/field_arrays.php | 2 +- modules/InboundEmail/index.php | 4 +- modules/InboundEmail/language/en_us.lang.php | 2 +- modules/InboundEmail/parseEncoding.php | 224 - modules/InboundEmail/vardefs.php | 2 +- modules/LabelEditor/EditView.html | 2 +- modules/LabelEditor/EditView.php | 4 +- modules/LabelEditor/Forms.php | 2 +- modules/LabelEditor/LabelList.php | 2 +- modules/LabelEditor/Menu.php | 2 +- modules/LabelEditor/Save.php | 2 +- modules/LabelEditor/language/en_us.lang.php | 2 +- modules/Leads/Capture.php | 2 +- .../MyLeadsDashlet/MyLeadsDashlet.data.php | 2 +- .../MyLeadsDashlet/MyLeadsDashlet.meta.php | 2 +- .../MyLeadsDashlet/MyLeadsDashlet.php | 2 +- modules/Leads/Lead.js | 2 +- modules/Leads/Lead.php | 4 +- modules/Leads/LeadFormBase.php | 2 +- modules/Leads/LeadsQuickCreate.php | 2 +- modules/Leads/Menu.php | 2 +- modules/Leads/MyLeads.html | 2 +- modules/Leads/MyLeads.php | 2 +- modules/Leads/Popup_picker.html | 2 +- modules/Leads/Save.php | 2 +- modules/Leads/SubPanelView.html | 2 +- modules/Leads/SubPanelView.php | 2 +- modules/Leads/SugarFeeds/LeadFeed.php | 2 +- modules/Leads/action_view_map.php | 2 +- modules/Leads/controller.php | 2 +- modules/Leads/field_arrays.php | 2 +- modules/Leads/language/en_us.lang.php | 4 +- modules/Leads/metadata/SearchFields.php | 17 +- modules/Leads/metadata/additionalDetails.php | 8 +- modules/Leads/metadata/convertdefs.php | 2 +- modules/Leads/metadata/detailviewdefs.php | 14 +- modules/Leads/metadata/editviewdefs.php | 2 +- modules/Leads/metadata/listviewdefs.php | 14 +- modules/Leads/metadata/popupdefs.php | 2 +- modules/Leads/metadata/quickcreatedefs.php | 2 +- modules/Leads/metadata/searchdefs.php | 5 +- modules/Leads/metadata/studio.php | 2 +- modules/Leads/metadata/subpaneldefs.php | 2 +- modules/Leads/metadata/subpanels/ForCalls.php | 2 +- .../Leads/metadata/subpanels/ForEmails.php | 2 +- .../Leads/metadata/subpanels/ForMeetings.php | 2 +- modules/Leads/metadata/subpanels/default.php | 2 +- modules/Leads/tpls/ConvertLead.tpl | 2 +- modules/Leads/tpls/ConvertLeadFooter.tpl | 2 +- modules/Leads/tpls/ConvertLeadHeader.tpl | 2 +- modules/Leads/tpls/DetailViewHeader.tpl | 2 +- modules/Leads/tpls/QuickCreate.tpl | 2 +- modules/Leads/vardefs.php | 5 +- modules/Leads/views/view.convertlead.php | 185 +- modules/Leads/views/view.list.php | 48 + modules/MailMerge/DetailView.php | 2 +- modules/MailMerge/EditView.php | 2 +- modules/MailMerge/MailMerge.php | 2 +- modules/MailMerge/Menu.php | 2 +- modules/MailMerge/Merge.html | 2 +- modules/MailMerge/Merge.php | 2 +- modules/MailMerge/Save.php | 2 +- modules/MailMerge/Step1.html | 2 +- modules/MailMerge/Step1.php | 12 +- modules/MailMerge/Step2.html | 2 +- modules/MailMerge/Step2.php | 2 +- modules/MailMerge/Step3.html | 2 +- modules/MailMerge/Step3.php | 2 +- modules/MailMerge/Step4.html | 2 +- modules/MailMerge/Step4.php | 2 +- modules/MailMerge/Step5.html | 2 +- modules/MailMerge/Step5.php | 2 +- modules/MailMerge/get_doc.php | 2 +- modules/MailMerge/index.php | 2 +- modules/MailMerge/language/en_us.lang.php | 2 +- modules/MailMerge/modules_array.php | 2 +- .../MyMeetingsDashlet.data.php | 6 +- .../MyMeetingsDashlet.meta.php | 2 +- .../MyMeetingsDashlet/MyMeetingsDashlet.php | 16 +- modules/Meetings/JoinExternalMeeting.php | 83 + modules/Meetings/Meeting.php | 154 +- modules/Meetings/MeetingFormBase.php | 116 +- modules/Meetings/MeetingsQuickCreate.php | 6 +- modules/Meetings/Menu.php | 2 +- modules/Meetings/Save.php | 2 +- modules/Meetings/SubPanelViewInvitees.html | 2 +- modules/Meetings/SubPanelViewInvitees.php | 2 +- modules/Meetings/action_view_map.php | 38 + modules/Meetings/field_arrays.php | 2 +- modules/Meetings/jsclass_scheduler.js | 2 +- modules/Meetings/language/en_us.lang.php | 34 +- modules/Meetings/metadata/SearchFields.php | 23 +- .../Meetings/metadata/additionalDetails.php | 2 +- modules/Meetings/metadata/detailviewdefs.php | 15 +- modules/Meetings/metadata/editviewdefs.php | 25 +- modules/Meetings/metadata/listviewdefs.php | 7 +- modules/Meetings/metadata/quickcreatedefs.php | 5 +- modules/Meetings/metadata/searchdefs.php | 5 +- modules/Meetings/metadata/studio.php | 2 +- modules/Meetings/metadata/subpaneldefs.php | 4 +- .../metadata/subpanels/ForActivities.php | 6 +- .../metadata/subpanels/ForHistory.php | 2 +- .../Meetings/metadata/subpanels/default.php | 2 +- modules/Meetings/tpls/QuickCreate.tpl | 2 +- modules/Meetings/tpls/extMeetingNoStart.tpl | 40 + .../Meetings/tpls/extMeetingNotInvited.tpl | 40 + modules/Meetings/tpls/footer.tpl | 2 +- modules/Meetings/tpls/header.tpl | 2 +- modules/Meetings/vardefs.php | 88 +- modules/Meetings/views/view.edit.php | 4 +- modules/Meetings/views/view.listbytype.php | 124 + modules/MergeRecords/Menu.php | 2 +- modules/MergeRecords/Merge.js | 2 +- modules/MergeRecords/MergeField.html | 2 +- modules/MergeRecords/MergeRecord.php | 15 +- modules/MergeRecords/SaveMerge.php | 2 +- modules/MergeRecords/SearchForm.html | 2 +- modules/MergeRecords/Step1.html | 2 +- modules/MergeRecords/Step1.php | 2 +- modules/MergeRecords/Step2.html | 2 +- modules/MergeRecords/Step2.php | 2 +- modules/MergeRecords/Step3.html | 2 +- modules/MergeRecords/Step3.php | 86 +- modules/MergeRecords/controller.php | 2 +- modules/MergeRecords/index.php | 12 +- modules/MergeRecords/language/en_us.lang.php | 2 +- modules/MergeRecords/vardefs.php | 2 +- modules/ModuleBuilder/Forms.php | 2 +- modules/ModuleBuilder/MB/AjaxCompose.php | 2 +- modules/ModuleBuilder/MB/MBField.php | 2 +- modules/ModuleBuilder/MB/MBLanguage.php | 10 +- modules/ModuleBuilder/MB/MBModule.php | 2 +- modules/ModuleBuilder/MB/MBPackage.php | 4 +- modules/ModuleBuilder/MB/MBPackageTree.php | 2 +- modules/ModuleBuilder/MB/MBRelationship.php | 2 +- modules/ModuleBuilder/MB/MBVardefs.php | 2 +- modules/ModuleBuilder/MB/ModuleBuilder.php | 2 +- modules/ModuleBuilder/MB/header.php | 2 +- .../ModuleBuilder/Module/DropDownBrowser.php | 2 +- modules/ModuleBuilder/Module/DropDownTree.php | 2 +- modules/ModuleBuilder/Module/MainTree.php | 2 +- .../ModuleBuilder/Module/StudioBrowser.php | 2 +- modules/ModuleBuilder/Module/StudioModule.php | 2 +- .../Module/StudioModuleFactory.php | 2 +- modules/ModuleBuilder/Module/StudioTree.php | 2 +- modules/ModuleBuilder/action_view_map.php | 2 +- modules/ModuleBuilder/controller.php | 82 +- .../ModuleBuilder/javascript/JSTransaction.js | 2 +- .../ModuleBuilder/javascript/ModuleBuilder.js | 67 +- .../ModuleBuilder/javascript/SimpleList.js | 6 +- modules/ModuleBuilder/javascript/studio2.js | 2 +- .../javascript/studio2FieldDD.js | 2 +- .../ModuleBuilder/javascript/studio2ListDD.js | 2 +- .../javascript/studio2PanelDD.js | 2 +- .../ModuleBuilder/javascript/studio2RowDD.js | 2 +- .../javascript/studiotabgroups.js | 2 +- .../javascript/wizardTemplate.js | 2 +- modules/ModuleBuilder/language/en_us.lang.php | 56 +- .../parsers/ModuleBuilderParser.php | 2 +- .../ModuleBuilder/parsers/ParserFactory.php | 5 +- .../ModuleBuilder/parsers/StandardField.php | 11 +- modules/ModuleBuilder/parsers/constants.php | 3 +- .../ModuleBuilder/parsers/parser.dropdown.php | 2 +- .../ModuleBuilder/parsers/parser.label.php | 2 +- .../parsers/parser.modifylayoutview.php | 2 +- .../parsers/parser.modifylistview.php | 8 +- .../parsers/parser.modifysubpanel.php | 2 +- .../relationships/AbstractRelationship.php | 38 +- .../relationships/AbstractRelationships.php | 2 +- .../relationships/ActivitiesRelationship.php | 2 +- .../relationships/DeployedRelationships.php | 32 +- .../relationships/ManyToManyRelationship.php | 2 +- .../relationships/ManyToOneRelationship.php | 2 +- .../relationships/OneToManyRelationship.php | 2 +- .../relationships/OneToOneRelationship.php | 2 +- .../relationships/RelationshipFactory.php | 2 +- .../relationships/RelationshipsInterface.php | 2 +- .../relationships/UndeployedRelationships.php | 2 +- .../views/AbstractMetaDataImplementation.php | 2 +- .../parsers/views/AbstractMetaDataParser.php | 7 +- .../parsers/views/DashletMetaDataParser.php | 2 +- .../views/DeployedMetaDataImplementation.php | 13 +- .../views/DeployedSubpanelImplementation.php | 2 +- .../views/GridLayoutMetaDataParser.php | 70 +- .../ModuleBuilder/parsers/views/History.php | 33 +- .../parsers/views/HistoryInterface.php | 2 +- .../views/ListLayoutMetaDataParser.php | 20 +- .../views/MetaDataImplementationInterface.php | 2 +- .../parsers/views/MetaDataParserInterface.php | 2 +- .../parsers/views/PopupMetaDataParser.php | 2 +- .../views/SearchViewMetaDataParser.php | 2 +- .../parsers/views/SubpanelMetaDataParser.php | 2 +- .../UndeployedMetaDataImplementation.php | 2 +- .../UndeployedSubpanelImplementation.php | 2 +- modules/ModuleBuilder/tpls/LayoutEditor.css | 2 +- modules/ModuleBuilder/tpls/ListEditor.css | 2 +- modules/ModuleBuilder/tpls/MB.css | 16 +- modules/ModuleBuilder/tpls/MBModule/Class.tpl | 2 +- .../tpls/MBModule/DeveloperClass.tpl | 2 +- modules/ModuleBuilder/tpls/MBModule/Menu.tpl | 2 +- .../ModuleBuilder/tpls/MBModule/Studio.tpl | 2 +- .../ModuleBuilder/tpls/MBModule/dropdown.css | 2 +- .../ModuleBuilder/tpls/MBModule/dropdown.tpl | 7 +- .../ModuleBuilder/tpls/MBModule/dropdowns.tpl | 2 +- modules/ModuleBuilder/tpls/MBModule/field.tpl | 2 +- .../ModuleBuilder/tpls/MBModule/fields.tpl | 2 +- .../ModuleBuilder/tpls/MBModule/language.tpl | 2 +- .../ModuleBuilder/tpls/MBModule/module.tpl | 6 +- .../ModuleBuilder/tpls/MBModule/vardef.tpl | 5 +- .../ModuleBuilder/tpls/MBPackage/deploy.tpl | 2 +- .../ModuleBuilder/tpls/MBPackage/package.tpl | 16 +- .../ModuleBuilder/tpls/Preview/layoutView.tpl | 13 +- .../ModuleBuilder/tpls/Preview/listView.tpl | 13 +- .../tpls/assistantJavascript.tpl | 2 +- modules/ModuleBuilder/tpls/editProperty.tpl | 2 +- .../tpls/exportcustomizations.tpl | 2 +- modules/ModuleBuilder/tpls/history.tpl | 2 +- modules/ModuleBuilder/tpls/includes.tpl | 2 +- modules/ModuleBuilder/tpls/index.tpl | 2 +- modules/ModuleBuilder/tpls/labels.tpl | 15 +- modules/ModuleBuilder/tpls/layoutView.tpl | 57 +- modules/ModuleBuilder/tpls/listView.tpl | 30 +- modules/ModuleBuilder/tpls/main.tpl | 2 +- modules/ModuleBuilder/tpls/resetModule.tpl | 2 +- .../ModuleBuilder/tpls/studioRelationship.tpl | 2 +- .../tpls/studioRelationships.tpl | 2 +- modules/ModuleBuilder/tpls/wizard.tpl | 2 +- modules/ModuleBuilder/views/view.dashlet.php | 7 +- .../ModuleBuilder/views/view.deletemodule.php | 6 +- .../views/view.deletepackage.php | 6 +- .../views/view.displaydeploy.php | 6 +- .../views/view.displaydeployresult.php | 6 +- modules/ModuleBuilder/views/view.dropdown.php | 13 +- .../ModuleBuilder/views/view.dropdowns.php | 6 +- .../views/view.exportcustomizations.php | 6 +- modules/ModuleBuilder/views/view.history.php | 8 +- modules/ModuleBuilder/views/view.home.php | 6 +- modules/ModuleBuilder/views/view.labels.php | 20 +- .../ModuleBuilder/views/view.layoutview.php | 68 +- modules/ModuleBuilder/views/view.listview.php | 7 +- modules/ModuleBuilder/views/view.main.php | 6 +- modules/ModuleBuilder/views/view.module.php | 6 +- .../ModuleBuilder/views/view.modulefield.php | 17 +- .../ModuleBuilder/views/view.modulefields.php | 10 +- .../ModuleBuilder/views/view.modulelabels.php | 6 +- modules/ModuleBuilder/views/view.package.php | 27 +- .../ModuleBuilder/views/view.popupview.php | 7 +- modules/ModuleBuilder/views/view.property.php | 6 +- .../ModuleBuilder/views/view.relationship.php | 6 +- .../views/view.relationships.php | 6 +- .../ModuleBuilder/views/view.resetmodule.php | 6 +- .../ModuleBuilder/views/view.searchview.php | 6 +- modules/ModuleBuilder/views/view.tree.php | 6 +- modules/ModuleBuilder/views/view.wizard.php | 6 +- modules/MySettings/LoadTabSubpanels.php | 2 +- modules/MySettings/StoreQuery.php | 121 +- modules/MySettings/TabController.php | 2 +- modules/MySettings/language/en_us.lang.php | 2 +- .../MyNotesDashlet/MyNotesDashlet.data.php | 126 + .../MyNotesDashlet/MyNotesDashlet.meta.php | 45 + .../MyNotesDashlet/MyNotesDashlet.php | 57 + modules/Notes/Menu.php | 2 +- modules/Notes/Note.php | 26 +- modules/Notes/NoteSoap.php | 14 +- modules/Notes/NotesQuickCreate.php | 2 +- modules/Notes/SubPanelView.html | 2 +- modules/Notes/SubPanelView.php | 2 +- modules/Notes/controller.php | 14 +- modules/Notes/field_arrays.php | 2 +- modules/Notes/language/en_us.lang.php | 5 +- modules/Notes/metadata/SearchFields.php | 11 +- modules/Notes/metadata/additionalDetails.php | 2 +- modules/Notes/metadata/detailviewdefs.php | 10 +- modules/Notes/metadata/editviewdefs.php | 46 +- modules/Notes/metadata/listviewdefs.php | 24 +- modules/Notes/metadata/quickcreatedefs.php | 37 +- modules/Notes/metadata/searchdefs.php | 4 +- modules/Notes/metadata/studio.php | 2 +- .../metadata/subpanels/ForCalls.php} | 123 +- .../Notes/metadata/subpanels/ForHistory.php | 7 +- .../Notes/metadata/subpanels/ForMeetings.php | 127 + modules/Notes/metadata/subpanels/default.php | 7 +- modules/Notes/tpls/EditViewHeader.tpl | 2 +- modules/Notes/tpls/QuickCreate.tpl | 2 +- modules/Notes/vardefs.php | 44 +- .../MyClosedOpportunitiesDashlet.meta.php | 2 +- .../MyClosedOpportunitiesDashlet.php | 72 +- .../MyClosedOpportunitiesDashlet.tpl | 12 +- .../MyClosedOpportunitiesDashletConfigure.tpl | 74 + .../MyClosedOpportunitiesDashletOptions.tpl | 86 + .../MyOpportunitiesDashlet.data.php | 2 +- .../MyOpportunitiesDashlet.meta.php | 2 +- .../MyOpportunitiesDashlet.php | 2 +- modules/Opportunities/ListViewTop.html | 2 +- modules/Opportunities/ListViewTop.php | 2 +- modules/Opportunities/Menu.php | 2 +- .../OpportunitiesQuickCreate.php | 2 +- modules/Opportunities/Opportunity.php | 107 +- modules/Opportunities/OpportunityFormBase.php | 2 +- modules/Opportunities/Save.php | 2 +- modules/Opportunities/SaveOverload.php | 2 +- modules/Opportunities/SubPanelView.html | 2 +- modules/Opportunities/SubPanelView.php | 2 +- .../Opportunities/SubPanelViewProjects.html | 2 +- .../Opportunities/SubPanelViewProjects.php | 2 +- modules/Opportunities/SugarFeeds/OppFeed.php | 2 +- modules/Opportunities/field_arrays.php | 2 +- modules/Opportunities/language/en_us.lang.php | 3 +- .../Opportunities/metadata/SearchFields.php | 26 +- modules/Opportunities/metadata/acldefs.php | 2 +- .../metadata/additionalDetails.php | 2 +- .../Opportunities/metadata/detailviewdefs.php | 11 +- .../Opportunities/metadata/editviewdefs.php | 2 +- .../Opportunities/metadata/listviewdefs.php | 11 +- modules/Opportunities/metadata/metafiles.php | 2 +- modules/Opportunities/metadata/popupdefs.php | 2 +- .../metadata/quickcreatedefs.php | 12 +- modules/Opportunities/metadata/searchdefs.php | 6 +- modules/Opportunities/metadata/studio.php | 2 +- .../Opportunities/metadata/subpaneldefs.php | 23 +- .../metadata/subpanels/ForAccounts.php | 2 +- .../metadata/subpanels/ForEmails.php | 2 +- .../metadata/subpanels/default.php | 2 +- modules/Opportunities/tpls/QuickCreate.tpl | 2 +- modules/Opportunities/vardefs.php | 18 +- modules/Opportunities/views/view.detail.php | 2 +- modules/Opportunities/views/view.edit.php | 4 +- modules/OptimisticLock/Forms.php | 2 +- modules/OptimisticLock/LockResolve.php | 2 +- modules/OptimisticLock/Menu.php | 2 +- .../OptimisticLock/language/en_us.lang.php | 2 +- modules/Project/Delete.php | 2 +- modules/Project/Menu.php | 2 +- modules/Project/Project.js | 2 +- modules/Project/Project.php | 2 +- modules/Project/ProjectQuickCreate.php | 2 +- modules/Project/Save.php | 2 +- modules/Project/SubPanelView.html | 2 +- modules/Project/SubPanelView.php | 2 +- modules/Project/action_view_map.php | 2 +- modules/Project/field_arrays.php | 2 +- modules/Project/language/en_us.lang.php | 2 +- modules/Project/metadata/SearchFields.php | 17 +- .../Project/metadata/additionalDetails.php | 2 +- modules/Project/metadata/detailviewdefs.php | 2 +- modules/Project/metadata/editviewdefs.php | 2 +- modules/Project/metadata/listviewdefs.php | 2 +- modules/Project/metadata/metafiles.php | 2 +- modules/Project/metadata/popupdefs.php | 2 +- modules/Project/metadata/quickcreatedefs.php | 2 +- modules/Project/metadata/searchdefs.php | 3 +- modules/Project/metadata/studio.php | 2 +- modules/Project/metadata/subpaneldefs.php | 2 +- .../Project/metadata/subpanels/ForEmails.php | 2 +- .../Project/metadata/subpanels/default.php | 2 +- modules/Project/tpls/QuickCreate.tpl | 2 +- modules/Project/vardefs.php | 12 +- modules/Project/views/view.detail.php | 2 +- modules/Project/views/view.edit.php | 2 +- modules/Project/views/view.list.php | 2 +- .../Project/views/view.templatesdetail.php | 6 +- modules/Project/views/view.templatesedit.php | 6 +- .../MyProjectTaskDashlet.data.php | 2 +- .../MyProjectTaskDashlet.meta.php | 2 +- .../MyProjectTaskDashlet.php | 2 +- modules/ProjectTask/Delete.php | 2 +- modules/ProjectTask/Forms.html | 2 +- modules/ProjectTask/Menu.php | 2 +- modules/ProjectTask/MyProjectTasks.html | 2 +- modules/ProjectTask/MyProjectTasks.php | 4 +- modules/ProjectTask/Popup.html | 2 +- modules/ProjectTask/Popup.php | 2 +- modules/ProjectTask/Popup_picker.html | 2 +- modules/ProjectTask/ProjectTask.js | 2 +- modules/ProjectTask/ProjectTask.php | 2 +- .../ProjectTask/ProjectTaskQuickCreate.php | 2 +- modules/ProjectTask/Save.php | 2 +- modules/ProjectTask/SubPanelView.html | 2 +- modules/ProjectTask/SubPanelView.php | 2 +- modules/ProjectTask/field_arrays.php | 2 +- modules/ProjectTask/language/en_us.lang.php | 2 +- modules/ProjectTask/metadata/SearchFields.php | 18 +- modules/ProjectTask/metadata/acldefs.php | 2 +- .../metadata/additionalDetails.php | 2 +- .../ProjectTask/metadata/detailviewdefs.php | 2 +- modules/ProjectTask/metadata/editviewdefs.php | 2 +- modules/ProjectTask/metadata/listviewdefs.php | 2 +- modules/ProjectTask/metadata/popupdefs.php | 2 +- modules/ProjectTask/metadata/searchdefs.php | 3 +- modules/ProjectTask/metadata/studio.php | 2 +- modules/ProjectTask/metadata/subpaneldefs.php | 2 +- .../metadata/subpanels/default.php | 2 +- modules/ProjectTask/tpls/QuickCreate.tpl | 2 +- modules/ProjectTask/vardefs.php | 11 +- modules/ProjectTask/views/view.list.php | 4 +- modules/ProspectLists/Delete.php | 2 +- modules/ProspectLists/Duplicate.php | 4 +- modules/ProspectLists/Forms.html | 2 +- modules/ProspectLists/Forms.php | 2 +- modules/ProspectLists/Menu.php | 11 +- modules/ProspectLists/Popup_picker.html | 2 +- modules/ProspectLists/ProspectList.php | 2 +- .../ProspectLists/ProspectListFormBase.php | 2 +- modules/ProspectLists/Save.php | 2 +- modules/ProspectLists/SubPanelView.html | 2 +- modules/ProspectLists/SubPanelView.php | 2 +- modules/ProspectLists/TargetListUpdate.php | 24 +- modules/ProspectLists/field_arrays.php | 2 +- modules/ProspectLists/language/en_us.lang.php | 7 +- .../ProspectLists/metadata/SearchFields.php | 2 +- .../ProspectLists/metadata/detailviewdefs.php | 2 +- .../ProspectLists/metadata/editviewdefs.php | 2 +- .../ProspectLists/metadata/listviewdefs.php | 9 +- modules/ProspectLists/metadata/popupdefs.php | 2 +- modules/ProspectLists/metadata/searchdefs.php | 5 +- .../ProspectLists/metadata/subpaneldefs.php | 2 +- .../metadata/subpanels/default.php | 2 +- modules/ProspectLists/vardefs.php | 34 +- modules/Prospects/Delete.php | 2 +- modules/Prospects/Import.php | 2 +- modules/Prospects/Menu.php | 10 +- modules/Prospects/Popup_picker.html | 2 +- modules/Prospects/Prospect.php | 4 +- modules/Prospects/ProspectFormBase.php | 2 +- modules/Prospects/Save.php | 2 +- modules/Prospects/field_arrays.php | 2 +- modules/Prospects/language/en_us.lang.php | 4 +- modules/Prospects/metadata/SearchFields.php | 11 +- .../Prospects/metadata/additionalDetails.php | 8 +- modules/Prospects/metadata/detailviewdefs.php | 12 +- modules/Prospects/metadata/editviewdefs.php | 2 +- modules/Prospects/metadata/listviewdefs.php | 12 +- modules/Prospects/metadata/popupdefs.php | 2 +- .../Prospects/metadata/quickcreatedefs.php | 2 +- modules/Prospects/metadata/searchdefs.php | 6 +- modules/Prospects/metadata/studio.php | 2 +- modules/Prospects/metadata/subpaneldefs.php | 2 +- .../Prospects/metadata/subpanels/default.php | 2 +- modules/Prospects/tpls/DetailViewHeader.tpl | 2 +- modules/Prospects/vardefs.php | 3 +- modules/Prospects/views/view.detail.php | 2 +- modules/Prospects/views/view.list.php | 48 + modules/Relationships/Relationship.php | 2 +- modules/Relationships/RelationshipHandler.php | 2 +- modules/Relationships/field_arrays.php | 2 +- modules/Relationships/language/en_us.lang.php | 2 +- modules/Relationships/vardefs.php | 2 +- modules/Releases/DetailView.php | 2 +- modules/Releases/EditView.html | 2 +- modules/Releases/EditView.php | 2 +- modules/Releases/ListView.html | 2 +- modules/Releases/Menu.php | 2 +- modules/Releases/Popup_picker.html | 2 +- modules/Releases/Popup_picker.php | 2 +- modules/Releases/Release.php | 2 +- modules/Releases/Save.php | 2 +- modules/Releases/field_arrays.php | 2 +- modules/Releases/index.php | 4 +- modules/Releases/language/en_us.lang.php | 2 +- modules/Releases/vardefs.php | 2 +- modules/Roles/Delete.php | 2 +- modules/Roles/DeleteUserRelationship.php | 2 +- modules/Roles/DetailView.html | 2 +- modules/Roles/DetailView.php | 4 +- modules/Roles/EditView.html | 2 +- modules/Roles/EditView.php | 4 +- modules/Roles/Forms.php | 2 +- modules/Roles/Menu.php | 2 +- modules/Roles/Role.php | 2 +- modules/Roles/Save.php | 2 +- modules/Roles/SaveUserRelationship.php | 2 +- modules/Roles/SubPanelViewUsers.html | 2 +- modules/Roles/SubPanelViewUsers.php | 2 +- modules/Roles/field_arrays.php | 2 +- modules/Roles/language/en_us.lang.php | 2 +- modules/Roles/metadata/SearchFields.php | 2 +- modules/Roles/metadata/listviewdefs.php | 2 +- modules/Roles/metadata/searchdefs.php | 5 +- modules/Roles/metadata/subpaneldefs.php | 2 +- modules/Roles/metadata/subpanels/default.php | 2 +- modules/Roles/vardefs.php | 2 +- modules/Roles/views/view.list.php | 2 +- modules/SavedSearch/ListView.php | 4 +- modules/SavedSearch/Menu.php | 2 +- modules/SavedSearch/SavedSearch.php | 99 +- modules/SavedSearch/SavedSearchForm.tpl | 8 +- modules/SavedSearch/SavedSearchSelects.tpl | 2 +- modules/SavedSearch/SearchForm.html | 2 +- modules/SavedSearch/UpgradeSavedSearch.php | 2 +- modules/SavedSearch/field_arrays.php | 2 +- modules/SavedSearch/index.php | 11 +- modules/SavedSearch/language/en_us.lang.php | 2 +- modules/SavedSearch/metadata/listviewdefs.php | 2 +- modules/SavedSearch/vardefs.php | 2 +- modules/Schedulers/Delete.php | 2 +- modules/Schedulers/DeleteScheduled.php | 2 +- modules/Schedulers/DetailView.html | 2 +- modules/Schedulers/DetailView.php | 2 +- modules/Schedulers/EditView.html | 6 +- modules/Schedulers/EditView.php | 5 +- modules/Schedulers/JobThread.php | 4 +- modules/Schedulers/ListView.html | 2 +- modules/Schedulers/ListView.php | 2 +- modules/Schedulers/Menu.php | 2 +- modules/Schedulers/Save.php | 2 +- modules/Schedulers/Scheduled.html | 2 +- modules/Schedulers/Scheduled.php | 2 +- modules/Schedulers/Scheduler.php | 194 +- modules/Schedulers/SchedulerDaemon.php | 43 +- modules/Schedulers/_AddJobsHere.php | 6 +- modules/Schedulers/field_arrays.php | 2 +- modules/Schedulers/index.php | 4 +- modules/Schedulers/language/en_us.lang.php | 2 +- modules/Schedulers/metadata/subpaneldefs.php | 2 +- .../Schedulers/metadata/subpanels/default.php | 2 +- modules/Schedulers/vardefs.php | 2 +- modules/SchedulersJobs/SchedulersJob.php | 66 +- modules/SchedulersJobs/field_arrays.php | 2 +- .../SchedulersJobs/language/en_us.lang.php | 2 +- .../metadata/subpanels/default.php | 2 +- modules/SchedulersJobs/vardefs.php | 2 +- modules/Studio/DropDowns/DropDownHelper.php | 10 +- modules/Studio/DropDowns/EditView.php | 4 +- modules/Studio/DropDowns/EditView.tpl | 2 +- modules/Studio/Forms.php | 2 +- modules/Studio/JSTransaction.js | 2 +- modules/Studio/SaveTabs.php | 2 +- modules/Studio/TabGroups.php | 2 +- modules/Studio/TabGroups/EditViewTabs.php | 4 +- modules/Studio/TabGroups/EditViewTabs.tpl | 2 +- modules/Studio/TabGroups/TabGroupHelper.php | 5 +- modules/Studio/config.php | 2 +- modules/Studio/language/en_us.Portal.html | 2 +- modules/Studio/language/en_us.lang.php | 2 +- modules/Studio/parsers/StudioParser.php | 10 +- modules/Studio/studio.js | 2 +- modules/Studio/studiodd.js | 2 +- modules/Studio/studiotabgroups.js | 2 +- modules/Studio/wizard.php | 2 +- modules/Studio/wizards/EditDropDownWizard.php | 2 +- modules/Studio/wizards/StudioWizard.php | 4 +- modules/Studio/ygDDListStudio.js | 2 +- modules/SugarFeed/AdminSettings.php | 4 +- .../Dashlets/SugarFeedDashlet/Options.tpl | 126 +- .../SugarFeedDashlet.meta.php | 2 +- .../SugarFeedDashlet/SugarFeedDashlet.php | 233 +- .../SugarFeedDashlet/SugarFeedScript.tpl | 49 +- .../SugarFeedDashlet/UserPostForm.tpl | 22 +- modules/SugarFeed/Menu.php | 2 +- modules/SugarFeed/SugarFeed.php | 146 +- modules/SugarFeed/SugarFeedFlush.php | 16 +- modules/SugarFeed/action_view_map.php | 38 + modules/SugarFeed/feedLogicBase.php | 2 +- modules/SugarFeed/language/en_us.lang.php | 36 +- modules/SugarFeed/linkHandlers/Image.php | 2 +- modules/SugarFeed/linkHandlers/Link.php | 2 +- modules/SugarFeed/linkHandlers/YouTube.php | 2 +- modules/SugarFeed/metadata/SearchFields.php | 2 +- .../SugarFeed/metadata/dashletviewdefs.php | 8 +- modules/SugarFeed/metadata/detailviewdefs.php | 2 +- modules/SugarFeed/metadata/editviewdefs.php | 2 +- modules/SugarFeed/metadata/listviewdefs.php | 2 +- modules/SugarFeed/metadata/metafiles.php | 2 +- modules/SugarFeed/metadata/popupdefs.php | 2 +- modules/SugarFeed/metadata/searchdefs.php | 3 +- .../SugarFeed/metadata/subpanels/default.php | 2 +- .../SugarFeed/{ => tpls}/AdminSettings.tpl | 5 +- modules/SugarFeed/vardefs.php | 2 +- .../SugarFeed/views/view.adminsettings.php | 179 + modules/TableDictionary.php | 10 +- .../MyTasksDashlet/MyTasksDashlet.data.php | 2 +- .../MyTasksDashlet/MyTasksDashlet.meta.php | 2 +- .../MyTasksDashlet/MyTasksDashlet.php | 2 +- modules/Tasks/Menu.php | 2 +- modules/Tasks/MyTasks.html | 2 +- modules/Tasks/MyTasks.php | 22 +- modules/Tasks/Save.php | 13 +- modules/Tasks/Task.php | 63 +- modules/Tasks/TasksQuickCreate.php | 2 +- modules/Tasks/field_arrays.php | 2 +- modules/Tasks/language/en_us.lang.php | 7 +- modules/Tasks/metadata/SearchFields.php | 24 +- modules/Tasks/metadata/additionalDetails.php | 3 +- modules/Tasks/metadata/detailviewdefs.php | 2 +- modules/Tasks/metadata/editviewdefs.php | 2 +- modules/Tasks/metadata/listviewdefs.php | 9 +- modules/Tasks/metadata/quickcreatedefs.php | 2 +- modules/Tasks/metadata/searchdefs.php | 4 +- modules/Tasks/metadata/studio.php | 2 +- .../metadata/subpanels/ForActivities.php | 2 +- .../Tasks/metadata/subpanels/ForEmails.php | 2 +- .../Tasks/metadata/subpanels/ForHistory.php | 2 +- modules/Tasks/metadata/subpanels/default.php | 2 +- modules/Tasks/tpls/QuickCreate.tpl | 2 +- modules/Tasks/vardefs.php | 7 +- modules/Tasks/views/view.edit.php | 18 +- modules/Trackers/BreadCrumbStack.php | 2 +- modules/Trackers/Metric.php | 2 +- modules/Trackers/Trackable.php | 2 +- modules/Trackers/Tracker.php | 82 +- modules/Trackers/TrackerManager.php | 2 +- modules/Trackers/config.php | 2 +- modules/Trackers/language/en_us.lang.php | 2 +- modules/Trackers/monitor/BlankMonitor.php | 2 +- modules/Trackers/monitor/Monitor.php | 68 +- modules/Trackers/monitor/tracker_monitor.php | 2 +- modules/Trackers/populateSeedData.php | 22 +- modules/Trackers/store/DatabaseStore.php | 2 +- modules/Trackers/store/Store.php | 2 +- modules/Trackers/store/SugarLogStore.php | 2 +- .../store/TrackerQueriesDatabaseStore.php | 2 +- .../store/TrackerSessionsDatabaseStore.php | 2 +- modules/Trackers/vardefs.php | 2 +- modules/UpgradeWizard/Menu.php | 2 +- modules/UpgradeWizard/SILENTUPGRADE.txt | 2 +- .../SugarMerge/DetailViewMerge.php | 2 +- .../SugarMerge/EditViewMerge.php | 23 +- .../SugarMerge/ListViewMerge.php | 2 +- .../SugarMerge/QuickCreateMerge.php | 2 +- .../UpgradeWizard/SugarMerge/SearchMerge.php | 26 +- .../SugarMerge/SubpanelMerge.php | 2 +- .../UpgradeWizard/SugarMerge/SugarMerge.php | 2 +- modules/UpgradeWizard/UploadFileCheck.php | 5 +- modules/UpgradeWizard/cancel.php | 2 +- modules/UpgradeWizard/commit.php | 69 +- modules/UpgradeWizard/commitJson.php | 2 +- modules/UpgradeWizard/deleteCache.php | 2 +- modules/UpgradeWizard/end.php | 86 +- modules/UpgradeWizard/index.php | 4 +- modules/UpgradeWizard/language/en_us.lang.php | 2 +- modules/UpgradeWizard/layouts.php | 2 +- modules/UpgradeWizard/populateColumns.php | 2 +- modules/UpgradeWizard/preflight.php | 20 +- modules/UpgradeWizard/preflightJson.php | 2 +- modules/UpgradeWizard/silentUpgrade.php | 2 +- .../UpgradeWizard/silentUpgrade_dce_step1.php | 2 +- .../UpgradeWizard/silentUpgrade_dce_step2.php | 8 +- modules/UpgradeWizard/silentUpgrade_step1.php | 220 +- modules/UpgradeWizard/silentUpgrade_step2.php | 79 +- modules/UpgradeWizard/start.php | 2 +- modules/UpgradeWizard/systemCheck.php | 2 +- modules/UpgradeWizard/systemCheckJson.php | 2 +- modules/UpgradeWizard/tpls/layoutsMerge.tpl | 2 +- modules/UpgradeWizard/upgradeMetaHelper.php | 2 +- modules/UpgradeWizard/upgradeTimeCounter.php | 2 +- modules/UpgradeWizard/upgradeWizard.js | 2 +- modules/UpgradeWizard/upload.php | 2 +- modules/UpgradeWizard/uw_ajax.php | 27 +- modules/UpgradeWizard/uw_emptyFunctions.php | 2 +- modules/UpgradeWizard/uw_files.php | 3 +- modules/UpgradeWizard/uw_main.tpl | 2 +- modules/UpgradeWizard/uw_utils.php | 802 +- modules/UserPreferences/UserPreference.php | 563 +- modules/UserPreferences/controller.php | 2 +- modules/UserPreferences/field_arrays.php | 2 +- modules/UserPreferences/index.php | 2 +- modules/UserPreferences/vardefs.php | 4 +- modules/Users/Authenticate.php | 31 +- modules/Users/ChangeGroupTab.php | 2 +- modules/Users/ChangePassword.php | 2 +- modules/Users/Changenewpassword.php | 9 +- modules/Users/Changenewpassword.tpl | 2 +- modules/Users/DetailView.js | 2 +- modules/Users/DetailView.php | 61 +- modules/Users/DetailView.tpl | 4 +- modules/Users/EditView.php | 68 +- modules/Users/EditView.tpl | 33 +- modules/Users/Error.php | 2 +- modules/Users/Forms.php | 2 +- modules/Users/GeneratePassword.php | 17 +- modules/Users/ListRoles.php | 2 +- modules/Users/Login.php | 39 +- modules/Users/Logout.php | 2 +- modules/Users/Menu.php | 2 +- modules/Users/PasswordRequirementBox.css | 2 +- modules/Users/PasswordRequirementBox.js | 2 +- modules/Users/PopupSignature.php | 4 +- modules/Users/PopupUsers.php | 2 +- modules/Users/Popup_Users_picker.html | 2 +- modules/Users/Popup_picker.html | 2 +- modules/Users/Save.php | 5 +- modules/Users/SaveSignature.php | 2 +- modules/Users/SaveTimezone.php | 2 +- modules/Users/SetTimezone.php | 56 +- modules/Users/SetTimezone.tpl | 22 +- modules/Users/User.js | 2 +- modules/Users/User.php | 32 +- modules/Users/UserSignature.php | 2 +- modules/Users/UserSignatureEditView.html | 2 +- .../AuthenticationController.php | 17 +- .../EmailAuthenticate/EmailAuthenticate.php | 2 +- .../EmailAuthenticateUser.php | 2 +- .../LDAPAuthenticate/LDAPAuthenticate.php | 2 +- .../LDAPAuthenticate/LDAPAuthenticateUser.php | 2 +- .../LDAPAuthenticate/LDAPConfigs/default.php | 2 +- .../SAMLAuthenticate/SAMLAuthenticate.php | 2 +- .../SAMLAuthenticate/SAMLAuthenticateUser.php | 2 +- .../SugarAuthenticate/SugarAuthenticate.php | 2 +- .../SugarAuthenticateUser.php | 2 +- modules/Users/controller.php | 9 +- modules/Users/field_arrays.php | 2 +- modules/Users/language/en_us.lang.php | 8 +- modules/Users/login.css | 5 +- modules/Users/login.js | 2 +- modules/Users/login.tpl | 15 +- modules/Users/metadata/SearchFields.php | 2 +- modules/Users/metadata/listviewdefs.php | 2 +- modules/Users/metadata/popupdefs.php | 2 +- .../Users/metadata/reassignScriptMetadata.php | 2 +- modules/Users/metadata/searchdefs.php | 4 +- modules/Users/metadata/subpaneldefs.php | 22 +- modules/Users/metadata/subpanels/ForCalls.php | 2 +- .../Users/metadata/subpanels/ForEmails.php | 2 +- .../Users/metadata/subpanels/ForMeetings.php | 2 +- .../Users/metadata/subpanels/ForProject.php | 2 +- .../metadata/subpanels/ForProspectLists.php | 6 +- modules/Users/metadata/subpanels/ForTeams.php | 2 +- modules/Users/metadata/subpanels/default.php | 2 +- modules/Users/password_utils.php | 43 +- modules/Users/reassignUserRecords.php | 15 +- modules/Users/tpls/wizard.tpl | 64 +- modules/Users/vardefs.php | 12 +- modules/Users/views/view.list.php | 14 +- modules/Users/views/view.wizard.php | 57 +- modules/Versions/CheckVersions.php | 2 +- modules/Versions/DefaultVersions.php | 10 +- modules/Versions/ExpectedVersions.php | 2 +- modules/Versions/InstallDefaultVersions.php | 2 +- modules/Versions/Version.php | 2 +- modules/Versions/field_arrays.php | 2 +- modules/Versions/index.html | 2 +- modules/Versions/vardefs.php | 2 +- modules/vCals/HTTP_WebDAV_Server_vCal.php | 2 +- modules/vCals/Server.php | 2 +- modules/vCals/field_arrays.php | 2 +- modules/vCals/vCal.php | 47 +- modules/vCals/vardefs.php | 2 +- pdf.php | 2 +- removeme.php | 2 +- service/core/NusoapSoap.php | 34 +- service/core/PHP5Soap.php | 7 +- service/core/REST/SugarRest.php | 2 +- service/core/REST/SugarRestJSON.php | 2 +- service/core/REST/SugarRestRSS.php | 144 +- service/core/REST/SugarRestSerialize.php | 2 +- service/core/SoapHelperWebService.php | 26 +- service/core/SugarRestService.php | 90 +- service/core/SugarRestServiceImpl.php | 2 +- service/core/SugarRestUtils.php | 2 +- service/core/SugarSoapService.php | 2 +- service/core/SugarWebService.php | 2 +- service/core/SugarWebServiceImpl.php | 27 +- service/core/webservice.php | 2 +- service/example/Rest_Proxy.php | 2 +- service/example/example.html | 2 +- service/example/test.html | 2 +- service/utils/SugarRest.js | 2 +- service/v2/SugarSoapService2.php | 2 +- service/v2/registry.php | 2 +- service/v2/rest.php | 2 +- service/v2/soap.php | 2 +- service/v2_1/SugarWebServiceImplv2_1.php | 16 +- service/v2_1/registry.php | 2 +- service/v2_1/rest.php | 2 +- service/v2_1/soap.php | 2 +- service/v3/SugarWebServiceImplv3.php | 6 +- service/v3/SugarWebServiceUtilv3.php | 106 +- service/v3/registry.php | 2 +- service/v3/rest.php | 2 +- service/v3/soap.php | 2 +- service/v3_1/SugarWebServiceImplv3_1.php | 865 + service/v3_1/SugarWebServiceUtilv3_1.php | 565 + service/v3_1/registry.php | 289 + service/v3_1/rest.php | 50 + service/v3_1/soap.php | 50 + service/v4/SugarWebServiceImplv4.php | 585 + service/v4/SugarWebServiceUtilv4.php | 677 + service/v4/registry.php | 144 + service/v4/rest.php | 50 + service/v4/soap.php | 50 + soap.php | 2 +- soap/SoapData.php | 2 +- soap/SoapDeprecated.php | 23 +- soap/SoapError.php | 2 +- soap/SoapErrorDefinitions.php | 2 +- soap/SoapHelperFunctions.php | 116 +- soap/SoapPortalHelper.php | 2 +- soap/SoapPortalUsers.php | 7 +- soap/SoapRelationshipHelper.php | 4 +- soap/SoapStudio.php | 2 +- soap/SoapSugarUsers.php | 46 +- soap/SoapTypes.php | 2 +- sugar_version.php | 10 +- tests/ModuleInstall/Bug41829Test.php | 34 + tests/ModuleInstall/ModuleScannerTest.php | 35 + .../PackageManager/Bug39980Test.php | 35 + tests/PHPUnit/ChangeLog.markdown | 143 + .../Extensions/Database/AbstractTester.php | 206 - .../Database/Constraint/DataSetIsEqual.php | 132 - .../Database/Constraint/TableIsEqual.php | 133 - .../Extensions/Database/DB/DataSet.php | 174 - .../Database/DB/DefaultDatabaseConnection.php | 232 - .../Database/DB/FilteredDataSet.php | 95 - .../Database/DB/IDatabaseConnection.php | 145 - .../Extensions/Database/DB/MetaData.php | 215 - .../DB/MetaData/InformationSchema.php | 184 - .../Extensions/Database/DB/MetaData/MySQL.php | 137 - .../Extensions/Database/DB/MetaData/Oci.php | 164 - .../Extensions/Database/DB/MetaData/PgSQL.php | 164 - .../Database/DB/MetaData/Sqlite.php | 152 - .../Extensions/Database/DB/ResultSetTable.php | 92 - .../PHPUnit/Extensions/Database/DB/Table.php | 84 - .../Extensions/Database/DB/TableIterator.php | 176 - .../Extensions/Database/DB/TableMetaData.php | 75 - .../Database/DataSet/AbstractDataSet.php | 178 - .../Database/DataSet/AbstractTable.php | 218 - .../DataSet/AbstractTableMetaData.php | 136 - .../Database/DataSet/AbstractXmlDataSet.php | 150 - .../Database/DataSet/CompositeDataSet.php | 130 - .../Database/DataSet/CsvDataSet.php | 158 - .../Database/DataSet/DataSetFilter.php | 144 - .../Database/DataSet/DefaultDataSet.php | 109 - .../Database/DataSet/DefaultTable.php | 124 - .../Database/DataSet/DefaultTableIterator.php | 173 - .../Database/DataSet/DefaultTableMetaData.php | 91 - .../Database/DataSet/FlatXmlDataSet.php | 111 - .../Extensions/Database/DataSet/IDataSet.php | 104 - .../Database/DataSet/IPersistable.php | 77 - .../Extensions/Database/DataSet/ITable.php | 104 - .../Database/DataSet/Persistors/Abstract.php | 137 - .../Database/DataSet/Persistors/FlatXml.php | 157 - .../Database/DataSet/Persistors/Xml.php | 161 - .../Database/DataSet/QueryDataSet.php | 142 - .../Database/DataSet/QueryTable.php | 172 - .../Database/DataSet/ReplacementDataSet.php | 140 - .../Database/DataSet/ReplacementTable.php | 250 - .../DataSet/ReplacementTableIterator.php | 197 - .../Database/DataSet/TableFilter.php | 107 - .../Database/DataSet/TableMetaDataFilter.php | 125 - .../Database/DataSet/XmlDataSet.php | 141 - .../Extensions/Database/DefaultTester.php | 95 - tests/PHPUnit/Extensions/Database/ITester.php | 128 - .../Database/Operation/Composite.php | 106 - .../Extensions/Database/Operation/Delete.php | 98 - .../Database/Operation/DeleteAll.php | 87 - .../Database/Operation/Exception.php | 137 - .../Extensions/Database/Operation/Factory.php | 157 - .../Database/Operation/IDatabaseOperation.php | 78 - .../Extensions/Database/Operation/Insert.php | 108 - .../Extensions/Database/Operation/Null.php | 74 - .../Extensions/Database/Operation/Replace.php | 148 - .../Database/Operation/RowBased.php | 125 - .../Database/Operation/Truncate.php | 96 - .../Extensions/Database/Operation/Update.php | 103 - .../PHPUnit/Extensions/Database/TestCase.php | 254 - .../Extensions/PerformanceTestCase.php | 118 - tests/PHPUnit/Extensions/SeleniumTestCase.php | 1317 - .../Extensions/SeleniumTestCase/Driver.php | 1048 - .../SeleniumTestCase/phpunit_coverage.php | 86 - .../Extensions/Story/SeleniumTestCase.php | 209 - tests/PHPUnit/File/Iterator.php | 197 + tests/PHPUnit/File/Iterator/Factory.php | 155 + tests/PHPUnit/Framework.php | 72 - .../Framework/ComparisonFailure/Scalar.php | 108 - .../Framework/ComparisonFailure/String.php | 120 - tests/PHPUnit/Framework/MockObject/Mock.php | 445 - tests/PHPUnit/Framework/MockObject/Stub.php | 90 - tests/PHPUnit/Framework/TestCase.php | 1043 - tests/PHPUnit/LICENSE | 33 + tests/PHPUnit/PHP/CodeCoverage.php | 613 + .../CodeCoverage/Driver.php} | 49 +- .../CodeCoverage/Driver/Xdebug.php} | 79 +- tests/PHPUnit/PHP/CodeCoverage/Filter.php | 334 + .../PHP/CodeCoverage/Report/Clover.php | 467 + .../PHPUnit/PHP/CodeCoverage/Report/HTML.php | 419 + .../CodeCoverage/Report/HTML}/Node.php | 237 +- .../Report/HTML}/Node/Directory.php | 172 +- .../CodeCoverage/Report/HTML}/Node/File.php | 526 +- .../Report/HTML/Node/Iterator.php | 149 + .../Report/HTML/Template/RGraph.bar.js | 1653 ++ .../HTML/Template/RGraph.common.core.js | 2454 ++ .../HTML/Template/RGraph.common.tooltips.js | 502 + .../Report/HTML/Template/RGraph.scatter.js | 1168 + .../Report/HTML}/Template/butter.png | Bin .../Report/HTML}/Template/chameleon.png | Bin .../Report/HTML}/Template/close12_1.gif | Bin .../Report/HTML/Template/container-min.js | 19 + .../Report/HTML}/Template/container.css | 11 +- .../Report/HTML/Template/dashboard.html.dist | 86 + .../Report/HTML}/Template/directory.html.dist | 4 +- .../Report/HTML/Template/directory.png | Bin 0 -> 581 bytes .../HTML}/Template/directory_item.html.dist | 10 +- .../HTML/Template/excanvas.compressed.js | Bin 0 -> 8660 bytes .../Report/HTML}/Template/file.html.dist | 6 +- .../Report/HTML/Template/file.png | Bin 0 -> 333 bytes .../Report/HTML}/Template/file_item.html.dist | 9 +- .../HTML}/Template/file_no_yui.html.dist | 2 +- .../Report/HTML}/Template/glass.png | Bin .../HTML}/Template/method_item.html.dist | 5 +- .../Report/HTML}/Template/scarlet_red.png | Bin .../Report/HTML}/Template/snow.png | Bin .../Report/HTML}/Template/style.css | 9 + .../Report/HTML/Template/yahoo-dom-event.js | 14 + .../Report/HTML}/Template/yui_item.js | 0 .../PHP/CodeCoverage/TextUI/Command.php | 268 + tests/PHPUnit/PHP/CodeCoverage/Util.php | 643 + tests/PHPUnit/{Util => PHP}/Timer.php | 79 +- tests/PHPUnit/PHP/Token.php | 475 + tests/PHPUnit/PHP/Token/Exception.php | 56 + tests/PHPUnit/PHP/Token/Stream.php | 378 + .../PHP/Token/Stream/CachingFactory.php | 75 + .../PHP/Token/Stream/TextUI/Command.php | 181 + .../AllTests.php => PHPUnit/Autoload.php} | 73 +- .../Extensions/GroupTestSuite.php | 28 +- .../Extensions/OutputTestCase.php | 55 +- .../{ => PHPUnit}/Extensions/PhptTestCase.php | 88 +- .../Extensions/PhptTestCase/Logger.php | 22 +- .../Extensions/PhptTestSuite.php | 37 +- .../{ => PHPUnit}/Extensions/RepeatedTest.php | 55 +- .../{ => PHPUnit}/Extensions/Story/Given.php | 24 +- .../Extensions/Story/ResultPrinter.php | 24 +- .../Extensions/Story/ResultPrinter/HTML.php | 45 +- .../ResultPrinter/Template/scenario.html.dist | 0 .../Template/scenario_header.html.dist | 0 .../Template/scenarios.html.dist | 0 .../ResultPrinter/Template/step.html.dist | 0 .../Extensions/Story/ResultPrinter/Text.php | 24 +- .../Extensions/Story/Scenario.php | 27 +- .../{ => PHPUnit}/Extensions/Story/Step.php | 23 +- .../Extensions/Story/TestCase.php | 29 +- .../{ => PHPUnit}/Extensions/Story/Then.php | 24 +- .../{ => PHPUnit}/Extensions/Story/When.php | 24 +- .../Extensions/TestDecorator.php | 23 +- .../PHPUnit/Extensions/TicketListener.php | 225 + .../Extensions/TicketListener/GitHub.php | 204 + .../Extensions/TicketListener/GoogleCode.php | 275 + .../Extensions/TicketListener/Trac.php | 189 + .../prepend.php => PHPUnit/Framework.php} | 22 +- .../{ => PHPUnit}/Framework/Assert.php | 1112 +- .../PHPUnit/Framework/Assert/Functions.php | 1827 ++ .../Framework/AssertionFailedError.php | 69 + .../Framework/ComparisonFailure.php | 199 +- .../Framework/ComparisonFailure/Array.php | 43 +- .../Framework/ComparisonFailure/Object.php | 86 +- .../Framework/ComparisonFailure/Scalar.php} | 53 +- .../Framework/ComparisonFailure/String.php | 82 + .../Framework/ComparisonFailure/Type.php | 25 +- .../{ => PHPUnit}/Framework/Constraint.php | 102 +- .../Framework/Constraint/And.php | 57 +- .../Framework/Constraint/ArrayHasKey.php | 41 +- .../Framework/Constraint/Attribute.php | 60 +- .../Constraint/ClassHasAttribute.php | 30 +- .../Constraint/ClassHasStaticAttribute.php | 24 +- .../Framework/Constraint/FileExists.php | 25 +- .../Framework/Constraint/GreaterThan.php | 32 +- .../Framework/Constraint/IsAnything.php | 36 +- .../PHPUnit/Framework/Constraint/IsEmpty.php | 102 + .../Framework/Constraint/IsEqual.php | 126 +- .../Framework/Constraint/IsFalse.php | 23 +- .../Framework/Constraint/IsIdentical.php | 50 +- .../Framework/Constraint/IsInstanceOf.php | 35 +- .../Framework/Constraint/IsNull.php | 23 +- .../Framework/Constraint/IsTrue.php | 23 +- .../Framework/Constraint/IsType.php | 105 +- .../Framework/Constraint/LessThan.php | 32 +- .../Framework/Constraint/Not.php | 49 +- .../Constraint/ObjectHasAttribute.php | 27 +- .../{ => PHPUnit}/Framework/Constraint/Or.php | 75 +- .../Framework/Constraint/PCREMatch.php | 32 +- .../Framework/Constraint/StringContains.php | 56 +- .../Framework/Constraint/StringEndsWith.php | 95 + .../Framework/Constraint/StringMatches.php | 140 + .../Constraint/StringStartsWith.php} | 68 +- .../Constraint/TraversableContains.php | 44 +- .../Constraint/TraversableContainsOnly.php | 39 +- .../Framework/Constraint/Xor.php | 73 +- .../PHPUnit/{ => PHPUnit}/Framework/Error.php | 26 +- .../{ => PHPUnit}/Framework/Error/Notice.php | 26 +- .../{ => PHPUnit}/Framework/Error/Warning.php | 26 +- .../Framework/Exception.php} | 31 +- .../Framework/ExpectationFailedException.php | 54 +- .../Framework/IncompleteTest.php | 26 +- .../Framework/IncompleteTestError.php | 27 +- .../Framework/MockObject/Builder/Identity.php | 30 +- .../MockObject/Builder/InvocationMocker.php | 99 +- .../Framework/MockObject/Builder/Match.php | 31 +- .../MockObject/Builder/MethodNameMatch.php | 37 +- .../MockObject/Builder/Namespace.php | 37 +- .../MockObject/Builder/ParametersMatch.php | 31 +- .../Framework/MockObject/Builder/Stub.php | 31 +- .../Framework/MockObject/Generator.php | 665 + .../Generator/mocked_class.tpl.dist | 46 + .../Generator/mocked_clone.tpl.dist | 4 + .../Generator/mocked_object_method.tpl.dist | 22 + .../Generator/mocked_static_method.tpl.dist | 22 + .../Generator/unmocked_clone.tpl.dist | 5 + .../MockObject/Generator/wsdl_class.tpl.dist | 7 + .../MockObject/Generator/wsdl_method.tpl.dist | 4 + .../Framework/MockObject/Invocation.php} | 33 +- .../MockObject/Invocation/Object.php | 74 + .../MockObject/Invocation/Static.php} | 133 +- .../Framework/MockObject/InvocationMocker.php | 80 +- .../Framework/MockObject/Invokable.php | 44 +- .../Framework/MockObject/Matcher.php | 119 +- .../MockObject/Matcher/AnyInvokedCount.php | 37 +- .../MockObject/Matcher/AnyParameters.php | 39 +- .../MockObject/Matcher/Invocation.php | 43 +- .../MockObject/Matcher/InvokedAtIndex.php | 58 +- .../MockObject/Matcher/InvokedAtLeastOnce.php | 44 +- .../MockObject/Matcher/InvokedCount.php | 73 +- .../MockObject/Matcher/InvokedRecorder.php | 55 +- .../MockObject/Matcher/MethodName.php | 57 +- .../MockObject/Matcher/Parameters.php | 69 +- .../Matcher/StatelessInvocation.php | 61 +- .../Framework/MockObject/MockBuilder.php | 218 + .../Framework/MockObject/MockObject.php | 72 +- .../PHPUnit/Framework/MockObject/Stub.php | 71 + .../MockObject/Stub/ConsecutiveCalls.php | 30 +- .../Framework/MockObject/Stub/Exception.php | 30 +- .../MockObject/Stub/MatcherCollection.php | 34 +- .../Framework/MockObject/Stub/Return.php | 32 +- .../MockObject/Stub/ReturnArgument.php | 29 +- .../MockObject/Stub/ReturnCallback.php | 36 +- .../Framework/MockObject/Verifiable.php | 34 +- .../Framework/Process/TestCaseMethod.tpl.dist | 48 + .../Framework/SelfDescribing.php | 26 +- .../{ => PHPUnit}/Framework/SkippedTest.php | 26 +- .../Framework/SkippedTestError.php | 27 +- .../Framework/SkippedTestSuiteError.php | 27 +- .../Framework/SyntheticError.php} | 96 +- .../PHPUnit/{ => PHPUnit}/Framework/Test.php | 27 +- tests/PHPUnit/PHPUnit/Framework/TestCase.php | 1513 ++ .../{ => PHPUnit}/Framework/TestFailure.php | 65 +- .../{ => PHPUnit}/Framework/TestListener.php | 27 +- .../{ => PHPUnit}/Framework/TestResult.php | 486 +- .../{ => PHPUnit}/Framework/TestSuite.php | 327 +- .../Framework/TestSuite/DataProvider.php | 71 + .../{ => PHPUnit}/Framework/Warning.php | 66 +- .../{ => PHPUnit}/Runner/BaseTestRunner.php | 164 +- .../Runner/IncludePathTestCollector.php | 84 +- .../Runner/StandardTestSuiteLoader.php | 63 +- .../{ => PHPUnit}/Runner/TestCollector.php | 22 +- .../{ => PHPUnit}/Runner/TestSuiteLoader.php | 22 +- .../PHPUnit/{ => PHPUnit}/Runner/Version.php | 26 +- tests/PHPUnit/PHPUnit/TextUI/Command.php | 886 + .../{ => PHPUnit}/TextUI/ResultPrinter.php | 254 +- .../{ => PHPUnit}/TextUI/TestRunner.php | 606 +- tests/PHPUnit/PHPUnit/Util/Class.php | 403 + tests/PHPUnit/PHPUnit/Util/Configuration.php | 862 + .../PHPUnit/Util/DeprecatedFeature.php | 103 + .../PHPUnit/Util/DeprecatedFeature/Logger.php | 202 + tests/PHPUnit/PHPUnit/Util/Diff.php | 261 + .../{ => PHPUnit}/Util/ErrorHandler.php | 40 +- tests/PHPUnit/PHPUnit/Util/File.php | 310 + .../PHPUnit/{ => PHPUnit}/Util/Fileloader.php | 113 +- tests/PHPUnit/PHPUnit/Util/Filesystem.php | 149 + tests/PHPUnit/PHPUnit/Util/Filter.php | 138 + tests/PHPUnit/{ => PHPUnit}/Util/Getopt.php | 99 +- tests/PHPUnit/PHPUnit/Util/GlobalState.php | 354 + .../Util/InvalidArgumentHelper.php} | 59 +- .../PEAR.php => PHPUnit/Util/Log/DBUS.php} | 193 +- tests/PHPUnit/{ => PHPUnit}/Util/Log/JSON.php | 112 +- .../XML.php => PHPUnit/Util/Log/JUnit.php} | 178 +- tests/PHPUnit/{ => PHPUnit}/Util/Log/TAP.php | 54 +- tests/PHPUnit/PHPUnit/Util/Log/XHProf.php | 252 + tests/PHPUnit/PHPUnit/Util/PHP.php | 277 + .../Util/PHP/Default.php} | 39 +- .../Util/PHP/Windows.php} | 68 +- tests/PHPUnit/{ => PHPUnit}/Util/Printer.php | 40 +- tests/PHPUnit/{ => PHPUnit}/Util/Skeleton.php | 65 +- tests/PHPUnit/PHPUnit/Util/Skeleton/Class.php | 327 + .../Util/Skeleton/Template/Class.tpl.dist | 0 .../Template/IncompleteTestMethod.tpl.dist | 0 .../Util/Skeleton/Template/Method.tpl.dist | 0 .../Util/Skeleton/Template/TestClass.tpl.dist | 12 +- .../Skeleton/Template/TestMethod.tpl.dist | 0 .../Skeleton/Template/TestMethodBool.tpl.dist | 0 .../Template/TestMethodBoolStatic.tpl.dist | 0 .../Template/TestMethodException.tpl.dist | 0 .../TestMethodExceptionStatic.tpl.dist | 0 .../Template/TestMethodStatic.tpl.dist | 0 .../{ => PHPUnit}/Util/Skeleton/Test.php | 185 +- tests/PHPUnit/PHPUnit/Util/Test.php | 473 + .../Util/TestDox/NamePrettifier.php | 66 +- .../Util/TestDox/ResultPrinter.php | 76 +- .../Util/TestDox/ResultPrinter/HTML.php | 28 +- .../Util/TestDox/ResultPrinter/Text.php | 23 +- .../{ => PHPUnit}/Util/TestSuiteIterator.php | 26 +- tests/PHPUnit/{ => PHPUnit}/Util/Type.php | 25 +- tests/PHPUnit/{ => PHPUnit}/Util/XML.php | 301 +- tests/PHPUnit/README.markdown | 86 + .../Samples/BankAccount/BankAccount.php | 121 - .../Samples/BankAccount/BankAccountTest.php | 138 - .../Samples/BankAccountDB/BankAccount.php | 210 - .../BankAccountDB/BankAccountDBTest.php | 150 - .../BankAccountDB/BankAccountDBTestMySQL.php | 150 - .../_files/bank-account-after-deposits.xml | 6 - .../_files/bank-account-after-new-account.xml | 7 - .../_files/bank-account-after-withdrawals.xml | 6 - .../_files/bank-account-seed.xml | 6 - .../Samples/BowlingGame/BowlingGame.php | 107 - .../Samples/BowlingGame/BowlingGameSpec.php | 183 - .../Samples/BowlingGame/BowlingGameTest.php | 110 - tests/PHPUnit/Samples/FailureTest.php | 114 - tests/PHPUnit/Samples/Money/IMoney.php | 73 - tests/PHPUnit/Samples/Money/Money.php | 151 - tests/PHPUnit/Samples/Money/MoneyBag.php | 250 - tests/PHPUnit/Samples/Money/MoneyTest.php | 248 - tests/PHPUnit/Tests/AllTests.php | 91 - tests/PHPUnit/Tests/Extensions/AllTests.php | 88 - .../Tests/Extensions/Database/AllTests.php | 84 - .../Extensions/Database/DataSet/AllTests.php | 96 - .../Database/DataSet/CompositeDataSetTest.php | 174 - .../Database/DataSet/CsvDataSetTest.php | 134 - .../Database/DataSet/FilterTest.php | 89 - .../Database/DataSet/PersistorTest.php | 116 - .../Database/DataSet/QueryDataSetTest.php | 144 - .../Database/DataSet/QueryTableTest.php | 144 - .../DataSet/ReplacementDataSetTest.php | 330 - .../Database/DataSet/ReplacementTableTest.php | 265 - .../Database/DataSet/XmlDataSetsTest.php | 144 - .../Database/Operation/AllTests.php | 82 - .../Database/Operation/OperationsTest.php | 195 - .../Database/Operation/RowBasedTest.php | 187 - .../Database/_files/CsvDataSets/table1.csv | 4 - .../Database/_files/CsvDataSets/table2.csv | 5 - .../Database/_files/DatabaseTestUtility.php | 116 - .../XmlDataSets/AllEmptyTableInsertResult.xml | 9 - .../XmlDataSets/AllEmptyTableInsertTest.xml | 4 - .../XmlDataSets/DeleteAllOperationTest.xml | 6 - .../XmlDataSets/DeleteOperationResult.xml | 7 - .../XmlDataSets/DeleteOperationTest.xml | 5 - .../XmlDataSets/EmptyTableInsertResult.xml | 11 - .../XmlDataSets/EmptyTableInsertTest.xml | 6 - .../XmlDataSets/FilteredTestComparison.xml | 9 - .../XmlDataSets/FilteredTestFixture.xml | 8 - .../_files/XmlDataSets/FlatXmlDataSet.xml | 9 - .../_files/XmlDataSets/FlatXmlWriter.xml | 32 - .../XmlDataSets/InsertOperationResult.xml | 12 - .../XmlDataSets/InsertOperationTest.xml | 6 - .../XmlDataSets/OperationsTestFixture.xml | 9 - .../_files/XmlDataSets/QueryDataSetTest.xml | 31 - .../XmlDataSets/ReplaceOperationResult.xml | 12 - .../XmlDataSets/ReplaceOperationTest.xml | 9 - .../_files/XmlDataSets/RowBasedExecute.xml | 6 - .../XmlDataSets/UpdateOperationResult.xml | 9 - .../XmlDataSets/UpdateOperationTest.xml | 6 - .../_files/XmlDataSets/XmlDataSet.xml | 65 - .../Database/_files/XmlDataSets/XmlWriter.xml | 28 - .../Tests/Extensions/OutputTestCaseTest.php | 101 - .../Extensions/PerformanceTestCaseTest.php | 85 - .../Tests/Extensions/RepeatedTestTest.php | 118 - .../Tests/Extensions/SeleniumTestCaseTest.php | 659 - tests/PHPUnit/Tests/Framework/AllTests.php | 96 - tests/PHPUnit/Tests/Framework/AssertTest.php | 3161 --- .../Tests/Framework/ComparisonFailureTest.php | 144 - .../Tests/Framework/ConstraintTest.php | 1253 - .../Tests/Framework/MockObjectTest.php | 251 - tests/PHPUnit/Tests/Framework/SuiteTest.php | 198 - .../PHPUnit/Tests/Framework/TestCaseTest.php | 297 - .../Tests/Framework/TestFailureTest.php | 1090 - .../Tests/Framework/TestImplementorTest.php | 87 - .../Tests/Framework/TestListenerTest.php | 154 - tests/PHPUnit/Tests/Regression/578.phpt | 36 - tests/PHPUnit/Tests/Regression/684.phpt | 25 - .../PHPUnit/Tests/Regression/Issue578Test.php | 22 - .../PHPUnit/Tests/Regression/Issue684Test.php | 4 - tests/PHPUnit/Tests/Runner/AllTests.php | 80 - .../Tests/Runner/BaseTestRunnerTest.php | 72 - .../Tests/TextUI/abstract-test-class.phpt | 26 - .../Tests/TextUI/concrete-test-class.phpt | 19 - .../coverage-clover-class-extended.phpt | 55 - .../Tests/TextUI/coverage-clover-class.phpt | 55 - .../Tests/TextUI/coverage-clover-method.phpt | 55 - .../TextUI/coverage-clover-not-private.phpt | 55 - .../TextUI/coverage-clover-not-protected.phpt | 55 - .../TextUI/coverage-clover-not-public.phpt | 55 - .../Tests/TextUI/coverage-clover-private.phpt | 55 - .../TextUI/coverage-clover-protected.phpt | 55 - .../Tests/TextUI/coverage-clover-public.phpt | 55 - .../PHPUnit/Tests/TextUI/coverage-clover.phpt | 50 - .../PHPUnit/Tests/TextUI/coverage-source.phpt | 842 - .../PHPUnit/Tests/TextUI/dataset-log-xml.phpt | 47 - tests/PHPUnit/Tests/TextUI/debug.phpt | 25 - tests/PHPUnit/Tests/TextUI/default.phpt | 18 - tests/PHPUnit/Tests/TextUI/exclude-group.phpt | 20 - tests/PHPUnit/Tests/TextUI/filter-class.phpt | 20 - tests/PHPUnit/Tests/TextUI/filter-method.phpt | 20 - tests/PHPUnit/Tests/TextUI/group.phpt | 20 - tests/PHPUnit/Tests/TextUI/help.phpt | 63 - tests/PHPUnit/Tests/TextUI/help2.phpt | 65 - tests/PHPUnit/Tests/TextUI/list-groups.phpt | 18 - tests/PHPUnit/Tests/TextUI/log-graphviz.phpt | 35 - tests/PHPUnit/Tests/TextUI/log-json.phpt | 20 - tests/PHPUnit/Tests/TextUI/log-tap.phpt | 25 - tests/PHPUnit/Tests/TextUI/log-xml.phpt | 28 - tests/PHPUnit/Tests/TextUI/repeat.phpt | 21 - tests/PHPUnit/Tests/TextUI/skeleton.phpt | 18 - tests/PHPUnit/Tests/TextUI/story.phpt | 79 - tests/PHPUnit/Tests/TextUI/tap.phpt | 17 - tests/PHPUnit/Tests/TextUI/testdox-html.phpt | 20 - tests/PHPUnit/Tests/TextUI/testdox-text.phpt | 24 - tests/PHPUnit/Tests/TextUI/testdox.phpt | 18 - tests/PHPUnit/Tests/TextUI/verbose.phpt | 20 - tests/PHPUnit/Tests/Util/AllTests.php | 86 - .../PHPUnit/Tests/Util/ConfigurationTest.php | 324 - .../Tests/Util/TestDox/NamePrettifierTest.php | 108 - tests/PHPUnit/Tests/Util/TestTest.php | 102 - tests/PHPUnit/Tests/Util/TimerTest.php | 78 - tests/PHPUnit/Tests/Util/XMLTest.php | 332 - tests/PHPUnit/Tests/_files/AbstractTest.php | 7 - tests/PHPUnit/Tests/_files/AnInterface.php | 6 - tests/PHPUnit/Tests/_files/Calculator.php | 15 - .../_files/ClassWithNonPublicAttributes.php | 30 - tests/PHPUnit/Tests/_files/ConcreteTest.php | 9 - .../_files/CoverageClassExtendedTest.php | 14 - .../Tests/_files/CoverageClassTest.php | 14 - .../Tests/_files/CoverageMethodTest.php | 14 - .../Tests/_files/CoverageNotPrivateTest.php | 14 - .../Tests/_files/CoverageNotProtectedTest.php | 14 - .../Tests/_files/CoverageNotPublicTest.php | 14 - .../Tests/_files/CoveragePrivateTest.php | 14 - .../Tests/_files/CoverageProtectedTest.php | 14 - .../Tests/_files/CoveragePublicTest.php | 14 - tests/PHPUnit/Tests/_files/CoveredClass.php | 37 - tests/PHPUnit/Tests/_files/DataSetTest.php | 21 - tests/PHPUnit/Tests/_files/DoubleTestCase.php | 26 - tests/PHPUnit/Tests/_files/Error.php | 9 - tests/PHPUnit/Tests/_files/Failure.php | 9 - .../PHPUnit/Tests/_files/FunctionCallback.php | 10 - .../Tests/_files/InheritedTestCase.php | 10 - tests/PHPUnit/Tests/_files/MethodCallback.php | 22 - tests/PHPUnit/Tests/_files/MockRunner.php | 22 - .../Tests/_files/NoArgTestCaseTest.php | 8 - .../PHPUnit/Tests/_files/NoTestCaseClass.php | 5 - tests/PHPUnit/Tests/_files/NoTestCases.php | 8 - tests/PHPUnit/Tests/_files/NonStatic.php | 9 - .../Tests/_files/NotPublicTestCase.php | 12 - .../PHPUnit/Tests/_files/NotVoidTestCase.php | 5 - tests/PHPUnit/Tests/_files/OneTestCase.php | 12 - tests/PHPUnit/Tests/_files/OutputTestCase.php | 30 - .../PHPUnit/Tests/_files/OverrideTestCase.php | 10 - .../Tests/_files/PartialMockTestClass.php | 12 - tests/PHPUnit/Tests/_files/SampleClass.php | 15 - .../_files/SelectorAssertionsFixture.html | 41 - tests/PHPUnit/Tests/_files/SetupFailure.php | 11 - tests/PHPUnit/Tests/_files/SleepTest.php | 11 - tests/PHPUnit/Tests/_files/Struct.php | 11 - tests/PHPUnit/Tests/_files/Success.php | 8 - .../PHPUnit/Tests/_files/TearDownFailure.php | 11 - tests/PHPUnit/Tests/_files/TestIterator.php | 37 - .../Tests/_files/ThrowExceptionTestCase.php | 9 - .../Tests/_files/ThrowNoExceptionTestCase.php | 8 - tests/PHPUnit/Tests/_files/TornDown.php | 16 - tests/PHPUnit/Tests/_files/TornDown2.php | 17 - tests/PHPUnit/Tests/_files/TornDown3.php | 11 - tests/PHPUnit/Tests/_files/TornDown4.php | 11 - tests/PHPUnit/Tests/_files/TornDown5.php | 11 - tests/PHPUnit/Tests/_files/WasRun.php | 11 - tests/PHPUnit/Tests/_files/bar.xml | 1 - tests/PHPUnit/Tests/_files/configuration.xml | 101 - tests/PHPUnit/Tests/_files/foo.xml | 1 - ...uctureAttributesAreSameButValuesAreNot.xml | 10 - .../Tests/_files/structureExpected.xml | 10 - .../Tests/_files/structureIgnoreTextNodes.xml | 13 - .../_files/structureIsSameButDataIsNot.xml | 10 - .../structureWrongNumberOfAttributes.xml | 10 - .../_files/structureWrongNumberOfNodes.xml | 9 - tests/PHPUnit/Tests/phpunit.xml.dist | 23 - tests/PHPUnit/{Util => Text}/Template.php | 60 +- .../append.php => Text/Template/Autoload.php} | 45 +- tests/PHPUnit/TextUI/Command.php | 731 - tests/PHPUnit/Util/Class.php | 472 - tests/PHPUnit/Util/CodeCoverage.php | 332 - tests/PHPUnit/Util/Configuration.php | 636 - tests/PHPUnit/Util/Filesystem.php | 313 - tests/PHPUnit/Util/Filter.php | 561 - tests/PHPUnit/Util/Log/CPD.php | 134 - .../Util/Log/CodeCoverage/Database.php | 594 - .../Util/Log/CodeCoverage/XML/Clover.php | 328 - .../Util/Log/CodeCoverage/XML/Source.php | 304 - tests/PHPUnit/Util/Log/Database.php | 516 - tests/PHPUnit/Util/Log/Database/MySQL.sql | 206 - tests/PHPUnit/Util/Log/Database/SQLite3.sql | 206 - tests/PHPUnit/Util/Log/GraphViz.php | 301 - tests/PHPUnit/Util/Log/Metrics.php | 182 - tests/PHPUnit/Util/Log/PMD.php | 337 - tests/PHPUnit/Util/Log/PMD/Rule.php | 89 - .../Log/PMD/Rule/Class/EfferentCoupling.php | 86 - .../PMD/Rule/Class/ExcessiveClassLength.php | 86 - .../PMD/Rule/Class/ExcessivePublicCount.php | 87 - .../Util/Log/PMD/Rule/Class/TooManyFields.php | 88 - .../Util/Log/PMD/Rule/Function/CRAP.php | 88 - .../Log/PMD/Rule/Function/CodeCoverage.php | 91 - .../Rule/Function/CyclomaticComplexity.php | 89 - .../Rule/Function/ExcessiveMethodLength.php | 86 - .../Rule/Function/ExcessiveParameterList.php | 86 - .../Log/PMD/Rule/Function/NPathComplexity.php | 87 - .../Util/Log/PMD/Rule/Project/CRAP.php | 110 - tests/PHPUnit/Util/Metrics.php | 71 - tests/PHPUnit/Util/Metrics/Class.php | 731 - tests/PHPUnit/Util/Metrics/File.php | 328 - tests/PHPUnit/Util/Metrics/Function.php | 504 - tests/PHPUnit/Util/Metrics/Project.php | 476 - tests/PHPUnit/Util/PDO.php | 357 - tests/PHPUnit/Util/Report.php | 246 - .../Util/Report/Template/container-min.js | 19 - .../Util/Report/Template/yahoo-dom-event.js | 12 - tests/PHPUnit/Util/Skeleton/Class.php | 257 - tests/PHPUnit/Util/Test.php | 371 - tests/PHPUnit/phpcov.bat | 38 + tests/PHPUnit/phpcov.php | 51 + tests/PHPUnit/phptok.bat | 38 + tests/PHPUnit/phptok.php | 51 + tests/SugarTestAccountUtilities.php | 36 + tests/SugarTestCallUtilities.php | 77 + tests/SugarTestCampaignUtilities.php | 36 + tests/SugarTestContactUtilities.php | 36 + tests/SugarTestEmailUtilities.php | 36 + tests/SugarTestHelper.php | 144 +- tests/SugarTestImportUtilities.php | 36 + tests/SugarTestLangPackCreator.php | 40 +- tests/SugarTestLeadUtilities.php | 36 + tests/SugarTestMeetingUtilities.php | 35 + tests/SugarTestMergeUtilities.php | 36 + tests/SugarTestStudioUtilities.php | 35 + tests/SugarTestTaskUtilities.php | 87 + tests/SugarTestThemeUtilities.php | 70 +- tests/SugarTestTrackerUtility.php | 37 +- tests/SugarTestUserUtilities.php | 49 +- tests/codecoverage.xml | 38 + tests/data/Bug39780Test.php | 41 +- tests/data/Bug40739Test.php | 39 + tests/data/Bug40989Test.php | 88 + tests/data/Bug43143Test.php | 109 + ...Formatting.php => FixUpFormattingTest.php} | 63 +- tests/data/GetACLCategoryTest.php | 82 + tests/data/ImportableFieldsTest.php | 109 + tests/data/SugarBeanTest.php | 63 + tests/expressions/expression_engine_eval.php | 4 +- tests/expressions/expression_engine_test.html | 38 + tests/include/Bug43652.php | 113 + tests/include/Dashlets/Bug41013Test.php | 36 + .../Dashlets/DashletAutoRefreshTest.php | 193 + .../Dashlets/DashletGenericChartTest.php | 138 + .../Dashlets/DashletLoadLanguageTest.php | 35 + .../DashletSaveUserPreferencesTest.php | 89 + tests/include/Dashlets/DashletTest.php | 240 + .../Expressions/Actions/ActionFactory.php | 105 - tests/include/JSONTest.php | 131 +- .../include/ListView/ListViewDisplayTest.php | 665 + .../include/Localization/LocalizationTest.php | 67 +- .../MVC/Controller/SugarControllerTest.php | 183 +- tests/include/MVC/SugarApplicationTest.php | 237 +- tests/include/MVC/SugarModuleTest.php | 42 +- tests/include/MVC/View/Bug40019Test.php | 48 +- tests/include/MVC/View/LoadMenuTest.php | 102 +- tests/include/MVC/View/SugarViewTest.php | 203 + tests/include/MVC/View/ViewFactoryTest.php | 60 + tests/include/MVC/View/views/ViewAjaxTest.php | 53 + .../MVC/View/views/ViewClassicTest.php | 92 + .../MVC/View/views/ViewNoAccessTest.php | 63 + .../include/MVC/View/views/ViewVcardTest.php | 85 + tests/include/MassUpdate/Bug43468Test.php | 77 + .../{ => MassUpdate}/MassUpdateTest.php | 42 +- tests/include/OutboundEmail/Bug23140Test.php | 38 +- tests/include/OutboundEmail/Bug32487Test.php | 40 +- tests/include/Popup/Bug36329Test.php | 80 +- tests/include/SearchForm/Bug43548Test.php | 128 + tests/include/SearchForm/RangeSearchTest.php | 319 + tests/include/SearchForm/SugarSpotTest.php | 79 + .../plugins/FunctionMultienumToArrayTest.php | 38 +- .../Smarty/plugins/FunctionSugarHelpTest.php | 36 + .../Smarty/plugins/FunctionSugarLinkTest.php | 38 +- .../plugins/FunctionSugarTranslateTest.php | 35 + tests/include/SubPanel/Bug40171Test.php | 35 + tests/include/SubPanel/Bug41738Test.php | 35 + .../include/SubPanel/GetUnionRelatedTest.php | 36 + tests/include/SugarCharts/Bug43574.php | 78 + .../CustomSugarChartFactoryTest.php | 124 + .../SugarCharts/SugarChartFactoryTest.php | 94 +- .../SugarEmailAddress/Bug40068Test.php | 41 +- .../SugarEmailAddressRegexTest.php | 41 +- .../Fields/Datetimecombo/Bug41114Test.php | 46 +- .../Fields/Enum/SugarFieldEnumTest.php | 48 +- .../Password/SugarFieldPasswordTest.php | 57 + .../SugarFields/Fields/Phone/Bug43942Test.php | 71 + .../Fields/Relate/SugarFieldRelateTest.php | 40 +- tests/include/SugarFolders/Bug33404Test.php | 38 +- tests/include/SugarFolders/Bug33906Test.php | 38 +- .../include/SugarFolders/SugarFoldersTest.php | 37 + tests/include/SugarLogger/SugarLoggerTest.php | 35 + .../SugarObjects/BasicTemplateTest.php | 44 +- .../SugarObjects/PersonTemplateTest.php | 38 +- .../include/SugarObjects/SugarConfigTest.php | 36 + .../SugarObjects/SugarRegistryTest.php | 36 + .../templates/file/Bug42862Test.php | 51 + .../SugarTheme/SugarThemeRegistryTest.php | 79 +- tests/include/SugarTheme/SugarThemeTest.php | 36 + tests/include/TimeDateTest.php | 713 +- tests/include/ValidDBNameTest.php | 71 + tests/include/connectors/Bug40247Test.php | 158 + .../connectors/ConnectorsTestUtility.php | 50 +- tests/include/database/Bug34547Test.php | 75 + tests/include/database/DBHelperTest.php | 247 +- .../include/database/DBManagerFactoryTest.php | 44 +- tests/include/database/DBManagerTest.php | 478 +- tests/include/database/FreeTDSManagerTest.php | 38 +- tests/include/javascript/JSAlertsTest.php | 45 +- tests/include/javascript/JavascriptTest.php | 35 + tests/include/utils/Bug22882Test.php | 38 +- tests/include/utils/Bug33284_Test.php | 68 +- tests/include/utils/Bug41003Test.php | 62 + tests/include/utils/Bug42427Test.php | 35 + tests/include/utils/CheckPhpVersionTest.php | 37 +- tests/include/utils/CheckPlatformTest.php | 36 + .../utils/CreateCacheDirectoryTest.php | 36 + tests/include/utils/DbUtilsTest.php | 36 + tests/include/utils/DeepArrayDiffTest.php | 38 +- tests/include/utils/ExternalCacheAPITest.php | 87 +- tests/include/utils/MiscUtilsTest.php | 230 + .../utils/SugarArrayMergeRecursiveTest.php | 38 +- tests/include/utils/SugarArrayMergeTest.php | 38 +- tests/include/utils/SugarArrayTest.php | 36 + tests/include/utils/SugarArrayUtilsTest.php | 161 + tests/include/utils/SugarFileUtilsTest.php | 36 + tests/include/utils/SugarVersionTest.php | 36 + tests/include/utils/XssTest.php | 39 +- tests/include/utils/ZipTest.php | 124 + tests/include/vCard/vCardBug40629Test.php | 36 + tests/include/vCard/vCardTest.php | 163 +- .../workflow/testfiles/logic_hooks.php | 36 + .../testfiles/workflow/actions_array.php | 36 + .../testfiles/workflow/alerts_array.php | 36 + .../testfiles/workflow/plugins_array.php | 36 + .../testfiles/workflow/triggers_array.php | 36 + .../workflow/testfiles/workflow/workflow.php | 38 +- tests/install/Bug40129Test.php | 177 + tests/install/QuotesSeedDataTest.php | 97 - tests/modules/Accounts/Bug34670Test.php | 60 + tests/modules/Administration/Bug36978Test.php | 79 +- .../Administration/UpgradeHistoryTest.php | 43 +- tests/modules/Calendar/Bug20626Test.php | 47 +- tests/modules/Calls/Bug39161Test.php | 34 + tests/modules/Calls/CallHelperTest.php | 37 + tests/modules/Calls/CallTest.php | 136 + tests/modules/CampaignLog/CampaignLogTest.php | 41 +- .../CampaignTrackers/CampaignTrackersTest.php | 42 +- tests/modules/Campaigns/Bug35014Test.php | 37 +- tests/modules/Campaigns/Bug40233Test.php | 38 + .../modules/Configurator/ConfiguratorTest.php | 35 + tests/modules/Contacts/Bug15255Test.php | 36 + tests/modules/Contacts/Bug7825Test.php | 37 +- tests/modules/Currencies/CurrencyTest.php | 107 + tests/modules/Documents/Bug43560Test.php | 104 + tests/modules/Documents/DocSaveTest.php | 80 + tests/modules/DynamicFields/Bug24095Test.php | 50 +- tests/modules/DynamicFields/Bug39766Test.php | 36 + tests/modules/DynamicFields/Bug40311Test.php | 97 + tests/modules/DynamicFields/Bug41845Test.php | 50 + .../DynamicFieldsCurrencyTests.php | 115 + .../EmptyCustomDateFieldTest.php | 198 + .../DynamicFields/RepairCustomFieldsTest.php | 43 +- .../DynamicFields/TemplateDateTest.php | 107 + tests/modules/DynamicFields/URLFieldTest.php | 36 + .../EmailAddresses/EmailAddressTest.php | 38 +- tests/modules/Emails/Bug32489Test.php | 38 +- tests/modules/Emails/Bug40527Test.php | 37 + tests/modules/Emails/Bug43343Test.php | 77 + tests/modules/Emails/ComposePackageTest.php | 54 +- tests/modules/Emails/EmailTest.php | 36 + tests/modules/Emails/EmailUITest.php | 171 +- .../Emails/FindEmailFromBeanIdsTest.php | 36 + ...etNamePlusEmailAddressesForComposeTest.php | 108 + .../Emails/HandleBodyInHTMLformatTest.php | 36 + tests/modules/Employees/Bug36615Test.php | 150 + tests/modules/Home/Bug40216Test.php | 107 + tests/modules/Home/Bug43653Test.php | 101 + tests/modules/Home/Bug44030Test.php | 121 + tests/modules/Home/QuickSearchTests.php | 38 +- .../Home/UnifiedSearchAdvancedTest.php | 108 +- tests/modules/Import/ImportCacheFilesTest.php | 36 + .../Import/ImportDuplicateCheckTest.php | 36 + .../Import/ImportFieldSanitizeTest.php | 464 +- .../modules/Import/ImportFileSplitterTest.php | 38 +- tests/modules/Import/ImportFileTest.php | 38 +- tests/modules/Import/ImportFormsTest.php | 149 +- tests/modules/Import/ImportMapTest.php | 36 + tests/modules/Import/UsersLastImportTest.php | 40 +- .../AutoCreateImportFolderTest.php | 38 +- tests/modules/InboundEmail/Bug43554Test.php | 53 +- tests/modules/InboundEmail/Bug44009Test.php | 37 + .../modules/InboundEmail/InboundEmailTest.php | 36 + tests/modules/Leads/Bug40209Test.php | 40 +- tests/modules/Leads/ConvertLeadTests.php | 35 + tests/modules/Meetings/MeetingTest.php | 81 + tests/modules/ModuleBuilder/Bug42085Test.php | 82 + .../ModuleBuilder/Module/StudioModuleTest.php | 35 + .../parsers/AbstractMetaDataParserTest.php | 35 + .../ModuleBuilder/views/ViewListVIewTest.php | 35 + tests/modules/MySettings/StoreQueryTest.php | 53 + tests/modules/Notes/Bug40263Test.php | 99 + tests/modules/Notes/NotesTest.php | 38 +- tests/modules/SavedSearch/Bug42378Test.php | 895 + tests/modules/SavedSearch/Bug42915Test.php | 913 + tests/modules/Schedulers/Bug44125Test.php | 120 + tests/modules/Schedulers/SchedulerTest.php | 216 + tests/modules/SchedulersJobs/Bug27344Test.php | 79 + tests/modules/SugarFeed/SugarFeedTest.php | 58 + tests/modules/Tasks/TasksTest.php | 91 +- tests/modules/Trackers/Bug40019_Test.php | 110 - .../Trackers/TrackerCreateDefaultUserTest.php | 100 - tests/modules/Trackers/TrackerManagerTest.php | 61 - tests/modules/Trackers/TrackerMetricsTest.php | 31 - tests/modules/Trackers/TrackerMonitorTest.php | 49 - .../Trackers/TrackerReportsUsageTest.php | 88 - tests/modules/Trackers/TrackerSaveTest.php | 16 - tests/modules/Trackers/TrackerTestUtility.php | 29 - .../Trackers/TrackerUpgradeDashletTest.php | 95 - tests/modules/UpgradeWizard/Bug30709Test.php | 37 +- .../UpgradeWizard/Bug30709_Part_2_Test.php | 35 + tests/modules/UpgradeWizard/Bug32003_Test.php | 592 - tests/modules/UpgradeWizard/Bug32382Test.php | 35 + tests/modules/UpgradeWizard/Bug36845Test.php | 222 + tests/modules/UpgradeWizard/Bug37214Test.php | 191 + tests/modules/UpgradeWizard/Bug39757Test.php | 80 + tests/modules/UpgradeWizard/Bug42490Test.php | 74 + tests/modules/UpgradeWizard/Bug42622Test.php | 92 + tests/modules/UpgradeWizard/Bug42643Test.php | 35 + tests/modules/UpgradeWizard/Bug43208Test.php | 295 + .../UpgradeWizard/RepairDatabaseTest.php | 130 + .../SilentUpgradeSessionVarsTest.php | 35 + .../UpgradeWizard/SugarMerge/Bug36257Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug36481Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug37231Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug37295Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug37461Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug37597Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug37692Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug37704Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug37725Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug37841Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug37850Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug37862Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug37917Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug37921Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug39057Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug39059Test.php | 35 + .../UpgradeWizard/SugarMerge/Bug43211Test.php | 107 + .../UpgradeWizard/SugarMerge/Bug43226Test.php | 126 + .../SugarMerge/Bug43226TestPartB.php | 125 + .../SugarMerge/LeadsMergeTest.php | 35 + .../UpgradeCustomTemplateMetaTest.php | 85 +- .../Contacts/metadata/detailviewdefs.php | 2 +- .../Contacts/metadata/editviewdefs.php | 2 +- .../Contacts/metadata/listviewdefs.php | 2 +- .../modules/Contacts/metadata/popupdefs.php | 2 +- .../Contacts/metadata/quickcreatedefs.php | 2 +- .../modules/Contacts/metadata/searchdefs.php | 2 +- .../Contacts/metadata/detailviewdefs.php | 36 + .../Contacts/metadata/editviewdefs.php | 36 + .../Contacts/metadata/listviewdefs.php | 36 + .../modules/Contacts/metadata/popupdefs.php | 36 + .../Contacts/metadata/quickcreatedefs.php | 36 + .../modules/Contacts/metadata/searchdefs.php | 36 + .../modules/Leads/metadata/detailviewdefs.php | 2 +- .../modules/Leads/metadata/detailviewdefs.php | 36 + .../Quotes/metadata/detailviewdefs.php | 2 +- .../Contacts/metadata/editviewdefs.php | 2 +- .../Contacts/metadata/editviewdefs.php | 2 +- .../modules/Contacts/metadata/searchdefs.php | 2 +- .../modules/Leads/metadata/detailviewdefs.php | 2 +- .../modules/Leads/metadata/editviewdefs.php | 2 +- .../551/modules/Notes/metadata/searchdefs.php | 2 +- .../modules/Accounts/metadata/searchdefs.php | 169 + .../Documents/metadata/detailviewdefs.php | 121 + .../Documents/metadata/editviewdefs.php | 124 + .../600/modules/Leads/metadata/searchdefs.php | 169 + .../modules/Calls/metadata/editviewdefs.php | 165 + .../Documents/metadata/SearchFields.php | 55 + .../Documents/metadata/detailviewdefs.php | 121 + .../Documents/metadata/editviewdefs.php | 125 + .../Documents/metadata/listviewdefs.php | 151 +- .../Documents/metadata/quickcreatedefs.php | 112 + .../modules/Documents/metadata/searchdefs.php | 61 + .../610/modules/Documents/metadata/studio.php | 67 + .../Documents/metadata/subpaneldefs.php | 68 + .../metadata/wireless.editviewdefs.php | 66 + .../610/modules/Documents/vardefs.php | 360 + .../modules/Notes/metadata/SearchFields.php | 53 + .../Notes/metadata/additionalDetails.php | 65 + .../modules/Notes/metadata/detailviewdefs.php | 123 + .../modules/Notes/metadata/editviewdefs.php | 110 + .../modules/Notes/metadata/listviewdefs.php | 118 + .../Notes/metadata/quickcreatedefs.php | 138 + .../610/modules/Notes/metadata/searchdefs.php | 106 + .../610/modules/Notes/metadata/studio.php | 67 + .../Notes/metadata/wireless.editviewdefs.php | 60 + .../610/modules/Notes/vardefs.php | 498 + .../modules/Calls/metadata/editviewdefs.php | 167 + .../Meetings/metadata/editviewdefs.php | 176 + .../modules/Accounts/metadata/searchdefs.php | 178 + .../modules/Calls/metadata/editviewdefs.php | 169 + .../Contacts/metadata/editviewdefs.php | 35 + .../Documents/metadata/detailviewdefs.php | 122 + .../Documents/metadata/editviewdefs.php | 178 + .../modules/Leads/metadata/detailviewdefs.php | 36 +- .../modules/Leads/metadata/editviewdefs.php | 2 +- .../modules/Leads/metadata/searchdefs.php | 178 + .../Meetings/metadata/editviewdefs.php | 11 +- .../Quotes/metadata/detailviewdefs.php | 35 + .../Meetings/metadata/detailviewdefs.php | 2 +- .../modules/Leads/metadata/detailviewdefs.php | 35 + .../Opportunities/metadata/listviewdefs.php | 34 + .../Accounts/metadata/detailviewdefs.php | 2 +- .../Accounts/metadata/detailviewdefs.php | 2 +- .../Accounts/metadata/detailviewdefs.php | 36 +- .../Accounts/metadata/listviewdefs.php | 36 +- .../Contacts/metadata/editviewdefs.php | 36 +- .../modules/Contacts/metadata/searchdefs.php | 36 +- .../modules/Leads/metadata/detailviewdefs.php | 36 +- .../Meetings/metadata/detailviewdefs.php | 35 + .../modules/Notes/metadata/searchdefs.php | 35 + .../Opportunities/metadata/listviewdefs.php | 35 + .../Project/metadata/detailviewdefs.php | 36 +- .../modules/Project/metadata/editviewdefs.php | 36 +- .../Accounts/metadata/detailviewdefs.php | 2 +- .../Accounts/metadata/editviewdefs.php | 2 +- .../Accounts/metadata/listviewdefs.php | 2 +- .../modules/Accounts/metadata/searchdefs.php | 2 +- .../Contacts/metadata/detailviewdefs.php | 2 +- .../Contacts/metadata/editviewdefs.php | 2 +- .../Opportunities/metadata/detailviewdefs.php | 2 +- .../Opportunities/metadata/editviewdefs.php | 2 +- .../Opportunities/metadata/searchdefs.php | 2 +- .../Accounts/metadata/detailviewdefs.php | 36 +- .../Accounts/metadata/editviewdefs.php | 35 + .../Accounts/metadata/listviewdefs.php | 35 + .../modules/Accounts/metadata/searchdefs.php | 35 + .../Contacts/metadata/detailviewdefs.php | 36 +- .../Contacts/metadata/editviewdefs.php | 35 + .../Opportunities/metadata/detailviewdefs.php | 40 +- .../Opportunities/metadata/editviewdefs.php | 35 + .../Opportunities/metadata/searchdefs.php | 35 + tests/modules/UpgradeWizard/UWUtilsTest.php | 122 + tests/modules/Users/AuthenticateTest.php | 140 + tests/modules/Users/Bug41527Test.php | 130 + tests/modules/Users/UserTest.php | 38 +- tests/phpuc.xml | 50 + tests/phpunit.bat | 15 +- tests/phpunit.php | 19 +- tests/phpunit.xml | 59 +- tests/service/APIv3Helper.php | 44 +- tests/service/Bug22504Test.php | 89 + tests/service/Bug36564Test.php | 60 + tests/service/Bug39234Test.php | 59 +- tests/service/Bug39855Test.php | 36 + tests/service/Bug40250Test.php | 36 + tests/service/Bug41985Test.php | 130 + tests/service/Bug42683Test.php | 36 + tests/service/Bug43196Test.php | 138 + tests/service/RESTAPI3Test.php | 559 +- tests/service/RESTAPI4Test.php | 293 + tests/service/RESTAPIRSSTest.php | 163 + tests/service/SOAPAPI1Test.php | 134 +- tests/service/SOAPAPI2Test.php | 162 +- tests/service/SOAPAPI3Test.php | 230 +- tests/service/SOAPTestCase.php | 41 +- tests/tests/SugarTestImportUtilitiesTest.php | 35 + tests/tests/SugarTestLangPackCreatorTest.php | 35 + tests/tests/SugarTestThemeUtilitiesTest.php | 48 + tests/tests/SugarTestUserUtilitiesTest.php | 49 +- themes/Sugar5/css/chart.css | 2 +- themes/Sugar5/css/deprecated.css | 2 +- themes/Sugar5/css/print.css | 2 +- themes/Sugar5/css/style.css | 26 +- themes/Sugar5/css/wizard.css | 2 +- themes/Sugar5/css/yui.css | 22 +- themes/Sugar5/images/icon_SearchForm.gif | Bin 2509 -> 1993 bytes themes/Sugar5/images/searchMore.gif | Bin 105 -> 1449 bytes themes/Sugar5/images/sugarColors.xml | 128 - themes/Sugar5/js/style.js | 24 +- themes/Sugar5/layout_utils.php | 2 +- themes/Sugar5/themedef.php | 3 +- themes/Sugar5/tpls/_companyLogo.tpl | 2 +- themes/Sugar5/tpls/_globalLinks.tpl | 2 +- themes/Sugar5/tpls/_head.tpl | 3 +- themes/Sugar5/tpls/_headerLastViewed.tpl | 2 +- themes/Sugar5/tpls/_headerModuleList.tpl | 57 +- themes/Sugar5/tpls/_headerSearch.tpl | 2 +- themes/Sugar5/tpls/_headerShortcuts.tpl | 2 +- themes/Sugar5/tpls/_welcome.tpl | 2 +- themes/Sugar5/tpls/footer.tpl | 8 +- themes/Sugar5/tpls/header.tpl | 2 +- themes/default/css/chart.css | 2 +- themes/default/css/deprecated.css | 2 +- themes/default/css/print.css | 2 +- themes/default/css/wizard.css | 2 +- themes/default/images/backtotop.gif | Bin 0 -> 124 bytes themes/default/images/chartBg.png | Bin 0 -> 583 bytes themes/default/images/create-record.gif | Bin 0 -> 1437 bytes themes/default/images/icon_SearchForm.gif | Bin 2509 -> 1993 bytes themes/default/images/join_imeeting.gif | Bin 0 -> 118 bytes themes/default/images/join_meeting_inline.png | Bin 0 -> 600 bytes themes/default/images/searchMore.gif | Bin 105 -> 1449 bytes .../default/images/start_meeting_inline.png | Bin 0 -> 579 bytes themes/default/images/sugarColors.xml | 54 +- themes/default/js/style.js | 2 +- vCard.php | 2 +- vcal_server.php | 2 +- 3994 files changed, 198602 insertions(+), 132705 deletions(-) create mode 100644 Zend/Crypt.php create mode 100644 Zend/Crypt/DiffieHellman.php create mode 100644 Zend/Crypt/DiffieHellman/Exception.php create mode 100644 Zend/Crypt/Exception.php create mode 100644 Zend/Crypt/Hmac.php create mode 100644 Zend/Crypt/Hmac/Exception.php create mode 100644 Zend/Crypt/Math.php create mode 100644 Zend/Crypt/Math/BigInteger.php create mode 100644 Zend/Crypt/Math/BigInteger/Bcmath.php create mode 100644 Zend/Crypt/Math/BigInteger/Exception.php create mode 100644 Zend/Crypt/Math/BigInteger/Gmp.php create mode 100644 Zend/Crypt/Math/BigInteger/Interface.php create mode 100644 Zend/Crypt/Math/Exception.php create mode 100644 Zend/Crypt/Rsa.php create mode 100644 Zend/Crypt/Rsa/Key.php create mode 100644 Zend/Crypt/Rsa/Key/Private.php create mode 100644 Zend/Crypt/Rsa/Key/Public.php create mode 100644 Zend/Exception.php create mode 100644 Zend/Gdata.php create mode 100644 Zend/Gdata/App.php create mode 100644 Zend/Gdata/App/AuthException.php create mode 100644 Zend/Gdata/App/BadMethodCallException.php create mode 100644 Zend/Gdata/App/Base.php create mode 100644 Zend/Gdata/App/BaseMediaSource.php create mode 100644 Zend/Gdata/App/CaptchaRequiredException.php create mode 100644 Zend/Gdata/App/Entry.php create mode 100644 Zend/Gdata/App/Exception.php create mode 100644 Zend/Gdata/App/Extension.php create mode 100644 Zend/Gdata/App/Extension/Author.php create mode 100644 Zend/Gdata/App/Extension/Category.php create mode 100644 Zend/Gdata/App/Extension/Content.php create mode 100644 Zend/Gdata/App/Extension/Contributor.php create mode 100644 Zend/Gdata/App/Extension/Control.php create mode 100644 Zend/Gdata/App/Extension/Draft.php create mode 100644 Zend/Gdata/App/Extension/Edited.php create mode 100644 Zend/Gdata/App/Extension/Element.php create mode 100644 Zend/Gdata/App/Extension/Email.php create mode 100644 Zend/Gdata/App/Extension/Generator.php create mode 100644 Zend/Gdata/App/Extension/Icon.php create mode 100644 Zend/Gdata/App/Extension/Id.php create mode 100644 Zend/Gdata/App/Extension/Link.php create mode 100644 Zend/Gdata/App/Extension/Logo.php create mode 100644 Zend/Gdata/App/Extension/Name.php create mode 100644 Zend/Gdata/App/Extension/Person.php create mode 100644 Zend/Gdata/App/Extension/Published.php create mode 100644 Zend/Gdata/App/Extension/Rights.php create mode 100644 Zend/Gdata/App/Extension/Source.php create mode 100644 Zend/Gdata/App/Extension/Subtitle.php create mode 100644 Zend/Gdata/App/Extension/Summary.php create mode 100644 Zend/Gdata/App/Extension/Text.php create mode 100644 Zend/Gdata/App/Extension/Title.php create mode 100644 Zend/Gdata/App/Extension/Updated.php create mode 100644 Zend/Gdata/App/Extension/Uri.php create mode 100644 Zend/Gdata/App/Feed.php create mode 100644 Zend/Gdata/App/FeedEntryParent.php create mode 100644 Zend/Gdata/App/FeedSourceParent.php create mode 100644 Zend/Gdata/App/HttpException.php create mode 100644 Zend/Gdata/App/IOException.php create mode 100644 Zend/Gdata/App/InvalidArgumentException.php create mode 100644 Zend/Gdata/App/LoggingHttpClientAdapterSocket.php create mode 100644 Zend/Gdata/App/MediaEntry.php create mode 100644 Zend/Gdata/App/MediaFileSource.php create mode 100644 Zend/Gdata/App/MediaSource.php create mode 100644 Zend/Gdata/App/Util.php create mode 100644 Zend/Gdata/App/VersionException.php create mode 100644 Zend/Gdata/AuthSub.php create mode 100644 Zend/Gdata/Books.php create mode 100644 Zend/Gdata/Books/CollectionEntry.php create mode 100644 Zend/Gdata/Books/CollectionFeed.php create mode 100644 Zend/Gdata/Books/Extension/AnnotationLink.php create mode 100644 Zend/Gdata/Books/Extension/BooksCategory.php create mode 100644 Zend/Gdata/Books/Extension/BooksLink.php create mode 100644 Zend/Gdata/Books/Extension/Embeddability.php create mode 100644 Zend/Gdata/Books/Extension/InfoLink.php create mode 100644 Zend/Gdata/Books/Extension/PreviewLink.php create mode 100644 Zend/Gdata/Books/Extension/Review.php create mode 100644 Zend/Gdata/Books/Extension/ThumbnailLink.php create mode 100644 Zend/Gdata/Books/Extension/Viewability.php create mode 100644 Zend/Gdata/Books/VolumeEntry.php create mode 100644 Zend/Gdata/Books/VolumeFeed.php create mode 100644 Zend/Gdata/Books/VolumeQuery.php create mode 100644 Zend/Gdata/Calendar.php create mode 100644 Zend/Gdata/Calendar/EventEntry.php create mode 100644 Zend/Gdata/Calendar/EventFeed.php create mode 100644 Zend/Gdata/Calendar/EventQuery.php create mode 100644 Zend/Gdata/Calendar/Extension/AccessLevel.php create mode 100644 Zend/Gdata/Calendar/Extension/Color.php create mode 100644 Zend/Gdata/Calendar/Extension/Hidden.php create mode 100644 Zend/Gdata/Calendar/Extension/Link.php create mode 100644 Zend/Gdata/Calendar/Extension/QuickAdd.php create mode 100644 Zend/Gdata/Calendar/Extension/Selected.php create mode 100644 Zend/Gdata/Calendar/Extension/SendEventNotifications.php create mode 100644 Zend/Gdata/Calendar/Extension/Timezone.php create mode 100644 Zend/Gdata/Calendar/Extension/WebContent.php create mode 100644 Zend/Gdata/Calendar/ListEntry.php create mode 100644 Zend/Gdata/Calendar/ListFeed.php create mode 100644 Zend/Gdata/ClientLogin.php create mode 100644 Zend/Gdata/Docs.php create mode 100644 Zend/Gdata/Docs/DocumentListEntry.php create mode 100644 Zend/Gdata/Docs/DocumentListFeed.php create mode 100644 Zend/Gdata/Docs/Query.php create mode 100644 Zend/Gdata/DublinCore.php create mode 100644 Zend/Gdata/DublinCore/Extension/Creator.php create mode 100644 Zend/Gdata/DublinCore/Extension/Date.php create mode 100644 Zend/Gdata/DublinCore/Extension/Description.php create mode 100644 Zend/Gdata/DublinCore/Extension/Format.php create mode 100644 Zend/Gdata/DublinCore/Extension/Identifier.php create mode 100644 Zend/Gdata/DublinCore/Extension/Language.php create mode 100644 Zend/Gdata/DublinCore/Extension/Publisher.php create mode 100644 Zend/Gdata/DublinCore/Extension/Rights.php create mode 100644 Zend/Gdata/DublinCore/Extension/Subject.php create mode 100644 Zend/Gdata/DublinCore/Extension/Title.php create mode 100644 Zend/Gdata/Entry.php create mode 100644 Zend/Gdata/Exif.php create mode 100644 Zend/Gdata/Exif/Entry.php create mode 100644 Zend/Gdata/Exif/Extension/Distance.php create mode 100644 Zend/Gdata/Exif/Extension/Exposure.php create mode 100644 Zend/Gdata/Exif/Extension/FStop.php create mode 100644 Zend/Gdata/Exif/Extension/Flash.php create mode 100644 Zend/Gdata/Exif/Extension/FocalLength.php create mode 100644 Zend/Gdata/Exif/Extension/ImageUniqueId.php create mode 100644 Zend/Gdata/Exif/Extension/Iso.php create mode 100644 Zend/Gdata/Exif/Extension/Make.php create mode 100644 Zend/Gdata/Exif/Extension/Model.php create mode 100644 Zend/Gdata/Exif/Extension/Tags.php create mode 100644 Zend/Gdata/Exif/Extension/Time.php create mode 100644 Zend/Gdata/Exif/Feed.php create mode 100644 Zend/Gdata/Extension.php create mode 100644 Zend/Gdata/Extension/AttendeeStatus.php create mode 100644 Zend/Gdata/Extension/AttendeeType.php create mode 100644 Zend/Gdata/Extension/Comments.php create mode 100644 Zend/Gdata/Extension/EntryLink.php create mode 100644 Zend/Gdata/Extension/EventStatus.php create mode 100644 Zend/Gdata/Extension/ExtendedProperty.php create mode 100644 Zend/Gdata/Extension/FeedLink.php create mode 100644 Zend/Gdata/Extension/OpenSearchItemsPerPage.php create mode 100644 Zend/Gdata/Extension/OpenSearchStartIndex.php create mode 100644 Zend/Gdata/Extension/OpenSearchTotalResults.php create mode 100644 Zend/Gdata/Extension/OriginalEvent.php create mode 100644 Zend/Gdata/Extension/Rating.php create mode 100644 Zend/Gdata/Extension/Recurrence.php create mode 100644 Zend/Gdata/Extension/RecurrenceException.php create mode 100644 Zend/Gdata/Extension/Reminder.php create mode 100644 Zend/Gdata/Extension/Transparency.php create mode 100644 Zend/Gdata/Extension/Visibility.php create mode 100644 Zend/Gdata/Extension/When.php create mode 100644 Zend/Gdata/Extension/Where.php create mode 100644 Zend/Gdata/Extension/Who.php create mode 100644 Zend/Gdata/Feed.php create mode 100644 Zend/Gdata/Gapps.php create mode 100644 Zend/Gdata/Gapps/EmailListEntry.php create mode 100644 Zend/Gdata/Gapps/EmailListFeed.php create mode 100644 Zend/Gdata/Gapps/EmailListQuery.php create mode 100644 Zend/Gdata/Gapps/EmailListRecipientEntry.php create mode 100644 Zend/Gdata/Gapps/EmailListRecipientFeed.php create mode 100644 Zend/Gdata/Gapps/EmailListRecipientQuery.php create mode 100644 Zend/Gdata/Gapps/Error.php create mode 100644 Zend/Gdata/Gapps/Extension/EmailList.php create mode 100644 Zend/Gdata/Gapps/Extension/Login.php create mode 100644 Zend/Gdata/Gapps/Extension/Name.php create mode 100644 Zend/Gdata/Gapps/Extension/Nickname.php create mode 100644 Zend/Gdata/Gapps/Extension/Property.php create mode 100644 Zend/Gdata/Gapps/Extension/Quota.php create mode 100644 Zend/Gdata/Gapps/GroupEntry.php create mode 100644 Zend/Gdata/Gapps/GroupFeed.php create mode 100644 Zend/Gdata/Gapps/GroupQuery.php create mode 100644 Zend/Gdata/Gapps/MemberEntry.php create mode 100644 Zend/Gdata/Gapps/MemberFeed.php create mode 100644 Zend/Gdata/Gapps/MemberQuery.php create mode 100644 Zend/Gdata/Gapps/NicknameEntry.php create mode 100644 Zend/Gdata/Gapps/NicknameFeed.php create mode 100644 Zend/Gdata/Gapps/NicknameQuery.php create mode 100644 Zend/Gdata/Gapps/OwnerEntry.php create mode 100644 Zend/Gdata/Gapps/OwnerFeed.php create mode 100644 Zend/Gdata/Gapps/OwnerQuery.php create mode 100644 Zend/Gdata/Gapps/Query.php create mode 100644 Zend/Gdata/Gapps/ServiceException.php create mode 100644 Zend/Gdata/Gapps/UserEntry.php create mode 100644 Zend/Gdata/Gapps/UserFeed.php create mode 100644 Zend/Gdata/Gapps/UserQuery.php create mode 100644 Zend/Gdata/Gbase.php create mode 100644 Zend/Gdata/Gbase/Entry.php create mode 100644 Zend/Gdata/Gbase/Extension/BaseAttribute.php create mode 100644 Zend/Gdata/Gbase/Feed.php create mode 100644 Zend/Gdata/Gbase/ItemEntry.php create mode 100644 Zend/Gdata/Gbase/ItemFeed.php create mode 100644 Zend/Gdata/Gbase/ItemQuery.php create mode 100644 Zend/Gdata/Gbase/Query.php create mode 100644 Zend/Gdata/Gbase/SnippetEntry.php create mode 100644 Zend/Gdata/Gbase/SnippetFeed.php create mode 100644 Zend/Gdata/Gbase/SnippetQuery.php create mode 100644 Zend/Gdata/Geo.php create mode 100644 Zend/Gdata/Geo/Entry.php create mode 100644 Zend/Gdata/Geo/Extension/GeoRssWhere.php create mode 100644 Zend/Gdata/Geo/Extension/GmlPoint.php create mode 100644 Zend/Gdata/Geo/Extension/GmlPos.php create mode 100644 Zend/Gdata/Geo/Feed.php create mode 100644 Zend/Gdata/Health.php create mode 100644 Zend/Gdata/Health/Extension/Ccr.php create mode 100644 Zend/Gdata/Health/ProfileEntry.php create mode 100644 Zend/Gdata/Health/ProfileFeed.php create mode 100644 Zend/Gdata/Health/ProfileListEntry.php create mode 100644 Zend/Gdata/Health/ProfileListFeed.php create mode 100644 Zend/Gdata/Health/Query.php create mode 100644 Zend/Gdata/HttpAdapterStreamingProxy.php create mode 100644 Zend/Gdata/HttpAdapterStreamingSocket.php create mode 100644 Zend/Gdata/HttpClient.php create mode 100644 Zend/Gdata/Kind/EventEntry.php create mode 100644 Zend/Gdata/Media.php create mode 100644 Zend/Gdata/Media/Entry.php create mode 100644 Zend/Gdata/Media/Extension/MediaCategory.php create mode 100644 Zend/Gdata/Media/Extension/MediaContent.php create mode 100644 Zend/Gdata/Media/Extension/MediaCopyright.php create mode 100644 Zend/Gdata/Media/Extension/MediaCredit.php create mode 100644 Zend/Gdata/Media/Extension/MediaDescription.php create mode 100644 Zend/Gdata/Media/Extension/MediaGroup.php create mode 100644 Zend/Gdata/Media/Extension/MediaHash.php create mode 100644 Zend/Gdata/Media/Extension/MediaKeywords.php create mode 100644 Zend/Gdata/Media/Extension/MediaPlayer.php create mode 100644 Zend/Gdata/Media/Extension/MediaRating.php create mode 100644 Zend/Gdata/Media/Extension/MediaRestriction.php create mode 100644 Zend/Gdata/Media/Extension/MediaText.php create mode 100644 Zend/Gdata/Media/Extension/MediaThumbnail.php create mode 100644 Zend/Gdata/Media/Extension/MediaTitle.php create mode 100644 Zend/Gdata/Media/Feed.php create mode 100644 Zend/Gdata/MediaMimeStream.php create mode 100644 Zend/Gdata/MimeBodyString.php create mode 100644 Zend/Gdata/MimeFile.php create mode 100644 Zend/Gdata/Photos.php create mode 100644 Zend/Gdata/Photos/AlbumEntry.php create mode 100644 Zend/Gdata/Photos/AlbumFeed.php create mode 100644 Zend/Gdata/Photos/AlbumQuery.php create mode 100644 Zend/Gdata/Photos/CommentEntry.php create mode 100644 Zend/Gdata/Photos/Extension/Access.php create mode 100644 Zend/Gdata/Photos/Extension/AlbumId.php create mode 100644 Zend/Gdata/Photos/Extension/BytesUsed.php create mode 100644 Zend/Gdata/Photos/Extension/Checksum.php create mode 100644 Zend/Gdata/Photos/Extension/Client.php create mode 100644 Zend/Gdata/Photos/Extension/CommentCount.php create mode 100644 Zend/Gdata/Photos/Extension/CommentingEnabled.php create mode 100644 Zend/Gdata/Photos/Extension/Height.php create mode 100644 Zend/Gdata/Photos/Extension/Id.php create mode 100644 Zend/Gdata/Photos/Extension/Location.php create mode 100644 Zend/Gdata/Photos/Extension/MaxPhotosPerAlbum.php create mode 100644 Zend/Gdata/Photos/Extension/Name.php create mode 100644 Zend/Gdata/Photos/Extension/Nickname.php create mode 100644 Zend/Gdata/Photos/Extension/NumPhotos.php create mode 100644 Zend/Gdata/Photos/Extension/NumPhotosRemaining.php create mode 100644 Zend/Gdata/Photos/Extension/PhotoId.php create mode 100644 Zend/Gdata/Photos/Extension/Position.php create mode 100644 Zend/Gdata/Photos/Extension/QuotaCurrent.php create mode 100644 Zend/Gdata/Photos/Extension/QuotaLimit.php create mode 100644 Zend/Gdata/Photos/Extension/Rotation.php create mode 100644 Zend/Gdata/Photos/Extension/Size.php create mode 100644 Zend/Gdata/Photos/Extension/Thumbnail.php create mode 100644 Zend/Gdata/Photos/Extension/Timestamp.php create mode 100644 Zend/Gdata/Photos/Extension/User.php create mode 100644 Zend/Gdata/Photos/Extension/Version.php create mode 100644 Zend/Gdata/Photos/Extension/Weight.php create mode 100644 Zend/Gdata/Photos/Extension/Width.php create mode 100644 Zend/Gdata/Photos/PhotoEntry.php create mode 100644 Zend/Gdata/Photos/PhotoFeed.php create mode 100644 Zend/Gdata/Photos/PhotoQuery.php create mode 100644 Zend/Gdata/Photos/TagEntry.php create mode 100644 Zend/Gdata/Photos/UserEntry.php create mode 100644 Zend/Gdata/Photos/UserFeed.php create mode 100644 Zend/Gdata/Photos/UserQuery.php create mode 100644 Zend/Gdata/Query.php create mode 100644 Zend/Gdata/Spreadsheets.php create mode 100644 Zend/Gdata/Spreadsheets/CellEntry.php create mode 100644 Zend/Gdata/Spreadsheets/CellFeed.php create mode 100644 Zend/Gdata/Spreadsheets/CellQuery.php create mode 100644 Zend/Gdata/Spreadsheets/DocumentQuery.php create mode 100644 Zend/Gdata/Spreadsheets/Extension/Cell.php create mode 100644 Zend/Gdata/Spreadsheets/Extension/ColCount.php create mode 100644 Zend/Gdata/Spreadsheets/Extension/Custom.php create mode 100644 Zend/Gdata/Spreadsheets/Extension/RowCount.php create mode 100644 Zend/Gdata/Spreadsheets/ListEntry.php create mode 100644 Zend/Gdata/Spreadsheets/ListFeed.php create mode 100644 Zend/Gdata/Spreadsheets/ListQuery.php create mode 100644 Zend/Gdata/Spreadsheets/SpreadsheetEntry.php create mode 100644 Zend/Gdata/Spreadsheets/SpreadsheetFeed.php create mode 100644 Zend/Gdata/Spreadsheets/WorksheetEntry.php create mode 100644 Zend/Gdata/Spreadsheets/WorksheetFeed.php create mode 100644 Zend/Gdata/YouTube.php create mode 100644 Zend/Gdata/YouTube/ActivityEntry.php create mode 100644 Zend/Gdata/YouTube/ActivityFeed.php create mode 100644 Zend/Gdata/YouTube/CommentEntry.php create mode 100644 Zend/Gdata/YouTube/CommentFeed.php create mode 100644 Zend/Gdata/YouTube/ContactEntry.php create mode 100644 Zend/Gdata/YouTube/ContactFeed.php create mode 100644 Zend/Gdata/YouTube/Extension/AboutMe.php create mode 100644 Zend/Gdata/YouTube/Extension/Age.php create mode 100644 Zend/Gdata/YouTube/Extension/Books.php create mode 100644 Zend/Gdata/YouTube/Extension/Company.php create mode 100644 Zend/Gdata/YouTube/Extension/Control.php create mode 100644 Zend/Gdata/YouTube/Extension/CountHint.php create mode 100644 Zend/Gdata/YouTube/Extension/Description.php create mode 100644 Zend/Gdata/YouTube/Extension/Duration.php create mode 100644 Zend/Gdata/YouTube/Extension/FirstName.php create mode 100644 Zend/Gdata/YouTube/Extension/Gender.php create mode 100644 Zend/Gdata/YouTube/Extension/Hobbies.php create mode 100644 Zend/Gdata/YouTube/Extension/Hometown.php create mode 100644 Zend/Gdata/YouTube/Extension/LastName.php create mode 100644 Zend/Gdata/YouTube/Extension/Link.php create mode 100644 Zend/Gdata/YouTube/Extension/Location.php create mode 100644 Zend/Gdata/YouTube/Extension/MediaContent.php create mode 100644 Zend/Gdata/YouTube/Extension/MediaCredit.php create mode 100644 Zend/Gdata/YouTube/Extension/MediaGroup.php create mode 100644 Zend/Gdata/YouTube/Extension/MediaRating.php create mode 100644 Zend/Gdata/YouTube/Extension/Movies.php create mode 100644 Zend/Gdata/YouTube/Extension/Music.php create mode 100644 Zend/Gdata/YouTube/Extension/NoEmbed.php create mode 100644 Zend/Gdata/YouTube/Extension/Occupation.php create mode 100644 Zend/Gdata/YouTube/Extension/PlaylistId.php create mode 100644 Zend/Gdata/YouTube/Extension/PlaylistTitle.php create mode 100644 Zend/Gdata/YouTube/Extension/Position.php create mode 100644 Zend/Gdata/YouTube/Extension/Private.php create mode 100644 Zend/Gdata/YouTube/Extension/QueryString.php create mode 100644 Zend/Gdata/YouTube/Extension/Racy.php create mode 100644 Zend/Gdata/YouTube/Extension/Recorded.php create mode 100644 Zend/Gdata/YouTube/Extension/Relationship.php create mode 100644 Zend/Gdata/YouTube/Extension/ReleaseDate.php create mode 100644 Zend/Gdata/YouTube/Extension/School.php create mode 100644 Zend/Gdata/YouTube/Extension/State.php create mode 100644 Zend/Gdata/YouTube/Extension/Statistics.php create mode 100644 Zend/Gdata/YouTube/Extension/Status.php create mode 100644 Zend/Gdata/YouTube/Extension/Token.php create mode 100644 Zend/Gdata/YouTube/Extension/Uploaded.php create mode 100644 Zend/Gdata/YouTube/Extension/Username.php create mode 100644 Zend/Gdata/YouTube/Extension/VideoId.php create mode 100644 Zend/Gdata/YouTube/InboxEntry.php create mode 100644 Zend/Gdata/YouTube/InboxFeed.php create mode 100644 Zend/Gdata/YouTube/MediaEntry.php create mode 100644 Zend/Gdata/YouTube/PlaylistListEntry.php create mode 100644 Zend/Gdata/YouTube/PlaylistListFeed.php create mode 100644 Zend/Gdata/YouTube/PlaylistVideoEntry.php create mode 100644 Zend/Gdata/YouTube/PlaylistVideoFeed.php create mode 100644 Zend/Gdata/YouTube/SubscriptionEntry.php create mode 100644 Zend/Gdata/YouTube/SubscriptionFeed.php create mode 100644 Zend/Gdata/YouTube/UserProfileEntry.php create mode 100644 Zend/Gdata/YouTube/VideoEntry.php create mode 100644 Zend/Gdata/YouTube/VideoFeed.php create mode 100644 Zend/Gdata/YouTube/VideoQuery.php create mode 100644 Zend/Http/Client.php create mode 100644 Zend/Http/Client/Adapter/Curl.php create mode 100644 Zend/Http/Client/Adapter/Exception.php create mode 100644 Zend/Http/Client/Adapter/Interface.php create mode 100644 Zend/Http/Client/Adapter/Proxy.php create mode 100644 Zend/Http/Client/Adapter/Socket.php create mode 100644 Zend/Http/Client/Adapter/Stream.php create mode 100644 Zend/Http/Client/Adapter/Test.php create mode 100644 Zend/Http/Client/Exception.php create mode 100644 Zend/Http/Exception.php create mode 100644 Zend/Http/Response.php create mode 100644 Zend/Http/Response/Stream.php create mode 100644 Zend/Loader.php create mode 100644 Zend/Oauth.php create mode 100644 Zend/Oauth/Client.php create mode 100644 Zend/Oauth/Config/ConfigInterface.php create mode 100644 Zend/Oauth/Consumer.php create mode 100644 Zend/Oauth/Exception.php create mode 100644 Zend/Oauth/Http.php create mode 100644 Zend/Oauth/Http/AccessToken.php create mode 100644 Zend/Oauth/Http/RequestToken.php create mode 100644 Zend/Oauth/Http/UserAuthorization.php create mode 100644 Zend/Oauth/Http/Utility.php create mode 100644 Zend/Oauth/Signature/Hmac.php create mode 100644 Zend/Oauth/Signature/Plaintext.php create mode 100644 Zend/Oauth/Signature/Rsa.php create mode 100644 Zend/Oauth/Signature/SignatureAbstract.php create mode 100644 Zend/Oauth/Token.php create mode 100644 Zend/Oauth/Token/Access.php create mode 100644 Zend/Oauth/Token/AuthorizedRequest.php create mode 100644 Zend/Oauth/Token/Request.php create mode 100644 Zend/Registry.php create mode 100644 Zend/Uri.php create mode 100644 Zend/Uri/Exception.php create mode 100644 Zend/Uri/Http.php create mode 100644 Zend/Validate/Abstract.php create mode 100644 Zend/Validate/Hostname.php create mode 100644 Zend/Validate/Hostname/Biz.php create mode 100644 Zend/Validate/Hostname/Cn.php create mode 100644 Zend/Validate/Hostname/Com.php create mode 100644 Zend/Validate/Hostname/Jp.php create mode 100644 Zend/Validate/Interface.php create mode 100644 Zend/Validate/Ip.php create mode 100644 Zend/Version.php delete mode 100644 demoData.en_us.php delete mode 100644 demoData.ja_jp.php delete mode 100644 demoData.zh_cn.php create mode 100644 include/Dashlets/DashletGenericAutoRefresh.tpl create mode 100644 include/Dashlets/DashletGenericAutoRefreshDynamic.tpl create mode 100644 include/ListView/ListViewDCMenu.tpl create mode 100644 include/MVC/View/tpls/xsrf.tpl create mode 100644 include/SugarCache/SugarCache.php create mode 100644 include/SugarCache/SugarCacheAPC.php create mode 100644 include/SugarCache/SugarCacheAbstract.php create mode 100644 include/SugarCache/SugarCacheFile.php create mode 100644 include/SugarCache/SugarCacheMemcache.php create mode 100644 include/SugarCache/SugarCacheMemcached.php create mode 100644 include/SugarCache/SugarCacheMemory.php create mode 100644 include/SugarCache/SugarCacheRedis.php create mode 100644 include/SugarCache/SugarCacheWincache.php rename include/{utils/external_cache/SugarCache_ZendServer.php => SugarCache/SugarCacheZend.php} (59%) create mode 100644 include/SugarCache/SugarCachesMash.php create mode 100644 include/SugarCharts/Jit/FlashCanvas/canvas2png.js create mode 100644 include/SugarCharts/Jit/FlashCanvas/flashcanvas.js create mode 100644 include/SugarCharts/Jit/FlashCanvas/flashcanvas.swf create mode 100644 include/SugarCharts/Jit/FlashCanvas/proxy.php create mode 100644 include/SugarCharts/Jit/FlashCanvas/save.php create mode 100644 include/SugarCharts/Jit/Jit.php create mode 100644 include/SugarCharts/Jit/JitReports.php rename include/{SugarPDF.php => SugarCharts/Jit/css/base.css} (54%) create mode 100644 include/SugarCharts/Jit/js/Jit/jit.js create mode 100644 include/SugarCharts/Jit/js/mySugarCharts.js create mode 100644 include/SugarCharts/Jit/js/sugarCharts.js rename include/{Dashlets => SugarCharts/Jit/tpls}/DashletGenericChartScript.tpl (80%) create mode 100644 include/SugarCharts/Jit/tpls/chart.tpl create mode 100644 include/SugarCharts/JsChart.php create mode 100644 include/SugarCharts/SugarChartFactory.php delete mode 100644 include/SugarCharts/tpls/chart.tpl create mode 100644 include/SugarDateTime.php create mode 100644 include/SugarFields/Fields/Assigned_user_name/EditViewFunction.tpl create mode 100644 include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl create mode 100644 include/SugarFields/Fields/File/ListView.tpl create mode 100644 include/SugarFields/Fields/File/SearchView.tpl create mode 100644 include/SugarFields/Fields/File/SugarFieldFile.js rename tests/include/Expressions/Expression/Parser/Parser.php => include/SugarFields/Fields/Id/SugarFieldId.php (64%) mode change 100755 => 100644 create mode 100644 include/SugarFields/Fields/Int/RangeSearchForm.tpl create mode 100644 include/SugarFields/Fields/Password/SugarFieldPassword.php create mode 100644 include/SugarFields/Fields/Phone/EditView.tpl create mode 100644 include/SugarFields/Fields/Phone/SugarFieldPhone.php create mode 100644 include/SugarOauth.php delete mode 100644 include/SugarTabs/SugarTab.php delete mode 100644 include/SugarTabs/tpls/singletabmenu.tpl delete mode 100644 include/VarDefHandler/SugarTabs/SugarTab.php delete mode 100644 include/VarDefHandler/SugarTabs/tpls/singletabmenu.tpl delete mode 100644 include/charts/Charts.php delete mode 100644 include/charts/hBarF.swf delete mode 100644 include/charts/hBarS.swf delete mode 100644 include/charts/lineF.swf delete mode 100644 include/charts/pieF.swf delete mode 100644 include/charts/vBarF.swf create mode 100644 include/externalAPI/Base/ExternalAPIBase.php create mode 100644 include/externalAPI/Base/ExternalAPIPlugin.php create mode 100644 include/externalAPI/Base/ExternalOAuthAPIPlugin.php create mode 100644 include/externalAPI/Base/OAuthPluginBase.php create mode 100644 include/externalAPI/Base/WebDocument.php create mode 100644 include/externalAPI/Base/WebFeed.php create mode 100644 include/externalAPI/Base/WebMeeting.php create mode 100644 include/externalAPI/ExternalAPIFactory.php rename modules/Calendar/DateTime.php => include/generic/SugarWidgets/SugarWidgetFieldfile.php (81%) create mode 100644 include/images/1.gif create mode 100644 include/images/default_user_feed_picture.png create mode 100644 include/images/seed_chris_id.gif create mode 100644 include/images/seed_jim_id.gif create mode 100644 include/images/seed_max_id.gif create mode 100644 include/images/seed_sally_id.gif create mode 100644 include/images/seed_sarah_id.gif create mode 100644 include/images/seed_will_id.gif create mode 100644 include/javascript/calendar.js create mode 100644 include/javascript/iscroll.js delete mode 100644 include/pdf/LICENSE delete mode 100644 include/pdf/class.ezpdf.php delete mode 100644 include/pdf/class.pdf.php delete mode 100644 include/utils/external_cache/SugarCache.php delete mode 100644 include/utils/external_cache/SugarCache_Base.php delete mode 100644 include/utils/external_cache/SugarCache_ExternalAbstract.php delete mode 100644 include/utils/external_cache/SugarCache_Memcache.php create mode 100644 include/utils/php_zip_utils.php delete mode 100644 install/seed_data/basicSeedData.php delete mode 100644 jscalendar/calendar-setup_3.js delete mode 100644 jscalendar/calendar-win2k-cold-1.css delete mode 100644 jscalendar/calendar.js delete mode 100644 jscalendar/img.gif delete mode 100644 jscalendar/lang/calendar-af.js delete mode 100644 jscalendar/lang/calendar-bg.js delete mode 100644 jscalendar/lang/calendar-br.js delete mode 100644 jscalendar/lang/calendar-ca.js delete mode 100644 jscalendar/lang/calendar-cs-win.js delete mode 100644 jscalendar/lang/calendar-da.js delete mode 100644 jscalendar/lang/calendar-de.js delete mode 100644 jscalendar/lang/calendar-du.js delete mode 100644 jscalendar/lang/calendar-el.js delete mode 100644 jscalendar/lang/calendar-en.js delete mode 100644 jscalendar/lang/calendar-es.js delete mode 100644 jscalendar/lang/calendar-fi.js delete mode 100644 jscalendar/lang/calendar-fr.js delete mode 100644 jscalendar/lang/calendar-hr-utf8.js delete mode 100644 jscalendar/lang/calendar-hr.js delete mode 100644 jscalendar/lang/calendar-hu.js delete mode 100644 jscalendar/lang/calendar-it.js delete mode 100644 jscalendar/lang/calendar-ja.js delete mode 100644 jscalendar/lang/calendar-jp.js delete mode 100644 jscalendar/lang/calendar-ko-utf8.js delete mode 100644 jscalendar/lang/calendar-ko.js delete mode 100644 jscalendar/lang/calendar-lt-utf8.js delete mode 100644 jscalendar/lang/calendar-lt.js delete mode 100644 jscalendar/lang/calendar-nl.js delete mode 100644 jscalendar/lang/calendar-no.js delete mode 100644 jscalendar/lang/calendar-pl-utf8.js delete mode 100644 jscalendar/lang/calendar-pl.js delete mode 100644 jscalendar/lang/calendar-pt.js delete mode 100644 jscalendar/lang/calendar-ro.js delete mode 100644 jscalendar/lang/calendar-ru.js delete mode 100644 jscalendar/lang/calendar-si.js delete mode 100644 jscalendar/lang/calendar-sk.js delete mode 100644 jscalendar/lang/calendar-sp.js delete mode 100644 jscalendar/lang/calendar-sv.js delete mode 100644 jscalendar/lang/calendar-tr.js delete mode 100644 jscalendar/lang/calendar-zh.js delete mode 100644 jscalendar/license.txt delete mode 100644 jscalendar/menuarrow.gif delete mode 100644 jscalendar/menuarrow2.gif create mode 100644 jssource/src_files/include/SugarCharts/Jit/FlashCanvas/canvas2png.js create mode 100644 jssource/src_files/include/SugarCharts/Jit/FlashCanvas/flashcanvas.js create mode 100644 jssource/src_files/include/SugarCharts/Jit/js/Jit/jit.js create mode 100644 jssource/src_files/include/SugarCharts/Jit/js/mySugarCharts.js create mode 100644 jssource/src_files/include/SugarCharts/Jit/js/sugarCharts.js create mode 100644 jssource/src_files/include/SugarFields/Fields/File/SugarFieldFile.js create mode 100644 jssource/src_files/include/javascript/calendar.js create mode 100644 jssource/src_files/include/javascript/iscroll.js delete mode 100644 jssource/src_files/jscalendar/calendar-setup_3.js delete mode 100644 jssource/src_files/jscalendar/calendar.js create mode 100644 jssource/src_files/modules/EAPM/EAPMEdit.js create mode 100644 metadata/documents_accountsMetaData.php create mode 100644 metadata/documents_bugsMetaData.php create mode 100644 metadata/documents_casesMetaData.php create mode 100644 metadata/documents_contactsMetaData.php create mode 100644 metadata/documents_opportunitiesMetaData.php create mode 100644 modules/Accounts/views/view.list.php delete mode 100644 modules/Administration/Backups.php delete mode 100644 modules/Administration/ConfigureShortcutBar.php rename modules/Administration/{Diagnostic.html => Diagnostic.tpl} (73%) create mode 100644 modules/Administration/templates/GlobalSearchSettings.tpl create mode 100644 modules/Administration/templates/Languages.tpl create mode 100644 modules/Administration/views/view.backups.php create mode 100644 modules/Administration/views/view.globalsearchsettings.php rename modules/{DocumentRevisions/Save.php => Administration/views/view.languages.php} (53%) create mode 100644 modules/Campaigns/Dashlets/TopCampaignsDashlet/TopCampaignsDashletConfigure.tpl rename modules/Campaigns/{RoiDetailView.html => RoiDetailView.tpl} (50%) rename modules/Campaigns/{TrackDetailView.html => TrackDetailView.tpl} (59%) create mode 100644 modules/Charts/DynamicAction.php delete mode 100644 modules/Configurator/SugarpdfSettings.php create mode 100644 modules/Configurator/views/view.sugarpdfsettings.php delete mode 100644 modules/Contacts/contactSeedData.php delete mode 100644 modules/Contacts/contactSeedData_jp.php create mode 100644 modules/Contacts/views/view.list.php delete mode 100644 modules/DocumentRevisions/DetailView.html delete mode 100644 modules/DocumentRevisions/DetailView.php delete mode 100644 modules/DocumentRevisions/EditView.html delete mode 100644 modules/DocumentRevisions/EditView.php create mode 100644 modules/DocumentRevisions/metadata/detailviewdefs.php create mode 100644 modules/DocumentRevisions/metadata/editviewdefs.php create mode 100644 modules/Documents/Dashlets/MyDocumentsDashlet/MyDocumentsDashlet.data.php create mode 100644 modules/Documents/Dashlets/MyDocumentsDashlet/MyDocumentsDashlet.meta.php rename include/utils/external_cache/SugarCache_Zend.php => modules/Documents/Dashlets/MyDocumentsDashlet/MyDocumentsDashlet.php (58%) create mode 100644 modules/Documents/DocumentExternalApiDropDown.php create mode 100644 modules/Documents/action_view_map.php create mode 100644 modules/Documents/tpls/view.extdoc.tpl create mode 100644 modules/Documents/views/view.extdoc.php create mode 100644 modules/DynamicFields/templates/Fields/Forms/phone.php create mode 100644 modules/DynamicFields/templates/Fields/Forms/phone.tpl create mode 100644 modules/DynamicFields/templates/Fields/TemplateRange.php create mode 100644 modules/EAPM/CheckLogins.php create mode 100644 modules/EAPM/EAPM.php create mode 100644 modules/EAPM/EAPMEdit.js create mode 100644 modules/EAPM/action_view_map.php create mode 100644 modules/EAPM/controller.php create mode 100644 modules/EAPM/language/en_us.lang.php create mode 100644 modules/EAPM/metadata/SearchFields.php create mode 100644 modules/EAPM/metadata/detailviewdefs.php create mode 100644 modules/EAPM/metadata/editviewdefs.php create mode 100644 modules/EAPM/metadata/listviewdefs.php create mode 100644 modules/EAPM/metadata/metafiles.php create mode 100644 modules/EAPM/metadata/popupdefs.php create mode 100644 modules/EAPM/metadata/quickcreatedefs.php create mode 100644 modules/EAPM/metadata/searchdefs.php rename modules/{Documents/subpanels/ForContractType.php => EAPM/metadata/subpanels/default.php} (63%) create mode 100644 modules/EAPM/tpls/DetailViewFooter.tpl create mode 100644 modules/EAPM/tpls/EditViewFooter.tpl create mode 100644 modules/EAPM/tpls/EditViewHeader.tpl create mode 100644 modules/EAPM/vardefs.php create mode 100644 modules/EAPM/views/view.detail.php create mode 100644 modules/EAPM/views/view.edit.php create mode 100644 modules/Emails/metadata/qcmodulesdefs.php create mode 100644 modules/Home/action_view_map.php rename modules/Home/{AdditionalDetailsRetrieve.php => views/view.additionaldetailsretrieve.php} (51%) delete mode 100644 modules/InboundEmail/parseEncoding.php create mode 100644 modules/Leads/views/view.list.php create mode 100644 modules/Meetings/JoinExternalMeeting.php create mode 100644 modules/Meetings/action_view_map.php create mode 100644 modules/Meetings/tpls/extMeetingNoStart.tpl create mode 100644 modules/Meetings/tpls/extMeetingNotInvited.tpl create mode 100644 modules/Meetings/views/view.listbytype.php create mode 100644 modules/Notes/Dashlets/MyNotesDashlet/MyNotesDashlet.data.php create mode 100644 modules/Notes/Dashlets/MyNotesDashlet/MyNotesDashlet.meta.php create mode 100644 modules/Notes/Dashlets/MyNotesDashlet/MyNotesDashlet.php rename modules/{Documents/subpanels/default.php => Notes/metadata/subpanels/ForCalls.php} (54%) create mode 100644 modules/Notes/metadata/subpanels/ForMeetings.php create mode 100644 modules/Opportunities/Dashlets/MyClosedOpportunitiesDashlet/MyClosedOpportunitiesDashletConfigure.tpl create mode 100644 modules/Opportunities/Dashlets/MyClosedOpportunitiesDashlet/MyClosedOpportunitiesDashletOptions.tpl create mode 100644 modules/Prospects/views/view.list.php create mode 100644 modules/SugarFeed/action_view_map.php rename modules/SugarFeed/{ => tpls}/AdminSettings.tpl (97%) create mode 100644 modules/SugarFeed/views/view.adminsettings.php create mode 100644 service/v3_1/SugarWebServiceImplv3_1.php create mode 100644 service/v3_1/SugarWebServiceUtilv3_1.php create mode 100644 service/v3_1/registry.php create mode 100644 service/v3_1/rest.php create mode 100644 service/v3_1/soap.php create mode 100644 service/v4/SugarWebServiceImplv4.php create mode 100644 service/v4/SugarWebServiceUtilv4.php create mode 100644 service/v4/registry.php create mode 100644 service/v4/rest.php create mode 100644 service/v4/soap.php create mode 100755 tests/PHPUnit/ChangeLog.markdown delete mode 100755 tests/PHPUnit/Extensions/Database/AbstractTester.php delete mode 100755 tests/PHPUnit/Extensions/Database/Constraint/DataSetIsEqual.php delete mode 100755 tests/PHPUnit/Extensions/Database/Constraint/TableIsEqual.php delete mode 100755 tests/PHPUnit/Extensions/Database/DB/DataSet.php delete mode 100755 tests/PHPUnit/Extensions/Database/DB/DefaultDatabaseConnection.php delete mode 100755 tests/PHPUnit/Extensions/Database/DB/FilteredDataSet.php delete mode 100755 tests/PHPUnit/Extensions/Database/DB/IDatabaseConnection.php delete mode 100755 tests/PHPUnit/Extensions/Database/DB/MetaData.php delete mode 100755 tests/PHPUnit/Extensions/Database/DB/MetaData/InformationSchema.php delete mode 100755 tests/PHPUnit/Extensions/Database/DB/MetaData/MySQL.php delete mode 100755 tests/PHPUnit/Extensions/Database/DB/MetaData/Oci.php delete mode 100755 tests/PHPUnit/Extensions/Database/DB/MetaData/PgSQL.php delete mode 100755 tests/PHPUnit/Extensions/Database/DB/MetaData/Sqlite.php delete mode 100755 tests/PHPUnit/Extensions/Database/DB/ResultSetTable.php delete mode 100755 tests/PHPUnit/Extensions/Database/DB/Table.php delete mode 100755 tests/PHPUnit/Extensions/Database/DB/TableIterator.php delete mode 100755 tests/PHPUnit/Extensions/Database/DB/TableMetaData.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/AbstractDataSet.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/AbstractTable.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/AbstractTableMetaData.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/AbstractXmlDataSet.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/CompositeDataSet.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/CsvDataSet.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/DataSetFilter.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/DefaultDataSet.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/DefaultTable.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/DefaultTableIterator.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/DefaultTableMetaData.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/FlatXmlDataSet.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/IDataSet.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/IPersistable.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/ITable.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/Persistors/Abstract.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/Persistors/FlatXml.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/Persistors/Xml.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/QueryDataSet.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/QueryTable.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/ReplacementDataSet.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/ReplacementTable.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/ReplacementTableIterator.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/TableFilter.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/TableMetaDataFilter.php delete mode 100755 tests/PHPUnit/Extensions/Database/DataSet/XmlDataSet.php delete mode 100755 tests/PHPUnit/Extensions/Database/DefaultTester.php delete mode 100755 tests/PHPUnit/Extensions/Database/ITester.php delete mode 100755 tests/PHPUnit/Extensions/Database/Operation/Composite.php delete mode 100755 tests/PHPUnit/Extensions/Database/Operation/Delete.php delete mode 100755 tests/PHPUnit/Extensions/Database/Operation/DeleteAll.php delete mode 100755 tests/PHPUnit/Extensions/Database/Operation/Exception.php delete mode 100755 tests/PHPUnit/Extensions/Database/Operation/Factory.php delete mode 100755 tests/PHPUnit/Extensions/Database/Operation/IDatabaseOperation.php delete mode 100755 tests/PHPUnit/Extensions/Database/Operation/Insert.php delete mode 100755 tests/PHPUnit/Extensions/Database/Operation/Null.php delete mode 100755 tests/PHPUnit/Extensions/Database/Operation/Replace.php delete mode 100755 tests/PHPUnit/Extensions/Database/Operation/RowBased.php delete mode 100755 tests/PHPUnit/Extensions/Database/Operation/Truncate.php delete mode 100755 tests/PHPUnit/Extensions/Database/Operation/Update.php delete mode 100755 tests/PHPUnit/Extensions/Database/TestCase.php delete mode 100755 tests/PHPUnit/Extensions/PerformanceTestCase.php delete mode 100755 tests/PHPUnit/Extensions/SeleniumTestCase.php delete mode 100755 tests/PHPUnit/Extensions/SeleniumTestCase/Driver.php delete mode 100755 tests/PHPUnit/Extensions/SeleniumTestCase/phpunit_coverage.php delete mode 100755 tests/PHPUnit/Extensions/Story/SeleniumTestCase.php create mode 100755 tests/PHPUnit/File/Iterator.php create mode 100755 tests/PHPUnit/File/Iterator/Factory.php delete mode 100755 tests/PHPUnit/Framework.php delete mode 100755 tests/PHPUnit/Framework/ComparisonFailure/Scalar.php delete mode 100755 tests/PHPUnit/Framework/ComparisonFailure/String.php delete mode 100755 tests/PHPUnit/Framework/MockObject/Mock.php delete mode 100755 tests/PHPUnit/Framework/MockObject/Stub.php delete mode 100755 tests/PHPUnit/Framework/TestCase.php create mode 100755 tests/PHPUnit/LICENSE create mode 100755 tests/PHPUnit/PHP/CodeCoverage.php rename tests/PHPUnit/{Util/Log/PMD/Rule/Function.php => PHP/CodeCoverage/Driver.php} (68%) rename tests/PHPUnit/{Framework/AssertionFailedError.php => PHP/CodeCoverage/Driver/Xdebug.php} (57%) create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Filter.php create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Report/Clover.php create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Report/HTML.php rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Node.php (63%) rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Node/Directory.php (64%) rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Node/File.php (58%) create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Report/HTML/Node/Iterator.php create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Report/HTML/Template/RGraph.bar.js create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Report/HTML/Template/RGraph.common.core.js create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Report/HTML/Template/RGraph.common.tooltips.js create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Report/HTML/Template/RGraph.scatter.js rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/butter.png (100%) rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/chameleon.png (100%) rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/close12_1.gif (100%) create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Report/HTML/Template/container-min.js rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/container.css (97%) create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Report/HTML/Template/dashboard.html.dist rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/directory.html.dist (86%) create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Report/HTML/Template/directory.png rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/directory_item.html.dist (70%) create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Report/HTML/Template/excanvas.compressed.js rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/file.html.dist (90%) create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Report/HTML/Template/file.png rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/file_item.html.dist (71%) rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/file_no_yui.html.dist (89%) rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/glass.png (100%) rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/method_item.html.dist (78%) rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/scarlet_red.png (100%) rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/snow.png (100%) rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/style.css (98%) create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Report/HTML/Template/yahoo-dom-event.js rename tests/PHPUnit/{Util/Report => PHP/CodeCoverage/Report/HTML}/Template/yui_item.js (100%) create mode 100755 tests/PHPUnit/PHP/CodeCoverage/TextUI/Command.php create mode 100755 tests/PHPUnit/PHP/CodeCoverage/Util.php rename tests/PHPUnit/{Util => PHP}/Timer.php (69%) create mode 100755 tests/PHPUnit/PHP/Token.php create mode 100755 tests/PHPUnit/PHP/Token/Exception.php create mode 100755 tests/PHPUnit/PHP/Token/Stream.php create mode 100755 tests/PHPUnit/PHP/Token/Stream/CachingFactory.php create mode 100755 tests/PHPUnit/PHP/Token/Stream/TextUI/Command.php rename tests/PHPUnit/{Tests/Util/TestDox/AllTests.php => PHPUnit/Autoload.php} (55%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/GroupTestSuite.php (82%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/OutputTestCase.php (81%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/PhptTestCase.php (81%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/PhptTestCase/Logger.php (80%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/PhptTestSuite.php (73%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/RepeatedTest.php (78%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/Story/Given.php (80%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/Story/ResultPrinter.php (83%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/Story/ResultPrinter/HTML.php (86%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/Story/ResultPrinter/Template/scenario.html.dist (100%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/Story/ResultPrinter/Template/scenario_header.html.dist (100%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/Story/ResultPrinter/Template/scenarios.html.dist (100%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/Story/ResultPrinter/Template/step.html.dist (100%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/Story/ResultPrinter/Text.php (87%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/Story/Scenario.php (87%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/Story/Step.php (86%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/Story/TestCase.php (89%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/Story/Then.php (80%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/Story/When.php (80%) rename tests/PHPUnit/{ => PHPUnit}/Extensions/TestDecorator.php (88%) create mode 100755 tests/PHPUnit/PHPUnit/Extensions/TicketListener.php create mode 100755 tests/PHPUnit/PHPUnit/Extensions/TicketListener/GitHub.php create mode 100755 tests/PHPUnit/PHPUnit/Extensions/TicketListener/GoogleCode.php create mode 100755 tests/PHPUnit/PHPUnit/Extensions/TicketListener/Trac.php rename tests/PHPUnit/{Extensions/SeleniumTestCase/prepend.php => PHPUnit/Framework.php} (75%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Assert.php (67%) create mode 100755 tests/PHPUnit/PHPUnit/Framework/Assert/Functions.php create mode 100755 tests/PHPUnit/PHPUnit/Framework/AssertionFailedError.php rename tests/PHPUnit/{ => PHPUnit}/Framework/ComparisonFailure.php (55%) rename tests/PHPUnit/{ => PHPUnit}/Framework/ComparisonFailure/Array.php (82%) rename tests/PHPUnit/{ => PHPUnit}/Framework/ComparisonFailure/Object.php (66%) rename tests/PHPUnit/{Util/FilterIterator.php => PHPUnit/Framework/ComparisonFailure/Scalar.php} (65%) create mode 100755 tests/PHPUnit/PHPUnit/Framework/ComparisonFailure/String.php rename tests/PHPUnit/{ => PHPUnit}/Framework/ComparisonFailure/Type.php (79%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint.php (65%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/And.php (77%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/ArrayHasKey.php (81%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/Attribute.php (74%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/ClassHasAttribute.php (84%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/ClassHasStaticAttribute.php (83%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/FileExists.php (85%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/GreaterThan.php (80%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/IsAnything.php (82%) create mode 100755 tests/PHPUnit/PHPUnit/Framework/Constraint/IsEmpty.php rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/IsEqual.php (76%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/IsFalse.php (82%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/IsIdentical.php (80%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/IsInstanceOf.php (85%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/IsNull.php (82%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/IsTrue.php (82%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/IsType.php (68%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/LessThan.php (80%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/Not.php (78%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/ObjectHasAttribute.php (79%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/Or.php (70%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/PCREMatch.php (81%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/StringContains.php (78%) create mode 100755 tests/PHPUnit/PHPUnit/Framework/Constraint/StringEndsWith.php create mode 100755 tests/PHPUnit/PHPUnit/Framework/Constraint/StringMatches.php rename tests/PHPUnit/{Extensions/Database/DataSet/ITableMetaData.php => PHPUnit/Framework/Constraint/StringStartsWith.php} (60%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/TraversableContains.php (79%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/TraversableContainsOnly.php (83%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Constraint/Xor.php (72%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Error.php (81%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Error/Notice.php (79%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Error/Warning.php (79%) rename tests/PHPUnit/{Util/Log/PMD/Rule/Class.php => PHPUnit/Framework/Exception.php} (69%) rename tests/PHPUnit/{ => PHPUnit}/Framework/ExpectationFailedException.php (77%) rename tests/PHPUnit/{ => PHPUnit}/Framework/IncompleteTest.php (78%) rename tests/PHPUnit/{ => PHPUnit}/Framework/IncompleteTestError.php (77%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Builder/Identity.php (78%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Builder/InvocationMocker.php (61%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Builder/Match.php (76%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Builder/MethodNameMatch.php (69%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Builder/Namespace.php (76%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Builder/ParametersMatch.php (80%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Builder/Stub.php (76%) create mode 100755 tests/PHPUnit/PHPUnit/Framework/MockObject/Generator.php create mode 100755 tests/PHPUnit/PHPUnit/Framework/MockObject/Generator/mocked_class.tpl.dist create mode 100755 tests/PHPUnit/PHPUnit/Framework/MockObject/Generator/mocked_clone.tpl.dist create mode 100755 tests/PHPUnit/PHPUnit/Framework/MockObject/Generator/mocked_object_method.tpl.dist create mode 100755 tests/PHPUnit/PHPUnit/Framework/MockObject/Generator/mocked_static_method.tpl.dist create mode 100755 tests/PHPUnit/PHPUnit/Framework/MockObject/Generator/unmocked_clone.tpl.dist create mode 100755 tests/PHPUnit/PHPUnit/Framework/MockObject/Generator/wsdl_class.tpl.dist create mode 100755 tests/PHPUnit/PHPUnit/Framework/MockObject/Generator/wsdl_method.tpl.dist rename tests/PHPUnit/{Util/Log/PMD/Rule/File.php => PHPUnit/Framework/MockObject/Invocation.php} (70%) create mode 100755 tests/PHPUnit/PHPUnit/Framework/MockObject/Invocation/Object.php rename tests/PHPUnit/{Framework/MockObject/Invocation.php => PHPUnit/Framework/MockObject/Invocation/Static.php} (51%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/InvocationMocker.php (71%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Invokable.php (67%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Matcher.php (73%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Matcher/AnyInvokedCount.php (74%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Matcher/AnyParameters.php (73%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Matcher/Invocation.php (71%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Matcher/InvokedAtIndex.php (74%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Matcher/InvokedAtLeastOnce.php (75%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Matcher/InvokedCount.php (69%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Matcher/InvokedRecorder.php (74%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Matcher/MethodName.php (71%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Matcher/Parameters.php (74%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Matcher/StatelessInvocation.php (59%) create mode 100755 tests/PHPUnit/PHPUnit/Framework/MockObject/MockBuilder.php rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/MockObject.php (59%) create mode 100755 tests/PHPUnit/PHPUnit/Framework/MockObject/Stub.php rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Stub/ConsecutiveCalls.php (79%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Stub/Exception.php (78%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Stub/MatcherCollection.php (74%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Stub/Return.php (75%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Stub/ReturnArgument.php (79%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Stub/ReturnCallback.php (78%) rename tests/PHPUnit/{ => PHPUnit}/Framework/MockObject/Verifiable.php (73%) create mode 100755 tests/PHPUnit/PHPUnit/Framework/Process/TestCaseMethod.tpl.dist rename tests/PHPUnit/{ => PHPUnit}/Framework/SelfDescribing.php (79%) rename tests/PHPUnit/{ => PHPUnit}/Framework/SkippedTest.php (78%) rename tests/PHPUnit/{ => PHPUnit}/Framework/SkippedTestError.php (77%) rename tests/PHPUnit/{ => PHPUnit}/Framework/SkippedTestSuiteError.php (77%) rename tests/PHPUnit/{Extensions/Database/DB/IMetaData.php => PHPUnit/Framework/SyntheticError.php} (55%) rename tests/PHPUnit/{ => PHPUnit}/Framework/Test.php (79%) create mode 100755 tests/PHPUnit/PHPUnit/Framework/TestCase.php rename tests/PHPUnit/{ => PHPUnit}/Framework/TestFailure.php (75%) rename tests/PHPUnit/{ => PHPUnit}/Framework/TestListener.php (86%) rename tests/PHPUnit/{ => PHPUnit}/Framework/TestResult.php (60%) rename tests/PHPUnit/{ => PHPUnit}/Framework/TestSuite.php (70%) create mode 100755 tests/PHPUnit/PHPUnit/Framework/TestSuite/DataProvider.php rename tests/PHPUnit/{ => PHPUnit}/Framework/Warning.php (69%) rename tests/PHPUnit/{ => PHPUnit}/Runner/BaseTestRunner.php (56%) rename tests/PHPUnit/{ => PHPUnit}/Runner/IncludePathTestCollector.php (63%) rename tests/PHPUnit/{ => PHPUnit}/Runner/StandardTestSuiteLoader.php (72%) rename tests/PHPUnit/{ => PHPUnit}/Runner/TestCollector.php (80%) rename tests/PHPUnit/{ => PHPUnit}/Runner/TestSuiteLoader.php (82%) rename tests/PHPUnit/{ => PHPUnit}/Runner/Version.php (79%) create mode 100755 tests/PHPUnit/PHPUnit/TextUI/Command.php rename tests/PHPUnit/{ => PHPUnit}/TextUI/ResultPrinter.php (74%) rename tests/PHPUnit/{ => PHPUnit}/TextUI/TestRunner.php (54%) create mode 100755 tests/PHPUnit/PHPUnit/Util/Class.php create mode 100755 tests/PHPUnit/PHPUnit/Util/Configuration.php create mode 100755 tests/PHPUnit/PHPUnit/Util/DeprecatedFeature.php create mode 100755 tests/PHPUnit/PHPUnit/Util/DeprecatedFeature/Logger.php create mode 100755 tests/PHPUnit/PHPUnit/Util/Diff.php rename tests/PHPUnit/{ => PHPUnit}/Util/ErrorHandler.php (79%) create mode 100755 tests/PHPUnit/PHPUnit/Util/File.php rename tests/PHPUnit/{ => PHPUnit}/Util/Fileloader.php (52%) create mode 100755 tests/PHPUnit/PHPUnit/Util/Filesystem.php create mode 100755 tests/PHPUnit/PHPUnit/Util/Filter.php rename tests/PHPUnit/{ => PHPUnit}/Util/Getopt.php (64%) create mode 100755 tests/PHPUnit/PHPUnit/Util/GlobalState.php rename tests/PHPUnit/{Extensions/Database/DataSet/ITableIterator.php => PHPUnit/Util/InvalidArgumentHelper.php} (63%) rename tests/PHPUnit/{Util/Log/PEAR.php => PHPUnit/Util/Log/DBUS.php} (54%) rename tests/PHPUnit/{ => PHPUnit}/Util/Log/JSON.php (71%) rename tests/PHPUnit/{Util/Log/XML.php => PHPUnit/Util/Log/JUnit.php} (74%) rename tests/PHPUnit/{ => PHPUnit}/Util/Log/TAP.php (83%) create mode 100755 tests/PHPUnit/PHPUnit/Util/Log/XHProf.php create mode 100755 tests/PHPUnit/PHPUnit/Util/PHP.php rename tests/PHPUnit/{Util/Log/PMD/Rule/Project.php => PHPUnit/Util/PHP/Default.php} (69%) rename tests/PHPUnit/{Util/Log/PMD/Rule/Class/DepthOfInheritanceTree.php => PHPUnit/Util/PHP/Windows.php} (59%) rename tests/PHPUnit/{ => PHPUnit}/Util/Printer.php (86%) rename tests/PHPUnit/{ => PHPUnit}/Util/Skeleton.php (66%) create mode 100755 tests/PHPUnit/PHPUnit/Util/Skeleton/Class.php rename tests/PHPUnit/{ => PHPUnit}/Util/Skeleton/Template/Class.tpl.dist (100%) rename tests/PHPUnit/{ => PHPUnit}/Util/Skeleton/Template/IncompleteTestMethod.tpl.dist (100%) rename tests/PHPUnit/{ => PHPUnit}/Util/Skeleton/Template/Method.tpl.dist (100%) rename tests/PHPUnit/{ => PHPUnit}/Util/Skeleton/Template/TestClass.tpl.dist (70%) rename tests/PHPUnit/{ => PHPUnit}/Util/Skeleton/Template/TestMethod.tpl.dist (100%) rename tests/PHPUnit/{ => PHPUnit}/Util/Skeleton/Template/TestMethodBool.tpl.dist (100%) rename tests/PHPUnit/{ => PHPUnit}/Util/Skeleton/Template/TestMethodBoolStatic.tpl.dist (100%) rename tests/PHPUnit/{ => PHPUnit}/Util/Skeleton/Template/TestMethodException.tpl.dist (100%) rename tests/PHPUnit/{ => PHPUnit}/Util/Skeleton/Template/TestMethodExceptionStatic.tpl.dist (100%) rename tests/PHPUnit/{ => PHPUnit}/Util/Skeleton/Template/TestMethodStatic.tpl.dist (100%) rename tests/PHPUnit/{ => PHPUnit}/Util/Skeleton/Test.php (67%) create mode 100755 tests/PHPUnit/PHPUnit/Util/Test.php rename tests/PHPUnit/{ => PHPUnit}/Util/TestDox/NamePrettifier.php (70%) rename tests/PHPUnit/{ => PHPUnit}/Util/TestDox/ResultPrinter.php (85%) rename tests/PHPUnit/{ => PHPUnit}/Util/TestDox/ResultPrinter/HTML.php (82%) rename tests/PHPUnit/{ => PHPUnit}/Util/TestDox/ResultPrinter/Text.php (83%) rename tests/PHPUnit/{ => PHPUnit}/Util/TestSuiteIterator.php (86%) rename tests/PHPUnit/{ => PHPUnit}/Util/Type.php (90%) rename tests/PHPUnit/{ => PHPUnit}/Util/XML.php (75%) create mode 100755 tests/PHPUnit/README.markdown delete mode 100755 tests/PHPUnit/Samples/BankAccount/BankAccount.php delete mode 100755 tests/PHPUnit/Samples/BankAccount/BankAccountTest.php delete mode 100755 tests/PHPUnit/Samples/BankAccountDB/BankAccount.php delete mode 100755 tests/PHPUnit/Samples/BankAccountDB/BankAccountDBTest.php delete mode 100755 tests/PHPUnit/Samples/BankAccountDB/BankAccountDBTestMySQL.php delete mode 100755 tests/PHPUnit/Samples/BankAccountDB/_files/bank-account-after-deposits.xml delete mode 100755 tests/PHPUnit/Samples/BankAccountDB/_files/bank-account-after-new-account.xml delete mode 100755 tests/PHPUnit/Samples/BankAccountDB/_files/bank-account-after-withdrawals.xml delete mode 100755 tests/PHPUnit/Samples/BankAccountDB/_files/bank-account-seed.xml delete mode 100755 tests/PHPUnit/Samples/BowlingGame/BowlingGame.php delete mode 100755 tests/PHPUnit/Samples/BowlingGame/BowlingGameSpec.php delete mode 100755 tests/PHPUnit/Samples/BowlingGame/BowlingGameTest.php delete mode 100755 tests/PHPUnit/Samples/FailureTest.php delete mode 100755 tests/PHPUnit/Samples/Money/IMoney.php delete mode 100755 tests/PHPUnit/Samples/Money/Money.php delete mode 100755 tests/PHPUnit/Samples/Money/MoneyBag.php delete mode 100755 tests/PHPUnit/Samples/Money/MoneyTest.php delete mode 100755 tests/PHPUnit/Tests/AllTests.php delete mode 100755 tests/PHPUnit/Tests/Extensions/AllTests.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/AllTests.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/DataSet/AllTests.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/DataSet/CompositeDataSetTest.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/DataSet/CsvDataSetTest.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/DataSet/FilterTest.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/DataSet/PersistorTest.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/DataSet/QueryDataSetTest.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/DataSet/QueryTableTest.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/DataSet/ReplacementDataSetTest.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/DataSet/ReplacementTableTest.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/DataSet/XmlDataSetsTest.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/Operation/AllTests.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/Operation/OperationsTest.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/Operation/RowBasedTest.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/CsvDataSets/table1.csv delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/CsvDataSets/table2.csv delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/DatabaseTestUtility.php delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/AllEmptyTableInsertResult.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/AllEmptyTableInsertTest.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/DeleteAllOperationTest.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/DeleteOperationResult.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/DeleteOperationTest.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/EmptyTableInsertResult.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/EmptyTableInsertTest.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/FilteredTestComparison.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/FilteredTestFixture.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/FlatXmlDataSet.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/FlatXmlWriter.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/InsertOperationResult.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/InsertOperationTest.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/OperationsTestFixture.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/QueryDataSetTest.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/ReplaceOperationResult.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/ReplaceOperationTest.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/RowBasedExecute.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/UpdateOperationResult.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/UpdateOperationTest.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/XmlDataSet.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/Database/_files/XmlDataSets/XmlWriter.xml delete mode 100755 tests/PHPUnit/Tests/Extensions/OutputTestCaseTest.php delete mode 100755 tests/PHPUnit/Tests/Extensions/PerformanceTestCaseTest.php delete mode 100755 tests/PHPUnit/Tests/Extensions/RepeatedTestTest.php delete mode 100755 tests/PHPUnit/Tests/Extensions/SeleniumTestCaseTest.php delete mode 100755 tests/PHPUnit/Tests/Framework/AllTests.php delete mode 100755 tests/PHPUnit/Tests/Framework/AssertTest.php delete mode 100755 tests/PHPUnit/Tests/Framework/ComparisonFailureTest.php delete mode 100755 tests/PHPUnit/Tests/Framework/ConstraintTest.php delete mode 100755 tests/PHPUnit/Tests/Framework/MockObjectTest.php delete mode 100755 tests/PHPUnit/Tests/Framework/SuiteTest.php delete mode 100755 tests/PHPUnit/Tests/Framework/TestCaseTest.php delete mode 100755 tests/PHPUnit/Tests/Framework/TestFailureTest.php delete mode 100755 tests/PHPUnit/Tests/Framework/TestImplementorTest.php delete mode 100755 tests/PHPUnit/Tests/Framework/TestListenerTest.php delete mode 100755 tests/PHPUnit/Tests/Regression/578.phpt delete mode 100755 tests/PHPUnit/Tests/Regression/684.phpt delete mode 100755 tests/PHPUnit/Tests/Regression/Issue578Test.php delete mode 100755 tests/PHPUnit/Tests/Regression/Issue684Test.php delete mode 100755 tests/PHPUnit/Tests/Runner/AllTests.php delete mode 100755 tests/PHPUnit/Tests/Runner/BaseTestRunnerTest.php delete mode 100755 tests/PHPUnit/Tests/TextUI/abstract-test-class.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/concrete-test-class.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/coverage-clover-class-extended.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/coverage-clover-class.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/coverage-clover-method.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/coverage-clover-not-private.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/coverage-clover-not-protected.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/coverage-clover-not-public.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/coverage-clover-private.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/coverage-clover-protected.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/coverage-clover-public.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/coverage-clover.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/coverage-source.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/dataset-log-xml.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/debug.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/default.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/exclude-group.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/filter-class.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/filter-method.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/group.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/help.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/help2.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/list-groups.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/log-graphviz.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/log-json.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/log-tap.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/log-xml.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/repeat.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/skeleton.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/story.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/tap.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/testdox-html.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/testdox-text.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/testdox.phpt delete mode 100755 tests/PHPUnit/Tests/TextUI/verbose.phpt delete mode 100755 tests/PHPUnit/Tests/Util/AllTests.php delete mode 100755 tests/PHPUnit/Tests/Util/ConfigurationTest.php delete mode 100755 tests/PHPUnit/Tests/Util/TestDox/NamePrettifierTest.php delete mode 100755 tests/PHPUnit/Tests/Util/TestTest.php delete mode 100755 tests/PHPUnit/Tests/Util/TimerTest.php delete mode 100755 tests/PHPUnit/Tests/Util/XMLTest.php delete mode 100755 tests/PHPUnit/Tests/_files/AbstractTest.php delete mode 100755 tests/PHPUnit/Tests/_files/AnInterface.php delete mode 100755 tests/PHPUnit/Tests/_files/Calculator.php delete mode 100755 tests/PHPUnit/Tests/_files/ClassWithNonPublicAttributes.php delete mode 100755 tests/PHPUnit/Tests/_files/ConcreteTest.php delete mode 100755 tests/PHPUnit/Tests/_files/CoverageClassExtendedTest.php delete mode 100755 tests/PHPUnit/Tests/_files/CoverageClassTest.php delete mode 100755 tests/PHPUnit/Tests/_files/CoverageMethodTest.php delete mode 100755 tests/PHPUnit/Tests/_files/CoverageNotPrivateTest.php delete mode 100755 tests/PHPUnit/Tests/_files/CoverageNotProtectedTest.php delete mode 100755 tests/PHPUnit/Tests/_files/CoverageNotPublicTest.php delete mode 100755 tests/PHPUnit/Tests/_files/CoveragePrivateTest.php delete mode 100755 tests/PHPUnit/Tests/_files/CoverageProtectedTest.php delete mode 100755 tests/PHPUnit/Tests/_files/CoveragePublicTest.php delete mode 100755 tests/PHPUnit/Tests/_files/CoveredClass.php delete mode 100755 tests/PHPUnit/Tests/_files/DataSetTest.php delete mode 100755 tests/PHPUnit/Tests/_files/DoubleTestCase.php delete mode 100755 tests/PHPUnit/Tests/_files/Error.php delete mode 100755 tests/PHPUnit/Tests/_files/Failure.php delete mode 100755 tests/PHPUnit/Tests/_files/FunctionCallback.php delete mode 100755 tests/PHPUnit/Tests/_files/InheritedTestCase.php delete mode 100755 tests/PHPUnit/Tests/_files/MethodCallback.php delete mode 100755 tests/PHPUnit/Tests/_files/MockRunner.php delete mode 100755 tests/PHPUnit/Tests/_files/NoArgTestCaseTest.php delete mode 100755 tests/PHPUnit/Tests/_files/NoTestCaseClass.php delete mode 100755 tests/PHPUnit/Tests/_files/NoTestCases.php delete mode 100755 tests/PHPUnit/Tests/_files/NonStatic.php delete mode 100755 tests/PHPUnit/Tests/_files/NotPublicTestCase.php delete mode 100755 tests/PHPUnit/Tests/_files/NotVoidTestCase.php delete mode 100755 tests/PHPUnit/Tests/_files/OneTestCase.php delete mode 100755 tests/PHPUnit/Tests/_files/OutputTestCase.php delete mode 100755 tests/PHPUnit/Tests/_files/OverrideTestCase.php delete mode 100755 tests/PHPUnit/Tests/_files/PartialMockTestClass.php delete mode 100755 tests/PHPUnit/Tests/_files/SampleClass.php delete mode 100755 tests/PHPUnit/Tests/_files/SelectorAssertionsFixture.html delete mode 100755 tests/PHPUnit/Tests/_files/SetupFailure.php delete mode 100755 tests/PHPUnit/Tests/_files/SleepTest.php delete mode 100755 tests/PHPUnit/Tests/_files/Struct.php delete mode 100755 tests/PHPUnit/Tests/_files/Success.php delete mode 100755 tests/PHPUnit/Tests/_files/TearDownFailure.php delete mode 100755 tests/PHPUnit/Tests/_files/TestIterator.php delete mode 100755 tests/PHPUnit/Tests/_files/ThrowExceptionTestCase.php delete mode 100755 tests/PHPUnit/Tests/_files/ThrowNoExceptionTestCase.php delete mode 100755 tests/PHPUnit/Tests/_files/TornDown.php delete mode 100755 tests/PHPUnit/Tests/_files/TornDown2.php delete mode 100755 tests/PHPUnit/Tests/_files/TornDown3.php delete mode 100755 tests/PHPUnit/Tests/_files/TornDown4.php delete mode 100755 tests/PHPUnit/Tests/_files/TornDown5.php delete mode 100755 tests/PHPUnit/Tests/_files/WasRun.php delete mode 100755 tests/PHPUnit/Tests/_files/bar.xml delete mode 100755 tests/PHPUnit/Tests/_files/configuration.xml delete mode 100755 tests/PHPUnit/Tests/_files/foo.xml delete mode 100755 tests/PHPUnit/Tests/_files/structureAttributesAreSameButValuesAreNot.xml delete mode 100755 tests/PHPUnit/Tests/_files/structureExpected.xml delete mode 100755 tests/PHPUnit/Tests/_files/structureIgnoreTextNodes.xml delete mode 100755 tests/PHPUnit/Tests/_files/structureIsSameButDataIsNot.xml delete mode 100755 tests/PHPUnit/Tests/_files/structureWrongNumberOfAttributes.xml delete mode 100755 tests/PHPUnit/Tests/_files/structureWrongNumberOfNodes.xml delete mode 100755 tests/PHPUnit/Tests/phpunit.xml.dist rename tests/PHPUnit/{Util => Text}/Template.php (78%) rename tests/PHPUnit/{Extensions/SeleniumTestCase/append.php => Text/Template/Autoload.php} (68%) delete mode 100755 tests/PHPUnit/TextUI/Command.php delete mode 100755 tests/PHPUnit/Util/Class.php delete mode 100755 tests/PHPUnit/Util/CodeCoverage.php delete mode 100755 tests/PHPUnit/Util/Configuration.php delete mode 100755 tests/PHPUnit/Util/Filesystem.php delete mode 100755 tests/PHPUnit/Util/Filter.php delete mode 100755 tests/PHPUnit/Util/Log/CPD.php delete mode 100755 tests/PHPUnit/Util/Log/CodeCoverage/Database.php delete mode 100755 tests/PHPUnit/Util/Log/CodeCoverage/XML/Clover.php delete mode 100755 tests/PHPUnit/Util/Log/CodeCoverage/XML/Source.php delete mode 100755 tests/PHPUnit/Util/Log/Database.php delete mode 100755 tests/PHPUnit/Util/Log/Database/MySQL.sql delete mode 100755 tests/PHPUnit/Util/Log/Database/SQLite3.sql delete mode 100755 tests/PHPUnit/Util/Log/GraphViz.php delete mode 100755 tests/PHPUnit/Util/Log/Metrics.php delete mode 100755 tests/PHPUnit/Util/Log/PMD.php delete mode 100755 tests/PHPUnit/Util/Log/PMD/Rule.php delete mode 100755 tests/PHPUnit/Util/Log/PMD/Rule/Class/EfferentCoupling.php delete mode 100755 tests/PHPUnit/Util/Log/PMD/Rule/Class/ExcessiveClassLength.php delete mode 100755 tests/PHPUnit/Util/Log/PMD/Rule/Class/ExcessivePublicCount.php delete mode 100755 tests/PHPUnit/Util/Log/PMD/Rule/Class/TooManyFields.php delete mode 100755 tests/PHPUnit/Util/Log/PMD/Rule/Function/CRAP.php delete mode 100755 tests/PHPUnit/Util/Log/PMD/Rule/Function/CodeCoverage.php delete mode 100755 tests/PHPUnit/Util/Log/PMD/Rule/Function/CyclomaticComplexity.php delete mode 100755 tests/PHPUnit/Util/Log/PMD/Rule/Function/ExcessiveMethodLength.php delete mode 100755 tests/PHPUnit/Util/Log/PMD/Rule/Function/ExcessiveParameterList.php delete mode 100755 tests/PHPUnit/Util/Log/PMD/Rule/Function/NPathComplexity.php delete mode 100755 tests/PHPUnit/Util/Log/PMD/Rule/Project/CRAP.php delete mode 100755 tests/PHPUnit/Util/Metrics.php delete mode 100755 tests/PHPUnit/Util/Metrics/Class.php delete mode 100755 tests/PHPUnit/Util/Metrics/File.php delete mode 100755 tests/PHPUnit/Util/Metrics/Function.php delete mode 100755 tests/PHPUnit/Util/Metrics/Project.php delete mode 100755 tests/PHPUnit/Util/PDO.php delete mode 100755 tests/PHPUnit/Util/Report.php delete mode 100755 tests/PHPUnit/Util/Report/Template/container-min.js delete mode 100755 tests/PHPUnit/Util/Report/Template/yahoo-dom-event.js delete mode 100755 tests/PHPUnit/Util/Skeleton/Class.php delete mode 100755 tests/PHPUnit/Util/Test.php create mode 100755 tests/PHPUnit/phpcov.bat create mode 100755 tests/PHPUnit/phpcov.php create mode 100755 tests/PHPUnit/phptok.bat create mode 100755 tests/PHPUnit/phptok.php create mode 100755 tests/SugarTestCallUtilities.php create mode 100755 tests/SugarTestTaskUtilities.php create mode 100755 tests/data/Bug40989Test.php create mode 100755 tests/data/Bug43143Test.php rename tests/data/{fixUpFormatting.php => FixUpFormattingTest.php} (77%) create mode 100755 tests/data/GetACLCategoryTest.php create mode 100755 tests/data/ImportableFieldsTest.php create mode 100755 tests/data/SugarBeanTest.php create mode 100755 tests/include/Bug43652.php create mode 100755 tests/include/Dashlets/DashletAutoRefreshTest.php create mode 100755 tests/include/Dashlets/DashletGenericChartTest.php create mode 100755 tests/include/Dashlets/DashletSaveUserPreferencesTest.php create mode 100755 tests/include/Dashlets/DashletTest.php delete mode 100755 tests/include/Expressions/Actions/ActionFactory.php create mode 100755 tests/include/ListView/ListViewDisplayTest.php create mode 100755 tests/include/MVC/View/SugarViewTest.php create mode 100755 tests/include/MVC/View/ViewFactoryTest.php create mode 100755 tests/include/MVC/View/views/ViewAjaxTest.php create mode 100755 tests/include/MVC/View/views/ViewClassicTest.php create mode 100755 tests/include/MVC/View/views/ViewNoAccessTest.php create mode 100755 tests/include/MVC/View/views/ViewVcardTest.php create mode 100755 tests/include/MassUpdate/Bug43468Test.php rename tests/include/{ => MassUpdate}/MassUpdateTest.php (50%) create mode 100755 tests/include/SearchForm/Bug43548Test.php create mode 100755 tests/include/SearchForm/RangeSearchTest.php create mode 100755 tests/include/SugarCharts/Bug43574.php create mode 100755 tests/include/SugarCharts/CustomSugarChartFactoryTest.php rename include/utils/external_cache/SugarCache_sMash.php => tests/include/SugarCharts/SugarChartFactoryTest.php (53%) mode change 100644 => 100755 create mode 100755 tests/include/SugarFields/Fields/Password/SugarFieldPasswordTest.php create mode 100755 tests/include/SugarFields/Fields/Phone/Bug43942Test.php create mode 100755 tests/include/SugarObjects/templates/file/Bug42862Test.php create mode 100755 tests/include/ValidDBNameTest.php create mode 100755 tests/include/connectors/Bug40247Test.php create mode 100755 tests/include/database/Bug34547Test.php create mode 100755 tests/include/utils/Bug41003Test.php create mode 100755 tests/include/utils/MiscUtilsTest.php create mode 100755 tests/include/utils/SugarArrayUtilsTest.php create mode 100755 tests/include/utils/ZipTest.php create mode 100755 tests/install/Bug40129Test.php delete mode 100755 tests/install/QuotesSeedDataTest.php create mode 100755 tests/modules/Accounts/Bug34670Test.php create mode 100755 tests/modules/Calls/CallTest.php create mode 100755 tests/modules/Currencies/CurrencyTest.php create mode 100755 tests/modules/Documents/Bug43560Test.php create mode 100755 tests/modules/Documents/DocSaveTest.php create mode 100755 tests/modules/DynamicFields/Bug40311Test.php create mode 100755 tests/modules/DynamicFields/Bug41845Test.php create mode 100755 tests/modules/DynamicFields/DynamicFieldsCurrencyTests.php create mode 100755 tests/modules/DynamicFields/EmptyCustomDateFieldTest.php create mode 100755 tests/modules/DynamicFields/TemplateDateTest.php create mode 100755 tests/modules/Emails/Bug43343Test.php create mode 100755 tests/modules/Emails/GetNamePlusEmailAddressesForComposeTest.php create mode 100755 tests/modules/Employees/Bug36615Test.php create mode 100755 tests/modules/Home/Bug40216Test.php create mode 100755 tests/modules/Home/Bug43653Test.php create mode 100755 tests/modules/Home/Bug44030Test.php create mode 100755 tests/modules/Meetings/MeetingTest.php create mode 100755 tests/modules/ModuleBuilder/Bug42085Test.php create mode 100755 tests/modules/Notes/Bug40263Test.php create mode 100755 tests/modules/SavedSearch/Bug42378Test.php create mode 100755 tests/modules/SavedSearch/Bug42915Test.php create mode 100755 tests/modules/Schedulers/Bug44125Test.php create mode 100755 tests/modules/Schedulers/SchedulerTest.php create mode 100755 tests/modules/SchedulersJobs/Bug27344Test.php create mode 100755 tests/modules/SugarFeed/SugarFeedTest.php delete mode 100755 tests/modules/Trackers/Bug40019_Test.php delete mode 100755 tests/modules/Trackers/TrackerCreateDefaultUserTest.php delete mode 100755 tests/modules/Trackers/TrackerManagerTest.php delete mode 100755 tests/modules/Trackers/TrackerMetricsTest.php delete mode 100755 tests/modules/Trackers/TrackerMonitorTest.php delete mode 100755 tests/modules/Trackers/TrackerReportsUsageTest.php delete mode 100755 tests/modules/Trackers/TrackerSaveTest.php delete mode 100755 tests/modules/Trackers/TrackerTestUtility.php delete mode 100755 tests/modules/Trackers/TrackerUpgradeDashletTest.php delete mode 100755 tests/modules/UpgradeWizard/Bug32003_Test.php create mode 100755 tests/modules/UpgradeWizard/Bug36845Test.php create mode 100755 tests/modules/UpgradeWizard/Bug37214Test.php create mode 100755 tests/modules/UpgradeWizard/Bug39757Test.php create mode 100755 tests/modules/UpgradeWizard/Bug42490Test.php create mode 100755 tests/modules/UpgradeWizard/Bug42622Test.php create mode 100755 tests/modules/UpgradeWizard/Bug43208Test.php create mode 100755 tests/modules/UpgradeWizard/RepairDatabaseTest.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/Bug43211Test.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/Bug43226Test.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/Bug43226TestPartB.php rename include/utils/external_cache/SugarCache_Wincache.php => tests/modules/UpgradeWizard/SugarMerge/UpgradeCustomTemplateMetaTest.php (52%) mode change 100644 => 100755 create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/600/modules/Accounts/metadata/searchdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/600/modules/Documents/metadata/detailviewdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/600/modules/Documents/metadata/editviewdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/600/modules/Leads/metadata/searchdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Calls/metadata/editviewdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Documents/metadata/SearchFields.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Documents/metadata/detailviewdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Documents/metadata/editviewdefs.php rename include/utils/external_cache/SugarCache_APC.php => tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Documents/metadata/listviewdefs.php (52%) mode change 100644 => 100755 create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Documents/metadata/quickcreatedefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Documents/metadata/searchdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Documents/metadata/studio.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Documents/metadata/subpaneldefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Documents/metadata/wireless.editviewdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Documents/vardefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Notes/metadata/SearchFields.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Notes/metadata/additionalDetails.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Notes/metadata/detailviewdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Notes/metadata/editviewdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Notes/metadata/listviewdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Notes/metadata/quickcreatedefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Notes/metadata/searchdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Notes/metadata/studio.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Notes/metadata/wireless.editviewdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/610/modules/Notes/vardefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/611/modules/Calls/metadata/editviewdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/611/modules/Meetings/metadata/editviewdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/custom/modules/Accounts/metadata/searchdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/custom/modules/Calls/metadata/editviewdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/custom/modules/Documents/metadata/detailviewdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/custom/modules/Documents/metadata/editviewdefs.php create mode 100755 tests/modules/UpgradeWizard/SugarMerge/metadata_files/custom/modules/Leads/metadata/searchdefs.php rename install/seed_data/index.html => tests/modules/UpgradeWizard/SugarMerge/metadata_files/custom/modules/Meetings/metadata/editviewdefs.php (93%) mode change 100644 => 100755 create mode 100755 tests/modules/UpgradeWizard/UWUtilsTest.php create mode 100755 tests/modules/Users/AuthenticateTest.php create mode 100755 tests/modules/Users/Bug41527Test.php create mode 100755 tests/service/Bug22504Test.php create mode 100755 tests/service/Bug36564Test.php create mode 100755 tests/service/Bug41985Test.php create mode 100755 tests/service/Bug43196Test.php create mode 100755 tests/service/RESTAPI4Test.php create mode 100755 tests/service/RESTAPIRSSTest.php delete mode 100644 themes/Sugar5/images/sugarColors.xml create mode 100644 themes/default/images/backtotop.gif create mode 100644 themes/default/images/chartBg.png create mode 100644 themes/default/images/create-record.gif create mode 100644 themes/default/images/join_imeeting.gif create mode 100644 themes/default/images/join_meeting_inline.png create mode 100644 themes/default/images/start_meeting_inline.png diff --git a/HandleAjaxCall.php b/HandleAjaxCall.php index 20ea22a3..4b08854a 100644 --- a/HandleAjaxCall.php +++ b/HandleAjaxCall.php @@ -1,7 +1,7 @@ repairAndClearAll($selectedActions, $installed_modules,true, false); $this->rebuild_relationships(); - $this->log('
' . translate('LBL_MI_COMPLETE') . ''); - UpdateSystemTabs('Add',$tab_modules); - + + //clear the unified_search_module.php file + require_once('modules/Home/UnifiedSearchAdvanced.php'); + UnifiedSearchAdvanced::unlinkUnifiedSearchModulesFile(); + + $this->log('
' . translate('LBL_MI_COMPLETE') . ''); }else{ die("No \$installdefs Defined In $this->base_dir/manifest.php"); } @@ -337,7 +340,9 @@ class ModuleInstaller{ //if it's not a sugar file then we remove it otherwise we can't restor it if(!$this->ms->sugarFileExists($to)){ $GLOBALS['log']->debug('ModuleInstaller[uninstall_new_file] deleting file ' . $to); - unlink($to); + if(file_exists($to)) { + unlink($to); + } }else{ $GLOBALS['log']->fatal('ModuleInstaller[uninstall_new_file] Could not remove file ' . $to . ' as no backup file was found to restore to'); } @@ -1261,6 +1266,10 @@ class ModuleInstaller{ UpdateSystemTabs('Restore',$installed_modules); + //clear the unified_search_module.php file + require_once('modules/Home/UnifiedSearchAdvanced.php'); + UnifiedSearchAdvanced::unlinkUnifiedSearchModulesFile(); + $this->log('
' . translate('LBL_MI_COMPLETE') . ''); if(!$this->silent){ update_progress_bar('install', $total_steps, $total_steps); @@ -1289,6 +1298,7 @@ class ModuleInstaller{ $this->merge_files('Ext/Vardefs/', 'vardefs.ext.php'); sugar_cache_reset(); } + function rebuild_layoutdefs(){ $this->log(translate('LBL_MI_REBUILDING') . " Layoutdefs..."); $this->merge_files('Ext/Layoutdefs/', 'layoutdefs.ext.php'); @@ -1302,12 +1312,12 @@ class ModuleInstaller{ function rebuild_dashletcontainers(){ $this->log(translate('LBL_MI_REBUILDING') . " DC Actions..."); - $this->merge_files('Ext/DashletContainer/Containers', 'dcactions.ext.php'); + $this->merge_files('Ext/DashletContainer/Containers/', 'dcactions.ext.php'); } function rebuild_modules(){ $this->log(translate('LBL_MI_REBUILDING') . " Modules..."); - $this->merge_files('Ext/Include', 'modules.ext.php', '', true); + $this->merge_files('Ext/Include/', 'modules.ext.php', '', true); } function rebuild_administration(){ @@ -1400,18 +1410,14 @@ class ModuleInstaller{ if (substr($entry, 0, 9) == '_override') { $override[] = $entry; } else { - $fp = sugar_fopen($module_install . '/' . $entry, 'r'); - $file = fread($fp , filesize($module_install . '/' . $entry)); + $file = file_get_contents($module_install . '/' . $entry); $GLOBALS['log']->debug(get_class($this)."->merge_files(): found {$module_install}{$entry}") ; - fclose($fp); $extension .= "\n". str_replace(array('', '', ' 0) && is_file($module_install.'/'.$entry) && $entry != '.' && $entry != '..' && strtolower(substr($entry, -4)) == ".php") { - $fp = sugar_fopen($module_install . '/' . $entry, 'r'); - $file = fread($fp , filesize($module_install . '/' . $entry)); - fclose($fp); + $file = file_get_contents($module_install . '/' . $entry); $extension .= "\n". str_replace(array('', 'read()){ @@ -1992,7 +1997,7 @@ private function dir_file_count($path){ $path ='custom/Extension/' . $relationship['module']. '/Ext/Layoutdefs'; } } - + if(!empty($relationship['module_layoutdefs']) && file_exists($path . '/'. $this->id_name . '.php')){ mkdir_recursive($path . '/'.DISABLED_PATH, true); rename( $path . '/'. $this->id_name . '.php', $path . '/'.DISABLED_PATH.'/'. $this->id_name . '.php'); diff --git a/ModuleInstall/ModuleScanner.php b/ModuleInstall/ModuleScanner.php index ac9aa547..427085b5 100644 --- a/ModuleInstall/ModuleScanner.php +++ b/ModuleInstall/ModuleScanner.php @@ -1,7 +1,7 @@ retrieveSettings(); $admin->saveSetting(CREDENTIAL_CATEGORY, CREDENTIAL_USERNAME, $username); @@ -244,7 +244,7 @@ require_once('ModuleInstall/PackageManager/PackageManagerComm.php'); } function getCredentials(){ - + $admin = new Administration(); $admin->retrieveSettings(CREDENTIAL_CATEGORY, true); $credentials = array(); @@ -619,7 +619,7 @@ require_once('ModuleInstall/PackageManager/PackageManagerComm.php'); } function getImageForType( $type ){ - + $icon = ""; switch( $type ){ case "full": @@ -664,7 +664,7 @@ require_once('ModuleInstall/PackageManager/PackageManagerComm.php'); $alreadyProcessed["$val"] = true; } } - + $upgrades_available = 0; $packages = array(); $mod_strings = return_module_language($current_language, "Administration"); @@ -703,7 +703,7 @@ require_once('ModuleInstall/PackageManager/PackageManagerComm.php'); //check dependencies first if(!empty($dependencies)){ - + $uh = new UpgradeHistory(); $not_found = $uh->checkDependencies($dependencies); if(!empty($not_found) && count($not_found) > 0){ @@ -736,7 +736,7 @@ require_once('ModuleInstall/PackageManager/PackageManagerComm.php'); $c = count($fileS); $fileName = (isset($fileS[$c-1]) && !empty($fileS[$c-1])) ? $fileS[$c-1] : $fileS[$c-2]; $upload_file = $sugar_config['upload_dir'].$fileName; - + $upgrade_content = urlencode($upgrade_content); $upload_content = urlencode($upload_file); $packages[] = array('name' => $name, 'version' => $version, 'published_date' => $published_date, 'description' => $description, 'uninstallable' =>$uninstallable, 'type' => $type, 'file_install' => fileToHash($file_install), 'file' => fileToHash($upgrade_content), 'upload_file' => $upload_content); @@ -751,9 +751,7 @@ require_once('ModuleInstall/PackageManager/PackageManagerComm.php'); $base_tmp_upgrade_dir = "$base_upgrade_dir/temp"; $license_file = $this->extractFile($file, 'LICENSE.txt', $base_tmp_upgrade_dir); if(is_file($license_file)){ - $fh = sugar_fopen($license_file, 'r'); - $contents = fread($fh, filesize($license_file)); - fclose($fh); + $contents = file_get_contents($license_file); return $contents; }else{ return null; @@ -856,15 +854,15 @@ require_once('ModuleInstall/PackageManager/PackageManagerComm.php'); } else { $file_uninstall = fileToHash( $file_uninstall ); } - + $packages[] = array( - 'name' => $name, - 'version' => $version, - 'type' => $type, - 'published_date' => $date_entered, - 'description' => $description, - 'uninstallable' =>$uninstallable, - 'file_install' => $file_uninstall , + 'name' => $name, + 'version' => $version, + 'type' => $type, + 'published_date' => $date_entered, + 'description' => $description, + 'uninstallable' =>$uninstallable, + 'file_install' => $file_uninstall , 'file' => fileToHash($filename), 'enabled' => $enabled_string ); diff --git a/ModuleInstall/PackageManager/PackageManagerComm.php b/ModuleInstall/PackageManager/PackageManagerComm.php index cbebb366..af32492a 100644 --- a/ModuleInstall/PackageManager/PackageManagerComm.php +++ b/ModuleInstall/PackageManager/PackageManagerComm.php @@ -1,6 +1,6 @@ "; $display .= ""; diff --git a/ModuleInstall/PackageManager/PackageManagerDownloader.php b/ModuleInstall/PackageManager/PackageManagerDownloader.php index 16a816a3..b20d26b3 100644 --- a/ModuleInstall/PackageManager/PackageManagerDownloader.php +++ b/ModuleInstall/PackageManager/PackageManagerDownloader.php @@ -1,6 +1,6 @@ {literal} - \ No newline at end of file diff --git a/include/Dashlets/DashletGenericAutoRefreshDynamic.tpl b/include/Dashlets/DashletGenericAutoRefreshDynamic.tpl new file mode 100644 index 00000000..5209406f --- /dev/null +++ b/include/Dashlets/DashletGenericAutoRefreshDynamic.tpl @@ -0,0 +1,64 @@ +{* + +/********************************************************************************* + * SugarCRM Community Edition is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. + * + * 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. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ + + + + +*} + + + \ No newline at end of file diff --git a/include/Dashlets/DashletGenericChart.php b/include/Dashlets/DashletGenericChart.php index 9806d7f5..87045095 100644 --- a/include/Dashlets/DashletGenericChart.php +++ b/include/Dashlets/DashletGenericChart.php @@ -1,7 +1,7 @@ title = $this->dashletStrings['LBL_TITLE']; + if ( isset($options['autoRefresh']) ) + $this->autoRefresh = $options['autoRefresh']; $this->layoutManager = new LayoutManager(); $this->layoutManager->setAttribute('context', 'Report'); @@ -127,6 +129,9 @@ abstract class DashletGenericChart extends Dashlet $this->layoutManager->setAttributePtr('reporter', $temp); } + /** + * @see Dashlet::setRefreshIcon() + */ public function setRefreshIcon() { $additionalTitle = ''; @@ -144,21 +149,11 @@ abstract class DashletGenericChart extends Dashlet */ public function displayScript() { - global $sugar_config, $current_user, $current_language; - - $xmlFile = $sugar_config['tmp_dir']. $current_user->id . '_' . $this->id . '.xml'; - $chartStringsXML = $GLOBALS['sugar_config']['tmp_dir'].'chart_strings.' . $current_language .'.lang.xml'; - - $ss = new Sugar_Smarty(); - $ss->assign('chartName', $this->id); - $ss->assign('chartXMLFile', $xmlFile); - $ss->assign('chartStyleCSS', SugarThemeRegistry::current()->getCSSURL('chart.css')); - $ss->assign('chartColorsXML', SugarThemeRegistry::current()->getImageURL('sugarColors.xml')); - $ss->assign('chartStringsXML', $chartStringsXML); - - $str = $ss->fetch('include/Dashlets/DashletGenericChartScript.tpl'); - return $str; + require_once('include/SugarCharts/SugarChartFactory.php'); + $sugarChart = SugarChartFactory::getInstance(); + return $sugarChart->getDashletScript($this->id); + } /** @@ -210,6 +205,8 @@ abstract class DashletGenericChart extends Dashlet if (!empty($req['dashletTitle'])) $options['title'] = $req['dashletTitle']; + $options['autoRefresh'] = empty($req['autoRefresh']) ? '0' : $req['autoRefresh']; + return $options; } @@ -257,6 +254,13 @@ abstract class DashletGenericChart extends Dashlet $this->getConfigureSmartyInstance()->assign('dashletType', 'predefined_chart'); $this->getConfigureSmartyInstance()->assign('module', $_REQUEST['module']); + if($this->isAutoRefreshable()) { + $this->getConfigureSmartyInstance()->assign('isRefreshable', true); + $this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']); + $this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions()); + $this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh); + } + return parent::displayOptions() . $this->getConfigureSmartyInstance()->fetch($this->_configureTpl); } @@ -268,8 +272,8 @@ abstract class DashletGenericChart extends Dashlet */ protected function getSeedBean() { - if ( !($this->_seedBean instanceof $this->_seedName) ) - $this->_seedBean = loadBean($this->_seedName); + if ( !($this->_seedBean instanceof SugarBean) ) + $this->_seedBean = SugarModule::get($this->_seedName)->loadBean(); return $this->_seedBean; } @@ -293,5 +297,58 @@ abstract class DashletGenericChart extends Dashlet { return array(); } + + /** + * Displays the Dashlet, must call process() prior to calling this + * + * @return string HTML that displays Dashlet + */ + public function display() + { + return parent::display() . $this->processAutoRefresh(); + } + + /** + * Processes and displays the auto refresh code for the dashlet + * + * @param int $dashletOffset + * @return string HTML code + */ + protected function processAutoRefresh($dashletOffset = 0) + { + global $sugar_config; + + if ( empty($dashletOffset) ) { + $dashletOffset = 0; + $module = $_REQUEST['module']; + if(isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) { + $dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset']; + } + } + + if ( !$this->isRefreshable ) { + return ''; + } + if ( !empty($sugar_config['dashlet_auto_refresh_min']) && $sugar_config['dashlet_auto_refresh_min'] == -1 ) { + return ''; + } + $autoRefreshSS = new Sugar_Smarty(); + $autoRefreshSS->assign('dashletOffset', $dashletOffset); + $autoRefreshSS->assign('dashletId', $this->id); + $autoRefreshSS->assign('strippedDashletId', str_replace("-","",$this->id)); //javascript doesn't like "-" in function names + if ( empty($this->autoRefresh) ) { + $this->autoRefresh = 0; + } + elseif ( !empty($sugar_config['dashlet_auto_refresh_min']) ) { + $this->autoRefresh = min($sugar_config['dashlet_auto_refresh_min'],$this->autoRefresh); + } + $autoRefreshSS->assign('dashletRefreshInterval', $this->autoRefresh * 1000); + $autoRefreshSS->assign('url', "predefined_chart"); + $tpl = 'include/Dashlets/DashletGenericAutoRefresh.tpl'; + if ( $_REQUEST['action'] == "DynamicAction" ) { + $tpl = 'include/Dashlets/DashletGenericAutoRefreshDynamic.tpl'; + } + + return $autoRefreshSS->fetch($tpl); + } } -?> diff --git a/include/Dashlets/DashletGenericChartConfigure.tpl b/include/Dashlets/DashletGenericChartConfigure.tpl index 6a97b53c..e853c3e1 100644 --- a/include/Dashlets/DashletGenericChartConfigure.tpl +++ b/include/Dashlets/DashletGenericChartConfigure.tpl @@ -1,7 +1,7 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -60,6 +60,18 @@ + {if $isRefreshable} + + + {$autoRefresh} + + + + + + {/if} {foreach name=searchIteration from=$searchFields key=name item=params} diff --git a/include/Dashlets/DashletGenericConfigure.tpl b/include/Dashlets/DashletGenericConfigure.tpl index d014d60a..216d8436 100644 --- a/include/Dashlets/DashletGenericConfigure.tpl +++ b/include/Dashlets/DashletGenericConfigure.tpl @@ -1,7 +1,7 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -70,11 +70,21 @@ {$strings.displayRows} - + + {if $isRefreshable} + + {$strings.autoRefresh} + + + + + {/if} diff --git a/include/Dashlets/DashletGenericDisplay.tpl b/include/Dashlets/DashletGenericDisplay.tpl index cbeef37c..1873a2bf 100644 --- a/include/Dashlets/DashletGenericDisplay.tpl +++ b/include/Dashlets/DashletGenericDisplay.tpl @@ -1,7 +1,7 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -124,7 +124,9 @@ {$arrowAlt} {/if} {else} - {sugar_translate label=$params.label module=$pageData.bean.moduleDir} + {if !isset($params.noHeader) || $params.noHeader == false} + {sugar_translate label=$params.label module=$pageData.bean.moduleDir} + {/if} {/if} diff --git a/include/DetailView/DetailView.php b/include/DetailView/DetailView.php index 80a81537..07afafae 100644 --- a/include/DetailView/DetailView.php +++ b/include/DetailView/DetailView.php @@ -1,7 +1,7 @@ {sugar_translate label='{{$label}}' module='{{$module}}'} {{/if}} {{* Print out the table data *}} - - + + {{foreach name=rowIteration from=$panel key=row item=rowData}} + {counter name="fieldsUsed" start=0 print=false assign="fieldsUsed"} + {counter name="fieldsHidden" start=0 print=false assign="fieldsHidden"} + {capture name="tr" assign="tableRow"} {{assign var='columnsInRow' value=$rowData|@count}} {{assign var='columnsUsed' value=0}} - {{foreach name=colIteration from=$rowData key=col item=colData}} + {{foreach name=colIteration from=$rowData key=col item=colData}} + {{if !empty($colData.field.hideIf)}} + {if !({{$colData.field.hideIf}}) } + {{/if}} + {counter name="fieldsUsed"} - + {{if !empty($colData.field.hideIf)}} + {else} + + + {/if} + {{/if}} {{/foreach}} + {/capture} + {if $fieldsUsed > 0 && $fieldsUsed != $fieldsHidden} + {$tableRow} + {/if} {{/foreach}}
+ {{if !empty($colData.field.name)}} + {if !$fields.{{$colData.field.name}}.hidden} + {{/if}} {{if isset($colData.field.customLabel)}} {{$colData.field.customLabel}} {{elseif isset($colData.field.label) && strpos($colData.field.label, '$')}} - {capture name="label" assign="label"} - {{$colData.field.label}} - {/capture} + {capture name="label" assign="label"}{{$colData.field.label}}{/capture} {$label|strip_semicolon}: {{elseif isset($colData.field.label)}} - {capture name="label" assign="label"} - {sugar_translate label='{{$colData.field.label}}' module='{{$module}}'} - {/capture} + {capture name="label" assign="label"}{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}{/capture} {$label|strip_semicolon}: {{elseif isset($fields[$colData.field.name])}} - {capture name="label" assign="label"} - {sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'} - {/capture} + {capture name="label" assign="label"}{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}{/capture} {$label|strip_semicolon}: {{else}}   {{/if}} + {{if isset($colData.field.popupHelp) || isset($fields[$colData.field.name]) && isset($fields[$colData.field.name].popupHelp) }} + {{if isset($colData.field.popupHelp) }} + {capture name="popupText" assign="popupText"}{sugar_translate label="{{$colData.field.popupHelp}}" module='{{$module}}'}{/capture} + {{elseif isset($fields[$colData.field.name].popupHelp)}} + {capture name="popupText" assign="popupText"}{sugar_translate label="{{$fields[$colData.field.name].popupHelp}}" module='{{$module}}'}{/capture} + {{/if}} + {overlib_includes} + {sugar_help text=$popupText WIDTH=400} + {{/if}} + {{if !empty($colData.field.name)}} + {/if} + {{/if}} + + {{if !empty($colData.field.name)}} + {if !$fields.{{$colData.field.name}}.hidden} + {{/if}} {{if $colData.field.customCode || $colData.field.assign}} {counter name="panelFieldCount"} - {{sugar_evalcolumn var=$colData.field colData=$colData}} + {{sugar_evalcolumn var=$colData.field colData=$colData}} {{elseif $fields[$colData.field.name] && !empty($colData.field.fields) }} {{foreach from=$colData.field.fields item=subField}} {{if $fields[$subField]}} @@ -115,14 +134,27 @@ class="yui-navset detailview_tabs" {counter name="panelFieldCount"} {{$subField}} {{/if}} - {{/foreach}} + {{/foreach}} {{elseif $fields[$colData.field.name]}} {counter name="panelFieldCount"} {{sugar_field parentFieldArray='fields' vardef=$fields[$colData.field.name] displayType='DetailView' displayParams=$colData.field.displayParams typeOverride=$colData.field.type}} {{/if}} + {{if !empty($colData.field.name)}} + {/if} + {{/if}}   
{{/if}} @@ -135,9 +167,9 @@ class="yui-navset detailview_tabs" {{include file=$footerTpl}} {{if $useTabs}} - + + {{/if}} \ No newline at end of file diff --git a/include/DetailView/DetailView2.php b/include/DetailView/DetailView2.php index b2792aba..e71c9c58 100644 --- a/include/DetailView/DetailView2.php +++ b/include/DetailView/DetailView2.php @@ -1,6 +1,6 @@ - + {{if isset($form.hidden)}} {{foreach from=$form.hidden item=field}} -{{$field}} +{{$field}} {{/foreach}} {{/if}} @@ -77,9 +77,13 @@ {{if count($form.buttons) > $num_buttons}} {{foreach from=$form.buttons key=val item=button}} {{if is_array($button) && $button.customCode}} + {{if isset($closeFormBeforeCustomButtons)}} + {{/if}} {{sugar_button module="$module" id="$button" view="EditView"}} + {{if isset($closeFormBeforeCustomButtons)}} + {{/if}} {{/if}} {{/foreach}} {{/if}} diff --git a/include/EditView/EditView.php b/include/EditView/EditView.php index 050912bf..8f387c04 100644 --- a/include/EditView/EditView.php +++ b/include/EditView/EditView.php @@ -1,7 +1,7 @@ {{assign var='columnsInRow' value=$rowData|@count}} @@ -103,30 +105,39 @@ class="yui-navset" {{assign var="colCount" value=0}} {{/if}} + {{if !empty($colData.field.hideIf)}} + {if !({{$colData.field.hideIf}}) } + {{/if}} {{if empty($def.templateMeta.labelsOnTop) && empty($colData.field.hideLabel)}} {{if isset($colData.field.customLabel)}} {{$colData.field.customLabel}} {{elseif isset($colData.field.label)}} - {capture name="label" assign="label"} - {sugar_translate label='{{$colData.field.label}}' module='{{$module}}'} - {/capture} + {capture name="label" assign="label"}{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}{/capture} {$label|strip_semicolon}: {{elseif isset($fields[$colData.field.name])}} - {capture name="label" assign="label"} - {sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'} - {/capture} + {capture name="label" assign="label"}{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}{/capture} {$label|strip_semicolon}: {{/if}} {{* Show the required symbol if field is required, but override not set. Or show if override is set *}} - {{if ($fields[$colData.field.name].required && !isset($colData.field.displayParams.required)) || - (isset($colData.field.displayParams.required) && $colData.field.displayParams.required && $fields[$colData.field.name].required !== false)}} + {{if ($fields[$colData.field.name].required && (!isset($colData.field.displayParams.required) || $colData.field.displayParams.required)) || + (isset($colData.field.displayParams.required) && $colData.field.displayParams.required)}} {{$APP.LBL_REQUIRED_SYMBOL}} {{/if}} + {{if isset($colData.field.popupHelp) || isset($fields[$colData.field.name]) && isset($fields[$colData.field.name].popupHelp) }} + {{if isset($colData.field.popupHelp) }} + {capture name="popupText" assign="popupText"}{sugar_translate label="{{$colData.field.popupHelp}}" module='{{$module}}'}{/capture} + {{elseif isset($fields[$colData.field.name].popupHelp)}} + {capture name="popupText" assign="popupText"}{sugar_translate label="{{$fields[$colData.field.name].popupHelp}}" module='{{$module}}'}{/capture} + {{/if}} + {capture name="overlibStuff" assign="overlibStuff"}{overlib_includes}{/capture} + {sugar_help text=$popupText WIDTH=-1} + {{/if}} + {{/if}} - + {counter name="fieldsUsed"} {{if !empty($def.templateMeta.labelsOnTop)}} {{if isset($colData.field.label)}} @@ -136,9 +147,9 @@ class="yui-navset" {{elseif isset($fields[$colData.field.name])}} {sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}: {{/if}} - + {{* Show the required symbol if field is required, but override not set. Or show if override is set *}} - {{if ($fields[$colData.field.name].required && (!isset($colData.field.displayParams.required) || $colData.field.displayParams.required)) || + {{if ($fields[$colData.field.name].required && (!isset($colData.field.displayParams.required) || $colData.field.displayParams.required)) || (isset($colData.field.displayParams.required) && $colData.field.displayParams.required)}} {{$APP.LBL_REQUIRED_SYMBOL}} {{/if}} @@ -147,7 +158,7 @@ class="yui-navset" {{/if}} {{/if}} - + {{if $fields[$colData.field.name] && !empty($colData.field.fields) }} {{foreach from=$colData.field.fields item=subField}} {{if $fields[$subField.name]}} @@ -163,9 +174,18 @@ class="yui-navset" {{$colData.displayParams}} {{sugar_field parentFieldArray='fields' tabindex=$colData.field.tabindex vardef=$fields[$colData.field.name] displayType='EditView' displayParams=$colData.field.displayParams typeOverride=$colData.field.type formName=$form_name}} {{/if}} + {{if !empty($colData.field.hideIf)}} + {else} + + {/if} + {{/if}} {{/foreach}} +{/capture} +{if $fieldsUsed > 0 } +{$tableRow} +{/if} {{/foreach}} @@ -179,15 +199,16 @@ class="yui-navset" {{/foreach}} {{include file=$footerTpl}} +{$overlibStuff} {{if $useTabs}} - + + {{/if}} \n"; - - $massUpdateRun = isset($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true'; - $uids = empty($_REQUEST['uid']) || $massUpdateRun ? '' : $_REQUEST['uid']; - $select_entire_list = isset($_REQUEST['select_entire_list']) && !$massUpdateRun ? $_REQUEST['select_entire_list'] : 0; - - echo "\n" . - "\n". - "\n". - "\n"; - - } - - - $GLOBALS['log']->debug("Offsets: (start, previous, next, last)(0, $previous_offset, $next_offset, $last_offset)"); - - if(0 == $current_offset) { - $start_link = ""; - $previous_link = ""; - } else { - if($this->multi_select_popup) {// nav links for multiselect popup, submit form to save checks. - $start_link = ""; - $previous_link = ""; - } elseif($this->shouldProcess) { - $start_link = ""; - $previous_link = ""; - } else { - $onClick = ''; - if(0 != preg_match('/javascript.*/', $start_URL)){ - $onClick = "\"$start_URL;\""; - }else{ - $onClick ="'location.href=\"$start_URL\";'"; - } - $start_link = ""; - - $onClick = ''; - if(0 != preg_match('/javascript.*/', $previous_URL)){ - $onClick = "\"$previous_URL;\""; - }else{ - $onClick = "'location.href=\"$previous_URL\";'"; - } - $previous_link = ""; - } - } - - if($last_offset <= $current_offset) { - $end_link = ""; - $next_link = ""; - } else { - if($this->multi_select_popup) { // nav links for multiselect popup, submit form to save checks. - $end_link = ""; - if(!empty($sugar_config['disable_count_query'])) { - $end_link = ''; - } - $next_link = ""; - } elseif($this->shouldProcess) { - $end_link = ""; - $next_link = ""; - } else { - $onClick = ''; - if(0 != preg_match('/javascript.*/', $next_URL)){ - $onClick = "\"$next_URL;\""; - }else{ - $onClick ="'location.href=\"$next_URL\";'"; - } - $next_link = ""; - - $onClick = ''; - if(0 != preg_match('/javascript.*/', $end_URL)){ - $onClick = "\"$end_URL;\""; - }else{ - $onClick = "'location.href=\"$end_URL\";'"; - } - $end_link = ""; - - } - } - - $GLOBALS['log']->info("Offset (next, current, prev)($next_offset, $current_offset, $previous_offset)"); - $GLOBALS['log']->info("Start/end records ($start_record, $end_record)"); - - $end_record = $end_record-1; - - echo ""; - - if($this->show_select_menu) { - $select_link = "".$this->local_app_strings['LBL_LINK_SELECT']." ".""; - } else { - $select_link = " "; - } - - // put overlib strings into functions to avoid backslash plague! - /*echo ""; - */ - //$export_link = "".SugarThemeRegistry::current()->getImage("export","alt='".$this->local_app_strings['LBL_EXPORT']."' border='0' align='absmiddle'")." ".$this->local_app_strings['LBL_EXPORT'].""; - $export_link = ''; - - if($this->show_delete_button) { - $delete_link = ''; - } else { - $delete_link = ' '; - } - - $admin = new Administration(); - $admin->retrieveSettings('system'); - - $user_merge = $current_user->getPreference('mailmerge_on'); - if($user_merge == 'on' && isset($admin->settings['system_mailmerge_on']) && $admin->settings['system_mailmerge_on']) { - echo ""; - $merge_link = " | ".$this->local_app_strings['LBL_MAILMERGE'].""; - } else { - $merge_link = " "; - } - - $selected_objects_span = " | {$this->local_app_strings['LBL_LISTVIEW_SELECTED_OBJECTS']}"; - - if($_REQUEST['module'] == 'Home' || $this->local_current_module == 'Import' - || $this->show_export_button == false - || (!empty($sugar_config['disable_export'])) - || (!empty($sugar_config['admin_export_only']) - && !( - is_admin($current_user) - || (ACLController::moduleSupportsACL($_REQUEST['module']) - && ACLAction::getUserAccessLevel($current_user->id,$_REQUEST['module'], 'access') == ACL_ALLOW_ENABLED - && (ACLAction::getUserAccessLevel($current_user->id, $_REQUEST['module'], 'admin') == ACL_ALLOW_ADMIN || - ACLAction::getUserAccessLevel($current_user->id, $_REQUEST['module'], 'admin') == ACL_ALLOW_ADMIN_DEV))))) - { - if ($_REQUEST['module'] != 'InboundEmail' && $_REQUEST['module'] != 'EmailMan' && $_REQUEST['module'] != 'iFrames') { - $selected_objects_span = ''; - } - $export_link = " "; - $merge_link = " "; - } elseif($_REQUEST['module'] != "Accounts" && $_REQUEST['module'] != "Cases" && $_REQUEST['module'] != "Contacts" && $_REQUEST['module'] != "Leads" && $_REQUEST['module'] != "Opportunities") { - $merge_link = " "; - } - - if($this->show_paging == true) { - if(!empty($sugar_config['disable_count_query'])) { - if($row_count > $end_record) { - $row_count .= '+'; - } - } - - $html_text = ''; - $html_text .= "\n"; - $html_text .= "\n"; - //$html_text .= "\n"; - //$html_text .= "
$export_link$merge_link$selected_objects_span
- diff --git a/include/SugarEmailAddress/templates/forDuplicatesView.tpl b/include/SugarEmailAddress/templates/forDuplicatesView.tpl index 2403b9b1..9a21fd46 100644 --- a/include/SugarEmailAddress/templates/forDuplicatesView.tpl +++ b/include/SugarEmailAddress/templates/forDuplicatesView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarEmailAddress/templates/forEditView.tpl b/include/SugarEmailAddress/templates/forEditView.tpl index 5e6e13c3..8125f9b6 100644 --- a/include/SugarEmailAddress/templates/forEditView.tpl +++ b/include/SugarEmailAddress/templates/forEditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarEmailAddress/templates/forWideFormBodyView.tpl b/include/SugarEmailAddress/templates/forWideFormBodyView.tpl index ea78aeb6..3074248d 100644 --- a/include/SugarEmailAddress/templates/forWideFormBodyView.tpl +++ b/include/SugarEmailAddress/templates/forWideFormBodyView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Address/DetailView.tpl b/include/SugarFields/Fields/Address/DetailView.tpl index e69ac350..b8a5ee27 100644 --- a/include/SugarFields/Fields/Address/DetailView.tpl +++ b/include/SugarFields/Fields/Address/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -38,9 +38,13 @@
"; - if ($subpanel_def != null) { - include_once('include/SubPanel/SubPanelTiles.php'); - $subpanelTiles = new SubPanelTiles($sugarbean); - $html_text .= "\n"; + $html_text .= " {/if} {if !empty($quickViewLinks)} - + {/if} {counter start=0 name="colCounter" print=false assign="colCounter"} {foreach from=$displayColumns key=col item=params} {strip} - {/if} - + {if $rowCounter % 2 == 1} {/if} diff --git a/include/MySugar/tpls/retrievePage.tpl b/include/MySugar/tpls/retrievePage.tpl index d72e130e..5608e79f 100644 --- a/include/MySugar/tpls/retrievePage.tpl +++ b/include/MySugar/tpls/retrievePage.tpl @@ -1,7 +1,7 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/MySugar/tpls/retrieveReportCharts.tpl b/include/MySugar/tpls/retrieveReportCharts.tpl index 83e81f85..1db25a4c 100644 --- a/include/MySugar/tpls/retrieveReportCharts.tpl +++ b/include/MySugar/tpls/retrieveReportCharts.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -38,7 +38,7 @@
"; + $end_record = $start_record + $this->records_per_page; + // back up the the last page. + if($end_record > $row_count+1) { + $end_record = $row_count+1; + } + // Deterime the start location of the last page + if($row_count == 0) + $number_pages = 0; + else + $number_pages = floor(($row_count - 1) / $this->records_per_page); + + $last_offset = $number_pages * $this->records_per_page; + + if(empty($this->query_limit) || $this->query_limit > $this->records_per_page) { + $this->base_URL = $this->getBaseURL($html_varName); + $dynamic_url = ''; + + if($this->is_dynamic) { + $dynamic_url .='&'. $this->getSessionVariableName($html_varName,'ORDER_BY') . '='. $this->getSessionVariable($html_varName,'ORDER_BY').'&sort_order='.$this->sort_order.'&to_pdf=true&action=SubPanelViewer&subpanel=' . $this->subpanel_module; + } + + $current_URL = $this->base_URL.$current_offset.$dynamic_url; + $start_URL = $this->base_URL."0".$dynamic_url; + $previous_URL = $this->base_URL.$previous_offset.$dynamic_url; + $next_URL = $this->base_URL.$next_offset.$dynamic_url; + $end_URL = $this->base_URL.'end'.$dynamic_url; + + if(!empty($this->start_link_wrapper)) { + $current_URL = $this->start_link_wrapper.$current_URL.$this->end_link_wrapper; + $start_URL = $this->start_link_wrapper.$start_URL.$this->end_link_wrapper; + $previous_URL = $this->start_link_wrapper.$previous_URL.$this->end_link_wrapper; + $next_URL = $this->start_link_wrapper.$next_URL.$this->end_link_wrapper; + $end_URL = $this->start_link_wrapper.$end_URL.$this->end_link_wrapper; + } + + $moduleString = "{$currentModule}_{$html_varName}_offset"; + $moduleStringOrder = "{$currentModule}_{$html_varName}_ORDER_BY"; + if($this->shouldProcess && !$this->multi_select_popup) { + // check the checkboxes onload + echo "\n"; + + $massUpdateRun = isset($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true'; + $uids = empty($_REQUEST['uid']) || $massUpdateRun ? '' : $_REQUEST['uid']; + $select_entire_list = isset($_REQUEST['select_entire_list']) && !$massUpdateRun ? $_REQUEST['select_entire_list'] : 0; + + echo "\n" . + "\n". + "\n". + "\n"; + + } + + + $GLOBALS['log']->debug("Offsets: (start, previous, next, last)(0, $previous_offset, $next_offset, $last_offset)"); + + if(0 == $current_offset) { + $start_link = ""; + $previous_link = ""; + } else { + if($this->multi_select_popup) {// nav links for multiselect popup, submit form to save checks. + $start_link = ""; + $previous_link = ""; + } elseif($this->shouldProcess) { + $start_link = ""; + $previous_link = ""; + } else { + $onClick = ''; + if(0 != preg_match('/javascript.*/', $start_URL)){ + $onClick = "\"$start_URL;\""; + }else{ + $onClick ="'location.href=\"$start_URL\";'"; + } + $start_link = ""; + + $onClick = ''; + if(0 != preg_match('/javascript.*/', $previous_URL)){ + $onClick = "\"$previous_URL;\""; + }else{ + $onClick = "'location.href=\"$previous_URL\";'"; + } + $previous_link = ""; + } + } + + if($last_offset <= $current_offset) { + $end_link = ""; + $next_link = ""; + } else { + if($this->multi_select_popup) { // nav links for multiselect popup, submit form to save checks. + $end_link = ""; + if(!empty($sugar_config['disable_count_query'])) { + $end_link = ''; + } + $next_link = ""; + } elseif($this->shouldProcess) { + $end_link = ""; + $next_link = ""; + } else { + $onClick = ''; + if(0 != preg_match('/javascript.*/', $next_URL)){ + $onClick = "\"$next_URL;\""; + }else{ + $onClick ="'location.href=\"$next_URL\";'"; + } + $next_link = ""; + + $onClick = ''; + if(0 != preg_match('/javascript.*/', $end_URL)){ + $onClick = "\"$end_URL;\""; + }else{ + $onClick = "'location.href=\"$end_URL\";'"; + } + $end_link = ""; + + } + } + + $GLOBALS['log']->info("Offset (next, current, prev)($next_offset, $current_offset, $previous_offset)"); + $GLOBALS['log']->info("Start/end records ($start_record, $end_record)"); + + $end_record = $end_record-1; + + echo ""; + + if($this->show_select_menu) { + $select_link = "".$this->local_app_strings['LBL_LINK_SELECT']." ".""; + } else { + $select_link = " "; + } + + // put overlib strings into functions to avoid backslash plague! + /*echo ""; + */ + //$export_link = "".SugarThemeRegistry::current()->getImage("export","alt='".$this->local_app_strings['LBL_EXPORT']."' border='0' align='absmiddle'")." ".$this->local_app_strings['LBL_EXPORT'].""; + $export_link = ''; + + if($this->show_delete_button) { + $delete_link = ''; + } else { + $delete_link = ' '; + } + + $admin = new Administration(); + $admin->retrieveSettings('system'); + + $user_merge = $current_user->getPreference('mailmerge_on'); + if($user_merge == 'on' && isset($admin->settings['system_mailmerge_on']) && $admin->settings['system_mailmerge_on']) { + echo ""; + $merge_link = " | ".$this->local_app_strings['LBL_MAILMERGE'].""; + } else { + $merge_link = " "; + } + + $selected_objects_span = " | {$this->local_app_strings['LBL_LISTVIEW_SELECTED_OBJECTS']}"; + + if($_REQUEST['module'] == 'Home' || $this->local_current_module == 'Import' + || $this->show_export_button == false + || (!empty($sugar_config['disable_export'])) + || (!empty($sugar_config['admin_export_only']) + && !( + is_admin($current_user) + || (ACLController::moduleSupportsACL($_REQUEST['module']) + && ACLAction::getUserAccessLevel($current_user->id,$_REQUEST['module'], 'access') == ACL_ALLOW_ENABLED + && (ACLAction::getUserAccessLevel($current_user->id, $_REQUEST['module'], 'admin') == ACL_ALLOW_ADMIN || + ACLAction::getUserAccessLevel($current_user->id, $_REQUEST['module'], 'admin') == ACL_ALLOW_ADMIN_DEV))))) + { + if ($_REQUEST['module'] != 'InboundEmail' && $_REQUEST['module'] != 'EmailMan' && $_REQUEST['module'] != 'iFrames') { + $selected_objects_span = ''; + } + $export_link = " "; + $merge_link = " "; + } elseif($_REQUEST['module'] != "Accounts" && $_REQUEST['module'] != "Cases" && $_REQUEST['module'] != "Contacts" && $_REQUEST['module'] != "Leads" && $_REQUEST['module'] != "Opportunities") { + $merge_link = " "; + } + + if($this->show_paging == true) { + if(!empty($sugar_config['disable_count_query'])) { + if($row_count > $end_record) { + $row_count .= '+'; + } + } + + $html_text = ''; + $html_text .= "
\n"; + //$html_text .= "\n"; + //$html_text .= "
$export_link$merge_link$selected_objects_span
\n"; + $html_text .= "\n"; + $this->xTemplate->assign("PAGINATION",$html_text); + } + + //C.L. - Fix for 23461 + if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { + $_SESSION['export_where'] = $this->query_where; + } + $this->xTemplate->parse($xtemplateSection.".list_nav_row"); + } + } // end processListNavigation + + function processOrderBy($html_varName) { + + if(!isset($this->base_URL)) { + $this->base_URL = $_SERVER['PHP_SELF']; + + if(isset($_SERVER['QUERY_STRING'])) { + $this->base_URL = preg_replace("/\&".$this->getSessionVariableName($html_varName,"ORDER_BY")."=[0-9a-zA-Z\_\.]*/","",$this->base_URL .'?'.$_SERVER['QUERY_STRING']); + $this->base_URL = preg_replace("/\&".$this->getSessionVariableName($html_varName,"offset")."=[0-9]*/","",$this->base_URL); + } + if($_SERVER['REQUEST_METHOD'] == 'POST') { + $this->base_URL .= '?'; + if(isset($_REQUEST['action'])) $this->base_URL .= '&action='.$_REQUEST['action']; + if(isset($_REQUEST['record'])) $this->base_URL .= '&record='.$_REQUEST['record']; + if(isset($_REQUEST['module'])) $this->base_URL .= '&module='.$_REQUEST['module']; + } + $this->base_URL .= "&".$this->getSessionVariableName($html_varName,"offset")."="; + } - if($this->is_dynamic) { - $this->base_URL.='&to_pdf=true&action=SubPanelViewer&subpanel=' . $this->source_module; - } + if($this->is_dynamic) { + $this->base_URL.='&to_pdf=true&action=SubPanelViewer&subpanel=' . $this->source_module; + } - $sort_URL_base = $this->base_URL. "&".$this->getSessionVariableName($html_varName,"ORDER_BY")."="; + $sort_URL_base = $this->base_URL. "&".$this->getSessionVariableName($html_varName,"ORDER_BY")."="; - if($sort_URL_base !== "") - { - $this->xTemplate->assign("ORDER_BY", $sort_URL_base); - return $sort_URL_base; - } else { - return ''; - } - } + if($sort_URL_base !== "") + { + $this->xTemplate->assign("ORDER_BY", $sort_URL_base); + return $sort_URL_base; + } else { + return ''; + } + } - function getAdditionalHeader() { + function getAdditionalHeader() { - } + } - /** - * @return void - * @param unknown $data - * @param unknown $xTemplateSection - * @param unknown $html_varName - * @desc INTERNAL FUNCTION handles the rows - * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. - * All Rights Reserved. - * Contributor(s): ______________________________________.. - */ - function processListRows($data, $xtemplateSection, $html_varName) - { - global $odd_bg; - global $even_bg; - global $hilite_bg; - global $app_strings, $sugar_version, $sugar_config; - global $currentModule; - - static $overlib_included; - if(!$overlib_included) { - echo ' - '; - $overlib_included = true; - } + /** + * @return void + * @param unknown $data + * @param unknown $xTemplateSection + * @param unknown $html_varName + * @desc INTERNAL FUNCTION handles the rows + * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. + * All Rights Reserved. + * Contributor(s): ______________________________________.. + */ + function processListRows($data, $xtemplateSection, $html_varName) + { + global $odd_bg; + global $even_bg; + global $hilite_bg; + global $app_strings, $sugar_version, $sugar_config; + global $currentModule; + + static $overlib_included; + if(!$overlib_included) { + echo ' + '; + $overlib_included = true; + } - $this->xTemplate->assign('BG_HILITE', $hilite_bg); - $this->xTemplate->assign('CHECKALL', "\"\""); - //$this->xTemplate->assign("BG_CLICK", $click_bg); - $oddRow = true; - $count = 0; - reset($data); - - //GETTING OFFSET - $offset = $this->getOffset($html_varName); - $timeStamp = $this->unique_id(); - $_SESSION[$html_varName."_FROM_LIST_VIEW"] = $timeStamp; - - $associated_row_data = array(); - - //mail merge list - $mergeList = array(); - $module = ''; - //todo what is this? It is using an array as a boolean - while(list($aVal, $aItem) = each($data)) - { - if(isset($this->data_array)) { - $fields = $this->data_array; - } else { - $aItem->check_date_relationships_load(); - $fields = $aItem->get_list_view_data(); - } - - if(is_object($aItem)) { // cn: bug 5349 - //add item id to merge list, if the button is clicked - $mergeList[] = $aItem->id; - if(empty($module)) { - $module = $aItem->module_dir; - } - } - //ADD OFFSET TO ARRAY - - $fields['OFFSET'] = ($offset + $count + 1); - - $fields['STAMP'] = $timeStamp; - if($this->shouldProcess) { - - $prerow = ''; - if(!isset($this->data_array)) { - $prerow .= ""; - } - $this->xTemplate->assign('PREROW', $prerow); - - $this->xTemplate->assign('CHECKALL', ""); - } - if(!isset($this->data_array)) { - $tag = $aItem->listviewACLHelper(); - $this->xTemplate->assign('TAG',$tag) ; - } - - if($oddRow) - { - $ROW_COLOR = 'oddListRow'; - $BG_COLOR = $odd_bg; - } - else - { - $ROW_COLOR = 'evenListRow'; - $BG_COLOR = $even_bg; - } - $oddRow = !$oddRow; - - $this->xTemplate->assign('ROW_COLOR', $ROW_COLOR); - $this->xTemplate->assign('BG_COLOR', $BG_COLOR); - - if(isset($this->data_array)) - { - $this->xTemplate->assign('KEY', $aVal); - $this->xTemplate->assign('VALUE', $aItem); - $this->xTemplate->assign('INDEX', $count); - - } - else - { - //AED -- some modules do not have their additionalDetails.php established. Add a check to ensure require_once does not fail - // Bug #2786 - if($this->_additionalDetails && $aItem->ACLAccess('DetailView') && (file_exists('modules/' . $aItem->module_dir . '/metadata/additionalDetails.php') || file_exists('custom/modules/' . $aItem->module_dir . '/metadata/additionalDetails.php'))) { - - $additionalDetailsFile = 'modules/' . $aItem->module_dir . '/metadata/additionalDetails.php'; - if(file_exists('custom/modules/' . $aItem->module_dir . '/metadata/additionalDetails.php')){ - $additionalDetailsFile = 'custom/modules/' . $aItem->module_dir . '/metadata/additionalDetails.php'; - } - - require_once($additionalDetailsFile); - $ad_function = (empty($this->additionalDetailsFunction) ? 'additionalDetails' : $this->additionalDetailsFunction) . $aItem->object_name; - $results = $ad_function($fields); - $results['string'] = str_replace(array("'", "'"), '\'', $results['string']); // no xss! - - if(trim($results['string']) == '') $results['string'] = $app_strings['LBL_NONE']; - $fields[$results['fieldToAddTo']] = $fields[$results['fieldToAddTo']].''; - } - //fixes bug for IE where empty list view rows causes IE to not display bottom border - if(isset($fields['DESCRIPTION']) && empty($fields['DESCRIPTION'])) - $fields['DESCRIPTION'] = " "; - if(isset($fields['LIST_ORDER']) && empty($fields['LIST_ORDER'])) - $fields['LIST_ORDER'] = " "; - - $this->xTemplate->assign($html_varName, $fields); - $aItem->setupCustomFields($aItem->module_dir); - $aItem->custom_fields->populateAllXTPL($this->xTemplate, 'detail', $html_varName, $fields); - } - if(!isset($this->data_array) && $aItem->ACLAccess('DetailView')) { - $count++; - } - if(isset($this->data_array)) { - $count++; - } - if(!isset($this->data_array)) { - $aItem->list_view_parse_additional_sections($this->xTemplate, $xtemplateSection); - - if($this->xTemplate->exists($xtemplateSection.'.row.pro')) { - $this->xTemplate->parse($xtemplateSection.'.row.pro'); - } - } - $this->xTemplate->parse($xtemplateSection . '.row'); - - if(isset($fields['ID'])) { - $associated_row_data[$fields['ID']] = $fields; - } - } + $this->xTemplate->assign('BG_HILITE', $hilite_bg); + $this->xTemplate->assign('CHECKALL', "\"\""); + //$this->xTemplate->assign("BG_CLICK", $click_bg); + $oddRow = true; + $count = 0; + reset($data); + + //GETTING OFFSET + $offset = $this->getOffset($html_varName); + $timeStamp = $this->unique_id(); + $_SESSION[$html_varName."_FROM_LIST_VIEW"] = $timeStamp; + + $associated_row_data = array(); + + //mail merge list + $mergeList = array(); + $module = ''; + //todo what is this? It is using an array as a boolean + while(list($aVal, $aItem) = each($data)) + { + if(isset($this->data_array)) { + $fields = $this->data_array; + } else { + $aItem->check_date_relationships_load(); + $fields = $aItem->get_list_view_data(); + } + + if(is_object($aItem)) { // cn: bug 5349 + //add item id to merge list, if the button is clicked + $mergeList[] = $aItem->id; + if(empty($module)) { + $module = $aItem->module_dir; + } + } + //ADD OFFSET TO ARRAY + + $fields['OFFSET'] = ($offset + $count + 1); + + $fields['STAMP'] = $timeStamp; + if($this->shouldProcess) { + + $prerow = ''; + if(!isset($this->data_array)) { + $prerow .= ""; + } + $this->xTemplate->assign('PREROW', $prerow); + + $this->xTemplate->assign('CHECKALL', ""); + } + if(!isset($this->data_array)) { + $tag = $aItem->listviewACLHelper(); + $this->xTemplate->assign('TAG',$tag) ; + } + + if($oddRow) + { + $ROW_COLOR = 'oddListRow'; + $BG_COLOR = $odd_bg; + } + else + { + $ROW_COLOR = 'evenListRow'; + $BG_COLOR = $even_bg; + } + $oddRow = !$oddRow; + + $this->xTemplate->assign('ROW_COLOR', $ROW_COLOR); + $this->xTemplate->assign('BG_COLOR', $BG_COLOR); + + if(isset($this->data_array)) + { + $this->xTemplate->assign('KEY', $aVal); + $this->xTemplate->assign('VALUE', $aItem); + $this->xTemplate->assign('INDEX', $count); + + } + else + { + //AED -- some modules do not have their additionalDetails.php established. Add a check to ensure require_once does not fail + // Bug #2786 + if($this->_additionalDetails && $aItem->ACLAccess('DetailView') && (file_exists('modules/' . $aItem->module_dir . '/metadata/additionalDetails.php') || file_exists('custom/modules/' . $aItem->module_dir . '/metadata/additionalDetails.php'))) { + + $additionalDetailsFile = 'modules/' . $aItem->module_dir . '/metadata/additionalDetails.php'; + if(file_exists('custom/modules/' . $aItem->module_dir . '/metadata/additionalDetails.php')){ + $additionalDetailsFile = 'custom/modules/' . $aItem->module_dir . '/metadata/additionalDetails.php'; + } + + require_once($additionalDetailsFile); + $ad_function = (empty($this->additionalDetailsFunction) ? 'additionalDetails' : $this->additionalDetailsFunction) . $aItem->object_name; + $results = $ad_function($fields); + $results['string'] = str_replace(array("'", "'"), '\'', $results['string']); // no xss! + + if(trim($results['string']) == '') $results['string'] = $app_strings['LBL_NONE']; + $fields[$results['fieldToAddTo']] = $fields[$results['fieldToAddTo']].''; + } + //fixes bug for IE where empty list view rows causes IE to not display bottom border + if(isset($fields['DESCRIPTION']) && empty($fields['DESCRIPTION'])) + $fields['DESCRIPTION'] = " "; + if(isset($fields['LIST_ORDER']) && empty($fields['LIST_ORDER'])) + $fields['LIST_ORDER'] = " "; + + $this->xTemplate->assign($html_varName, $fields); + $aItem->setupCustomFields($aItem->module_dir); + $aItem->custom_fields->populateAllXTPL($this->xTemplate, 'detail', $html_varName, $fields); + } + if(!isset($this->data_array) && $aItem->ACLAccess('DetailView')) { + $count++; + } + if(isset($this->data_array)) { + $count++; + } + if(!isset($this->data_array)) { + $aItem->list_view_parse_additional_sections($this->xTemplate, $xtemplateSection); + + if($this->xTemplate->exists($xtemplateSection.'.row.pro')) { + $this->xTemplate->parse($xtemplateSection.'.row.pro'); + } + } + $this->xTemplate->parse($xtemplateSection . '.row'); + + if(isset($fields['ID'])) { + $associated_row_data[$fields['ID']] = $fields; + // Bug 38908: cleanup data for JS to avoid having   shuffled around + foreach($fields as $key => $value) { + if($value == ' ') { + $associated_row_data[$fields['ID']][$key] = ''; + } + } + } + } - $_SESSION['MAILMERGE_RECORDS'] = $mergeList; - $_SESSION['MAILMERGE_MODULE_FROM_LISTVIEW'] = $module; - if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { - $_SESSION['MAILMERGE_MODULE'] = $module; - } + $_SESSION['MAILMERGE_RECORDS'] = $mergeList; + $_SESSION['MAILMERGE_MODULE_FROM_LISTVIEW'] = $module; + if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { + $_SESSION['MAILMERGE_MODULE'] = $module; + } - if($this->process_for_popups) - { - $json = getJSONobj(); + if($this->process_for_popups) + { + $json = getJSONobj(); $is_show_fullname = showFullName() ? 1 : 0; - $associated_javascript_data = ''; - $this->xTemplate->assign('ASSOCIATED_JAVASCRIPT_DATA', $associated_javascript_data); - } + . ''; + $this->xTemplate->assign('ASSOCIATED_JAVASCRIPT_DATA', $associated_javascript_data); + } - $this->xTemplate->parse($xtemplateSection); - } + $this->xTemplate->parse($xtemplateSection); + } - function getLayoutManager() - { - require_once('include/generic/LayoutManager.php'); - if($this->layout_manager == null) - { - $this->layout_manager = new LayoutManager(); - } - return $this->layout_manager; - } + function getLayoutManager() + { + require_once('include/generic/LayoutManager.php'); + if($this->layout_manager == null) + { + $this->layout_manager = new LayoutManager(); + } + return $this->layout_manager; + } - function process_dynamic_listview_header($source_module, $subpanel_def, $html_var = 'CELL') - { + function process_dynamic_listview_header($source_module, $subpanel_def, $html_var = 'CELL') + { - $layout_manager = $this->getLayoutManager(); - $layout_manager->setAttribute('order_by_link',$this->processOrderBy($html_var)); - $layout_manager->setAttribute('context','HeaderCell'); - $layout_manager->setAttribute('image_path',$this->local_image_path); - $layout_manager->setAttribute('html_varName',$html_var); - $layout_manager->setAttribute('module_name', $source_module); - list($orderBy,$desc) = $this->getOrderByInfo($html_var); + $layout_manager = $this->getLayoutManager(); + $layout_manager->setAttribute('order_by_link',$this->processOrderBy($html_var)); + $layout_manager->setAttribute('context','HeaderCell'); + $layout_manager->setAttribute('image_path',$this->local_image_path); + $layout_manager->setAttribute('html_varName',$html_var); + $layout_manager->setAttribute('module_name', $source_module); + list($orderBy,$desc) = $this->getOrderByInfo($html_var); - if($orderBy == 'amount*1') - { - $orderBy= 'amount'; - } + if($orderBy == 'amount*1') + { + $orderBy= 'amount'; + } - foreach($subpanel_def->get_list_fields() as $column_name=>$widget_args) - { - $usage = empty($widget_args['usage']) ? '' : $widget_args['usage']; - if($usage != 'query_only') - { - $imgArrow = ''; - - if($orderBy == $column_name || (isset($widget_args['sort_by']) && str_replace('.','_',$widget_args['sort_by']) == $orderBy)) - { - $imgArrow = "_down"; - if($this->sort_order == 'desc') { - $imgArrow = "_up"; - } - } - $widget_args['name']=$column_name; - $widget_args['sort'] = $imgArrow; - $widget_args['start_link_wrapper'] = $this->start_link_wrapper; - $widget_args['end_link_wrapper'] = $this->end_link_wrapper; - $widget_args['subpanel_module'] = $this->subpanel_module; - - $widget_contents = $layout_manager->widgetDisplay($widget_args); - $cell_width = empty($widget_args['width']) ? '' : $widget_args['width']; - $this->xTemplate->assign('HEADER_CELL', $widget_contents); - static $count; - if(!isset($count))$count = 0; else $count++; - $this->xTemplate->assign('CELL_COUNT', $count); - $this->xTemplate->assign('CELL_WIDTH', $cell_width); - $this->xTemplate->parse('dyn_list_view.header_cell'); - } - } + foreach($subpanel_def->get_list_fields() as $column_name=>$widget_args) + { + $usage = empty($widget_args['usage']) ? '' : $widget_args['usage']; + if($usage != 'query_only') + { + $imgArrow = ''; + + if($orderBy == $column_name || (isset($widget_args['sort_by']) && str_replace('.','_',$widget_args['sort_by']) == $orderBy)) + { + $imgArrow = "_down"; + if($this->sort_order == 'desc') { + $imgArrow = "_up"; + } + } + $widget_args['name']=$column_name; + $widget_args['sort'] = $imgArrow; + $widget_args['start_link_wrapper'] = $this->start_link_wrapper; + $widget_args['end_link_wrapper'] = $this->end_link_wrapper; + $widget_args['subpanel_module'] = $this->subpanel_module; + + $widget_contents = $layout_manager->widgetDisplay($widget_args); + $cell_width = empty($widget_args['width']) ? '' : $widget_args['width']; + $this->xTemplate->assign('HEADER_CELL', $widget_contents); + static $count; + if(!isset($count))$count = 0; else $count++; + $this->xTemplate->assign('CELL_COUNT', $count); + $this->xTemplate->assign('CELL_WIDTH', $cell_width); + $this->xTemplate->parse('dyn_list_view.header_cell'); + } + } - } + } - /** - * @return void - * @param unknown $seed - * @param unknown $xTemplateSection - * @param unknown $html_varName - * @desc PUBLIC FUNCTION Handles List Views using seeds that extend SugarBean - $XTemplateSection is the section in the XTemplate file that should be parsed usually main - $html_VarName is the variable name used in the XTemplateFile e.g. TASK - $seed is a seed there are two types of seeds one is a subclass of SugarBean, the other is a list usually created from a sugar bean using get_list - if no XTemplate is set it will create a new XTemplate - * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. - * All Rights Reserved.. - * Contributor(s): ______________________________________.. - */ - - function processListViewTwo($seed, $xTemplateSection, $html_varName) { - global $current_user; - if(!isset($this->xTemplate)) { - $this->createXTemplate(); - } + /** + * @return void + * @param unknown $seed + * @param unknown $xTemplateSection + * @param unknown $html_varName + * @desc PUBLIC FUNCTION Handles List Views using seeds that extend SugarBean + $XTemplateSection is the section in the XTemplate file that should be parsed usually main + $html_VarName is the variable name used in the XTemplateFile e.g. TASK + $seed is a seed there are two types of seeds one is a subclass of SugarBean, the other is a list usually created from a sugar bean using get_list + if no XTemplate is set it will create a new XTemplate + * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. + * All Rights Reserved.. + * Contributor(s): ______________________________________.. + */ + + function processListViewTwo($seed, $xTemplateSection, $html_varName) { + global $current_user; + if(!isset($this->xTemplate)) { + $this->createXTemplate(); + } - $isSugarBean = is_subclass_of($seed, "SugarBean"); - $list = null; + $isSugarBean = is_subclass_of($seed, "SugarBean"); + $list = null; - if($isSugarBean) { - $list = $this->processSugarBean($xTemplateSection, $html_varName, $seed); - } else { - $list = $seed; - } + if($isSugarBean) { + $list = $this->processSugarBean($xTemplateSection, $html_varName, $seed); + } else { + $list = $seed; + } - if (is_object($seed) && isset($seed->object_name) && $seed->object_name == 'WorkFlow') { - $tab=array(); - $access = get_workflow_admin_modules_for_user($current_user); - for ($i = 0; $i < count($list); $i++) { - if(!empty($access[$list[$i]->base_module])){ + if (is_object($seed) && isset($seed->object_name) && $seed->object_name == 'WorkFlow') { + $tab=array(); + $access = get_workflow_admin_modules_for_user($current_user); + for ($i = 0; $i < count($list); $i++) { + if(!empty($access[$list[$i]->base_module])){ $tab[]=$list[$i]; } - } + } $list = $tab; - } + } - if($this->is_dynamic) { - $this->processHeaderDynamic($xTemplateSection,$html_varName); - $this->processListRows($list,$xTemplateSection, $html_varName); - } else { - $this->processSortArrows($html_varName); + if($this->is_dynamic) { + $this->processHeaderDynamic($xTemplateSection,$html_varName); + $this->processListRows($list,$xTemplateSection, $html_varName); + } else { + $this->processSortArrows($html_varName); - if($isSugarBean) { - $seed->parse_additional_headers($this->xTemplate, $xTemplateSection); - } - $this->xTemplateAssign('CHECKALL', ""); + if($isSugarBean) { + $seed->parse_additional_headers($this->xTemplate, $xTemplateSection); + } + $this->xTemplateAssign('CHECKALL', ""); - // Process the order by before processing the pro_nav. The pro_nav requires the order by values to be set - $this->processOrderBy($html_varName); + // Process the order by before processing the pro_nav. The pro_nav requires the order by values to be set + $this->processOrderBy($html_varName); - $this->processListRows($list,$xTemplateSection, $html_varName); - } + $this->processListRows($list,$xTemplateSection, $html_varName); + } - if($this->display_header_and_footer) { - $this->getAdditionalHeader(); - if(!empty($this->header_title)) { - echo get_form_header($this->header_title, $this->header_text, false); - } - } + if($this->display_header_and_footer) { + $this->getAdditionalHeader(); + if(!empty($this->header_title)) { + echo get_form_header($this->header_title, $this->header_text, false); + } + } - $this->xTemplate->out($xTemplateSection); + $this->xTemplate->out($xTemplateSection); - if(isset($_SESSION['validation'])) { - print base64_decode('PGEgaHJlZj0naHR0cDovL3d3dy5zdWdhcmNybS5jb20nPlBPV0VSRUQmbmJzcDtCWSZuYnNwO1NVR0FSQ1JNPC9hPg=='); - } - } + if(isset($_SESSION['validation'])) { + print base64_decode('PGEgaHJlZj0naHR0cDovL3d3dy5zdWdhcmNybS5jb20nPlBPV0VSRUQmbmJzcDtCWSZuYnNwO1NVR0FSQ1JNPC9hPg=='); + } + } - function getArrowStart() { + function getArrowStart() { $imgFileParts = pathinfo(SugarThemeRegistry::current()->getImageURL("arrow.gif")); - return " pngSupport ? "png" : "gif" ); if (!isset($upDown) || empty($upDown)) { - $upDown = ""; + $upDown = ""; } - return " getImageURL("arrow.gif")); + function getArrowEnd() { + $imgFileParts = pathinfo(SugarThemeRegistry::current()->getImageURL("arrow.gif")); list($width,$height) = ListView::getArrowImageSize(); - return '.'.$imgFileParts['extension']."' width='$width' height='$height' align='absmiddle' alt=".translate('LBL_SORT').">"; - } + return '.'.$imgFileParts['extension']."' width='$width' height='$height' align='absmiddle' alt=".translate('LBL_SORT').">"; + } - function getArrowImageSize() { - // just get the non-sort image's size.. the up and down have be the same. - $image = SugarThemeRegistry::current()->getImageURL("arrow.gif",false); + function getArrowImageSize() { + // just get the non-sort image's size.. the up and down have be the same. + $image = SugarThemeRegistry::current()->getImageURL("arrow.gif",false); - $cache_key = 'arrow_size.'.$image; + $cache_key = 'arrow_size.'.$image; - // Check the cache - $result = sugar_cache_retrieve($cache_key); - if(!empty($result)) - return $result; + // Check the cache + $result = sugar_cache_retrieve($cache_key); + if(!empty($result)) + return $result; - // No cache hit. Calculate the value and return. - $result = getimagesize($image); - sugar_cache_put($cache_key, $result); - return $result; - } + // No cache hit. Calculate the value and return. + $result = getimagesize($image); + sugar_cache_put($cache_key, $result); + return $result; + } - function getOrderByInfo($html_varName) - { - $orderBy = $this->getSessionVariable($html_varName, "OBL"); - $desc = $this->getSessionVariable($html_varName, $orderBy.'S'); - $orderBy = str_replace('.', '_', $orderBy); - return array($orderBy,$desc); - } + function getOrderByInfo($html_varName) + { + $orderBy = $this->getSessionVariable($html_varName, "OBL"); + $desc = $this->getSessionVariable($html_varName, $orderBy.'S'); + $orderBy = str_replace('.', '_', $orderBy); + return array($orderBy,$desc); + } - function processSortArrows($html_varName) - { + function processSortArrows($html_varName) + { - $this->xTemplateAssign("arrow_start", $this->getArrowStart()); + $this->xTemplateAssign("arrow_start", $this->getArrowStart()); - list($orderBy,$desc) = $this->getOrderByInfo($html_varName); + list($orderBy,$desc) = $this->getOrderByInfo($html_varName); - $imgArrow = "_down"; - if($desc) { - $imgArrow = "_up"; - } + $imgArrow = "_down"; + if($desc) { + $imgArrow = "_up"; + } - if($orderBy == 'amount*1') - { - $this->xTemplateAssign('amount_arrow', $imgArrow); - } - else if($orderBy == 'amount_usdollar*1') - { - $this->xTemplateAssign('amount_usdollar_arrow', $imgArrow); - } - else - { - $this->xTemplateAssign($orderBy.'_arrow', $imgArrow); - } + if($orderBy == 'amount*1') + { + $this->xTemplateAssign('amount_arrow', $imgArrow); + } + else if($orderBy == 'amount_usdollar*1') + { + $this->xTemplateAssign('amount_usdollar_arrow', $imgArrow); + } + else + { + $this->xTemplateAssign($orderBy.'_arrow', $imgArrow); + } - $this->xTemplateAssign('arrow_end', $this->getArrowEnd()); - } + $this->xTemplateAssign('arrow_end', $this->getArrowEnd()); + } - // this is where translation happens for dynamic list views - function loadListFieldDefs(&$subpanel_fields,&$child_focus) - { - $this->list_field_defs = $subpanel_fields; - - for($i=0;$i < count($this->list_field_defs);$i++) - { - $list_field = $this->list_field_defs[$i]; - $field_def = null; - $key = ''; - if(!empty($list_field['vname'])) - { - $key = $list_field['vname']; - } else if(isset($list_field['name']) && isset($child_focus->field_defs[$list_field['name']])) - { - $field_def = $child_focus->field_defs[$list_field['name']]; - $key = $field_def['vname']; - } - if(!empty($key)) - { - $list_field['label'] = translate($key,$child_focus->module_dir); - $this->list_field_defs[$i]['label'] = preg_replace('/:$/','',$list_field['label']); - } - else - { - $this->list_field_defs[$i]['label'] =' '; - } - } - } + // this is where translation happens for dynamic list views + function loadListFieldDefs(&$subpanel_fields,&$child_focus) + { + $this->list_field_defs = $subpanel_fields; + + for($i=0;$i < count($this->list_field_defs);$i++) + { + $list_field = $this->list_field_defs[$i]; + $field_def = null; + $key = ''; + if(!empty($list_field['vname'])) + { + $key = $list_field['vname']; + } else if(isset($list_field['name']) && isset($child_focus->field_defs[$list_field['name']])) + { + $field_def = $child_focus->field_defs[$list_field['name']]; + $key = $field_def['vname']; + } + if(!empty($key)) + { + $list_field['label'] = translate($key,$child_focus->module_dir); + $this->list_field_defs[$i]['label'] = preg_replace('/:$/','',$list_field['label']); + } + else + { + $this->list_field_defs[$i]['label'] =' '; + } + } + } function unique_id() { - return sugar_microtime(); + return sugar_microtime(); } /**INTERNAL FUNCTION sets a session variable keeping it local to the listview @@ -1728,8 +1739,8 @@ function getUserVariable($localVarName, $varName) { */ function getLocalSessionVariable($localVarName,$varName) { if(isset($_SESSION[$localVarName."_".$varName])) { - return $_SESSION[$localVarName."_".$varName]; - } + return $_SESSION[$localVarName."_".$varName]; + } else{ return ""; } @@ -1738,8 +1749,8 @@ function getUserVariable($localVarName, $varName) { /* Set to true if you want Additional Details to appear in the listview */ function setAdditionalDetails($value = true, $function = '') { - if(!empty($function)) $this->additionalDetailsFunction = $function; - $this->_additionalDetails = $value; + if(!empty($function)) $this->additionalDetailsFunction = $function; + $this->_additionalDetails = $value; } } diff --git a/include/ListView/ListViewDCMenu.tpl b/include/ListView/ListViewDCMenu.tpl new file mode 100644 index 00000000..a0a1cf5b --- /dev/null +++ b/include/ListView/ListViewDCMenu.tpl @@ -0,0 +1,189 @@ + {* + +/********************************************************************************* + * SugarCRM Community Edition is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. + * + * 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. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ + + + + +*} + + +
"; + if ($subpanel_def != null) { + include_once('include/SubPanel/SubPanelTiles.php'); + $subpanelTiles = new SubPanelTiles($sugarbean); + $html_text .= "\n"; - $html_text .= "\n"; - $this->xTemplate->assign("PAGINATION",$html_text); - } - - //C.L. - Fix for 23461 - if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { - $_SESSION['export_where'] = $this->query_where; - } - $this->xTemplate->parse($xtemplateSection.".list_nav_row"); - } - } // end processListNavigation - - function processOrderBy($html_varName) { - - if(!isset($this->base_URL)) { - $this->base_URL = $_SERVER['PHP_SELF']; - - if(isset($_SERVER['QUERY_STRING'])) { - $this->base_URL = preg_replace("/\&".$this->getSessionVariableName($html_varName,"ORDER_BY")."=[0-9a-zA-Z\_\.]*/","",$this->base_URL .'?'.$_SERVER['QUERY_STRING']); - $this->base_URL = preg_replace("/\&".$this->getSessionVariableName($html_varName,"offset")."=[0-9]*/","",$this->base_URL); - } - if($_SERVER['REQUEST_METHOD'] == 'POST') { - $this->base_URL .= '?'; - if(isset($_REQUEST['action'])) $this->base_URL .= '&action='.$_REQUEST['action']; - if(isset($_REQUEST['record'])) $this->base_URL .= '&record='.$_REQUEST['record']; - if(isset($_REQUEST['module'])) $this->base_URL .= '&module='.$_REQUEST['module']; - } - $this->base_URL .= "&".$this->getSessionVariableName($html_varName,"offset")."="; - } + } + else { + $html_text .= "
"; //attempt to get the query to recreate this subpanel if(!empty($this->response)){ - $response =& $this->response; - }else{ - $response = SugarBean::get_union_related_list($sugarbean,$this->sortby, $this->sort_order, $this->query_where, $current_offset, -1,-1,$this->query_limit,$subpanel_def); - $this->response = $response; - } + $response =& $this->response; + }else{ + $response = SugarBean::get_union_related_list($sugarbean,$this->sortby, $this->sort_order, $this->query_where, $current_offset, -1,-1,$this->query_limit,$subpanel_def); + $this->response = $response; + } //if query is present, then pass it in as parameter if (isset($response['query']) && !empty($response['query'])){ $html_text .= $subpanelTiles->get_buttons($subpanel_def, $response['query']); }else{ $html_text .= $subpanelTiles->get_buttons($subpanel_def); } - } - else { - $html_text .= "\n
$select_link $export_link $delete_link $selected_objects_span"; - } - $html_text .= "".$start_link."  ".$previous_link."  (".$start_record." - ".$end_record." ".$this->local_app_strings['LBL_LIST_OF']." ".$row_count.")  ".$next_link."  ".$end_link."
\n"; - $html_text .= "
\n
$select_link $export_link $delete_link $selected_objects_span"; + } + $html_text .= "".$start_link."  ".$previous_link."  (".$start_record." - ".$end_record." ".$this->local_app_strings['LBL_LIST_OF']." ".$row_count.")  ".$next_link."  ".$end_link."
\n"; + $html_text .= "
+ + + + +
+ + + +
+ + + + {if $prerow} + + {/if} + {if $favorites} + + {/if} + {if !empty($quickViewLinks)} + + {/if} + {counter start=0 name="colCounter" print=false assign="colCounter"} + {foreach from=$displayColumns key=colHeader item=params} + + {counter name="colCounter"} + {/foreach} + + + + {counter start=$pageData.offsets.current print=false assign="offset" name="offset"} + {foreach name=rowIteration from=$data key=id item=rowData} + {counter name="offset" print=false} + + {if $smarty.foreach.rowIteration.iteration is odd} + {assign var='_rowColor' value=$rowColor[0]} + {else} + {assign var='_rowColor' value=$rowColor[1]} + {/if} + + {if $prerow} + + {/if} + {if $favorites} + + {/if} + {if !empty($quickViewLinks)} + + {/if} + {counter start=0 name="colCounter" print=false assign="colCounter"} + {foreach from=$displayColumns key=col item=params} + {strip} + + {/strip} + {counter name="colCounter"} + {/foreach} + + {foreachelse} + + + + {/foreach} +
+
+ + {$selectLink} +
+
+   +   +
+ {if false} + {if $params.url_sort} + + {else} + {if $params.orderBy|default:$colHeader|lower == $pageData.ordering.orderBy} + + {else} + + {/if} + {/if} + {sugar_translate label=$params.label module=$pageData.bean.moduleDir} +    + {if $params.orderBy|default:$colHeader|lower == $pageData.ordering.orderBy} + {if $pageData.ordering.sortOrder == 'ASC'} + {capture assign="imageName"}arrow_down.{$arrowExt}{/capture} + {$arrowAlt} + {else} + {capture assign="imageName"}arrow_up.{$arrowExt}{/capture} + {$arrowAlt} + {/if} + {else} + {capture assign="imageName"}arrow.{$arrowExt}{/capture} + {$arrowAlt} + {/if} + {else} + {if !isset($params.noHeader) || $params.noHeader == false} + {sugar_translate label=$params.label module=$pageData.bean.moduleDir} + {/if} + {/if} +
+
+ {if !$is_admin && is_admin_for_user && $rowData.IS_ADMIN==1} + + {else} + + {/if} + {$rowData.star}{if $pageData.access.edit}{/if} + {if $col == 'NAME' || $params.bold}{/if} + {if $params.link && !$params.customCode} + <{$pageData.tag.$id[$params.ACLTag]|default:$pageData.tag.$id.MAIN} href='index.php?action={$params.action|default:'DetailView'}&module={if $params.dynamic_module}{$rowData[$params.dynamic_module]}{else}{$params.module|default:$pageData.bean.moduleDir}{/if}&record={$rowData[$params.id]|default:$rowData.ID}&offset={$pageData.offsets.current+$smarty.foreach.rowIteration.iteration}&stamp={$pageData.stamp}'> + {/if} + {if $params.customCode} + {sugar_evalcolumn_old var=$params.customCode rowData=$rowData} + {else} + {sugar_field parentFieldArray=$rowData vardef=$params displayType=ListView field=$col} + {/if} + {if empty($rowData.$col) && empty($params.customCode)} {/if} + {if $params.link && !$params.customCode} + + {/if} + {if $col == 'NAME' || $params.bold}{/if} +
+ {$APP.LBL_NO_DATA} +
\ No newline at end of file diff --git a/include/ListView/ListViewData.php b/include/ListView/ListViewData.php index 553bb1f3..f2094523 100644 --- a/include/ListView/ListViewData.php +++ b/include/ListView/ListViewData.php @@ -1,7 +1,7 @@ setValue('item_summary', "lvso=".$direction."&".$this->var_order_by."=".$_REQUEST[$this->var_order_by]); $monitor->setValue('action', 'listview'); $monitor->setValue('user_id', $GLOBALS['current_user']->id); - $monitor->setValue('date_modified', gmdate($GLOBALS['timedate']->get_db_date_time_format())); + $monitor->setValue('date_modified', TimeDate::getInstance()->nowDb()); $monitor->save(); } } @@ -143,7 +143,7 @@ class ListViewData { $blockVariables[] = 'Home2_'.strtoupper($bean).'_ORDER_BY'; } $blockVariables[] = 'Home2_CASE_ORDER_BY'; - + // Added mostly for the unit test runners, which may not have these superglobals defined $params = array(); if ( isset($_POST) && is_array($_POST) ) { $params = array_merge($params,$_POST); @@ -152,7 +152,7 @@ class ListViewData { $params = array_merge($params,$_GET); } foreach($params as $name=>$value) { - if(!in_array($name, $blockVariables)){ + if(!in_array($name, $blockVariables)){ if(is_array($value)) { foreach($value as $v) { $base_url .= $name.urlencode('[]').'='.urlencode($v) . '&'; @@ -275,28 +275,35 @@ class ListViewData { // Bug 22740 - Tweak this check to strip off the table name off the order by parameter. // Samir Gandhi : Do not remove the report_cache.date_modified condition as the report list view is broken $orderby = $order['orderBy']; - if (strpos($order['orderBy'],'.') && ($order['orderBy'] != "report_cache.date_modified")) + if (strpos($order['orderBy'],'.') && ($order['orderBy'] != "report_cache.date_modified")) { $orderby = substr($order['orderBy'],strpos($order['orderBy'],'.')+1); - if($orderby != 'date_entered' && !in_array($orderby, array_keys($filter_fields))){ + } + if ($orderby != 'date_entered' && !in_array($orderby, array_keys($filter_fields))) { $order['orderBy'] = ''; $order['sortOrder'] = ''; } - if(empty($order['orderBy'])) { + if (empty($order['orderBy'])) { $orderBy = ''; - } - else { + } else { $orderBy = $order['orderBy'] . ' ' . $order['sortOrder']; //wdong, Bug 25476, fix the sorting problem of Oracle. if (isset($params['custom_order_by_override']['ori_code']) && $order['orderBy'] == $params['custom_order_by_override']['ori_code']) $orderBy = $params['custom_order_by_override']['custom_code'] . ' ' . $order['sortOrder']; } - - if(empty($params['skipOrderSave'])) // don't save preferences if told so + + if (empty($params['skipOrderSave'])) { // don't save preferences if told so $current_user->setPreference('listviewOrder', $order, 0, $this->var_name); // save preference + } + + // If $params tells us to override for the special last_name, first_name sorting + if (!empty($params['overrideLastNameOrder']) && $order['orderBy'] == 'last_name') { + $orderBy = 'last_name '.$order['sortOrder'].', first_name '.$order['sortOrder']; + } + $ret_array = $seed->create_new_list_query($orderBy, $where, $filter_fields, $params, 0, '', true, $seed, true); $ret_array['inner_join'] = ''; - if(!empty($this->seed->listview_inner_join)) { + if (!empty($this->seed->listview_inner_join)) { $ret_array['inner_join'] = ' ' . implode(' ', $this->seed->listview_inner_join) . ' '; } @@ -395,10 +402,7 @@ class ListViewData { $pageData = array(); - $additionalDetailsAllow = $this->additionalDetails && $this->seed->ACLAccess('DetailView') && (file_exists('modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php') || file_exists('custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php')); - if($additionalDetailsAllow) $pageData['additionalDetails'] = array(); - $additionalDetailsEdit = $this->seed->ACLAccess('EditView'); - reset($rows); + reset($rows); while($row = current($rows)){ $temp = clone $seed; $dataIndex = count($data); @@ -411,7 +415,11 @@ class ListViewData { $pageData['tag'][$dataIndex] = $pageData['tag'][$idIndex[$row[$id_field]][0]]; } $data[$dataIndex] = $temp->get_list_view_data($filter_fields); - if($additionalDetailsAllow) { + $pageData['rowAccess'][$dataIndex] = array('view' => $temp->ACLAccess('DetailView'), 'edit' => $temp->ACLAccess('EditView')); + $additionalDetailsAllow = $this->additionalDetails && $temp->ACLAccess('DetailView') && (file_exists('modules/' . $temp->module_dir . '/metadata/additionalDetails.php') || file_exists('custom/modules/' . $temp->module_dir . '/metadata/additionalDetails.php')); + //if($additionalDetailsAllow) $pageData['additionalDetails'] = array(); + $additionalDetailsEdit = $temp->ACLAccess('EditView'); + if($additionalDetailsAllow) { if($this->additionalDetailsAjax) { $ar = $this->getAdditionalDetailsAjax($data[$dataIndex]['ID']); } diff --git a/include/ListView/ListViewDisplay.php b/include/ListView/ListViewDisplay.php index a31af296..69201cf0 100644 --- a/include/ListView/ListViewDisplay.php +++ b/include/ListView/ListViewDisplay.php @@ -1,7 +1,7 @@ should_process = false; return false; @@ -120,42 +124,7 @@ class ListViewDisplay { } $this->seed = $seed; - // create filter fields based off of display columns - if(empty($filter_fields) || $this->mergeDisplayColumns) { - foreach($this->displayColumns as $columnName => $def) { - - $filter_fields[strtolower($columnName)] = true; - - if(isset($this->seed->field_defs[strtolower($columnName)]['type']) && - strtolower($this->seed->field_defs[strtolower($columnName)]['type']) == 'currency' && - isset($this->seed->field_defs['currency_id'])) { - $filter_fields['currency_id'] = true; - } - - if(!empty($def['related_fields'])) { - foreach($def['related_fields'] as $field) { - //id column is added by query construction function. This addition creates duplicates - //and causes issues in oracle. #10165 - if ($field != 'id') { - $filter_fields[$field] = true; - } - } - } - if (!empty($this->seed->field_defs[strtolower($columnName)]['db_concat_fields'])) { - foreach($this->seed->field_defs[strtolower($columnName)]['db_concat_fields'] as $index=>$field){ - if(!isset($filter_fields[strtolower($field)]) || !$filter_fields[strtolower($field)]) - { - $filter_fields[strtolower($field)] = true; - } - } - } - } - foreach ($this->searchColumns as $columnName => $def ) - { - $filter_fields[strtolower($columnName)] = true; - } - } - + $filter_fields = $this->setupFilterFields($filter_fields); $data = $this->lvd->getListViewData($seed, $where, $offset, $limit, $filter_fields, $params, $id_field); @@ -221,6 +190,49 @@ class ListViewDisplay { return true; } + function setupFilterFields($filter_fields = array()) + { + // create filter fields based off of display columns + if(empty($filter_fields) || $this->mergeDisplayColumns) { + foreach($this->displayColumns as $columnName => $def) { + + $filter_fields[strtolower($columnName)] = true; + + if(isset($this->seed->field_defs[strtolower($columnName)]['type']) && + strtolower($this->seed->field_defs[strtolower($columnName)]['type']) == 'currency' && + isset($this->seed->field_defs['currency_id'])) { + $filter_fields['currency_id'] = true; + } + + if(!empty($def['related_fields'])) { + foreach($def['related_fields'] as $field) { + //id column is added by query construction function. This addition creates duplicates + //and causes issues in oracle. #10165 + if ($field != 'id') { + $filter_fields[$field] = true; + } + } + } + if (!empty($this->seed->field_defs[strtolower($columnName)]['db_concat_fields'])) { + foreach($this->seed->field_defs[strtolower($columnName)]['db_concat_fields'] as $index=>$field){ + if(!isset($filter_fields[strtolower($field)]) || !$filter_fields[strtolower($field)]) + { + $filter_fields[strtolower($field)] = true; + } + } + } + } + foreach ($this->searchColumns as $columnName => $def ) + { + $filter_fields[strtolower($columnName)] = true; + } + } + + + return $filter_fields; + } + + /** * Any additional processing * @param file File template file to use @@ -236,13 +248,18 @@ class ListViewDisplay { * Display the listview * @return string ListView contents */ - function display() { - if(!$this->should_process) return ''; + public function display() + { + if (!$this->should_process) { + return ''; + } + $str = ''; - if($this->multiSelect == true && $this->show_mass_update_form) + if ($this->multiSelect == true && $this->show_mass_update_form) { $str = $this->mass->getDisplayMassUpdateForm(true, $this->multi_select_popup).$this->mass->getMassUpdateFormHeader($this->multi_select_popup); - - return $str; + } + + return $str; } /** * Display the select link @@ -260,9 +277,9 @@ class ListViewDisplay { } $script = "\n"; $massUpdateRun = isset($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true'; diff --git a/include/ListView/ListViewFacade.php b/include/ListView/ListViewFacade.php index 84904182..6c17aefe 100644 --- a/include/ListView/ListViewFacade.php +++ b/include/ListView/ListViewFacade.php @@ -1,7 +1,7 @@ {/if} {else} - {sugar_translate label=$params.label module=$pageData.bean.moduleDir} + {if !isset($params.noHeader) || $params.noHeader == false} + {sugar_translate label=$params.label module=$pageData.bean.moduleDir} + {/if} {/if} @@ -121,12 +123,12 @@
{if $pageData.access.edit}{/if}{if $pageData.rowAccess[$id].edit}{/if} + {if $col == 'NAME' || $params.bold}{/if} {if $params.link && !$params.customCode} <{$pageData.tag.$id[$params.ACLTag]|default:$pageData.tag.$id.MAIN} href="#" onMouseOver="javascript:lvg_nav('{if $params.dynamic_module}{$rowData[$params.dynamic_module]}{else}{$params.module|default:$pageData.bean.moduleDir}{/if}', '{$rowData[$params.id]|default:$rowData.ID}', 'd', {$offset}, this)" onFocus="javascript:lvg_nav('{if $params.dynamic_module}{$rowData[$params.dynamic_module]}{else}{$params.module|default:$pageData.bean.moduleDir}{/if}', '{$rowData[$params.id]|default:$rowData.ID}', 'd', {$offset}, this)"> @@ -135,6 +137,7 @@ {sugar_evalcolumn_old var=$params.customCode rowData=$rowData} {else} {sugar_field parentFieldArray=$rowData vardef=$params displayType=ListView field=$col} + {/if} {if empty($rowData.$col) && empty($params.customCode)} {/if} {if $params.link && !$params.customCode} diff --git a/include/ListView/ListViewNoMassUpdate.tpl b/include/ListView/ListViewNoMassUpdate.tpl index 9cfd0390..267f2e9d 100644 --- a/include/ListView/ListViewNoMassUpdate.tpl +++ b/include/ListView/ListViewNoMassUpdate.tpl @@ -1,7 +1,7 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/ListView/ListViewPagination.tpl b/include/ListView/ListViewPagination.tpl index 9d183c38..1c7bf86c 100644 --- a/include/ListView/ListViewPagination.tpl +++ b/include/ListView/ListViewPagination.tpl @@ -1,7 +1,7 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/ListView/ListViewSmarty.php b/include/ListView/ListViewSmarty.php index 7f3b74b7..3ccb907b 100644 --- a/include/ListView/ListViewSmarty.php +++ b/include/ListView/ListViewSmarty.php @@ -1,7 +1,7 @@ ss->assign('recordsLinkString',$app_strings['LBL_LINK_RECORDS']); $this->ss->assign('selectLinkString',$app_strings['LBL_LINK_SELECT']); if($this->overlib) $this->ss->assign('overlib', true); - - $pageTotal = $this->data['pageData']['offsets']['next'] - $this->data['pageData']['offsets']['current']; - if($this->data['pageData']['offsets']['next'] < 0){ // If we are on the last page, 'next' is -1, which means we have to have a custom calculation + + // Bug 24677 - Correct the page total amount on the last page of listviews + $pageTotal = $this->data['pageData']['offsets']['next']-$this->data['pageData']['offsets']['current']; + if ( $this->data['pageData']['offsets']['next'] < 0 ) { $pageTotal = $this->data['pageData']['offsets']['total'] - $this->data['pageData']['offsets']['current']; } if($this->select)$this->ss->assign('selectLink', $this->buildSelectLink('select_link', $this->data['pageData']['offsets']['total'], $pageTotal)); @@ -126,7 +129,7 @@ class ListViewSmarty extends ListViewDisplay{ } $this->ss->assign('quickViewLinks', $this->quickViewLinks); - + // handle save checks and stuff if($this->multiSelect) { @@ -140,8 +143,10 @@ class ListViewSmarty extends ListViewDisplay{ $this->ss->assign('multiSelectData', $this->getMultiSelectData()); } // include button for Adding to Target List if in one of four applicable modules - if ( isset ( $_REQUEST['module']) && in_array ( $_REQUEST['module'] , array ( 'Contacts','Prospects','Leads','Accounts' ))) + if ( isset ( $_REQUEST['module']) && in_array ( $_REQUEST['module'] , array ( 'Contacts','Prospects','Leads','Accounts' )) + && ACLController::checkAccess('ProspectLists','edit',true)) { $this->ss->assign( 'targetLink', $this->buildTargetList() ) ; + } $this->processArrows($data['pageData']['ordering']); $this->ss->assign('prerow', $this->multiSelect); $this->ss->assign('clearAll', $app_strings['LBL_CLEARALL']); @@ -197,7 +202,7 @@ class ListViewSmarty extends ListViewDisplay{ $this->ss->assign('data', $this->data['data']); $this->data['pageData']['offsets']['lastOffsetOnPage'] = $this->data['pageData']['offsets']['current'] + count($this->data['data']); $this->ss->assign('pageData', $this->data['pageData']); - + $navStrings = array('next' => $app_strings['LNK_LIST_NEXT'], 'previous' => $app_strings['LNK_LIST_PREVIOUS'], 'end' => $app_strings['LNK_LIST_END'], diff --git a/include/ListView/ListViewXTPL.php b/include/ListView/ListViewXTPL.php index 9be15138..8e9eecf2 100644 --- a/include/ListView/ListViewXTPL.php +++ b/include/ListView/ListViewXTPL.php @@ -1,7 +1,7 @@ query($q); - + while($a = $db->fetchByAssoc($r)) { $load = array(); $load['name'] = $a['name']; $load['symbol'] = $a['symbol']; $load['conversion_rate'] = $a['conversion_rate']; - + $this->currencies[$a['id']] = $load; } sugar_cache_put('currency_list',$this->currencies); @@ -405,6 +405,11 @@ class Localization { return $precision; } + function getCurrencySymbol($user=null) { + $dec = $this->getPrecedentPreference('default_currency_symbol', $user); + return $dec; + } + /** * returns a number formatted by user preference or system default * @param string number Number to be formatted and returned @@ -419,12 +424,12 @@ class Localization { $dec = $this->getDecimalSeparator($user); $thou = $this->getNumberGroupingSeparator($user); $precision = $this->getPrecision($user); - $symbol = empty($currencySymbol) ? $this->getCurrencySymbol() : $currencySymbol; + $symbol = empty($currencySymbol) ? $this->getCurrencySymbol($user) : $currencySymbol; $exNum = explode($dec, $number); // handle grouping if(is_array($exNum) && count($exNum) > 0) { - if(strlen($exNum) > 3) { + if(strlen($exNum[0]) > 3) { $offset = strlen($exNum[0]) % 3; if($offset > 0) { for($i=0; $i<$offset; $i++) { @@ -562,13 +567,13 @@ eoq; * sfl is "Salutation FirstName LastName", "l, f s" is "LastName[comma][space]FirstName[space]Salutation" * @param object user object * @param bool returnEmptyStringIfEmpty true if we should return back an empty string rather than a single space - * when the formatted name would be blank + * when the formatted name would be blank * @return string formattedName */ function getLocaleFormattedName($firstName, $lastName, $salutationKey='', $title='', $format="", $user=null, $returnEmptyStringIfEmpty = false) { global $current_user; global $app_list_strings; - + if ( $user == null ) { $user = $current_user; } @@ -586,6 +591,19 @@ eoq; $names['s'] = (empty($salutation) && $salutation != 0) ? '' : $salutation; $names['t'] = (empty($title) && $title != 0) ? '' : $title; + //Bug: 39936 - if all of the inputs are empty, then don't try to format the name. + $allEmpty = true; + foreach($names as $key => $val){ + if(!empty($val)){ + $allEmpty = false; + break; + } + } + if($allEmpty){ + return $returnEmptyStringIfEmpty ? '' : ' '; + } + //end Bug: 39936 + if(empty($format)) { $this->localeNameFormat = $this->getLocaleFormatMacro($user); } else { @@ -655,8 +673,8 @@ eoq; } //// END NAME DISPLAY FORMATTING CODE /////////////////////////////////////////////////////////////////////////// - - /** + + /** * Attempts to detect the charset used in the string * * @param $str string @@ -668,7 +686,7 @@ eoq; { if ( function_exists('mb_convert_encoding') ) return mb_detect_encoding($str,'ASCII,JIS,UTF-8,EUC-JP,SJIS,ISO-8859-1'); - + return false; } } // end class def diff --git a/include/MVC/Controller/ControllerFactory.php b/include/MVC/Controller/ControllerFactory.php index aad9f29d..f0b01587 100644 --- a/include/MVC/Controller/ControllerFactory.php +++ b/include/MVC/Controller/ControllerFactory.php @@ -1,6 +1,6 @@ module])){ $class = $GLOBALS['beanList'][$this->module]; if(!empty($GLOBALS['beanFiles'][$class])){ @@ -457,9 +458,6 @@ class SugarController{ foreach($this->bean->field_defs as $field => $properties) { $type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type']; $sf = $sfh->getSugarField(ucfirst($type), true); - if($sf != null){ - $sf->save($this->bean, $_POST, $field, $properties); - } if(isset($_POST[$field])) { if(is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { if(empty($_POST[$field][0])) { @@ -471,6 +469,9 @@ class SugarController{ } else if(!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field . '_multiselect'])) { $this->bean->$field = ''; } + if($sf != null){ + $sf->save($this->bean, $_POST, $field, $properties); + } } foreach($this->bean->relationship_fields as $field=>$link){ diff --git a/include/MVC/Controller/action_file_map.php b/include/MVC/Controller/action_file_map.php index 3a634f6d..e7ff6a53 100644 --- a/include/MVC/Controller/action_file_map.php +++ b/include/MVC/Controller/action_file_map.php @@ -1,6 +1,6 @@ $v) { - $GLOBALS['request_string'] .= urlencode($key).'[]='.urlencode($v).'&'; + //If an array, then skip the urlencoding. This should be handled with stringify instead. + if(is_array($v)) + continue; + + $GLOBALS['request_string'] .= urlencode($key).'['.$k.']='.urlencode($v).'&'; } } else @@ -289,6 +292,16 @@ class SugarApplication return; } + // Bug 20916 - Special case for check ACL access rights for Subpanel QuickCreates + if(isset($_POST['action']) && $_POST['action'] == 'SubpanelCreates') { + $actual_module = $_POST['target_module']; + if(!empty($GLOBALS['modListHeader']) && !in_array($actual_module,$GLOBALS['modListHeader'])) { + $this->controller->hasAccess = false; + } + return; + } + + if(!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) $GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']); @@ -494,77 +507,57 @@ class SugarApplication * * Checks a request to ensure the request is coming from a valid source or it is for one of the white listed actions */ - function checkHTTPReferer(){ + protected function checkHTTPReferer($dieIfInvalid = true) + { global $sugar_config; - $whiteListActions = (!empty($sugar_config['http_referer']['actions']))?$sugar_config['http_referer']['actions']:array('index', 'ListView', 'DetailView', 'Authenticate', 'Login'); + $whiteListActions = (!empty($sugar_config['http_referer']['actions']))?$sugar_config['http_referer']['actions']:array('index', 'ListView', 'DetailView', 'EditView','oauth', 'Authenticate', 'Login'); + $strong = empty($sugar_config['http_referer']['weak']); + // Bug 39691 - Make sure localhost and 127.0.0.1 are always valid HTTP referers $whiteListReferers = array('127.0.0.1','localhost'); if(!empty($_SERVER['SERVER_ADDR']))$whiteListReferers[] = $_SERVER['SERVER_ADDR']; if ( !empty($sugar_config['http_referer']['list']) ) { $whiteListReferers = array_merge($whiteListReferers,$sugar_config['http_referer']['list']); } - if($strong && empty($_SERVER['HTTP_REFERER']) && !in_array($this->controller->action, $whiteListActions) && $this->isModifyAction()){ + + if($strong && empty($_SERVER['HTTP_REFERER']) && !in_array($this->controller->action, $whiteListActions) && $this->isModifyAction()) { + $http_host = explode(':', $_SERVER['HTTP_HOST']); + $whiteListActions[] = $this->controller->action; $whiteListString = "'" . implode("', '", $whiteListActions) . "'"; - header("Cache-Control: no-cache, must-revalidate"); - echo << -

Possible Cross Site Request Forgery (XSRF) Attack Detected

-

You've made a request to {$this->controller->action} but your HTTP Referer header is blank.

-

Click here for directions to allow the HTTP Referer to not be set

- - - - -EOQ; - sugar_cleanup(true); - }else if(!empty($_SERVER['HTTP_REFERER']) && !empty($_SERVER['SERVER_NAME'])){ + if ( $dieIfInvalid ) { + header("Cache-Control: no-cache, must-revalidate"); + $ss = new Sugar_Smarty; + $ss->assign('host', $http_host[0]); + $ss->assign('action',$this->controller->action); + $ss->assign('whiteListString',$whiteListString); + $ss->display('include/MVC/View/tpls/xsrf.tpl'); + sugar_cleanup(true); + } + return false; + } else + if(!empty($_SERVER['HTTP_REFERER']) && !empty($_SERVER['SERVER_NAME'])){ $http_ref = parse_url($_SERVER['HTTP_REFERER']); if($http_ref['host'] !== $_SERVER['SERVER_NAME'] && !in_array($this->controller->action, $whiteListActions) && + (empty($whiteListReferers) || !in_array($http_ref['host'], $whiteListReferers))){ - header("Cache-Control: no-cache, must-revalidate"); - $whiteListActions[] = $this->controller->action; - $whiteListString = "'" . implode("', '", $whiteListActions) . "'"; - - echo << -

Possible Cross Site Request Forgery (XSRF) Attack Detected

-

If you think this is a mistake please ask your administrator to add the following site to the acceptable referer list

-

{$http_ref['host']}

-

Click here for directions to add this site to the acceptable referer list

- - - - -EOQ; - sugar_cleanup(true); + if ( $dieIfInvalid ) { + header("Cache-Control: no-cache, must-revalidate"); + $whiteListActions[] = $this->controller->action; + $whiteListString = "'" . implode("', '", $whiteListActions) . "'"; + + $ss = new Sugar_Smarty; + $ss->assign('host',$http_ref['host']); + $ss->assign('action',$this->controller->action); + $ss->assign('whiteListString',$whiteListString); + $ss->display('include/MVC/View/tpls/xsrf.tpl'); + sugar_cleanup(true); + } + return false; } } + return true; } function startSession() { @@ -625,6 +618,31 @@ EOQ; exit(); } + /** + * Redirect to another URL + * + * @access public + * @param string $url The URL to redirect to + */ + public static function appendErrorMessage($error_message) + { + if (empty($_SESSION['user_error_message']) || !is_array($_SESSION['user_error_message'])){ + $_SESSION['user_error_message'] = array(); + } + $_SESSION['user_error_message'][] = $error_message; + } + + public static function getErrorMessages() + { + if (isset($_SESSION['user_error_message']) && is_array($_SESSION['user_error_message']) ) { + $msgs = $_SESSION['user_error_message']; + unset($_SESSION['user_error_message']); + return $msgs; + }else{ + return array(); + } + } + /** * Wrapper for the PHP setcookie() function, to handle cases where headers have * already been sent diff --git a/include/MVC/SugarModule.php b/include/MVC/SugarModule.php index 5da7c0d8..5b795510 100644 --- a/include/MVC/SugarModule.php +++ b/include/MVC/SugarModule.php @@ -1,7 +1,7 @@ _moduleName]) ) { $bean = $beanList[$this->_moduleName]; if (isset($beanFiles[$bean])) { + if ( !$returnObject ) { + return true; + } + if ( !sugar_is_file($beanFiles[$bean]) ) { + return false; + } require_once($beanFiles[$bean]); $focus = new $bean; } - else + else { return false; + } } - else + else { return false; + } return $focus; } diff --git a/include/MVC/View/SugarView.php b/include/MVC/View/SugarView.php index 564cba6b..e4cec4b4 100644 --- a/include/MVC/View/SugarView.php +++ b/include/MVC/View/SugarView.php @@ -1,6 +1,6 @@ bean = &$bean; + $this->bean = $bean; $this->view_object_map = $view_object_map; $this->action = $GLOBALS['action']; $this->module = $GLOBALS['module']; $this->_initSmarty(); } - + protected function _initSmarty() { $this->ss = new Sugar_Smarty(); @@ -105,17 +110,17 @@ class SugarView public function process() { LogicHook::initialize(); - $this->_checkModule(); - + $this->_checkModule(); + //trackView has to be here in order to track for breadcrumbs $this->_trackView(); - + if ($this->_getOption('show_header')) { $this->displayHeader(); } else { - $this->renderJavascript(); + $this->renderJavascript(); } - + $this->_buildModuleList(); $this->preDisplay(); $this->displayErrors(); @@ -124,7 +129,7 @@ class SugarView if ($this->_getOption('show_subpanels')) $this->_displaySubPanels(); if ($this->action === 'Login') { //this is needed for a faster loading login page ie won't render unless the tables are closed - ob_flush(); + ob_flush(); } if ($this->_getOption('show_footer')) $this->displayFooter(); $GLOBALS['logic_hook']->call_custom_logic('', 'after_ui_footer'); @@ -137,8 +142,17 @@ class SugarView */ public function displayErrors() { + $errors = ''; + foreach($this->errors as $error) { - echo '' . $error . '
'; + $errors .= '' . $error . '
'; + } + + if ( !$this->suppressDisplayErrors ) { + echo $errors; + } + else { + return $errors; } } @@ -167,38 +181,38 @@ class SugarView /** * trackView */ - protected function _trackView() + protected function _trackView() { - $action = strtolower($this->action); - //Skip save, tracked in SugarBean instead - if($action == 'save') { - return; - } + $action = strtolower($this->action); + //Skip save, tracked in SugarBean instead + if($action == 'save') { + return; + } + - $trackerManager = TrackerManager::getInstance(); - $timeStamp = gmdate($GLOBALS['timedate']->get_db_date_time_format()); - if($monitor = $trackerManager->getMonitor('tracker')){ - $monitor->setValue('action', $action); - $monitor->setValue('user_id', $GLOBALS['current_user']->id); - $monitor->setValue('module_name', $this->module); - $monitor->setValue('date_modified', $timeStamp); - $monitor->setValue('visible', (($monitor->action == 'detailview') || ($monitor->action == 'editview') - ) ? 1 : 0); - - if (!empty($this->bean->id)) { - $monitor->setValue('item_id', $this->bean->id); - $monitor->setValue('item_summary', $this->bean->get_summary_text()); - } - - //If visible is true, but there is no bean, do not track (invalid/unauthorized reference) - //Also, do not track save actions where there is no bean id - if($monitor->visible && empty($this->bean->id)) { - $trackerManager->unsetMonitor($monitor); - return; - } - $trackerManager->saveMonitor($monitor, true, true); - } + $timeStamp = TimeDate::getInstance()->nowDb(); + if($monitor = $trackerManager->getMonitor('tracker')){ + $monitor->setValue('action', $action); + $monitor->setValue('user_id', $GLOBALS['current_user']->id); + $monitor->setValue('module_name', $this->module); + $monitor->setValue('date_modified', $timeStamp); + $monitor->setValue('visible', (($monitor->action == 'detailview') || ($monitor->action == 'editview') + ) ? 1 : 0); + + if (!empty($this->bean->id)) { + $monitor->setValue('item_id', $this->bean->id); + $monitor->setValue('item_summary', $this->bean->get_summary_text()); + } + + //If visible is true, but there is no bean, do not track (invalid/unauthorized reference) + //Also, do not track save actions where there is no bean id + if($monitor->visible && empty($this->bean->id)) { + $trackerManager->unsetMonitor($monitor); + return; + } + $trackerManager->saveMonitor($monitor, true, true); + } } @@ -215,48 +229,48 @@ class SugarView global $app_list_strings; global $mod_strings; global $current_language; - + $GLOBALS['app']->headerDisplayed = true; - + $themeObject = SugarThemeRegistry::current(); $theme = $themeObject->__toString(); - + $ss = new Sugar_Smarty(); $ss->assign("APP", $app_strings); $ss->assign("THEME", $theme); $ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true':'false'); $ss->assign("MODULE_NAME", $this->module); - + // get browser title $ss->assign("SYSTEM_NAME", $this->getBrowserTitle()); - + // get css $css = $themeObject->getCSS(); if ($this->_getOption('view_print')) { $css .= ''; } $ss->assign("SUGAR_CSS",$css); - + // get javascript ob_start(); $this->renderJavascript(); $ss->assign("SUGAR_JS",ob_get_contents().$themeObject->getJS()); ob_end_clean(); - + // get favicon - if(isset($GLOBALS['sugar_config']['default_module_favicon'])) + if(isset($GLOBALS['sugar_config']['default_module_favicon'])) $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; else $module_favicon = false; - + $favicon = ''; - if ( $module_favicon ) + if ( $module_favicon ) $favicon = $themeObject->getImageURL($this->module.'.gif',false); if ( !sugar_is_file($favicon) || !$module_favicon ) $favicon = $themeObject->getImageURL('sugar_icon.ico',false); $ss->assign('FAVICON_URL',getJSPath($favicon)); - + // build the shortcut menu $shortcut_menu = array(); foreach ( $this->getMenu() as $key => $menu_item ) @@ -268,7 +282,7 @@ class SugarView ->getImage($menu_item[2],"alt='".$menu_item[1]."' border='0' align='absmiddle'"), ); $ss->assign("SHORTCUT_MENU",$shortcut_menu); - + // handle rtl text direction if(isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL'){ $_SESSION['RTL'] = true; @@ -279,12 +293,12 @@ class SugarView if(isset($_SESSION['RTL']) && $_SESSION['RTL']){ $ss->assign("DIR", 'dir="RTL"'); } - + // handle resizing of the company logo correctly on the fly $companyLogoURL = $themeObject->getImageURL('company_logo.png'); - $companyLogoURL_arr = explode('?', $companyLogoURL); - $companyLogoURL = $companyLogoURL_arr[0]; - + $companyLogoURL_arr = explode('?', $companyLogoURL); + $companyLogoURL = $companyLogoURL_arr[0]; + $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes'); if(!empty($company_logo_attributes)) { $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); @@ -321,19 +335,19 @@ class SugarView ); } $ss->assign("COMPANY_LOGO_URL",getJSPath($companyLogoURL)."&logo_md5=".$ss->get_template_vars("COMPANY_LOGO_MD5")); - + // get the global links $gcls = array(); $global_control_links = array(); require("include/globalControlLinks.php"); - + foreach($global_control_links as $key => $value) { if ($key == 'users') { //represents logout link. - $ss->assign("LOGOUT_LINK", $value['linkinfo'][key($value['linkinfo'])]); + $ss->assign("LOGOUT_LINK", $value['linkinfo'][key($value['linkinfo'])]); $ss->assign("LOGOUT_LABEL", key($value['linkinfo']));//key value for first element. continue; } - + foreach ($value as $linkattribute => $attributevalue) { // get the main link info if ( $linkattribute == 'linkinfo' ) { @@ -362,21 +376,21 @@ class SugarView } } $ss->assign("GCLS",$gcls); - + $ss->assign("SEARCH", isset($_REQUEST['query_string']) ? $_REQUEST['query_string'] : ''); - - if ($this->action == "EditView" || $this->action == "Login") + + if ($this->action == "EditView" || $this->action == "Login") $ss->assign("ONLOAD", 'onload="set_focus()"'); $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"])); - + // get other things needed for page style popup if (isset($_SESSION["authenticated_user_id"])) { // get the current user name and id $ss->assign("CURRENT_USER", $current_user->full_name == '' || !showFullName() ? $current_user->user_name : $current_user->full_name ); $ss->assign("CURRENT_USER_ID", $current_user->id); - + // get the last viewed records $tracker = new Tracker(); $history = $tracker->get_recently_viewed($current_user->id); @@ -387,22 +401,22 @@ class SugarView } $ss->assign("recentRecords",$history); } - - $bakModStrings = $mod_strings; + + $bakModStrings = $mod_strings; if (isset($_SESSION["authenticated_user_id"]) ) { // get the module list $moduleTopMenu = array(); - + $max_tabs = $current_user->getPreference('max_tabs'); // Attempt to correct if max tabs count is waaay too high. if ( !isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10 ) { $max_tabs = $GLOBALS['sugar_config']['default_max_tabs']; $current_user->setPreference('max_tabs', $max_tabs, 0, 'global'); } - + $moduleTab = $this->_getModuleTab(); $ss->assign('MODULE_TAB',$moduleTab); - + // See if they are using grouped tabs or not (removed in 6.0, returned in 6.1) $user_navigation_paradigm = $current_user->getPreference('navigation_paradigm'); @@ -424,9 +438,9 @@ class SugarView $iFrame = new iFrame(); $frames = $iFrame->lookup_frames('tab'); foreach($frames as $key => $values){ - $fullModuleList[$key] = $values; + $fullModuleList[$key] = $values; } - } + } elseif (isset($fullModuleList['iFrames'])) { unset($fullModuleList['iFrames']); } @@ -434,32 +448,23 @@ class SugarView if ( $user_navigation_paradigm == 'gm' && isset($themeObject->group_tabs) && $themeObject->group_tabs) { // We are using grouped tabs require_once('include/GroupedTabs/GroupedTabStructure.php'); - $groupedTabsClass = new GroupedTabStructure(); + $groupedTabsClass = new GroupedTabStructure(); $modules = query_module_access_list($current_user); //handle with submoremodules $max_tabs = $current_user->getPreference('max_tabs'); // If the max_tabs isn't set incorrectly, set it within the range, to the default max sub tabs size if ( !isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10){ // We have a default value. Use it - if(isset($GLOBALS['sugar_config']['default_max_subtabs'])){ - // As of 6.1, we shouldn't have a max subtabs higher than 10. - // If it's larger, bring it down to the max and save it in the config override - if($GLOBALS['sugar_config']['default_max_subtabs'] > 10){ - require_once('modules/Configurator/Configurator.php'); - $configurator = new Configurator(); - $configurator->config['default_max_subtabs'] = '10'; - $configurator->handleOverride(); - $configurator->clearCache(); - } - $max_tabs = $GLOBALS['sugar_config']['default_max_subtabs']; + if(isset($GLOBALS['sugar_config']['default_max_tabs'])){ + $max_tabs = $GLOBALS['sugar_config']['default_max_tabs']; } else{ $max_tabs = 8; } } - - $subMoreModules = false; - $groupTabs = $groupedTabsClass->get_tab_structure(get_val_array($modules)); + + $subMoreModules = false; + $groupTabs = $groupedTabsClass->get_tab_structure(get_val_array($modules)); // We need to put this here, so the "All" group is valid for the user's preference. $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules'] = $fullModuleList; @@ -478,7 +483,7 @@ class SugarView $ss->assign('currentGroupTab',$currentGroupTab); $usingGroupTabs = true; - + } else { // Setup the default group tab. $ss->assign('currentGroupTab',$app_strings['LBL_TABGROUP_ALL']); @@ -488,10 +493,10 @@ class SugarView $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules'] = $fullModuleList; } - + $topTabList = array(); - + // Now time to go through each of the tab sets and fix them up. foreach ( $groupTabs as $tabIdx => $tabData ) { $topTabs = $tabData['modules']; @@ -499,7 +504,7 @@ class SugarView $topTabs = array(); } $extraTabs = array(); - + // Split it in to the tabs that go across the top, and the ones that are on the extra menu. if ( count($topTabs) > $max_tabs ) { $extraTabs = array_splice($topTabs,$max_tabs); @@ -517,10 +522,12 @@ class SugarView $lastElem = array_splice($topTabs,$max_tabs-1); $extraTabs = $lastElem + $extraTabs; } - $topTabs[$moduleTab] = $app_list_strings['moduleList'][$moduleTab]; + if ( !empty($moduleTab) ) { + $topTabs[$moduleTab] = $app_list_strings['moduleList'][$moduleTab]; + } } - - + + /* // This was removed, but I like the idea, so I left the code in here in case we decide to turn it back on // If we are using group tabs, add all the "hidden" tabs to the end of the extra menu @@ -537,7 +544,7 @@ class SugarView foreach ( $topTabs as $moduleKey => $module ) { $topTabList[$moduleKey] = $module; } - + $groupTabs[$tabIdx]['modules'] = $topTabs; $groupTabs[$tabIdx]['extra'] = $extraTabs; } @@ -569,14 +576,22 @@ class SugarView } - global $mod_strings; - $mod_strings = $bakModStrings; + global $mod_strings; + $mod_strings = $bakModStrings; $headerTpl = $themeObject->getTemplate('header.tpl'); if ( isset($GLOBALS['sugar_config']['developerMode']) && $GLOBALS['sugar_config']['developerMode'] ) $ss->clear_compiled_tpl($headerTpl); $ss->display($headerTpl); - + $this->includeClassicFile('modules/Administration/DisplayWarnings.php'); + + $errorMessages = SugarApplication::getErrorMessages(); + if ( !empty($errorMessages)) { + foreach ( $errorMessages as $error_message ) { + echo('

' . $error_message.'

'); + } + } + } /** * If the view is classic then this method will include the file and @@ -598,41 +613,77 @@ class SugarView protected function _displayLoginJS() { - global $sugar_config; - + global $sugar_config, $timedate; + if(isset($this->bean->module_dir)){ echo ""; } if(isset($_REQUEST['action'])){ echo ""; } - echo ''; + echo ''; if (!is_file("include/javascript/sugar_grp1.js")) { - $_REQUEST['root_directory'] = "."; - require_once("jssource/minify_utils.php"); - ConcatenateFiles("."); + $_REQUEST['root_directory'] = "."; + require_once("jssource/minify_utils.php"); + ConcatenateFiles("."); } echo ''; echo ''; - echo ''; + echo ''; echo << - if ( typeof(SUGAR) == 'undefined' ) {SUGAR = {}}; - if ( typeof(SUGAR.themes) == 'undefined' ) SUGAR.themes = {}; - + EOQ; if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) echo ''; } + /** + * Get JS validation code for views + */ + public static function getJavascriptValidation() + { + global $timedate; + $cal_date_format = $timedate->get_cal_date_format(); + $timereg = $timedate->get_regular_expression($timedate->get_time_format()); + $datereg = $timedate->get_regular_expression($timedate->get_date_format()); + $date_pos = ''; + foreach ($datereg['positions'] as $type => $pos) { + if (empty($date_pos)) { + $date_pos .= "'$type': $pos"; + } else { + $date_pos .= ",'$type': $pos"; + } + } + + $time_separator = $timedate->timeSeparator(); + $hour_offset = $timedate->getUserUTCOffset() * 60; + + // Add in the number formatting styles here as well, we have been handling this with individual modules. + require_once ('modules/Currencies/Currency.php'); + list ($num_grp_sep, $dec_sep) = get_number_seperators(); + + $the_script = ""; + + return $the_script; + } + /** * Called from process(). This method will display the correct javascript. */ protected function _displayJavascript() { - global $locale, $sugar_config; - - + global $locale, $sugar_config, $timedate; + + if ($this->_getOption('show_javascript')) { if (!$this->_getOption('show_header')) echo << EOHTML; - + echo ""; echo ""; - - if(isset($this->bean->module_dir)){ + + if(isset($this->bean->module_dir)){ echo ""; } if(isset($_REQUEST['action'])){ echo ""; } - echo ''; - if (!is_file("include/javascript/sugar_grp1.js") || !is_file("include/javascript/sugar_grp1_yui.js")) { - $_REQUEST['root_directory'] = "."; - require_once("jssource/minify_utils.php"); - ConcatenateFiles("."); - } + echo ''; + if (!is_file("include/javascript/sugar_grp1.js") || !is_file("include/javascript/sugar_grp1_yui.js")) { + $_REQUEST['root_directory'] = "."; + require_once("jssource/minify_utils.php"); + ConcatenateFiles("."); + } echo ''; echo ''; - echo ''; + echo ''; if ( isset($sugar_config['quicksearch_querydelay']) ) { echo ""; @@ -670,7 +721,7 @@ EOHTML; $image_server = (defined('TEMPLATE_URL'))?TEMPLATE_URL . '/':''; echo ''; // cn: bug 12274 - create session-stored key to defend against CSRF echo ''; - echo $GLOBALS['timedate']->get_javascript_validation(); + echo self::getJavascriptValidation(); if (!is_file($GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js')) { require_once ('include/language/jsLanguage.php'); jsLanguage::createAppStringsCache($GLOBALS['current_language']); @@ -685,7 +736,7 @@ EOHTML; echo ''; echo ''; } - + if (isset($_REQUEST['popup']) && !empty($_REQUEST['popup'])) { // cn: bug 12274 - add security metadata envelope for async calls in popups echo ''; // cn: bug 12274 - create session-stored key to defend against CSRF @@ -702,41 +753,69 @@ EOHTML; } global $sugar_config; global $app_strings; - + //decide whether or not to show themepicker, default is to show $showThemePicker = true; if (isset($sugar_config['showThemePicker'])) { $showThemePicker = $sugar_config['showThemePicker']; } - + echo ""; $jsalerts = new jsAlerts(); if ( !isset($_SESSION['isMobile']) ) echo $jsalerts->getScript(); - + $ss = new Sugar_Smarty(); $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"])); $ss->assign('MOD',return_module_language($GLOBALS['current_language'], 'Users')); - + + $bottomLinkList = array(); + if (isset($this->action) && $this->action != "EditView") { + $bottomLinkList['print'] = + array($app_strings['LNK_PRINT'] => 'javascript:void window.open(\'index.php?'.$GLOBALS['request_string'].'\',\'printwin\',\'menubar=1,status=0,resizable=1,scrollbars=1,toolbar=0,location=1\')'); + + } + $bottomLinkList['backtotop'] = array($app_strings['LNK_BACKTOTOP'] => '#top'); + + $bottomLinksStr = ""; + foreach($bottomLinkList as $key => $value) { + foreach($value as $text => $link) { + $href = $link; + if(substr($link, 0, 11) == "javascript:") { + $onclick = " onclick=\"".substr($link,11)."\""; + $href = "#"; + } else { + $onclick = ""; + } + $imageURL = SugarThemeRegistry::current()->getImageURL($key.'.gif'); + $bottomLinksStr .= ""; + } + } + $ss->assign("BOTTOMLINKS",$bottomLinksStr); if (SugarConfig::getInstance()->get('calculate_response_time', false)) $ss->assign('STATISTICS',$this->_getStatistics()); - + // Under the License referenced above, you are required to leave in all copyright statements in both // the code and end-user application. - + $copyright = '© 2004-2011 SugarCRM Inc. The Program is provided AS IS, without warranty. Licensed under AGPLv3.
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, including the additional permission set forth in the source code header.
'; - - - + + + // 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 General Public License version @@ -748,15 +827,15 @@ EOHTML; $attribLinkImg = "Powered By SugarCRM\n"; - + // Bug 38594 - Add in Trademark wording $copyright .= 'SugarCRM is a trademark of SugarCRM, Inc. All other company and product names may be trademarks of the respective companies with which they are associated.
'; //rrs bug: 20923 - if this image does not exist as per the license, then the proper image will be displaye regardless, so no need - //to display an empty image here. - if(file_exists('include/images/poweredby_sugarcrm.png')){ - $copyright .= $attribLinkImg; - } + //to display an empty image here. + if(file_exists('include/images/poweredby_sugarcrm.png')){ + $copyright .= $attribLinkImg; + } // End Required Image $ss->assign('COPYRIGHT',$copyright); $ss->display(SugarThemeRegistry::current()->getTemplate('footer.tpl')); @@ -774,10 +853,10 @@ EOHTML; echo $subpanel->display(); } } - + protected function _buildModuleList() { - if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) + if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) $GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']); } @@ -790,7 +869,7 @@ EOHTML; * @return bool - the value of the option */ protected function _getOption( - $option, + $option, $default = false ) { @@ -800,7 +879,7 @@ EOHTML; return $this->options[$option]; } else return $default; } - + /** * track * Private function to track information about the view request @@ -814,10 +893,10 @@ EOHTML; return; } - + $trackerManager = TrackerManager::getInstance(); $trackerManager->save(); - + } /** @@ -825,40 +904,31 @@ EOHTML; */ protected function _checkModule() { - if(!empty($this->module) && !file_exists('modules/'.$this->module)){ - $error = str_replace("[module]", "$this->module", $GLOBALS['app_strings']['ERR_CANNOT_FIND_MODULE']); - $GLOBALS['log']->fatal($error); - echo $error; - die(); - } + if(!empty($this->module) && !file_exists('modules/'.$this->module)){ + $error = str_replace("[module]", "$this->module", $GLOBALS['app_strings']['ERR_CANNOT_FIND_MODULE']); + $GLOBALS['log']->fatal($error); + echo $error; + die(); + } } - public function renderJavascript() + public function renderJavascript() { if ($this->action !== 'Login') $this->_displayJavascript(); else - $this->_displayLoginJS(); - } - + $this->_displayLoginJS(); + } + private function _calculateFooterMetrics() { $endTime = microtime(true); $deltaTime = $endTime - $GLOBALS['startTime']; $this->responseTime = number_format(round($deltaTime, 2), 2); // Print out the resources used in constructing the page. - $included_files = get_included_files(); - // take all of the included files and make a list that does not allow for duplicates based on case - // I believe the full get_include_files result set appears to have one entry for each file in real - // case, and one entry in all lower case. - $list_of_files_case_insensitive = array(); - foreach($included_files as $key => $name) { - // preserve the first capitalization encountered. - $list_of_files_case_insensitive[mb_strtolower($name) ] = $name; - } - $this->fileResources = sizeof($list_of_files_case_insensitive); + $this->fileResources = count(get_included_files()); } - + private function _getStatistics() { $endTime = microtime(true); @@ -880,16 +950,15 @@ EOHTML; } $return .= $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_RESOURCES'] . '(' . DBManager::getQueryCount() . ',' . sizeof($list_of_files_case_insensitive) . ')
'; // Display performance of the internal and external caches.... - $return .= "External cache (hits/total=ratio) local ({$GLOBALS['external_cache_request_local_hits']}/{$GLOBALS['external_cache_request_local_total']}=" . round($GLOBALS['external_cache_request_local_hits']*100/$GLOBALS['external_cache_request_local_total'], 0) . "%)"; - if ($GLOBALS['external_cache_request_external_total']) { - // Only display out of process cache results if there was at least one attempt to retrieve from the out of process cache (this signifies that it was enabled). - $return .= " external ({$GLOBALS['external_cache_request_external_hits']}/{$GLOBALS['external_cache_request_external_total']}=" . round($GLOBALS['external_cache_request_external_hits']*100/$GLOBALS['external_cache_request_external_total'], 0) . "%)
"; - } + $cacheStats = SugarCache::instance()->getCacheStats(); + $return .= "External cache (hits/total=ratio) local ({$cacheStats['localHits']}/{$cacheStats['requests']}=" . round($cacheStats['localHits']*100/$cacheStats['requests'], 0) . "%)"; + $return .= " external ({$cacheStats['externalHits']}/{$cacheStats['requests']}=" . round($cacheStats['externalHits']*100/$cacheStats['requests'], 0) . "%)
"; + $return .= " misses ({$cacheStats['misses']}/{$cacheStats['requests']}=" . round($cacheStats['misses']*100/$cacheStats['requests'], 0) . "%)
"; } - + return $return; } - + /** * Loads the module shortcuts menu * @@ -901,58 +970,54 @@ EOHTML; ) { global $current_language, $current_user, $mod_strings, $app_strings; - + if ( empty($module) ) $module = $this->module; - - $module_menu = sugar_cache_retrieve("{$current_user->id}_{$module}_module_menu_{$current_language}"); - if ( !is_array($module_menu) ) { - $final_module_menu = array(); - - if (file_exists('modules/' . $module . '/Menu.php')) { - $GLOBALS['module_menu'] = $module_menu = array(); - require('modules/' . $module . '/Menu.php'); - $final_module_menu = array_merge($final_module_menu,$GLOBALS['module_menu'],$module_menu); - } - if (file_exists('custom/modules/' . $module . '/Ext/Menus/menu.ext.php')) { - $GLOBALS['module_menu'] = $module_menu = array(); - require('custom/modules/' . $module . '/Ext/Menus/menu.ext.php'); - $final_module_menu = array_merge($final_module_menu,$GLOBALS['module_menu'],$module_menu); - } - if (!file_exists('modules/' . $module . '/Menu.php') - && !file_exists('custom/modules/' . $module . '/Ext/Menus/menu.ext.php') - && !empty($GLOBALS['mod_strings']['LNK_NEW_RECORD'])) { - $final_module_menu[] = array("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView", - $GLOBALS['mod_strings']['LNK_NEW_RECORD'],"{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}$module" ,$module ); - $final_module_menu[] = array("index.php?module=$module&action=index", $GLOBALS['mod_strings']['LNK_LIST'], - $module, $module); - if ( ($this->bean instanceOf SugarBean) && !empty($this->bean->importable) ) - if ( !empty($mod_strings['LNK_IMPORT_'.strtoupper($module)]) ) - $final_module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", - $mod_strings['LNK_IMPORT_'.strtoupper($module)], "Import", $module); - else - $final_module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", - $app_strings['LBL_IMPORT'], "Import", $module); - } - if (file_exists('custom/application/Ext/Menus/menu.ext.php')) { - $GLOBALS['module_menu'] = $module_menu = array(); - require('custom/application/Ext/Menus/menu.ext.php'); - $final_module_menu = array_merge($final_module_menu,$GLOBALS['module_menu'],$module_menu); - } - $module_menu = $final_module_menu; - sugar_cache_put("{$current_user->id}_{$module}_module_menu_{$current_language}",$module_menu); + + $final_module_menu = array(); + + if (file_exists('modules/' . $module . '/Menu.php')) { + $GLOBALS['module_menu'] = $module_menu = array(); + require('modules/' . $module . '/Menu.php'); + $final_module_menu = array_merge($final_module_menu,$GLOBALS['module_menu'],$module_menu); + } + if (file_exists('custom/modules/' . $module . '/Ext/Menus/menu.ext.php')) { + $GLOBALS['module_menu'] = $module_menu = array(); + require('custom/modules/' . $module . '/Ext/Menus/menu.ext.php'); + $final_module_menu = array_merge($final_module_menu,$GLOBALS['module_menu'],$module_menu); } - + if (!file_exists('modules/' . $module . '/Menu.php') + && !file_exists('custom/modules/' . $module . '/Ext/Menus/menu.ext.php') + && !empty($GLOBALS['mod_strings']['LNK_NEW_RECORD'])) { + $final_module_menu[] = array("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView", + $GLOBALS['mod_strings']['LNK_NEW_RECORD'],"{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}$module" ,$module ); + $final_module_menu[] = array("index.php?module=$module&action=index", $GLOBALS['mod_strings']['LNK_LIST'], + $module, $module); + if ( ($this->bean instanceOf SugarBean) && !empty($this->bean->importable) ) + if ( !empty($mod_strings['LNK_IMPORT_'.strtoupper($module)]) ) + $final_module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", + $mod_strings['LNK_IMPORT_'.strtoupper($module)], "Import", $module); + else + $final_module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", + $app_strings['LBL_IMPORT'], "Import", $module); + } + if (file_exists('custom/application/Ext/Menus/menu.ext.php')) { + $GLOBALS['module_menu'] = $module_menu = array(); + require('custom/application/Ext/Menus/menu.ext.php'); + $final_module_menu = array_merge($final_module_menu,$GLOBALS['module_menu'],$module_menu); + } + $module_menu = $final_module_menu; + return $module_menu; - } - - /** - * Returns the module name which should be highlighted in the module menu + } + + /** + * Returns the module name which should be highlighted in the module menu */ protected function _getModuleTab() { global $app_list_strings, $moduleTabMap; - + // Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions. if ( !empty($_REQUEST['module_tab']) ) return $_REQUEST['module_tab']; @@ -960,7 +1025,7 @@ EOHTML; return $moduleTabMap[$this->module]; // Special cases elseif ( $this->module == 'MergeRecords' ) - return $_REQUEST['return_module']; + return !empty($_REQUEST['merge_module']) ? $_REQUEST['merge_module'] : $_REQUEST['return_module']; elseif ( $this->module == 'Users' && $this->action == 'SetTimezone' ) return 'Home'; // Default anonymous pages to be under Home @@ -969,7 +1034,7 @@ EOHTML; else return $this->module; } - + /** * Return the "breadcrumbs" to display at the top of the page * @@ -980,50 +1045,45 @@ EOHTML; $show_help = true ) { - global $sugar_version, $sugar_flavor, $server_unique_key, $current_language, $action; - - $theTitle = "
\n

"; - - $module = preg_replace("/ /","",$this->module); - + global $sugar_version, $sugar_flavor, $server_unique_key, $current_language, $action; + + $theTitle = "
\n

"; + + $module = preg_replace("/ /","",$this->module); + $params = $this->_getModuleTitleParams(); $count = count($params); $index = 0; - + + if(SugarThemeRegistry::current()->directionality == "rtl") { + $params = array_reverse($params); + } + foreach($params as $parm){ $index++; $theTitle .= $parm; if($index < $count){ - $theTitle .= "»"; + $theTitle .= $this->getBreadCrumbSymbol(); } } $theTitle .= "

\n"; - - if ($show_help) { + + if ($show_help) { $theTitle .= ""; - if (isset($this->action) && $this->action != "EditView") { - $printImageURL = SugarThemeRegistry::current()->getImageURL('print.gif'); - $theTitle .= << -{$GLOBALS['app_strings']['LNK_PRINT']} - -{$GLOBALS['app_strings']['LNK_PRINT']} - -EOHTML; - } - $helpImageURL = SugarThemeRegistry::current()->getImageURL('help.gif'); + + $createImageURL = SugarThemeRegistry::current()->getImageURL('create-record.gif'); $theTitle .= << -{$GLOBALS[ - -{$GLOBALS['app_strings']['LNK_HELP']} + +{$GLOBALS[ + +{$GLOBALS['app_strings']['LNK_CREATE']} EOHTML; } - + $theTitle .= "
\n"; - return $theTitle; + return $theTitle; } /** @@ -1031,52 +1091,54 @@ EOHTML; * * @return string File location of the metadata file. */ - public function getMetaDataFile(){ - + public function getMetaDataFile() + { $metadataFile = null; - $foundViewDefs = false; - $viewDef = strtolower($this->type) . 'viewdefs'; - $coreMetaPath = 'modules/'.$this->module.'/metadata/' . $viewDef . '.php'; - if(file_exists('custom/' .$coreMetaPath )){ - $metadataFile = 'custom/' . $coreMetaPath; - $foundViewDefs = true; - }else{ - if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){ - require_once('custom/modules/'.$this->module.'/metadata/metafiles.php'); - if(!empty($metafiles[$this->module][$viewDef])){ - $metadataFile = $metafiles[$this->module][$viewDef]; - $foundViewDefs = true; - } - }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ - require_once('modules/'.$this->module.'/metadata/metafiles.php'); - if(!empty($metafiles[$this->module][$viewDef])){ - $metadataFile = $metafiles[$this->module][$viewDef]; - $foundViewDefs = true; - } - } - } - - if(!$foundViewDefs && file_exists($coreMetaPath)){ - $metadataFile = $coreMetaPath; - } - $GLOBALS['log']->debug("metadatafile=". $metadataFile); - - return $metadataFile; + $foundViewDefs = false; + $viewDef = strtolower($this->type) . 'viewdefs'; + $coreMetaPath = 'modules/'.$this->module.'/metadata/' . $viewDef . '.php'; + if(file_exists('custom/' .$coreMetaPath )){ + $metadataFile = 'custom/' . $coreMetaPath; + $foundViewDefs = true; + }else{ + if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){ + require_once('custom/modules/'.$this->module.'/metadata/metafiles.php'); + if(!empty($metafiles[$this->module][$viewDef])){ + $metadataFile = $metafiles[$this->module][$viewDef]; + $foundViewDefs = true; + } + }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ + require_once('modules/'.$this->module.'/metadata/metafiles.php'); + if(!empty($metafiles[$this->module][$viewDef])){ + $metadataFile = $metafiles[$this->module][$viewDef]; + $foundViewDefs = true; + } + } + } + + if(!$foundViewDefs && file_exists($coreMetaPath)){ + $metadataFile = $coreMetaPath; + } + $GLOBALS['log']->debug("metadatafile=". $metadataFile); + + return $metadataFile; } - + /** * Returns an array composing of the breadcrumbs to use for the module title * + * @param bool $browserTitle true if the returned string is being used for the browser title, meaning + * there should be no HTML in the string * @return array */ - protected function _getModuleTitleParams($bTitle=false) + protected function _getModuleTitleParams($browserTitle = false) { - $params = array($this->_getModuleTitleListParam($bTitle)); - - if (isset($this->action)){ - switch ($this->action) { - case 'EditView': + $params = array($this->_getModuleTitleListParam($browserTitle)); + + if (isset($this->action)){ + switch ($this->action) { + case 'EditView': if(!empty($this->bean->id)) { $params[] = "".$this->bean->get_summary_text().""; $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL']; @@ -1088,60 +1150,67 @@ EOHTML; $beanName = $this->bean->get_summary_text(); $params[] = $beanName; break; - } - } - - return $params; + } + } + + return $params; } - + /** * Returns the portion of the array that will represent the listview in the breadcrumb * + * @param bool $browserTitle true if the returned string is being used for the browser title, meaning + * there should be no HTML in the string * @return string */ - protected function _getModuleTitleListParam($bTitle=false) + protected function _getModuleTitleListParam( $browserTitle = false ) { global $current_user; global $app_strings; - + if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) $firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module]; else $firstParam = $this->module; - + $iconPath = $this->getModuleTitleIconPath($this->module); - if($this->action == "ListView" || $this->action == "index") - { - if (!empty($iconPath) && !$bTitle) { - return "" - . "".$this->module."" - . "»".$app_strings['LBL_SEARCH']; + if($this->action == "ListView" || $this->action == "index") { + if (!empty($iconPath) && !$browserTitle) { + if (SugarThemeRegistry::current()->directionality == "ltr") { + return "" + . "".$this->module."" + . $this->getBreadCrumbSymbol().$app_strings['LBL_SEARCH']; + } else { + return $app_strings['LBL_SEARCH'].$this->getBreadCrumbSymbol() + . "" + . "".$this->module.""; + } } else { return $firstParam; } - } else - { - if (!empty($iconPath) && !$bTitle) { - return "" + } + else { + if (!empty($iconPath) && !$browserTitle) { + return "" . "".$this->module.""; } else { - return "{$firstParam}"; + return "{$firstParam}"; } } } - - protected function getModuleTitleIconPath($module) { + + protected function getModuleTitleIconPath($module) + { $iconPath = ""; - if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) - { + if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) { $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png'); - } else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) - { + } + else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) { $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png'); } return $iconPath; } - + /** * Returns the string which will be shown in the browser's title; defaults to using the same breadcrumb * as in the module title @@ -1151,14 +1220,29 @@ EOHTML; public function getBrowserTitle() { global $app_strings; - + $browserTitle = $app_strings['LBL_BROWSER_TITLE']; if ( $this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login') ) return $browserTitle; $params = $this->_getModuleTitleParams(true); - foreach ($params as $value ) + foreach ($params as $value ) $browserTitle = strip_tags($value) . ' » ' . $browserTitle; - + return $browserTitle; } + + /** + * Returns the correct breadcrumb symbol according to theme's directionality setting + * + * @return string + */ + public function getBreadCrumbSymbol() + { + if(SugarThemeRegistry::current()->directionality == "ltr") { + return "»"; + } + else { + return "«"; + } + } } diff --git a/include/MVC/View/ViewFactory.php b/include/MVC/View/ViewFactory.php index 45c64999..18139383 100644 --- a/include/MVC/View/ViewFactory.php +++ b/include/MVC/View/ViewFactory.php @@ -1,6 +1,6 @@ {$MOD.LBL_IMPORT_VCARDTEXT}
+ {literal} - diff --git a/include/MySugar/tpls/addDashletsDialog.tpl b/include/MySugar/tpls/addDashletsDialog.tpl index 619c4f56..99e834e4 100644 --- a/include/MySugar/tpls/addDashletsDialog.tpl +++ b/include/MySugar/tpls/addDashletsDialog.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/MySugar/tpls/chartDashletsSearchResults.tpl b/include/MySugar/tpls/chartDashletsSearchResults.tpl index 3cd9167d..b9e705a7 100644 --- a/include/MySugar/tpls/chartDashletsSearchResults.tpl +++ b/include/MySugar/tpls/chartDashletsSearchResults.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -42,7 +42,7 @@ {foreach from=$charts item=chart} - + {/foreach}
{$chart.icon} {$chart.title}
{$chart.icon} {$chart.title}
diff --git a/include/MySugar/tpls/dashletsSearchResults.tpl b/include/MySugar/tpls/dashletsSearchResults.tpl index a9a1ccb1..264b8133 100644 --- a/include/MySugar/tpls/dashletsSearchResults.tpl +++ b/include/MySugar/tpls/dashletsSearchResults.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -45,7 +45,7 @@ {if $rowCounter % 2 == 0}

{$module.icon} {$module.title}
{$module.icon} {$module.title}
{foreach from=$reportCharts item=chart} - + {/foreach}
{$chart.title}
{$chart.title}
\ No newline at end of file diff --git a/include/OutboundEmail/OutboundEmail.php b/include/OutboundEmail/OutboundEmail.php index 65a4c8ff..e6efdddb 100644 --- a/include/OutboundEmail/OutboundEmail.php +++ b/include/OutboundEmail/OutboundEmail.php @@ -1,7 +1,7 @@ _popupMeta['create']['formBaseClass'](); if(isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'save') { - $formBase->handleSave('', false, true); + //If it's a new record, set useRequired to false + $useRequired = empty($_REQUEST['id']) ? false : true; + $formBase->handleSave('', false, $useRequired); } } @@ -298,6 +300,7 @@ class PopupSmarty extends ListViewSmarty{ $this->searchForm->lv = $lv; $this->searchForm->displaySavedSearch = false; + $this->searchForm->populateFromRequest('advanced_search'); $searchWhere = $this->_get_where_clause(); $this->searchColumns = $this->searchForm->searchColumns; diff --git a/include/Popups/Popup_picker.php b/include/Popups/Popup_picker.php index d2d057c9..3278c64d 100644 --- a/include/Popups/Popup_picker.php +++ b/include/Popups/Popup_picker.php @@ -1,7 +1,7 @@ searchFields)) { $arrayKeys = array_keys($array); $searchFieldsKeys = array_keys($this->searchFields); @@ -430,60 +430,82 @@ require_once('include/EditView/EditView2.php'); } } } - } + }else{ $fromMergeRecords = isset($array['merge_module']); foreach($this->searchFields as $name => $params) { - $long_name = $name.'_'.$SearchName; /*nsingh 21648: Add additional check for bool values=0. empty() considers 0 to be empty Only repopulates if value is 0 or 1:( */ - if(isset($array[$long_name]) && ( $array[$long_name] !== '' - || (isset($this->fieldDefs[$long_name]) && $this->fieldDefs[$long_name]['type'] == 'bool' - && ($array[$long_name]=='0' || $array[$long_name]=='1'))) ) - { //advanced*/ + $long_name = $name.'_'.$SearchName; + /*nsingh 21648: Add additional check for bool values=0. empty() considers 0 to be empty Only repopulates if value is 0 or 1:( */ + if(isset($array[$long_name]) && !$this->isEmptyDropdownField($long_name, $array[$long_name]) && ( $array[$long_name] !== '' || (isset($this->fieldDefs[$long_name]['type']) && $this->fieldDefs[$long_name]['type'] == 'bool'&& ($array[$long_name]=='0' || $array[$long_name]=='1')))) + { //advanced*/ $this->searchFields[$name]['value'] = $array[$long_name]; if(empty($this->fieldDefs[$long_name]['value'])) { $this->fieldDefs[$long_name]['value'] = $array[$long_name]; } - }else if(!empty($array[$name]) && !$fromMergeRecords) { //basic - $this->searchFields[$name]['value'] = $array[$name]; - if(empty($this->fieldDefs[$long_name]['value'])) $this->fieldDefs[$long_name]['value'] = $array[$name]; + }else if(!empty($array[$name]) && !$fromMergeRecords && !$this->isEmptyDropdownField($name, $array[$name])) { //basic + $this->searchFields[$name]['value'] = $array[$name]; + if(empty($this->fieldDefs[$name]['value'])) { + $this->fieldDefs[$name]['value'] = $array[$name]; + } } + + if(!empty($params['enable_range_search']) && isset($this->searchFields[$name]['value'])) + { + if(preg_match('/^range_(.*?)$/', $long_name, $match) && isset($array[$match[1].'_range_choice'])) + { + $this->searchFields[$name]['operator'] = $array[$match[1].'_range_choice']; + } + } + + if(!empty($params['is_date_field']) && isset($this->searchFields[$name]['value'])) + { + global $timedate; + $date_value = $timedate->to_db_date($this->searchFields[$name]['value']); + $this->searchFields[$name]['value'] = $date_value == '' ? $this->searchFields[$name]['value'] : $date_value; + } } - + if((empty($array['massupdate']) || $array['massupdate'] == 'false') && $addAllBeanFields) { foreach($this->seed->field_name_map as $key => $params) { if($key != 'assigned_user_name' && $key != 'modified_by_name') { - if(in_array($key.'_'.$SearchName, $arrayKeys) && !in_array($key, $searchFieldsKeys)) { - $this->searchFields[$key] = array('query_type' => 'default', - 'value' => $array[$key.'_'.$SearchName]); + $long_name = $key.'_'.$SearchName; + + if(in_array($key.'_'.$SearchName, $arrayKeys) && !in_array($key, $searchFieldsKeys) && !$this->isEmptyDropdownField($long_name, $array[$long_name])) + { + + $this->searchFields[$key] = array('query_type' => 'default', 'value' => $array[$long_name]); + if (!empty($params['type']) && $params['type'] == 'parent' && !empty($params['type_name']) && !empty($this->searchFields[$key]['value'])) { $this->searchFields[$params['type_name']] = array('query_type' => 'default', 'value' => $array[$params['type_name']]); - } + } + if(empty($this->fieldDefs[$long_name]['value'])) { - $this->fieldDefs[$key.'_'.$SearchName]['value'] = $array[$key.'_'.$SearchName]; + $this->fieldDefs[$long_name]['value'] = $array[$long_name]; } } } } - - } + } } + if ( is_array($this->searchFields) ) { foreach ( $this->searchFields as $fieldName => $field ) { if ( !empty($field['value']) && is_string($field['value']) ) { $this->searchFields[$fieldName]['value'] = trim($field['value']); } } - } + } + } /** @@ -500,7 +522,6 @@ require_once('include/EditView/EditView2.php'); global $timedate; $this->searchColumns = array () ; - $values = $this->searchFields; $where_clauses = array(); @@ -509,6 +530,7 @@ require_once('include/EditView/EditView2.php'); $this->seed->fill_in_additional_detail_fields(); //rrs check for team_id + foreach($this->searchFields as $field=>$parms) { $customField = false; // Jenny - Bug 7462: We need a type check here to avoid database errors @@ -516,6 +538,48 @@ require_once('include/EditView/EditView2.php'); // a generic search form validation mechanism. $type = (!empty($this->seed->field_name_map[$field]['type']))?$this->seed->field_name_map[$field]['type']:''; + if(!empty($parms['enable_range_search']) && empty($type)) + { + if(preg_match('/^start_range_(.*?)$/', $field, $match)) + { + $real_field = $match[1]; + $start_field = 'start_range_' . $real_field; + $end_field = 'end_range_' . $real_field; + + if(isset($this->searchFields[$start_field]['value']) && isset($this->searchFields[$end_field]['value'])) + { + $this->searchFields[$real_field]['value'] = $this->searchFields[$start_field]['value'] . '<>' . $this->searchFields[$end_field]['value']; + $this->searchFields[$real_field]['operator'] = 'between'; + $parms['value'] = $this->searchFields[$real_field]['value']; + $parms['operator'] = 'between'; + $field = $real_field; + unset($this->searchFields[$end_field]['value']); + } + } else if (preg_match('/^range_(.*?)$/', $field, $match) && isset($this->searchFields[$field]['value'])) { + $real_field = $match[1]; + + //Special case for datetime and datetimecombo fields. By setting the type here we allow an actual between search + if($parms['operator'] == '=') + { + $field_type = isset($this->seed->field_name_map[$real_field]['type']) ? $this->seed->field_name_map[$real_field]['type'] : ''; + if($field_type == 'datetimecombo' || $field_type == 'datetime') + { + $type = $field_type; + } + } + + $this->searchFields[$real_field]['value'] = $this->searchFields[$field]['value']; + $this->searchFields[$real_field]['operator'] = $this->searchFields[$field]['operator']; + $params['value'] = $this->searchFields[$field]['value']; + $params['operator'] = $this->searchFields[$field]['operator']; + unset($this->searchFields[$field]['value']); + $field = $real_field; + } else { + //Skip this range search field, it is the end field THIS IS NEEDED or the end range date will break the query + continue; + } + } + if(!empty($this->seed->field_name_map[$field]['source']) && ($this->seed->field_name_map[$field]['source'] == 'custom_fields' || //Non-db custom fields, such as custom relates @@ -550,9 +614,10 @@ require_once('include/EditView/EditView2.php'); elseif($type == 'html' && $customField) { continue; } - - if(isset($parms['value']) && $parms['value'] != "") { + + if(isset($parms['value']) && $parms['value'] != "") { + $operator = 'like'; if(!empty($parms['operator'])) { $operator = $parms['operator']; @@ -603,8 +668,7 @@ require_once('include/EditView/EditView2.php'); } } - } - else { + } else { $field_value = $GLOBALS['db']->quote($parms['value']); } @@ -613,22 +677,32 @@ require_once('include/EditView/EditView2.php'); $parms['db_field'] = array($field); } - if(isset($parms['my_items']) and $parms['my_items'] == true) { - if( $parms['value'] == false ) { //do not include where clause for custom fields with checkboxes that are unchecked - + //This if-else block handles the shortcut checkbox selections for "My Items" and "Closed Only" + if(!empty($parms['my_items'])) { + if( $parms['value'] == false ) { continue; - } - else{ //my items is checked. + } else { + //my items is checked. global $current_user; $field_value = $GLOBALS['db']->quote($current_user->id); $operator = '=' ; } -// $operator = ($parms['value'] == '1') ? '=' : '!='; - } - + } else if(!empty($parms['closed_values']) && is_array($parms['closed_values'])) { + if( $parms['value'] == false ) { + continue; + } else { + $field_value = ''; + foreach($parms['closed_values'] as $closed_value) + { + $field_value .= ",'" . $GLOBALS['db']->quote($closed_value) . "'"; + } + $field_value = substr($field_value, 1); + } + } + $where = ''; $itr = 0; - + if($field_value != '' || $operator=='isnull') { $this->searchColumns [ strtoupper($field) ] = $field ; @@ -647,6 +721,8 @@ require_once('include/EditView/EditView2.php'); //Best Guess for table name $db_field = strtolower($link['module']) . '.' . $db_field; } + + } else if ($type == 'parent') { if (!empty($this->searchFields['parent_type'])) { @@ -700,42 +776,73 @@ require_once('include/EditView/EditView2.php'); } if($type == 'datetime' || $type == 'datetimecombo') { - $dates = $timedate->getDayStartEndGMT($field_value); - $field_value = $dates["start"] . "<>" . $dates["end"]; - $operator = 'between'; + try { + $dates = $timedate->getDayStartEndGMT($field_value); + $field_value = $dates["start"] . "<>" . $dates["end"]; + $operator = 'between'; + } catch(Exception $timeException) { + //In the event that a date value is given that cannot be correctly processed by getDayStartEndGMT method, + //just skip searching on this field and continue. This may occur if user switches locale date formats + //in another browser screen, but re-runs a search with the previous format on another screen + $GLOBALS['log']->error($timeException->getMessage()); + continue; + } } - if($type == 'decimal' || $type == 'float' || $type == 'currency') { - require_once('modules/Currencies/Currency.php'); - - $field_value = unformat_number($field_value); - if ( $type == 'currency' && stripos($field,'_usdollar')!==FALSE ) { - // It's a US Dollar field, we need to do some conversions from the user's local currency - $currency_id = $GLOBALS['current_user']->getPreference('currency'); - if ( empty($currency_id) ) { - $currency_id = -99; - } - if ( $currency_id != -99 ) { - $currency = new Currency(); - $currency->retrieve($currency_id); - $field_value = $currency->convertToDollar($field_value); - } - } + + if($type == 'decimal' || $type == 'float' || $type == 'currency' || (!empty($parms['enable_range_search']) && empty($parms['is_date_field']))) { + require_once('modules/Currencies/Currency.php'); + + //we need to handle formatting either a single value or 2 values in case the 'between' search option is set + //start by splitting the string if the between operator exists + $fieldARR = explode('<>', $field_value); + //set the first pass through boolean + $first_between = true; + + foreach($fieldARR as $fk => $fv){ + //reset the field value, it will be rebuild in the foreach loop below + $tmpfield_value = unformat_number($fv); + + if ( $type == 'currency' && stripos($field,'_usdollar')!==FALSE ) { + // It's a US Dollar field, we need to do some conversions from the user's local currency + $currency_id = $GLOBALS['current_user']->getPreference('currency'); + if ( empty($currency_id) ) { + $currency_id = -99; + } + if ( $currency_id != -99 ) { + $currency = new Currency(); + $currency->retrieve($currency_id); + $field_value = $currency->convertToDollar($tmpfield_value); + } + } + + //recreate the field value + if($first_between){ + //set the field value with the new formatted temp value + $field_value = $tmpfield_value; + }else{ + //this is a between query, so append the between operator and add the second formatted temp value + $field_value .= '<>'.$tmpfield_value; + } + //set the first pass through variable to false + $first_between = false; + } + + if(!empty($parms['enable_range_search']) && $parms['operator'] == '=') + { + // Databases can't really search for floating point numbers, because they can't be accurately described in binary, + // So we have to fuzz out the math a little bit + $field_value = ($field_value - 0.01) . "<>" . ($field_value + 0.01); + $operator = 'between'; + } + } - // Databases can't really search for floating point numbers, because they can't be accurately described in binary, - // So we have to fuzz out the match a little bit - $top = $field_value + 0.01; - $bottom = $field_value - 0.01; - $field_value = $bottom . "<>" . $top; - $operator = 'between'; - } - $itr++; if(!empty($where)) { $where .= " OR "; } - + switch(strtolower($operator)) { case 'subquery': $in = 'IN'; @@ -781,15 +888,15 @@ require_once('include/EditView/EditView2.php'); if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'UnifiedSearch'){ $UnifiedSearch = true; } + //check to see if this is a universal search, AND the field name is "last_name" if($UnifiedSearch && strpos($db_field, 'last_name') !== false){ //split the string value, and the db field name $string = explode(' ', $field_value); $column_name = explode('.', $db_field); - //when a search is done with a space, we concatenate and search against the full name. if(count($string)>1){ - //add where clause agains concatenated fields + //add where clause against concatenated fields $where .= $GLOBALS['db']->concat($column_name[0],array('first_name','last_name')) . " LIKE '{$field_value}%'"; $where .= ' OR ' . $GLOBALS['db']->concat($column_name[0],array('last_name','first_name')) . " LIKE '{$field_value}%'"; }else{ @@ -797,14 +904,38 @@ require_once('include/EditView/EditView2.php'); $where .= $db_field . " like '".$field_value.$like_char."'"; } - }else{ + }else { + + //Check if this is a first_name, last_name search + if(isset($this->seed->field_name_map) && isset($this->seed->field_name_map[$db_field])) + { + $vardefEntry = $this->seed->field_name_map[$db_field]; + if(!empty($vardefEntry['db_concat_fields']) && in_array('first_name', $vardefEntry['db_concat_fields']) && in_array('last_name', $vardefEntry['db_concat_fields'])) + { + if(!empty($GLOBALS['app_list_strings']['salutation_dom']) && is_array($GLOBALS['app_list_strings']['salutation_dom'])) + { + foreach($GLOBALS['app_list_strings']['salutation_dom'] as $salutation) + { + if(!empty($salutation) && strpos($field_value, $salutation) == 0) + { + $field_value = trim(substr($field_value, strlen($salutation))); + break; + } + } + } + } + } + //field is not last name or this is not from global unified search, so do normal where clause $where .= $db_field . " like '".$field_value.$like_char."'"; } } break; + case 'not in': + $where .= $db_field . ' not in ('.$field_value.')'; + break; case 'in': - $where .= $db_field . " in (".$field_value.')'; + $where .= $db_field . ' in ('.$field_value.')'; break; case '=': if($type == 'bool' && $field_value == 0) { @@ -837,6 +968,101 @@ require_once('include/EditView/EditView2.php'); case 'innerjoin': $this->seed->listview_inner_join[] = $parms['innerjoin'] . " '" . $parms['value'] . "%')"; break; + case 'not_equal': + $where .= $db_field . " != '". $field_value . "'"; + break; + case 'greater_than': + $where .= $db_field . " > '". $field_value . "'"; + break; + case 'greater_than_equals': + $where .= $db_field . " >= '". $field_value . "'"; + break; + case 'less_than': + $where .= $db_field . " < '". $field_value . "'"; + break; + case 'less_than_equals': + $where .= $db_field . " <= '". $field_value . "'"; + break; + case 'last_7_days': + if($GLOBALS['db']->dbType == 'mysql') { + $where .= "LEFT(" . $db_field . ",10) BETWEEN LEFT((current_date - interval '7' day),10) AND LEFT(current_date,10)"; + } + elseif ($GLOBALS['db']->dbType == 'mssql') { + $where .= "DATEDIFF ( d , " . $db_field . " , GETDATE() ) <= 7 and DATEDIFF ( d , " . $db_field . " , GETDATE() ) >= 0"; + } + break; + case 'next_7_days': + if($GLOBALS['db']->dbType == 'mysql') { + $where .= "LEFT(" . $db_field . ",10) BETWEEN LEFT(current_date,10) AND LEFT((current_date + interval '7' day),10)"; + } + elseif ($GLOBALS['db']->dbType == 'mssql') { + $where .= "DATEDIFF ( d , GETDATE() , " . $db_field . " ) <= 7 and DATEDIFF ( d , GETDATE() , " . $db_field . " ) >= 0"; + } + break; + case 'next_month': + if ($GLOBALS['db']->dbType == 'mysql') { + $where .= "LEFT(" . $db_field . ",7) = LEFT( (current_date + interval '1' month),7)"; + } + elseif ($GLOBALS['db']->dbType == 'mssql') { + $where .= "(LEFT( ".$db_field.",4) = LEFT( (DATEADD(mm,1,GETDATE())),4)) and (DATEPART(yy, DATEADD(mm,1,GETDATE())) = DATEPART(yy, DATEADD(mm,1,".$db_field.")))"; + } + break; + case 'last_month': + if ($GLOBALS['db']->dbType == 'mysql') { + $where .= "LEFT(" . $db_field . ",7) = LEFT( (current_date - interval '1' month),7)"; + } + elseif ($GLOBALS['db']->dbType == 'mssql') { + $where .= "LEFT(" . $db_field . ",4) = LEFT((DATEADD(mm,-1,GETDATE())),4) and DATEPART(yy," . $db_field . ") = DATEPART(yy, GETDATE())"; + } + break; + case 'this_month': + if ($GLOBALS['db']->dbType == 'mysql') { + $where .= "LEFT(" . $db_field . ",7) = LEFT( current_date,7)"; + } + elseif ($GLOBALS['db']->dbType == 'mssql') { + $where .= "LEFT (" . $db_field . ",4) = LEFT( GETDATE(),4) and DATEPART(yy," . $db_field . ") = DATEPART(yy, GETDATE())"; + } + break; + case 'last_30_days': + if ($GLOBALS['db']->dbType == 'mysql') { + $where .= "LEFT(" . $db_field . ",10) BETWEEN LEFT((current_date - interval '30' day),10) AND LEFT(current_date,10)"; + } + elseif ($GLOBALS['db']->dbType == 'mssql') { + $where .= "DATEDIFF ( d , " . $db_field . " , GETDATE() ) <= 30 and DATEDIFF ( d , " . $db_field . " , GETDATE() ) >= 0"; + } + break; + case 'next_30_days': + if ($GLOBALS['db']->dbType == 'mysql') { + $where .= $db_field . " BETWEEN (current_date) AND (current_date + interval '1' month)"; + } + elseif ($GLOBALS['db']->dbType == 'mssql') { + $where .= "DATEDIFF ( d , GETDATE() , " . $db_field . " ) <= 30 and DATEDIFF ( d , GETDATE() , " . $db_field . " ) >= 0"; + } + break; + case 'this_year': + if ($GLOBALS['db']->dbType == 'mysql') { + $where .= "LEFT(" . $db_field . ",4) = EXTRACT(YEAR FROM ( current_date ))"; + } + elseif ($GLOBALS['db']->dbType == 'mssql') { + $where .= "DATEPART(yy," . $db_field . ") = DATEPART(yy, GETDATE())"; + } + break; + case 'last_year': + if ($GLOBALS['db']->dbType == 'mysql') { + $where .= "LEFT(" . $db_field . ",4) = EXTRACT(YEAR FROM ( current_date - interval '1' year))"; + } + elseif ($GLOBALS['db']->dbType == 'mssql') { + $where .= "DATEPART(yy," . $db_field . ") = DATEPART(yy,( dateadd(yy,-1,GETDATE())))"; + } + break; + case 'next_year': + if ($GLOBALS['db']->dbType == 'mysql') { + $where .= "LEFT(" . $db_field . ",4) = EXTRACT(YEAR FROM ( current_date + interval '1' year))"; + } + elseif ($GLOBALS['db']->dbType == 'mssql') { + $where .= "DATEPART(yy," . $db_field . ") = DATEPART(yy,( dateadd(yy, 1,GETDATE())))"; + } + break; case 'isnull': // OOTB fields are NULL, custom fields are blank $where .= '('.$db_field . ' IS NULL or ' . $db_field . "='')"; @@ -857,9 +1083,24 @@ require_once('include/EditView/EditView2.php'); } } } - + return $where_clauses; } + + + /** + * isEmptyDropdownField + * + * This function checks to see if a blank dropdown field was supplied. This scenario will occur where + * a dropdown select is in single selection mode + * + * @param $value Mixed dropdown value + */ + private function isEmptyDropdownField($name='', $value=array()) + { + $result = is_array($value) && isset($value[0]) && $value[0] == ''; + $GLOBALS['log']->debug("Found empty value for {$name} dropdown search key"); + return $result; + } } - -?> +?> \ No newline at end of file diff --git a/include/SearchForm/SugarSpot.php b/include/SearchForm/SugarSpot.php index 437db9f3..c33db586 100644 --- a/include/SearchForm/SugarSpot.php +++ b/include/SearchForm/SugarSpot.php @@ -1,7 +1,7 @@ _performSearch($query, $modules, $offset); + $str = '
'; + $actions=0; $foundData = false; - foreach($results as $m=>$data){ + foreach($results as $m=>$data){ if(empty($data['data'])){ continue; } + $foundData = true; - + $countRemaining = $data['pageData']['offsets']['total'] - count($data['data']); if($offset > 0) $countRemaining -= $offset; $more = ''; $data['pageData']['offsets']['next']++; if($countRemaining > 0){ $more = <<($countRemaining more) +($countRemaining {$GLOBALS['app_strings']['LBL_SEARCH_MORE']}) EOHTML; } - + $modDisplayString = $m; if(isset($GLOBALS['app_list_strings']['moduleList'][$m])) $modDisplayString = $GLOBALS['app_list_strings']['moduleList'][$m]; - + $str.= "
{$modDisplayString} $more
"; $str.= '
    '; foreach($data['data'] as $row){ $name = ''; + if(!empty($row['NAME'])){ $name = $row['NAME']; - }else{ + } else if(!empty($row['DOCUMENT_NAME'])) { + $name = $row['DOCUMENT_NAME']; + } else { foreach($row as $k=>$v){ - if(strpos($k, 'NAME') !== false){ + if(strpos($k, 'NAME') !== false && !empty($row[$k])){ $name = $v; break; } } + + if(empty($name)) + { + foreach($row as $k=>$v){ + if(strpos($k, 'NAME') !== false){ + $name = $v; + break; + } + } + } } - + $str .= <<$name EOHTML; } $str.= '
'; } - $str .= <<{$GLOBALS['app_strings']['LBL_EMAIL_SHOW_READ']} -
+ + if($foundData) + { + $str = <<{$GLOBALS['app_strings']['LBL_EMAIL_SHOW_READ']} +

+ {$str} + +

+ +EOHTML; + } else { + $str .= $GLOBALS['app_strings']['LBL_EMAIL_SEARCH_NO_RESULTS']; + $str .= << +

+ EOHTML; + + } + return $str; } - + /** - * Returns the array containing the $searchFields for a module + * Returns the array containing the $searchFields for a module. This function + * first checks the default installation directories for the SearchFields.php file and then + * loads any custom definition (if found) * - * @param $moduleName string - * @return array + * @param $moduleName String name of module to retrieve SearchFields entries for + * @return array of SearchFields */ - protected function getSearchFields( + protected static function getSearchFields( $moduleName ) { - if(file_exists("modules/{$moduleName}/metadata/SearchFields.php")) { - $searchFields = array(); - require "modules/{$moduleName}/metadata/SearchFields.php" ; - return $searchFields; + $searchFields = array(); + + if(file_exists("modules/{$moduleName}/metadata/SearchFields.php")) + { + require("modules/{$moduleName}/metadata/SearchFields.php"); } - else { - return array(); + + if(file_exists("custom/modules/{$moduleName}/metadata/SearchFields.php")) + { + require("custom/modules/{$moduleName}/metadata/SearchFields.php"); } + + return $searchFields; + } + + + /** + * Get count from query + * @param SugarBean $seed + * @param string $main_query + */ + protected function _getCount($seed, $main_query) + { +// $count_query = $seed->create_list_count_query($main_query); + $result = $seed->db->query("SELECT COUNT(*) as c FROM ($main_query) main"); + $row = $seed->db->fetchByAssoc($result); + return isset($row['c'])?$row['c']:0; } + /** * Performs the search * @@ -133,118 +188,254 @@ EOHTML; * @return array */ protected function _performSearch( - $query, - $modules, + $query, + $modules, $offset = -1 ) { + if(empty($query)) return array(); $primary_module=''; $results = array(); require_once 'include/SearchForm/SearchForm2.php' ; $where = ''; - - $searchEmail = preg_match('/^([^\%]|\%)*@([^\%]|\%)*$/', $query); - - foreach($modules as $moduleName){ - if (empty($primary_module)) $primary_module=$moduleName; + $searchEmail = preg_match('/^([^%]|%)*@([^%]|%)*$/', $query); + + $limit = ( !empty($GLOBALS['sugar_config']['max_spotresults_initial']) ? $GLOBALS['sugar_config']['max_spotresults_initial'] : 5 ); + if($offset !== -1){ + $limit = ( !empty($GLOBALS['sugar_config']['max_spotresults_more']) ? $GLOBALS['sugar_config']['max_spotresults_more'] : 20 ); + } + $totalCounted = empty($GLOBALS['sugar_config']['disable_count_query']); + + + foreach($modules as $moduleName){ + if (empty($primary_module)) + { + $primary_module=$moduleName; + } + + $searchFields = SugarSpot::getSearchFields($moduleName); - $searchFields = SugarSpot::getSearchFields($moduleName); + if (empty($searchFields[$moduleName])) + { + continue; + } + $class = $GLOBALS['beanList'][$moduleName]; $return_fields = array(); $seed = new $class(); - if (empty($searchFields[$moduleName])) - continue; - - if ($class == 'aCase') { - $class = 'Case'; - } - foreach($searchFields[$moduleName] as $k=>$v){ - $keep = false; - $searchFields[$moduleName][$k]['value'] = $query; - - if(!empty($GLOBALS['dictionary'][$class]['unified_search'])){ - if(empty($GLOBALS['dictionary'][$class]['fields'][$k]['unified_search'])){ - - if(isset($searchFields[$moduleName][$k]['db_field'])){ - foreach($searchFields[$moduleName][$k]['db_field'] as $field){ - if(!empty($GLOBALS['dictionary'][$class]['fields'][$field]['unified_search'])){ - $return_fields[] = $field; - $keep = true; - } - } - } - if(!$keep){ - if(strpos($k,'email') === false || !$searchEmail) { - unset($searchFields[$moduleName][$k]); + if(!$seed->ACLAccess('ListView')) continue; + + if ($class == 'aCase') { + $class = 'Case'; + } + + foreach($searchFields[$moduleName] as $k=>$v){ + $keep = false; + $searchFields[$moduleName][$k]['value'] = $query; + + if(!empty($GLOBALS['dictionary'][$class]['unified_search'])){ + if(empty($GLOBALS['dictionary'][$class]['fields'][$k]['unified_search'])){ + + if(isset($searchFields[$moduleName][$k]['db_field'])){ + foreach($searchFields[$moduleName][$k]['db_field'] as $field){ + if(!empty($GLOBALS['dictionary'][$class]['fields'][$field]['unified_search'])){ + $keep = true; } } - }else{ - $return_fields[] = $k; } - }else if(empty($GLOBALS['dictionary'][$class]['fields'][$k]) ){; - unset($searchFields[$moduleName][$k]); - }else{ - switch($GLOBALS['dictionary'][$class]['fields'][$k]['type']){ - case 'id': - case 'date': - case 'datetime': - case 'bool': + if(!$keep){ + if(strpos($k,'email') === false || !$searchEmail) { unset($searchFields[$moduleName][$k]); - default: - $return_fields[] = $k; - + } } - + }else{ + if($GLOBALS['dictionary'][$class]['fields'][$k]['type'] == 'int' && !is_numeric($query)) { + unset($searchFields[$moduleName][$k]); + } + } + }else if(empty($GLOBALS['dictionary'][$class]['fields'][$k]) ){ + //If module did not have unified_search defined, then check the exception for an email search before we unset + if(strpos($k,'email') === false || !$searchEmail) + { + unset($searchFields[$moduleName][$k]); + } + }else{ + switch($GLOBALS['dictionary'][$class]['fields'][$k]['type']){ + case 'id': + case 'date': + case 'datetime': + case 'bool': + unset($searchFields[$moduleName][$k]); + break; + case 'int': + if(!is_numeric($query)) { + unset($searchFields[$moduleName][$k]); + break; + } } - } + } + + if (empty($searchFields[$moduleName])) continue; + + if(isset($seed->field_defs['name'])) { + $return_fields['name'] = $seed->field_defs['name']; + } + + foreach($seed->field_defs as $k => $v) { + if(isset($seed->field_defs[$k]['type']) && ($seed->field_defs[$k]['type'] == 'name') && !isset($return_fields[$k])) { + $return_fields[$k] = $seed->field_defs[$k]; + } + } + + if(!isset($return_fields['name'])) { + // if we couldn't find any name fields, try search fields that have name in it + foreach($searchFields[$moduleName] as $k => $v) { + if(strpos($k, 'name') != -1 && isset($seed->field_defs[$k]) + && !isset($seed->field_defs[$k]['source'])) { + $return_fields[$k] = $seed->field_defs[$k]; + break; + } + } + } + + if(!isset($return_fields['name'])) { + // last resort - any fields that have 'name' in their name + foreach($seed->field_defs as $k => $v) { + if(strpos($k, 'name') != -1 && isset($seed->field_defs[$k]) + && !isset($seed->field_defs[$k]['source'])) { + $return_fields[$k] = $seed->field_defs[$k]; + break; + } + } + } + + if(!isset($return_fields['name'])) { + // FAIL: couldn't find id & name for the module + $GLOBALS['log']->error("Unable to find name for module $moduleName"); + continue; + } + + if(isset($return_fields['name']['fields'])) { + // some names are composite + foreach($return_fields['name']['fields'] as $field) { + $return_fields[$field] = $seed->field_defs[$field]; + } + } + - $searchForm = new SearchForm ( $seed, $moduleName ) ; $searchForm->setup (array ( $moduleName => array() ) , $searchFields , '' , 'saved_views' /* hack to avoid setup doing further unwanted processing */ ) ; $where_clauses = $searchForm->generateSearchWhere() ; - $where = ""; - if (count($where_clauses) > 0){ - $where = '(('. implode(' ) OR ( ', $where_clauses) . '))'; - } - $lvd = new ListViewData(); - $lvd->additionalDetails = false; - $max = ( !empty($sugar_config['max_spotresults_initial']) ? $sugar_config['max_spotresults_initial'] : 5 ); - if($offset !== -1){ - $max = ( !empty($sugar_config['max_spotresults_more']) ? $sugar_config['max_spotresults_more'] : 20 ); + if(empty($where_clauses)) { + continue; } - $params = array(); - if ( $moduleName == 'Reports') { - $params['overrideOrder'] = true; - $params['orderBy'] = 'name'; + if(count($where_clauses) > 1) { + $query_parts = array(); + + $ret_array_start = $seed->create_new_list_query('', '', $return_fields, array(), 0, '', true, $seed, true); + $search_keys = array_keys($searchFields[$moduleName]); + + foreach($where_clauses as $n => $clause) { + $allfields = $return_fields; + $skey = $search_keys[$n]; + if(isset($seed->field_defs[$skey])) { + // Joins for foreign fields aren't produced unless the field is in result, hence the merge + $allfields[$skey] = $seed->field_defs[$skey]; + } + $ret_array = $seed->create_new_list_query('', $clause, $allfields, array(), 0, '', true, $seed, true); + $query_parts[] = $ret_array_start['select'] . $ret_array['from'] . $ret_array['where'] . $ret_array['order_by']; + } + $main_query = "(".join(") UNION (", $query_parts).")"; + } else { + foreach($searchFields[$moduleName] as $k=>$v){ + if(isset($seed->field_defs[$k])) { + $return_fields[$k] = $seed->field_defs[$k]; + } + } + $ret_array = $seed->create_new_list_query('', $where_clauses[0], $return_fields, array(), 0, '', true, $seed, true); + $main_query = $ret_array['select'] . $ret_array['from'] . $ret_array['where'] . $ret_array['order_by']; } - $results[$moduleName]= $lvd->getListViewData($seed, $where, $offset, $max, $return_fields,$params,'id') ; - + + $totalCount = null; + if($limit < -1) { + $result = $seed->db->query($main_query); + } else { + if($limit == -1) { + $limit = $GLOBALS['sugar_config']['list_max_entries_per_page']; + } + + if($offset == 'end') { + $totalCount = $this->_getCount($seed, $main_query); + if($totalCount) { + $offset = (floor(($totalCount -1) / $limit)) * $limit; + } else { + $offset = 0; + } + } + $result = $seed->db->limitQuery($main_query, $offset, $limit + 1); + } + + $data = array(); + $count = 0; + while($count < $limit && ($row = $seed->db->fetchByAssoc($result))) { + $temp = clone $seed; + $temp->setupCustomFields($temp->module_dir); + $temp->loadFromRow($row); + $data[] = $temp->get_list_view_data($return_fields); + $count++; + } + + $nextOffset = -1; + $prevOffset = -1; + $endOffset = -1; + + if($count >= $limit) { + $nextOffset = $offset + $limit; + } + + if($offset > 0) { + $prevOffset = $offset - $limit; + if($prevOffset < 0) $prevOffset = 0; + } + + if( $count >= $limit && $totalCounted){ + if(!isset($totalCount)) { + $totalCount = $this->_getCount($seed, $main_query); + } + } else { + $totalCount = $count + $offset; + } + + $pageData['offsets'] = array( 'current'=>$offset, 'next'=>$nextOffset, 'prev'=>$prevOffset, 'end'=>$endOffset, 'total'=>$totalCount, 'totalCounted'=>$totalCounted); + $pageData['bean'] = array('objectName' => $seed->object_name, 'moduleDir' => $seed->module_dir); + + $results[$moduleName] = array("data" => $data, "pageData" => $pageData); } return $results; - } - + } + /** * Function used to walk the array and find keys that map the queried string. * if both the pattern and module name is found the promote the string to thet top. */ protected function _searchKeys( - $item1, - $key, + $item1, + $key, $patterns - ) + ) { //make the module name singular.... if ($patterns[1][strlen($patterns[1])-1] == 's') { $patterns[1]=substr($patterns[1],0,(strlen($patterns[1])-1)); } - + $module_exists = stripos($key,$patterns[1]); //primary module name. $pattern_exists = stripos($key,$patterns[0]); //pattern provided by the user. if ($module_exists !== false and $pattern_exists !== false) { $GLOBALS['matching_keys']= array_merge(array(array('NAME'=>$key, 'ID'=>$key, 'VALUE'=>$item1)),$GLOBALS['matching_keys']); - } + } else { if ($pattern_exists !== false) { $GLOBALS['matching_keys'][]=array('NAME'=>$key, 'ID'=>$key, 'VALUE'=>$item1); diff --git a/include/SearchForm/tpls/SearchFormGeneric.tpl b/include/SearchForm/tpls/SearchFormGeneric.tpl index 0d08e36a..41acdfad 100644 --- a/include/SearchForm/tpls/SearchFormGeneric.tpl +++ b/include/SearchForm/tpls/SearchFormGeneric.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,7 +35,12 @@ ********************************************************************************/ *} - +{{* If templateMeta.maxColumnsBasic is not set, use maxColumns *}} +{if !isset($templateMeta.maxColumnsBasic)} + {assign var="basicMaxColumns" value=$templateMeta.maxColumns} +{else} + {assign var="basicMaxColumns" value=$templateMeta.maxColumnsBasic} +{/if} @@ -43,10 +48,10 @@ {counter assign=index} {math equation="left % right" left=$index - right=$templateMeta.maxColumns + right=$basicMaxColumns assign=modVal } - {if ($index % $templateMeta.maxColumns == 1 && $index != 1)} + {if ($index % $basicMaxColumns == 1 && $index != 1)} {/if} @@ -65,19 +70,19 @@ {{/if}} {{/foreach}} - {if $formData|@count >= $templateMeta.maxColumns+1} + {if $formData|@count >= $basicMaxColumns+1} - +
{else} - + {/if}   {if $HAS_ADVANCED_SEARCH} -   {$APP.LNK_ADVANCED_SEARCH} +   {$APP.LNK_ADVANCED_SEARCH} {/if}
diff --git a/include/SearchForm/tpls/SearchFormGenericAdvanced.tpl b/include/SearchForm/tpls/SearchFormGenericAdvanced.tpl index d6a02115..9d916a70 100644 --- a/include/SearchForm/tpls/SearchFormGenericAdvanced.tpl +++ b/include/SearchForm/tpls/SearchFormGenericAdvanced.tpl @@ -82,7 +82,7 @@

+ {if $DISPLAY_SEARCH_HELP} {/if} diff --git a/include/SearchForm/tpls/footer.tpl b/include/SearchForm/tpls/footer.tpl index b87122c7..4f55505e 100644 --- a/include/SearchForm/tpls/footer.tpl +++ b/include/SearchForm/tpls/footer.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SearchForm/tpls/header.tpl b/include/SearchForm/tpls/header.tpl index c68f4e4d..744b6603 100644 --- a/include/SearchForm/tpls/header.tpl +++ b/include/SearchForm/tpls/header.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/Smarty/Config_File.class.php b/include/Smarty/Config_File.class.php index 7c5e7cbd..ef283b0b 100644 --- a/include/Smarty/Config_File.class.php +++ b/include/Smarty/Config_File.class.php @@ -261,15 +261,12 @@ class Config_File { $config_file = $file_name; ini_set('track_errors', true); - $fp = @fopen($config_file, "r"); - if (!is_resource($fp)) { + $contents = @sugar_file_get_contents($config_file); + if ($contents === false) { $this->_trigger_error_msg("Could not open config file '$config_file'"); return false; } - $contents = ($size = filesize($config_file)) ? fread($fp, $size) : ''; - fclose($fp); - $this->_config_data[$config_file] = $this->parse_contents($contents); return true; } @@ -324,7 +321,7 @@ class Config_File { $vars = array(); continue; } - } else { + } else { $section_name = $match[1]; } if (!isset($config_data['sections'][$section_name])) diff --git a/include/Smarty/plugins/function.html_select_date.php b/include/Smarty/plugins/function.html_select_date.php index c230d29d..eae959ec 100644 --- a/include/Smarty/plugins/function.html_select_date.php +++ b/include/Smarty/plugins/function.html_select_date.php @@ -60,7 +60,7 @@ r8230 - 2005-10-03 17:47:19 -0700 (Mon, 03 Oct 2005) - majed - Added Sugar_Smart * @param Smarty * @return string */ -function smarty_function_html_select_date($params, &$smarty) +function smarty_function_html_select_date($params, $smarty) { require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); require_once $smarty->_get_plugin_filepath('shared','make_timestamp'); @@ -170,7 +170,7 @@ function smarty_function_html_select_date($params, &$smarty) } // Now split this in pieces, which later can be used to set the select $time = explode("-", $time); - + // make syntax "+N" or "-N" work with start_year and end_year if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) { if ($match[1] == '+') { @@ -186,7 +186,7 @@ function smarty_function_html_select_date($params, &$smarty) $start_year = strftime('%Y') - $match[2]; } } - if (strlen($time[0]) > 0) { + if (strlen($time[0]) > 0) { if ($start_year > $time[0] && !isset($params['start_year'])) { // force start year to include given date if not explicitly set $start_year = $time[0]; diff --git a/include/Smarty/plugins/function.sugar_button.php b/include/Smarty/plugins/function.sugar_button.php index 5409d1be..9ef9b4e0 100644 --- a/include/Smarty/plugins/function.sugar_button.php +++ b/include/Smarty/plugins/function.sugar_button.php @@ -287,19 +287,21 @@ function smarty_function_sugar_button($params, &$smarty) } $type = $params['id']; + $location = (empty($params['location'])) ? "" : "_".$params['location']; + if(!is_array($type)) { $module = $params['module']; $view = $params['view']; switch(strtoupper($type)) { case "CANCEL": $cancelButton = '{if !empty($smarty.request.return_action) && ($smarty.request.return_action == "DetailView" && !empty($smarty.request.return_id))}'; - $cancelButton .= ' '; + $cancelButton .= ' '; $cancelButton .= '{elseif !empty($smarty.request.return_action) && ($smarty.request.return_action == "DetailView" && !empty($fields.id.value))}'; - $cancelButton .= ' '; + $cancelButton .= ' '; $cancelButton .= '{elseif empty($smarty.request.return_action) || empty($smarty.request.return_id) && !empty($fields.id.value)}'; - $cancelButton .= ' '; + $cancelButton .= ' '; $cancelButton .= '{else}'; - $cancelButton .= ' '; + $cancelButton .= ' '; $cancelButton .= '{/if}'; return $cancelButton; break; @@ -317,12 +319,12 @@ function smarty_function_sugar_button($params, &$smarty) break; case "FIND_DUPLICATES": - return '{if $bean->aclAccess("edit")}{/if} '; + return '{if $bean->aclAccess("edit") && $bean->aclAccess("delete")}{/if} '; break; case "SAVE": $view = ($_REQUEST['action'] == 'EditView') ? 'EditView' : (($view == 'EditView') ? 'EditView' : $view); - return '{if $bean->aclAccess("save")}{/if} '; + return '{if $bean->aclAccess("save")}{/if} '; break; case "SUBPANELSAVE": diff --git a/include/Smarty/plugins/function.sugar_connector_display.php b/include/Smarty/plugins/function.sugar_connector_display.php index a421ff20..f111ea4b 100644 --- a/include/Smarty/plugins/function.sugar_connector_display.php +++ b/include/Smarty/plugins/function.sugar_connector_display.php @@ -58,7 +58,7 @@ r41724 - 2008-11-13 08:55:42 -0800 (Thu, 13 Nov 2008) - Collin Lee - Made change if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/Smarty/plugins/function.sugar_link.php b/include/Smarty/plugins/function.sugar_link.php index 51fe3f2e..19ba2206 100644 --- a/include/Smarty/plugins/function.sugar_link.php +++ b/include/Smarty/plugins/function.sugar_link.php @@ -35,7 +35,7 @@ r42268 - 2008-12-02 13:29:54 -0800 (Tue, 02 Dec 2008) - rob - Get some tweaks to if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/Smarty/plugins/function.sugar_phone.php b/include/Smarty/plugins/function.sugar_phone.php index 8f802d32..5289a573 100644 --- a/include/Smarty/plugins/function.sugar_phone.php +++ b/include/Smarty/plugins/function.sugar_phone.php @@ -45,7 +45,7 @@ r28841 - 2007-10-24 20:11:24 -0700 (Wed, 24 Oct 2007) - ajay - 16807: added supp if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/Smarty/plugins/function.sugarvar.php b/include/Smarty/plugins/function.sugarvar.php index fbbd8e28..0ba1aec3 100644 --- a/include/Smarty/plugins/function.sugarvar.php +++ b/include/Smarty/plugins/function.sugarvar.php @@ -60,7 +60,7 @@ r22124 - 2007-04-20 16:54:53 -0700 (Fri, 20 Apr 2007) - clee - * Type: function
* Name: sugarvar
* Purpose: creates a smarty variable from the parameters - * + * * @author Wayne Pan {wayne at sugarcrm.com} * @param array * @param Smarty @@ -71,12 +71,12 @@ function smarty_function_sugarvar($params, &$smarty) if(empty($params['key'])) { $smarty->trigger_error("sugarvar: missing 'key' parameter"); return; - } + } $object = (empty($params['objectName']))?$smarty->get_template_vars('parentFieldArray'): $params['objectName']; $displayParams = $smarty->get_template_vars('displayParams'); - - + + if(empty($params['memberName'])){ $member = $smarty->get_template_vars('vardef'); $member = $member['name']; @@ -84,15 +84,15 @@ function smarty_function_sugarvar($params, &$smarty) $members = explode('.', $params['memberName']); $member = $smarty->get_template_vars($members[0]); for($i = 1; $i < count($members); $i++){ - $member = $member[$members[$i]]; + $member = $member[$members[$i]]; } - } - + } + $_contents = '$'. $object . '.' . $member . '.' . $params['key']; if(empty($params['stringFormat']) && empty($params['string'])) { $_contents = '{' . $_contents; if(!empty($params['htmlentitydecode'])){ - $_contents .= '|escape:\'htmlentitydecode\''; + $_contents .= '|escape:\'htmlentitydecode\''; } if(!empty($displayParams['htmlescape'])){ $_contents .= '|escape:\'html\''; @@ -102,11 +102,11 @@ function smarty_function_sugarvar($params, &$smarty) } if(!empty($displayParams['url2html'])){ $_contents .= '|url2html'; - } + } if(!empty($displayParams['nl2br'])){ $_contents .= '|nl2br'; - } - + } + $_contents .= '}'; } return $_contents; diff --git a/include/Smarty/plugins/function.sugarvar_connector.php b/include/Smarty/plugins/function.sugarvar_connector.php index 38b792a6..90636a3d 100644 --- a/include/Smarty/plugins/function.sugarvar_connector.php +++ b/include/Smarty/plugins/function.sugarvar_connector.php @@ -34,7 +34,7 @@ r41724 - 2008-11-13 08:55:42 -0800 (Thu, 13 Nov 2008) - Collin Lee - Made change if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/Smarty/plugins/modifier.default_date_value.php b/include/Smarty/plugins/modifier.default_date_value.php index 747c27ab..23e4536c 100644 --- a/include/Smarty/plugins/modifier.default_date_value.php +++ b/include/Smarty/plugins/modifier.default_date_value.php @@ -152,7 +152,7 @@ include/Smarty/plugins/modifier.default_date_value.php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -207,6 +207,5 @@ function smarty_modifier_default_date_value($defaultValue) { global $timedate; require_once('modules/DynamicFields/templates/Fields/TemplateDate.php'); $td = new TemplateDate(); - return $timedate->to_display_date(date($GLOBALS['timedate']->dbDayFormat,strtotime($td->dateStrings[$defaultValue])), false); + return $timedate->asUser(new SugarDateTime($td->dateStrings[$defaultValue])); } -?> diff --git a/include/Smarty/plugins/modifier.to_url.php b/include/Smarty/plugins/modifier.to_url.php index 45dc3cbe..dc61b29c 100644 --- a/include/Smarty/plugins/modifier.to_url.php +++ b/include/Smarty/plugins/modifier.to_url.php @@ -27,7 +27,7 @@ r36643 - 2008-06-11 14:28:43 -0700 (Wed, 11 Jun 2008) - dwheeler - bug 20270: Ad /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SubPanel/SubPanel.php b/include/SubPanel/SubPanel.php index 74014cd1..9613991b 100644 --- a/include/SubPanel/SubPanel.php +++ b/include/SubPanel/SubPanel.php @@ -1,7 +1,7 @@ show_export_button = false; //function returns the query that was used to populate sub-panel data. + $query=$ListView->process_dynamic_listview($this->parent_module, $this->parent_bean,$this->subpanel_defs); $this->subpanel_query=$query; $ob_contents = ob_get_contents(); diff --git a/include/SubPanel/SubPanelDefinitions.php b/include/SubPanel/SubPanelDefinitions.php index 5024725c..5d685198 100644 --- a/include/SubPanel/SubPanelDefinitions.php +++ b/include/SubPanel/SubPanelDefinitions.php @@ -2,7 +2,7 @@ if (! defined ( 'sugarEntry' ) || ! sugarEntry) die ( 'Not A Valid Entry Point' ) ; /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SubPanel/SubPanelDynamic.html b/include/SubPanel/SubPanelDynamic.html index a5a8bfc7..25e00673 100644 --- a/include/SubPanel/SubPanelDynamic.html +++ b/include/SubPanel/SubPanelDynamic.html @@ -1,6 +1,6 @@ + + + '; + } + + function getMySugarChartResources() { + return ' + + '; + } + + + function display($name, $xmlFile, $width='320', $height='480', $resize=false) { + + parent::display($name, $xmlFile, $width, $height, $resize); + + return $this->ss->fetch('include/SugarCharts/Jit/tpls/chart.tpl'); + } + + + function getDashletScript($id,$xmlFile="") { + + parent::getDashletScript($id,$xmlFile); + return $this->ss->fetch('include/SugarCharts/Jit/tpls/DashletGenericChartScript.tpl'); + } + + + + +} + +?> \ No newline at end of file diff --git a/include/SugarCharts/Jit/JitReports.php b/include/SugarCharts/Jit/JitReports.php new file mode 100644 index 00000000..c144d633 --- /dev/null +++ b/include/SugarCharts/Jit/JitReports.php @@ -0,0 +1,217 @@ +super_set as $key){ + $temp_dataset[$key] = (isset($dataset[$key])) ? $dataset[$key] : array(); + } + $dataset = $temp_dataset; + } + + foreach ($dataset as $key=>$value){ + if ($first && empty($value)){ + $data .= $this->processDataGroup(4, $key, 'NULL', '', ''); + } + else if (array_key_exists('numerical_value', $dataset)){ + $link = (isset($dataset['link'])) ? '#'.$dataset['link'] : ''; + $data .= $this->processDataGroup($level, $dataset['group_base_text'], $dataset['numerical_value'], $dataset['numerical_value'], $link); + array_push($this->processed_report_keys, $dataset['group_base_text']); + return $data; + } + else{ + $data .= $this->processReportData($value, $level+1); + } + } + + return $data; + } + + function processReportGroup($dataset){ + $super_set = array(); + + foreach($dataset as $groupBy => $groups){ + $prev_super_set = $super_set; + if (count($groups) > count($super_set)){ + $super_set = array_keys($groups); + foreach($prev_super_set as $prev_group){ + if (!in_array($prev_group, $groups)){ + array_push($super_set, $prev_group); + } + } + } + else{ + foreach($groups as $group => $groupData){ + if (!in_array($group, $super_set)){ + array_push($super_set, $group); + } + } + } + } + $super_set = array_unique($super_set); + + return $super_set; + } + + function xmlDataReportSingleValue(){ + $data = ''; + foreach ($this->data_set as $key => $dataset){ + $total = $this->calculateReportGroupTotal($dataset); + $this->checkYAxis($total); + + $data .= $this->tab('', 2); + $data .= $this->tabValue('title',$key, 3); + $data .= $this->tab('', 3); + $data .= $this->tab('',4); + $data .= $this->tabValue('title',$total,5); + $data .= $this->tabValue('value',$total,5); + $data .= $this->tabValue('label',$key,5); + $data .= $this->tab('',5); + $data .= $this->tab('',4); + $data .= $this->tab('', 3); + $data .= $this->tab('', 2); + } + return $data; + } + + function xmlDataReportChart(){ + $data = ''; + // correctly process the first row + $first = true; + foreach ($this->data_set as $key => $dataset){ + + $total = $this->calculateReportGroupTotal($dataset); + $this->checkYAxis($total); + + $data .= $this->tab('', 2); + $data .= $this->tabValue('title',$key, 3); + $data .= $this->tabValue('value',$total, 3); + $data .= $this->tabValue('label',$total, 3); + $data .= $this->tab('', 3); + + if ((isset($dataset[$total]) && $total != $dataset[$total]['numerical_value']) || !array_key_exists($key, $dataset)){ + $data .= $this->processReportData($dataset, 4, $first); + } + + if (!$first){ + $not_processed = array_diff($this->super_set, $this->processed_report_keys); + $processed_diff_count = count($this->super_set) - count($not_processed); + + if ($processed_diff_count != 0){ + foreach ($not_processed as $title){ + $data .= $this->processDataGroup(4, $title, 'NULL', '', ''); + } + } + } + $data .= $this->tab('', 3); + $data .= $this->tab('', 2); + $this->processed_report_keys = array(); + // we're done with the first row! + //$first = false; + } + return $data; + } + + public function processXmlData(){ + $data = ''; + + $this->super_set = $this->processReportGroup($this->data_set); + $single_value = false; + + foreach ($this->data_set as $key => $dataset){ + if ((isset($dataset[$key]) && count($this->data_set[$key]) == 1)){ + $single_value = true; + } + else{ + $single_value = false; + } + } + if ($this->chart_properties['type'] == 'line chart' && $single_value){ + $data .= $this->xmlDataReportSingleValue(); + } + else{ + $data .= $this->xmlDataReportChart(); + } + + return $data; + } + + /** + * wrapper function to return the html code containing the chart in a div + * + * @param string $name name of the div + * string $xmlFile location of the XML file + * string $style optional additional styles for the div + * @return string returns the html code through smarty + */ + function display($name, $xmlFile, $width='320', $height='480', $reportChartDivStyle, $resize=false){ + if(empty($name)) { + $name = "unsavedReport"; + } + + parent::display($name, $xmlFile, $width, $height, $resize=false); + + return $this->ss->fetch('include/SugarCharts/Jit/tpls/chart.tpl'); + } +} + +?> \ No newline at end of file diff --git a/include/SugarPDF.php b/include/SugarCharts/Jit/css/base.css similarity index 54% rename from include/SugarPDF.php rename to include/SugarCharts/Jit/css/base.css index 4def89a2..90d61c99 100644 --- a/include/SugarPDF.php +++ b/include/SugarCharts/Jit/css/base.css @@ -1,7 +1,5 @@ -field_defs as $k => $field) { - if($field['type'] == 'varchar' || $field['type'] == 'text' || $field['type'] == 'enum') { - $bean->$k = $this->handleCharset($bean->$k); - } - } - - return $bean; - } +.chartContainer .scrollBars { + overflow: auto; + max-height: 600px; + position: relative; +} - /** - * Translates text from UTF-8 (as of SugarCRM v4.5) into the selected - * default character set for a given instance, abrogated by user preference. - * @param string text The text to be handled - * @return string ret The translated string. - */ - function handleCharset($text) { - global $locale; - - $ret = $locale->translateCharset($text, 'UTF-8', $locale->getPrecedentPreference('default_export_charset')); - return $ret; - } +.chartCanvas { + position:relative; + margin:auto; + overflow:hidden; + background-image: url(../../../../index.php?entryPoint=getImage&imageName=chartBg.png); + background-repeat:repeat-x; +} + +.query-color { +width: 16px; +height: 16px; +display: inline-block; +margin-right: 10px; +border: 1px solid #999; } -?> \ No newline at end of file + +.legend { +padding: 10px 20px; +float: left; +} + +.legend table td.label { +padding: 0px 20px 5px 0px; +text-align: left; +} +/*TOOLTIPS*/ +.tip { + color: #111; + width: auto; + background-color: white; + border:1px solid #ccc; + -moz-box-shadow:#555 2px 2px 8px; + -webkit-box-shadow:#555 2px 2px 8px; + -o-box-shadow:#555 2px 2px 8px; + box-shadow:#555 2px 2px 8px; + opacity:0.9; + filter:alpha(opacity=90); + font-size:11px; + font-family: Arial, Helvetica, sans-serif; + padding:7px; + -moz-border-radius: 6px; + -webkit-border-radius: 6px; + border-radius: 6px; + +} +.rotatedLabel { +-webkit-transform: rotate(-90deg); +-moz-transform: rotate(-90deg); +filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); +} + +.rotatedLabelReverse { +-webkit-transform: rotate(-0deg); +-moz-transform: rotate(90deg); +filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2); +} \ No newline at end of file diff --git a/include/SugarCharts/Jit/js/Jit/jit.js b/include/SugarCharts/Jit/js/Jit/jit.js new file mode 100644 index 00000000..e84adc9e --- /dev/null +++ b/include/SugarCharts/Jit/js/Jit/jit.js @@ -0,0 +1,501 @@ +/* + Copyright (c) 2010, Nicolas Garcia Belmonte + All rights reserved + + > Redistribution and use in source and binary forms, with or without + > modification, are permitted provided that the following conditions are met: + > * Redistributions of source code must retain the above copyright + > notice, this list of conditions and the following disclaimer. + > * Redistributions in binary form must reproduce the above copyright + > notice, this list of conditions and the following disclaimer in the + > documentation and/or other materials provided with the distribution. + > * Neither the name of the organization nor the + > names of its contributors may be used to endorse or promote products + > derived from this software without specific prior written permission. + > + > THIS SOFTWARE IS PROVIDED BY NICOLAS GARCIA BELMONTE ``AS IS'' AND ANY + > EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + > WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + > DISCLAIMED. IN NO EVENT SHALL NICOLAS GARCIA BELMONTE BE LIABLE FOR ANY + > DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + > (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + > LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + > ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + > (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + > SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +(function(){window.$jit=function(w){w=w||window;for(var k in $jit){if($jit[k].$extend){w[k]=$jit[k];}}};$jit.version='2.0.0b';var $=function(d){return document.getElementById(d);};$.empty=function(){};function pad(number,length){var str=''+number;while(str.length127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);} +else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}} +return utftext;},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;} +else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}} +return string;}};Array.prototype.sum=function(){return(!this.length)?0:this.slice(1).sum()+ +((typeof this[0]=='number')?this[0]:0);};function array_match(needle,haystack){var length=haystack.length;var indexValue=new Array();for(var i=0,count=0;i>16,hex>>8&0xff,hex&0xff];}};$.destroy=function(elem){$.clean(elem);if(elem.parentNode) +elem.parentNode.removeChild(elem);if(elem.clearAttributes) +elem.clearAttributes();};$.clean=function(elem){for(var ch=elem.childNodes,i=0,l=ch.length;i-1;};$.addClass=function(obj,klass){if(!$.hasClass(obj,klass)) +obj.className=(obj.className+" "+klass);};$.removeClass=function(obj,klass){obj.className=obj.className.replace(new RegExp('(^|\\s)'+klass+'(?:\\s|$)'),'$1');};$.getPos=function(elem){var offset=getOffsets(elem);var scroll=getScrolls(elem);return{x:offset.x-scroll.x,y:offset.y-scroll.y};function getOffsets(elem){var position={x:0,y:0};while(elem&&!isBody(elem)){position.x+=elem.offsetLeft;position.y+=elem.offsetTop;elem=elem.offsetParent;} +return position;} +function getScrolls(elem){var position={x:0,y:0};while(elem&&!isBody(elem)){position.x+=elem.scrollLeft;position.y+=elem.scrollTop;elem=elem.parentNode;} +return position;} +function isBody(element){return(/^(?:body|html)$/i).test(element.tagName);}};$.event={get:function(e,win){win=win||window;return e||win.event;},getWheel:function(e){return e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3;},isRightClick:function(e){return(e.which==3||e.button==2);},getPos:function(e,win){win=win||window;e=e||win.event;var doc=win.document;doc=doc.documentElement||doc.body;if(e.touches&&e.touches.length){e=e.touches[0];} +var page={x:e.pageX||(e.clientX+doc.scrollLeft),y:e.pageY||(e.clientY+doc.scrollTop)};return page;},stop:function(e){if(e.stopPropagation)e.stopPropagation();e.cancelBubble=true;if(e.preventDefault)e.preventDefault();else e.returnValue=false;}};$jit.util=$jit.id=$;var Class=function(properties){properties=properties||{};var klass=function(){for(var key in this){if(typeof this[key]!='function') +this[key]=$.unlink(this[key]);} +this.constructor=klass;if(Class.prototyping) +return this;var instance=this.initialize?this.initialize.apply(this,arguments):this;this.$$family='class';return instance;};for(var mutator in Class.Mutators){if(!properties[mutator]) +continue;properties=Class.Mutators[mutator](properties,properties[mutator]);delete properties[mutator];} +$.extend(klass,this);klass.constructor=Class;klass.prototype=properties;return klass;};Class.Mutators={Implements:function(self,klasses){$.each($.splat(klasses),function(klass){Class.prototyping=klass;var instance=(typeof klass=='function')?new klass:klass;for(var prop in instance){if(!(prop in self)){self[prop]=instance[prop];}} +delete Class.prototyping;});return self;}};$.extend(Class,{inherit:function(object,properties){for(var key in properties){var override=properties[key];var previous=object[key];var type=$.type(override);if(previous&&type=='function'){if(override!=previous){Class.override(object,key,override);}}else if(type=='object'){object[key]=$.merge(previous,override);}else{object[key]=override;}} +return object;},override:function(object,name,method){var parent=Class.prototyping;if(parent&&object[name]!=parent[name]) +parent=null;var override=function(){var previous=this.parent;this.parent=parent?parent[name]:object[name];var value=method.apply(this,arguments);this.parent=previous;return value;};object[name]=override;}});Class.prototype.implement=function(){var proto=this.prototype;$.each(Array.prototype.slice.call(arguments||[]),function(properties){Class.inherit(proto,properties);});return this;};$jit.Class=Class;$jit.json={prune:function(tree,maxLevel){this.each(tree,function(elem,i){if(i==maxLevel&&elem.children){delete elem.children;elem.children=[];}});},getParent:function(tree,id){if(tree.id==id) +return false;var ch=tree.children;if(ch&&ch.length>0){for(var i=0;i=(7-4*a)/11){value=b*b-Math.pow((11-6*a-11*p)/4,2);break;}} +return value;},Elastic:function(p,x){return Math.pow(2,10*--p)*Math.cos(20*p*Math.PI*(x[0]||1)/3);}};$.each(transitions,function(val,key){Trans[key]=makeTrans(val);});$.each(['Quad','Cubic','Quart','Quint'],function(elem,i){Trans[elem]=makeTrans(function(p){return Math.pow(p,[i+2]);});});})();var Animation=new Class({initialize:function(options){this.setOptions(options);},setOptions:function(options){var opt={duration:2500,fps:40,transition:Trans.Quart.easeInOut,compute:$.empty,complete:$.empty,link:'ignore'};this.opt=$.merge(opt,options||{});return this;},step:function(){var time=$.time(),opt=this.opt;if(timewin.height)?(pos.y-obj.height-y):pos.y+y)+'px';style.left=((pos.x+obj.width+x>win.width)?(pos.x-obj.width-x):pos.x+x)+'px';},hide:function(triggerCallback){if(!SUGAR.util.isTouchScreen()){this.tip.style.display='none';} +triggerCallback&&this.config.onHide();}});Extras.Classes.NodeStyles=new Class({Implements:[ExtrasInitializer,EventsInterface],initializePost:function(){this.fx=this.viz.fx;this.types=this.viz.fx.nodeTypes;this.nStyles=this.config;this.nodeStylesOnHover=this.nStyles.stylesHover;this.nodeStylesOnClick=this.nStyles.stylesClick;this.hoveredNode=false;this.fx.nodeFxAnimation=new Animation();this.down=false;this.move=false;},onMouseOut:function(e,win){this.down=this.move=false;if(!this.hoveredNode)return;if(this.dom&&this.isLabel(e,win)){this.toggleStylesOnHover(this.hoveredNode,false);} +var rt=e.relatedTarget,canvasWidget=this.canvas.getElement();while(rt&&rt.parentNode){if(canvasWidget==rt.parentNode)return;rt=rt.parentNode;} +this.toggleStylesOnHover(this.hoveredNode,false);this.hoveredNode=false;},onMouseOver:function(e,win){var label;if(this.dom&&(label=this.isLabel(e,win))){var node=this.viz.graph.getNode(label.id);if(node.selected)return;this.hoveredNode=node;this.toggleStylesOnHover(this.hoveredNode,true);}},onMouseDown:function(e,win,event,isRightClick){if(isRightClick)return;var label;if(this.dom&&(label=this.isLabel(e,win))){this.down=this.viz.graph.getNode(label.id);}else if(!this.dom){this.down=event.getNode();} +this.move=false;},onMouseUp:function(e,win,event,isRightClick){if(isRightClick)return;if(!this.move){this.onClick(event.getNode());} +this.down=this.move=false;},getRestoredStyles:function(node,type){var restoredStyles={},nStyles=this['nodeStylesOn'+type];for(var prop in nStyles){restoredStyles[prop]=node.styles['$'+prop];} +return restoredStyles;},toggleStylesOnHover:function(node,set){if(this.nodeStylesOnHover){this.toggleStylesOn('Hover',node,set);}},toggleStylesOnClick:function(node,set){if(this.nodeStylesOnClick){this.toggleStylesOn('Click',node,set);}},toggleStylesOn:function(type,node,set){var viz=this.viz;var nStyles=this.nStyles;if(set){var that=this;if(!node.styles){node.styles=$.merge(node.data,{});} +for(var s in this['nodeStylesOn'+type]){var $s='$'+s;if(!($s in node.styles)){node.styles[$s]=node.getData(s);}} +viz.fx.nodeFx($.extend({'elements':{'id':node.id,'properties':that['nodeStylesOn'+type]},transition:Trans.Quart.easeOut,duration:300,fps:40},this.config));}else{var restoredStyles=this.getRestoredStyles(node,type);viz.fx.nodeFx($.extend({'elements':{'id':node.id,'properties':restoredStyles},transition:Trans.Quart.easeOut,duration:300,fps:40},this.config));}},onClick:function(node){if(!node)return;var nStyles=this.nodeStylesOnClick;if(!nStyles)return;if(node.selected){this.toggleStylesOnClick(node,false);delete node.selected;}else{this.viz.graph.eachNode(function(n){if(n.selected){for(var s in nStyles){n.setData(s,n.styles['$'+s],'end');} +delete n.selected;}});this.toggleStylesOnClick(node,true);node.selected=true;delete node.hovered;this.hoveredNode=false;}},onMouseMove:function(e,win,event){if(this.down)this.move=true;if(this.dom&&this.isLabel(e,win))return;var nStyles=this.nodeStylesOnHover;if(!nStyles)return;if(!this.dom){if(this.hoveredNode){var geom=this.types[this.hoveredNode.getData('type')];var contains=geom&&geom.contains&&geom.contains.call(this.fx,this.hoveredNode,event.getPos());if(contains)return;} +var node=event.getNode();if(!this.hoveredNode&&!node)return;if(node.hovered)return;if(node&&!node.selected){this.fx.nodeFxAnimation.stopTimer();this.viz.graph.eachNode(function(n){if(n.hovered&&!n.selected){for(var s in nStyles){n.setData(s,n.styles['$'+s],'end');} +delete n.hovered;}});node.hovered=true;this.hoveredNode=node;this.toggleStylesOnHover(node,true);}else if(this.hoveredNode&&!this.hoveredNode.selected){this.fx.nodeFxAnimation.stopTimer();this.toggleStylesOnHover(this.hoveredNode,false);delete this.hoveredNode.hovered;this.hoveredNode=false;}}}});Extras.Classes.Navigation=new Class({Implements:[ExtrasInitializer,EventsInterface],initializePost:function(){this.pos=false;this.pressed=false;},onMouseWheel:function(e,win,scroll){if(!this.config.zooming)return;$.event.stop($.event.get(e,win));var val=this.config.zooming/1000,ans=1+scroll*val;this.canvas.scale(ans,ans);},onMouseDown:function(e,win,eventInfo){if(!this.config.panning)return;if(this.config.panning=='avoid nodes'&&eventInfo.getNode())return;this.pressed=true;this.pos=eventInfo.getPos();var canvas=this.canvas,ox=canvas.translateOffsetX,oy=canvas.translateOffsetY,sx=canvas.scaleOffsetX,sy=canvas.scaleOffsetY;this.pos.x*=sx;this.pos.x+=ox;this.pos.y*=sy;this.pos.y+=oy;},onMouseMove:function(e,win,eventInfo){if(!this.config.panning)return;if(!this.pressed)return;if(this.config.panning=='avoid nodes'&&eventInfo.getNode())return;var thispos=this.pos,currentPos=eventInfo.getPos(),canvas=this.canvas,ox=canvas.translateOffsetX,oy=canvas.translateOffsetY,sx=canvas.scaleOffsetX,sy=canvas.scaleOffsetY;currentPos.x*=sx;currentPos.y*=sy;currentPos.x+=ox;currentPos.y+=oy;var x=currentPos.x-thispos.x,y=currentPos.y-thispos.y;this.pos=currentPos;this.canvas.translate(x*1/sx,y*1/sy);},onMouseUp:function(e,win,eventInfo,isRightClick){if(!this.config.panning)return;this.pressed=false;}});var Canvas;(function(){var canvasType=typeof HTMLCanvasElement,supportsCanvas=(canvasType=='object'||canvasType=='function');function $E(tag,props){var elem=document.createElement(tag);for(var p in props){if(typeof props[p]=="object"){$.extend(elem[p],props[p]);}else{elem[p]=props[p];}} +if(tag=="canvas"&&!supportsCanvas&&G_vmlCanvasManager){elem=G_vmlCanvasManager.initElement(elem);} +return elem;} +$jit.Canvas=Canvas=new Class({canvases:[],pos:false,element:false,labelContainer:false,translateOffsetX:0,translateOffsetY:0,scaleOffsetX:1,scaleOffsetY:1,initialize:function(viz,opt){this.viz=viz;this.opt=opt;var id=$.type(opt.injectInto)=='string'?opt.injectInto:opt.injectInto.id,idLabel=id+"-label",wrapper=$(id),width=opt.width||wrapper.offsetWidth,height=opt.height||wrapper.offsetHeight;this.id=id;var canvasOptions={injectInto:id,width:width,height:height};this.element=$E('div',{'id':id+'-canvaswidget','style':{'position':'relative','width':width+'px','height':height+'px'}});this.labelContainer=this.createLabelContainer(opt.Label.type,idLabel,canvasOptions);this.canvases.push(new Canvas.Base({config:$.extend({idSuffix:'-canvas'},canvasOptions),plot:function(base){viz.fx.plot();},resize:function(){viz.refresh();}}));var back=opt.background;if(back){var backCanvas=new Canvas.Background[back.type](viz,$.extend(back,canvasOptions));this.canvases.push(new Canvas.Base(backCanvas));} +var len=this.canvases.length;while(len--){this.element.appendChild(this.canvases[len].canvas);if(len>0){this.canvases[len].plot();}} +this.element.appendChild(this.labelContainer);wrapper.appendChild(this.element);var timer=null,that=this;$.addEvent(window,'scroll',function(){clearTimeout(timer);timer=setTimeout(function(){that.getPos(true);},500);});$.addEvent(window,'click',function(){clearTimeout(timer);timer=setTimeout(function(){that.getPos(true);},500);});sb=document.getElementById('sb'+id);$.addEvent(sb,'scroll',function(){clearTimeout(timer);timer=setTimeout(function(){that.getPos(true);},500);});},getCtx:function(i){return this.canvases[i||0].getCtx();},getConfig:function(){return this.opt;},getElement:function(){return this.element;},getSize:function(i){return this.canvases[i||0].getSize();},resize:function(width,height){this.getPos(true);this.translateOffsetX=this.translateOffsetY=0;this.scaleOffsetX=this.scaleOffsetY=1;for(var i=0,l=this.canvases.length;iet){sum=ch((et+((tt-pi2)-et)*delta));}else{sum=ch((et-pi2+(tt-(et))*delta));}}else if(diff>=pi){if(tt>et){sum=ch((et+((tt-pi2)-et)*delta));}else{sum=ch((et-pi2+(tt-(et-pi2))*delta));}}else{sum=ch((et+(tt-et)*delta));} +var r=(this.rho-elem.rho)*delta+elem.rho;return{'theta':sum,'rho':r};}};var $P=function(a,b){return new Polar(a,b);};Polar.KER=$P(0,0);var Complex=function(x,y){this.x=x;this.y=y;};$jit.Complex=Complex;Complex.prototype={getc:function(){return this;},getp:function(simple){return this.toPolar(simple);},set:function(c){c=c.getc(true);this.x=c.x;this.y=c.y;},setc:function(x,y){this.x=x;this.y=y;},setp:function(theta,rho){this.x=Math.cos(theta)*rho;this.y=Math.sin(theta)*rho;},clone:function(){return new Complex(this.x,this.y);},toPolar:function(simple){var rho=this.norm();var atan=Math.atan2(this.y,this.x);if(atan<0)atan+=Math.PI*2;if(simple)return{'theta':atan,'rho':rho};return new Polar(atan,rho);},norm:function(){return Math.sqrt(this.squaredNorm());},squaredNorm:function(){return this.x*this.x+this.y*this.y;},add:function(pos){return new Complex(this.x+pos.x,this.y+pos.y);},prod:function(pos){return new Complex(this.x*pos.x-this.y*pos.y,this.y*pos.x+this.x*pos.y);},conjugate:function(){return new Complex(this.x,-this.y);},scale:function(factor){return new Complex(this.x*factor,this.y*factor);},equals:function(c){return this.x==c.x&&this.y==c.y;},$add:function(pos){this.x+=pos.x;this.y+=pos.y;return this;},$prod:function(pos){var x=this.x,y=this.y;this.x=x*pos.x-y*pos.y;this.y=y*pos.x+x*pos.y;return this;},$conjugate:function(){this.y=-this.y;return this;},$scale:function(factor){this.x*=factor;this.y*=factor;return this;},$div:function(pos){var x=this.x,y=this.y;var sq=pos.squaredNorm();this.x=x*pos.x+y*pos.y;this.y=y*pos.x-x*pos.y;return this.$scale(1/sq);}};var $C=function(a,b){return new Complex(a,b);};Complex.KER=$C(0,0);$jit.Graph=new Class({initialize:function(opt,Node,Edge,Label){var innerOptions={'complex':false,'Node':{}};this.Node=Node;this.Edge=Edge;this.Label=Label;this.opt=$.merge(innerOptions,opt||{});this.nodes={};this.edges={};var that=this;this.nodeList={};for(var p in Accessors){that.nodeList[p]=(function(p){return function(){var args=Array.prototype.slice.call(arguments);that.eachNode(function(n){n[p].apply(n,args);});};})(p);}},getNode:function(id){if(this.hasNode(id))return this.nodes[id];return false;},getByName:function(name){for(var id in this.nodes){var n=this.nodes[id];if(n.name==name)return n;} +return false;},getAdjacence:function(id,id2){if(id in this.edges){return this.edges[id][id2];} +return false;},addNode:function(obj){if(!this.nodes[obj.id]){var edges=this.edges[obj.id]={};this.nodes[obj.id]=new Graph.Node($.extend({'id':obj.id,'name':obj.name,'data':$.merge(obj.data||{},{}),'adjacencies':edges},this.opt.Node),this.opt.complex,this.Node,this.Edge,this.Label);} +return this.nodes[obj.id];},addAdjacence:function(obj,obj2,data){if(!this.hasNode(obj.id)){this.addNode(obj);} +if(!this.hasNode(obj2.id)){this.addNode(obj2);} +obj=this.nodes[obj.id];obj2=this.nodes[obj2.id];if(!obj.adjacentTo(obj2)){var adjsObj=this.edges[obj.id]=this.edges[obj.id]||{};var adjsObj2=this.edges[obj2.id]=this.edges[obj2.id]||{};adjsObj[obj2.id]=adjsObj2[obj.id]=new Graph.Adjacence(obj,obj2,data,this.Edge,this.Label);return adjsObj[obj2.id];} +return this.edges[obj.id][obj2.id];},removeNode:function(id){if(this.hasNode(id)){delete this.nodes[id];var adjs=this.edges[id];for(var to in adjs){delete this.edges[to][id];} +delete this.edges[id];}},removeAdjacence:function(id1,id2){delete this.edges[id1][id2];delete this.edges[id2][id1];},hasNode:function(id){return id in this.nodes;},empty:function(){this.nodes={};this.edges={};}});var Graph=$jit.Graph;var Accessors;(function(){var getDataInternal=function(prefix,prop,type,force,prefixConfig){var data;type=type||'current';prefix="$"+(prefix?prefix+"-":"");if(type=='current'){data=this.data;}else if(type=='start'){data=this.startData;}else if(type=='end'){data=this.endData;} +var dollar=prefix+prop;if(force){return data[dollar];} +if(!this.Config.overridable) +return prefixConfig[prop]||0;return(dollar in data)?data[dollar]:((dollar in this.data)?this.data[dollar]:(prefixConfig[prop]||0));} +var setDataInternal=function(prefix,prop,value,type){type=type||'current';prefix='$'+(prefix?prefix+'-':'');var data;if(type=='current'){data=this.data;}else if(type=='start'){data=this.startData;}else if(type=='end'){data=this.endData;} +data[prefix+prop]=value;} +var removeDataInternal=function(prefix,properties){prefix='$'+(prefix?prefix+'-':'');var that=this;$.each(properties,function(prop){var pref=prefix+prop;delete that.data[pref];delete that.endData[pref];delete that.startData[pref];});} +Accessors={getData:function(prop,type,force){return getDataInternal.call(this,"",prop,type,force,this.Config);},setData:function(prop,value,type){setDataInternal.call(this,"",prop,value,type);},setDataset:function(types,obj){types=$.splat(types);for(var attr in obj){for(var i=0,val=$.splat(obj[attr]),l=types.length;i=levelBegin&&d<=levelEnd&&filter(node))action(node,d);if(dd)loopLevel(n,levelBegin,levelEnd);});}})(node,levelBegin+d,levelEnd+d);},eachSubgraph:function(node,action,flags){this.eachLevel(node,0,false,action,flags);},eachSubnode:function(node,action,flags){this.eachLevel(node,1,1,action,flags);},anySubnode:function(node,cond,flags){var flag=false;cond=cond||$.lambda(true);var c=$.type(cond)=='string'?function(n){return n[cond];}:cond;this.eachSubnode(node,function(elem){if(c(elem))flag=true;},flags);return flag;},getSubnodes:function(node,level,flags){var ans=[],that=this;level=level||0;var levelStart,levelEnd;if($.type(level)=='array'){levelStart=level[0];levelEnd=level[1];}else{levelStart=level;levelEnd=Number.MAX_VALUE-node._depth;} +this.eachLevel(node,levelStart,levelEnd,function(n){ans.push(n);},flags);return ans;},getParents:function(node){var ans=[];this.eachAdjacency(node,function(adj){var n=adj.nodeTo;if(n._depth-1)){elem.endData[prop]=graphNodeData[prop];}else{elem.data[prop]=graphNodeData[prop];}}}});viz.graph.eachNode(function(elem){if(elem.ignore)return;elem.eachAdjacency(function(adj){if(adj.nodeFrom.ignore||adj.nodeTo.ignore)return;var nodeFrom=graph.getNode(adj.nodeFrom.id);var nodeTo=graph.getNode(adj.nodeTo.id);if(!nodeFrom.adjacentTo(nodeTo)){var adj=viz.graph.getAdjacence(nodeFrom.id,nodeTo.id);fadeEdges=true;adj.setData('alpha',1);adj.setData('alpha',1,'start');adj.setData('alpha',0,'end');}});});var fadeEdges=this.preprocessSum(graph);var modes=!fadeEdges?['node-property:alpha']:['node-property:alpha','edge-property:alpha'];modes[0]=modes[0]+((extraModes&&('node-property'in extraModes))?(':'+$.splat(extraModes['node-property']).join(':')):'');modes[1]=(modes[1]||'edge-property:alpha')+((extraModes&&('edge-property'in extraModes))?(':'+$.splat(extraModes['edge-property']).join(':')):'');if(extraModes&&('label-property'in extraModes)){modes.push('label-property:'+$.splat(extraModes['label-property']).join(':'))} +viz.reposition();viz.graph.eachNode(function(elem){if(elem.id!=root&&elem.pos.getp().equals(Polar.KER)){elem.pos.set(elem.endPos);elem.startPos.set(elem.endPos);}});viz.fx.animate($.merge(options,{modes:['polar'].concat(modes),onComplete:function(){viz.graph.eachNode(function(elem){if(elem.ignore)viz.graph.removeNode(elem.id);});viz.graph.eachNode(function(elem){elem.eachAdjacency(function(adj){if(adj.ignore)viz.graph.removeAdjacence(adj.nodeFrom.id,adj.nodeTo.id);});});options.onComplete();}}));break;default:;}},contract:function(node,opt){var viz=this.viz;if(node.collapsed||!node.anySubnode($.lambda(true)))return;opt=$.merge(this.options,viz.config,opt||{},{'modes':['node-property:alpha:span','linear']});node.collapsed=true;(function subn(n){n.eachSubnode(function(ch){ch.ignore=true;ch.setData('alpha',0,opt.type=='animate'?'end':'current');subn(ch);});})(node);if(opt.type=='animate'){viz.compute('end');if(viz.rotated){viz.rotate(viz.rotated,'none',{'property':'end'});} +(function subn(n){n.eachSubnode(function(ch){ch.setPos(node.getPos('end'),'end');subn(ch);});})(node);viz.fx.animate(opt);}else if(opt.type=='replot'){viz.refresh();}},expand:function(node,opt){if(!('collapsed'in node))return;var viz=this.viz;opt=$.merge(this.options,viz.config,opt||{},{'modes':['node-property:alpha:span','linear']});delete node.collapsed;(function subn(n){n.eachSubnode(function(ch){delete ch.ignore;ch.setData('alpha',1,opt.type=='animate'?'end':'current');subn(ch);});})(node);if(opt.type=='animate'){viz.compute('end');if(viz.rotated){viz.rotate(viz.rotated,'none',{'property':'end'});} +viz.fx.animate(opt);}else if(opt.type=='replot'){viz.refresh();}},preprocessSum:function(graph){var viz=this.viz;graph.eachNode(function(elem){if(!viz.graph.hasNode(elem.id)){viz.graph.addNode(elem);var n=viz.graph.getNode(elem.id);n.setData('alpha',0);n.setData('alpha',0,'start');n.setData('alpha',1,'end');}});var fadeEdges=false;graph.eachNode(function(elem){elem.eachAdjacency(function(adj){var nodeFrom=viz.graph.getNode(adj.nodeFrom.id);var nodeTo=viz.graph.getNode(adj.nodeTo.id);if(!nodeFrom.adjacentTo(nodeTo)){var adj=viz.graph.addAdjacence(nodeFrom,nodeTo,adj.data);if(nodeFrom.startAlpha==nodeFrom.endAlpha&&nodeTo.startAlpha==nodeTo.endAlpha){fadeEdges=true;adj.setData('alpha',0);adj.setData('alpha',0,'start');adj.setData('alpha',1,'end');}}});});return fadeEdges;}};var NodeHelper={'none':{'render':$.empty,'contains':$.lambda(false)},'circle':{'render':function(type,pos,radius,canvas){var ctx=canvas.getCtx();ctx.beginPath();ctx.arc(pos.x,pos.y,radius,0,Math.PI*2,true);ctx.closePath();ctx[type]();},'contains':function(npos,pos,radius){var diffx=npos.x-pos.x,diffy=npos.y-pos.y,diff=diffx*diffx+diffy*diffy;return diff<=radius*radius;}},'ellipse':{'render':function(type,pos,width,height,canvas){var ctx=canvas.getCtx();height/=2;width/=2;ctx.save();ctx.scale(width/height,height/width);ctx.beginPath();ctx.arc(pos.x*(height/width),pos.y*(width/height),height,0,Math.PI*2,true);ctx.closePath();ctx[type]();ctx.restore();},'contains':function(npos,pos,width,height){width/=2;height/=2;var dist=(width+height)/2,diffx=npos.x-pos.x,diffy=npos.y-pos.y,diff=diffx*diffx+diffy*diffy;return diff<=dist*dist;}},'square':{'render':function(type,pos,dim,canvas){canvas.getCtx()[type+"Rect"](pos.x-dim,pos.y-dim,2*dim,2*dim);},'contains':function(npos,pos,dim){return Math.abs(pos.x-npos.x)<=dim&&Math.abs(pos.y-npos.y)<=dim;}},'rectangle':{'render':function(type,pos,width,height,canvas){canvas.getCtx()[type+"Rect"](pos.x-width/2,pos.y-height/2,width,height);},'contains':function(npos,pos,width,height){return Math.abs(pos.x-npos.x)<=width/2&&Math.abs(pos.y-npos.y)<=height/2;}},'triangle':{'render':function(type,pos,dim,canvas){var ctx=canvas.getCtx(),c1x=pos.x,c1y=pos.y-dim,c2x=c1x-dim,c2y=pos.y+dim,c3x=c1x+dim,c3y=c2y;ctx.beginPath();ctx.moveTo(c1x,c1y);ctx.lineTo(c2x,c2y);ctx.lineTo(c3x,c3y);ctx.closePath();ctx[type]();},'contains':function(npos,pos,dim){return NodeHelper.circle.contains(npos,pos,dim);}},'star':{'render':function(type,pos,dim,canvas){var ctx=canvas.getCtx(),pi5=Math.PI/5;ctx.save();ctx.translate(pos.x,pos.y);ctx.beginPath();ctx.moveTo(dim,0);for(var i=0;i<9;i++){ctx.rotate(pi5);if(i%2==0){ctx.lineTo((dim/0.525731)*0.200811,0);}else{ctx.lineTo(dim,0);}} +ctx.closePath();ctx[type]();ctx.restore();},'contains':function(npos,pos,dim){return NodeHelper.circle.contains(npos,pos,dim);}}};var EdgeHelper={'line':{'render':function(from,to,canvas){var ctx=canvas.getCtx();ctx.beginPath();ctx.moveTo(from.x,from.y);ctx.lineTo(to.x,to.y);ctx.stroke();},'contains':function(posFrom,posTo,pos,epsilon){var min=Math.min,max=Math.max,minPosX=min(posFrom.x,posTo.x),maxPosX=max(posFrom.x,posTo.x),minPosY=min(posFrom.y,posTo.y),maxPosY=max(posFrom.y,posTo.y);if(pos.x>=minPosX&&pos.x<=maxPosX&&pos.y>=minPosY&&pos.y<=maxPosY){if(Math.abs(posTo.x-posFrom.x)<=epsilon){return true;} +var dist=(posTo.y-posFrom.y)/(posTo.x-posFrom.x)*(pos.x-posFrom.x)+posFrom.y;return Math.abs(dist-pos.y)<=epsilon;} +return false;}},'arrow':{'render':function(from,to,dim,swap,canvas){var ctx=canvas.getCtx();if(swap){var tmp=from;from=to;to=tmp;} +var vect=new Complex(to.x-from.x,to.y-from.y);vect.$scale(dim/vect.norm());var intermediatePoint=new Complex(to.x-vect.x,to.y-vect.y),normal=new Complex(-vect.y/2,vect.x/2),v1=intermediatePoint.add(normal),v2=intermediatePoint.$add(normal.$scale(-1));ctx.beginPath();ctx.moveTo(from.x,from.y);ctx.lineTo(to.x,to.y);ctx.stroke();ctx.beginPath();ctx.moveTo(v1.x,v1.y);ctx.lineTo(v2.x,v2.y);ctx.lineTo(to.x,to.y);ctx.closePath();ctx.fill();},'contains':function(posFrom,posTo,pos,epsilon){return EdgeHelper.line.contains(posFrom,posTo,pos,epsilon);}},'hyperline':{'render':function(from,to,r,canvas){var ctx=canvas.getCtx();var centerOfCircle=computeArcThroughTwoPoints(from,to);if(centerOfCircle.a>1000||centerOfCircle.b>1000||centerOfCircle.ratio<0){ctx.beginPath();ctx.moveTo(from.x*r,from.y*r);ctx.lineTo(to.x*r,to.y*r);ctx.stroke();}else{var angleBegin=Math.atan2(to.y-centerOfCircle.y,to.x +-centerOfCircle.x);var angleEnd=Math.atan2(from.y-centerOfCircle.y,from.x +-centerOfCircle.x);var sense=sense(angleBegin,angleEnd);ctx.beginPath();ctx.arc(centerOfCircle.x*r,centerOfCircle.y*r,centerOfCircle.ratio*r,angleBegin,angleEnd,sense);ctx.stroke();} +function computeArcThroughTwoPoints(p1,p2){var aDen=(p1.x*p2.y-p1.y*p2.x),bDen=aDen;var sq1=p1.squaredNorm(),sq2=p2.squaredNorm();if(aDen==0) +return{x:0,y:0,ratio:-1};var a=(p1.y*sq2-p2.y*sq1+p1.y-p2.y)/aDen;var b=(p2.x*sq1-p1.x*sq2+p2.x-p1.x)/bDen;var x=-a/2;var y=-b/2;var squaredRatio=(a*a+b*b)/4-1;if(squaredRatio<0) +return{x:0,y:0,ratio:-1};var ratio=Math.sqrt(squaredRatio);var out={x:x,y:y,ratio:ratio>1000?-1:ratio,a:a,b:b};return out;} +function sense(angleBegin,angleEnd){return(angleBeginangleEnd)?false:true):((angleEnd+Math.PI>angleBegin)?true:false);}},'contains':$.lambda(false)}};Graph.Plot={initialize:function(viz,klass){this.viz=viz;this.config=viz.config;this.node=viz.config.Node;this.edge=viz.config.Edge;this.animation=new Animation;this.nodeTypes=new klass.Plot.NodeTypes;this.edgeTypes=new klass.Plot.EdgeTypes;this.labels=viz.labels;},nodeHelper:NodeHelper,edgeHelper:EdgeHelper,Interpolator:{'map':{'border':'color','color':'color','width':'number','height':'number','dim':'number','alpha':'number','lineWidth':'number','angularWidth':'number','span':'number','valueArray':'array-number','dimArray':'array-number'},'canvas':{'globalAlpha':'number','fillStyle':'color','strokeStyle':'color','lineWidth':'number','shadowBlur':'number','shadowColor':'color','shadowOffsetX':'number','shadowOffsetY':'number','miterLimit':'number'},'label':{'size':'number','color':'color'},'compute':function(from,to,delta){return from+(to-from)*delta;},'moebius':function(elem,props,delta,vector){var v=vector.scale(-delta);if(v.norm()<1){var x=v.x,y=v.y;var ans=elem.startPos.getc().moebiusTransformation(v);elem.pos.setc(ans.x,ans.y);v.x=x;v.y=y;}},'linear':function(elem,props,delta){var from=elem.startPos.getc(true);var to=elem.endPos.getc(true);elem.pos.setc(this.compute(from.x,to.x,delta),this.compute(from.y,to.y,delta));},'polar':function(elem,props,delta){var from=elem.startPos.getp(true);var to=elem.endPos.getp();var ans=to.interpolate(from,delta);elem.pos.setp(ans.theta,ans.rho);},'number':function(elem,prop,delta,getter,setter){var from=elem[getter](prop,'start');var to=elem[getter](prop,'end');elem[setter](prop,this.compute(from,to,delta));},'color':function(elem,prop,delta,getter,setter){var from=$.hexToRgb(elem[getter](prop,'start'));var to=$.hexToRgb(elem[getter](prop,'end'));var comp=this.compute;var val=$.rgbToHex([parseInt(comp(from[0],to[0],delta)),parseInt(comp(from[1],to[1],delta)),parseInt(comp(from[2],to[2],delta))]);elem[setter](prop,val);},'array-number':function(elem,prop,delta,getter,setter){var from=elem[getter](prop,'start'),to=elem[getter](prop,'end'),cur=[];for(var i=0,l=from.length;i=0.95){that.labels.plotLabel(canvas,node,opt);}else{that.labels.hideLabel(node,false);}} +ctx.restore();node.visited=!T;});},plotTree:function(node,opt,animating){var that=this,viz=this.viz,canvas=viz.canvas,config=this.config,ctx=canvas.getCtx();var nodeAlpha=node.getData('alpha');node.eachSubnode(function(elem){if(opt.plotSubtree(node,elem)&&elem.exist&&elem.drawn){var adj=node.getAdjacency(elem.id);!animating&&opt.onBeforePlotLine(adj);ctx.globalAlpha=Math.min(nodeAlpha,elem.getData('alpha'));that.plotLine(adj,canvas,animating);!animating&&opt.onAfterPlotLine(adj);that.plotTree(elem,opt,animating);}});if(node.drawn){!animating&&opt.onBeforePlotNode(node);this.plotNode(node,canvas,animating);!animating&&opt.onAfterPlotNode(node);if(!opt.hideLabels&&opt.withLabels&&nodeAlpha>=0.95) +this.labels.plotLabel(canvas,node,opt);else +this.labels.hideLabel(node,false);}else{this.labels.hideLabel(node,true);}},plotNode:function(node,canvas,animating){var f=node.getData('type'),ctxObj=this.node.CanvasStyles;if(f!='none'){var width=node.getData('lineWidth'),color=node.getData('color'),alpha=node.getData('alpha'),ctx=canvas.getCtx();ctx.lineWidth=width;ctx.fillStyle=ctx.strokeStyle=color;ctx.globalAlpha=alpha;for(var s in ctxObj){ctx[s]=node.getCanvasStyle(s);} +this.nodeTypes[f].render.call(this,node,canvas,animating);}},plotLine:function(adj,canvas,animating){var f=adj.getData('type'),ctxObj=this.edge.CanvasStyles;if(f!='none'){var width=adj.getData('lineWidth'),color=adj.getData('color'),ctx=canvas.getCtx();ctx.lineWidth=width;ctx.fillStyle=ctx.strokeStyle=color;for(var s in ctxObj){ctx[s]=adj.getCanvasStyle(s);} +this.edgeTypes[f].render.call(this,adj,canvas,animating);}}};Graph.Label={};Graph.Label.Native=new Class({plotLabel:function(canvas,node,controller){var ctx=canvas.getCtx();var pos=node.pos.getc(true);ctx.font=node.getLabelData('style')+' '+node.getLabelData('size')+'px '+node.getLabelData('family');ctx.textAlign=node.getLabelData('textAlign');ctx.fillStyle=ctx.strokeStyle=node.getLabelData('color');ctx.textBaseline=node.getLabelData('textBaseline');this.renderLabel(canvas,node,controller);},renderLabel:function(canvas,node,controller){var ctx=canvas.getCtx();var pos=node.pos.getc(true);ctx.fillText(node.name,pos.x,pos.y+node.getData("height")/2);},hideLabel:$.empty,hideLabels:$.empty});Graph.Label.DOM=new Class({labelsHidden:false,labelContainer:false,labels:{},getLabelContainer:function(){return this.labelContainer?this.labelContainer:this.labelContainer=document.getElementById(this.viz.config.labelContainer);},getLabel:function(id){return(id in this.labels&&this.labels[id]!=null)?this.labels[id]:this.labels[id]=document.getElementById(id);},hideLabels:function(hide){var container=this.getLabelContainer();if(hide) +container.style.display='none';else +container.style.display='';this.labelsHidden=hide;},clearLabels:function(force){for(var id in this.labels){if(force||!this.viz.graph.hasNode(id)){this.disposeLabel(id);delete this.labels[id];}}},disposeLabel:function(id){var elem=this.getLabel(id);if(elem&&elem.parentNode){elem.parentNode.removeChild(elem);}},hideLabel:function(node,show){node=$.splat(node);var st=show?"":"none",lab,that=this;$.each(node,function(n){var lab=that.getLabel(n.id);if(lab){lab.style.display=st;}});},fitsInCanvas:function(pos,canvas){var size=canvas.getSize();if(pos.x>=size.width||pos.x<0||pos.y>=size.height||pos.y<0)return false;return true;}});Graph.Label.HTML=new Class({Implements:Graph.Label.DOM,plotLabel:function(canvas,node,controller){var id=node.id,tag=this.getLabel(id);if(!tag&&!(tag=document.getElementById(id))){tag=document.createElement('div');var container=this.getLabelContainer();tag.id=id;tag.className='node';tag.style.position='absolute';controller.onCreateLabel(tag,node);container.appendChild(tag);this.labels[node.id]=tag;} +this.placeLabel(tag,node,controller);}});Graph.Label.SVG=new Class({Implements:Graph.Label.DOM,plotLabel:function(canvas,node,controller){var id=node.id,tag=this.getLabel(id);if(!tag&&!(tag=document.getElementById(id))){var ns='http://www.w3.org/2000/svg';tag=document.createElementNS(ns,'svg:text');var tspan=document.createElementNS(ns,'svg:tspan');tag.appendChild(tspan);var container=this.getLabelContainer();tag.setAttribute('id',id);tag.setAttribute('class','node');container.appendChild(tag);controller.onCreateLabel(tag,node);this.labels[node.id]=tag;} +this.placeLabel(tag,node,controller);}});Graph.Geom=new Class({initialize:function(viz){this.viz=viz;this.config=viz.config;this.node=viz.config.Node;this.edge=viz.config.Edge;},translate:function(pos,prop){prop=$.splat(prop);this.viz.graph.eachNode(function(elem){$.each(prop,function(p){elem.getPos(p).$add(pos);});});},setRightLevelToShow:function(node,canvas,callback){var level=this.getRightLevelToShow(node,canvas),fx=this.viz.labels,opt=$.merge({execShow:true,execHide:true,onHide:$.empty,onShow:$.empty},callback||{});node.eachLevel(0,this.config.levelsToShow,function(n){var d=n._depth-node._depth;if(d>level){opt.onHide(n);if(opt.execHide){n.drawn=false;n.exist=false;fx.hideLabel(n,false);}}else{opt.onShow(n);if(opt.execShow){n.exist=true;}}});node.drawn=true;},getRightLevelToShow:function(node,canvas){var config=this.config;var level=config.levelsToShow;var constrained=config.constrained;if(!constrained)return level;while(!this.treeFitsInCanvas(node,canvas,level)&&level>1){level--;} +return level;}});var Loader={construct:function(json){var isGraph=($.type(json)=='array');var ans=new Graph(this.graphOptions,this.config.Node,this.config.Edge,this.config.Label);if(!isGraph) +(function(ans,json){ans.addNode(json);if(json.children){for(var i=0,ch=json.children;ioffsetHeight?offsetWidth:offsetHeight;n.setData('width',dim);n.setData('height',dim);n.setData('dim',dim);}}});},initializeLabel:function(opt){if(!this.label){this.label=document.createElement('div');document.body.appendChild(this.label);} +this.setLabelStyles(opt);},setLabelStyles:function(opt){$.extend(this.label.style,{'visibility':'hidden','position':'absolute','width':'auto','height':'auto'});this.label.className='jit-autoadjust-label';}};Layouts.Tree=(function(){var slice=Array.prototype.slice;function getBoundaries(graph,config,level,orn,prop){var dim=config.Node;var multitree=config.multitree;if(dim.overridable){var w=-1,h=-1;graph.eachNode(function(n){if(n._depth==level&&(!multitree||('$orn'in n.data)&&n.data.$orn==orn)){var dw=n.getData('width',prop);var dh=n.getData('height',prop);w=(w0)?parents[0]:null;path(parents);};for(var i=0,ns=[node.id].concat(nodesInPath);i=b._depth);});for(var i=0;i0&&n.drawn){n.drawn=false;nds[node.id].push(n);}else if((!root||!orns)&&n.drawn){n.drawn=false;nds[node.id].push(n);}});node.drawn=true;} +if(nodes.length>0)viz.fx.plot();for(i in nds){$.each(nds[i],function(n){n.drawn=true;});} +for(i=0;ibaseHeight?size:baseHeight)+this.config.subtreeOffset;},getEdge:function(node,type,s){var $C=function(a,b){return function(){return node.pos.add(new Complex(a,b));};};var dim=this.node;var w=node.getData('width');var h=node.getData('height');if(type=='begin'){if(dim.align=="center"){return this.dispatch(s,$C(0,h/2),$C(-w/2,0),$C(0,-h/2),$C(w/2,0));}else if(dim.align=="left"){return this.dispatch(s,$C(0,h),$C(0,0),$C(0,0),$C(w,0));}else if(dim.align=="right"){return this.dispatch(s,$C(0,0),$C(-w,0),$C(0,-h),$C(0,0));}else throw"align: not implemented";}else if(type=='end'){if(dim.align=="center"){return this.dispatch(s,$C(0,-h/2),$C(w/2,0),$C(0,h/2),$C(-w/2,0));}else if(dim.align=="left"){return this.dispatch(s,$C(0,0),$C(w,0),$C(0,h),$C(0,0));}else if(dim.align=="right"){return this.dispatch(s,$C(0,-h),$C(0,0),$C(0,0),$C(-w,0));}else throw"align: not implemented";}},getScaledTreePosition:function(node,scale){var dim=this.node;var w=node.getData('width');var h=node.getData('height');var s=(this.config.multitree&&('$orn'in node.data)&&node.data.$orn)||this.config.orientation;var $C=function(a,b){return function(){return node.pos.add(new Complex(a,b)).$scale(1-scale);};};if(dim.align=="left"){return this.dispatch(s,$C(0,h),$C(0,0),$C(0,0),$C(w,0));}else if(dim.align=="center"){return this.dispatch(s,$C(0,h/2),$C(-w/2,0),$C(0,-h/2),$C(w/2,0));}else if(dim.align=="right"){return this.dispatch(s,$C(0,0),$C(-w,0),$C(0,-h),$C(0,0));}else throw"align: not implemented";},treeFitsInCanvas:function(node,canvas,level){var csize=canvas.getSize();var s=(this.config.multitree&&('$orn'in node.data)&&node.data.$orn)||this.config.orientation;var size=this.dispatch(s,csize.width,csize.height);var baseSize=this.getTreeBaseSize(node,level,function(level,node){return level===0||!node.anySubnode();});return(baseSize=0){node.drawn=false;var ctx=canvas.getCtx();var diff=viz.geom.getScaledTreePosition(node,scale);ctx.translate(diff.x,diff.y);ctx.scale(scale,scale);} +this.plotTree(node,$.merge(opt,{'withLabels':true,'hideLabels':!!scale,'plotSubtree':function(n,ch){var root=config.multitree&&!('$orn'in node.data);var orns=root&&node.getData('orns');return!root||orns.indexOf(elem.getData('orn'))>-1;}}),animating);if(scale>=0)node.drawn=true;},getAlignedPos:function(pos,width,height){var nconfig=this.node;var square,orn;if(nconfig.align=="center"){square={x:pos.x-width/2,y:pos.y-height/2};}else if(nconfig.align=="left"){orn=this.config.orientation;if(orn=="bottom"||orn=="top"){square={x:pos.x-width/2,y:pos.y};}else{square={x:pos.x,y:pos.y-height/2};}}else if(nconfig.align=="right"){orn=this.config.orientation;if(orn=="bottom"||orn=="top"){square={x:pos.x-width/2,y:pos.y-height};}else{square={x:pos.x-width,y:pos.y-height/2};}}else throw"align: not implemented";return square;},getOrientation:function(adj){var config=this.config;var orn=config.orientation;if(config.multitree){var nodeFrom=adj.nodeFrom;var nodeTo=adj.nodeTo;orn=(('$orn'in nodeFrom.data)&&nodeFrom.data.$orn)||(('$orn'in nodeTo.data)&&nodeTo.data.$orn);} +return orn;}});$jit.ST.Label={};$jit.ST.Label.Native=new Class({Implements:Graph.Label.Native,renderLabel:function(canvas,node,controller){var ctx=canvas.getCtx();var coord=node.pos.getc(true);ctx.fillText(node.name,coord.x,coord.y);}});$jit.ST.Label.DOM=new Class({Implements:Graph.Label.DOM,placeLabel:function(tag,node,controller){var pos=node.pos.getc(true),config=this.viz.config,dim=config.Node,canvas=this.viz.canvas,w=node.getData('width'),h=node.getData('height'),radius=canvas.getSize(),labelPos,orn;var ox=canvas.translateOffsetX,oy=canvas.translateOffsetY,sx=canvas.scaleOffsetX,sy=canvas.scaleOffsetY,posx=pos.x*sx+ox,posy=pos.y*sy+oy;if(dim.align=="center"){labelPos={x:Math.round(posx-w/2+radius.width/2),y:Math.round(posy-h/2+radius.height/2)};}else if(dim.align=="left"){orn=config.orientation;if(orn=="bottom"||orn=="top"){labelPos={x:Math.round(posx-w/2+radius.width/2),y:Math.round(posy+radius.height/2)};}else{labelPos={x:Math.round(posx+radius.width/2),y:Math.round(posy-h/2+radius.height/2)};}}else if(dim.align=="right"){orn=config.orientation;if(orn=="bottom"||orn=="top"){labelPos={x:Math.round(posx-w/2+radius.width/2),y:Math.round(posy-h+radius.height/2)};}else{labelPos={x:Math.round(posx-w+radius.width/2),y:Math.round(posy-h/2+radius.height/2)};}}else throw"align: not implemented";var style=tag.style;style.left=labelPos.x+'px';style.top=labelPos.y+'px';style.display=this.fitsInCanvas(labelPos,canvas)?'':'none';controller.onPlaceLabel(tag,node);}});$jit.ST.Label.SVG=new Class({Implements:[$jit.ST.Label.DOM,Graph.Label.SVG],initialize:function(viz){this.viz=viz;}});$jit.ST.Label.HTML=new Class({Implements:[$jit.ST.Label.DOM,Graph.Label.HTML],initialize:function(viz){this.viz=viz;}});$jit.ST.Plot.NodeTypes=new Class({'none':{'render':$.empty,'contains':$.lambda(false)},'circle':{'render':function(node,canvas){var dim=node.getData('dim'),pos=this.getAlignedPos(node.pos.getc(true),dim,dim),dim2=dim/2;this.nodeHelper.circle.render('fill',{x:pos.x+dim2,y:pos.y+dim2},dim2,canvas);},'contains':function(node,pos){var dim=node.getData('dim'),npos=this.getAlignedPos(node.pos.getc(true),dim,dim),dim2=dim/2;this.nodeHelper.circle.contains({x:npos.x+dim2,y:npos.y+dim2},dim2);}},'square':{'render':function(node,canvas){var dim=node.getData('dim'),dim2=dim/2,pos=this.getAlignedPos(node.pos.getc(true),dim,dim);this.nodeHelper.square.render('fill',{x:pos.x+dim2,y:pos.y+dim2},dim2,canvas);},'contains':function(node,pos){var dim=node.getData('dim'),npos=this.getAlignedPos(node.pos.getc(true),dim,dim),dim2=dim/2;this.nodeHelper.square.contains({x:npos.x+dim2,y:npos.y+dim2},dim2);}},'ellipse':{'render':function(node,canvas){var width=node.getData('width'),height=node.getData('height'),pos=this.getAlignedPos(node.pos.getc(true),width,height);this.nodeHelper.ellipse.render('fill',{x:pos.x+width/2,y:pos.y+height/2},width,height,canvas);},'contains':function(node,pos){var width=node.getData('width'),height=node.getData('height'),npos=this.getAlignedPos(node.pos.getc(true),width,height);this.nodeHelper.ellipse.contains({x:npos.x+width/2,y:npos.y+height/2},width,height,canvas);}},'rectangle':{'render':function(node,canvas){var width=node.getData('width'),height=node.getData('height'),pos=this.getAlignedPos(node.pos.getc(true),width,height);this.nodeHelper.rectangle.render('fill',{x:pos.x+width/2,y:pos.y+height/2},width,height,canvas);},'contains':function(node,pos){var width=node.getData('width'),height=node.getData('height'),npos=this.getAlignedPos(node.pos.getc(true),width,height);this.nodeHelper.rectangle.contains({x:npos.x+width/2,y:npos.y+height/2},width,height,canvas);}}});$jit.ST.Plot.EdgeTypes=new Class({'none':$.empty,'line':{'render':function(adj,canvas){var orn=this.getOrientation(adj),nodeFrom=adj.nodeFrom,nodeTo=adj.nodeTo,rel=nodeFrom._depth1&&direction[0]!=node.id);this.edgeHelper.arrow.render(from,to,dim,inv,canvas);},'contains':function(adj,pos){var orn=this.getOrientation(adj),nodeFrom=adj.nodeFrom,nodeTo=adj.nodeTo,rel=nodeFrom._depthx+dataPointMidPoint){return false;} +for(var i=0,l=dimArray.length;i=x-dataPointMidPoint&&mpos.x<=x+dataPointMidPoint&&mpos.y>=y-dimi[0]-dataPointMidPoint&&mpos.y<=y-dimi[0]+dataPointMidPoint){var valArrayCur=node.getData('valArrayCur');var results=array_match(valArrayCur[i],valArrayCur);var matches=results[0];var indexValues=results[1];if(matches>1){var names=new Array(),values=new Array(),percentages=new Array(),linksArr=new Array();for(var j=0,il=indexValues.length;j0){acum+=valArray[i][0];leftAcum+=dimArray[i][0];}} +aggregateStyle.top=(-font-config.labelOffset)+'px';labelStyle.top=(config.labelOffset+leftAcum)+'px';domElement.style.top=parseInt(domElement.style.top,10)-leftAcum+'px';domElement.style.height=wrapperStyle.height=leftAcum+'px';labels.aggregate.innerHTML=acum;}}});var size=st.canvas.getSize(),margin=config.Margin;st.config.offsetY=-size.height/2+margin.bottom ++(config.showLabels&&(config.labelOffset+config.Label.size));st.config.offsetX=(margin.right-margin.left-config.labelOffset-config.Label.size)/2;this.st=st;this.canvas=this.st.canvas;},renderTitle:function(){var canvas=this.canvas,size=canvas.getSize(),config=this.config,margin=config.Margin,label=config.Label,title=config.Title;ctx=canvas.getCtx();ctx.fillStyle=title.color;ctx.textAlign='left';ctx.textBaseline='top';ctx.font=label.style+' bold '+' '+title.size+'px '+label.family;if(label.type=='Native'){ctx.fillText(title.text,-size.width/2+margin.left,-size.height/2+margin.top);}},renderTicks:function(){var canvas=this.canvas,size=canvas.getSize(),config=this.config,margin=config.Margin,ticks=config.Ticks,title=config.Title,subtitle=config.Subtitle,label=config.Label,maxValue=this.maxValue,maxTickValue=Math.ceil(maxValue*.1)*10;if(maxTickValue==maxValue){var length=maxTickValue.toString().length;maxTickValue=maxTickValue+parseInt(pad(1,length));} +labelValue=0,labelIncrement=maxTickValue/ticks.segments,ctx=canvas.getCtx();ctx.strokeStyle=ticks.color;ctx.font=label.style+' '+label.size+'px '+label.family;ctx.textAlign='center';ctx.textBaseline='middle';idLabel=canvas.id+"-label";labelDim=100;container=document.getElementById(idLabel);var axis=(size.height/2)-(margin.bottom+config.labelOffset+label.size+(subtitle.text?subtitle.size+subtitle.offset:0)),htmlOrigin=size.height-(margin.bottom+config.labelOffset+label.size+(subtitle.text?subtitle.size+subtitle.offset:0)),grid=-size.height+(margin.bottom+config.labelOffset+label.size+margin.top+(title.text?title.size+title.offset:0)+(subtitle.text?subtitle.size+subtitle.offset:0)),segmentLength=grid/ticks.segments;ctx.fillStyle=ticks.color;ctx.fillRect(-(size.width/2)+margin.left+config.labelOffset+label.size-1,-(size.height/2)+margin.top+(title.text?title.size+title.offset:0),1,size.height-margin.top-margin.bottom-label.size-config.labelOffset-(title.text?title.size+title.offset:0)-(subtitle.text?subtitle.size+subtitle.offset:0));while(axis>=grid){ctx.save();ctx.translate(-(size.width/2)+margin.left,Math.round(axis));ctx.rotate(Math.PI/2);ctx.fillStyle=label.color;if(config.showLabels){if(label.type=='Native'){ctx.fillText(labelValue,0,0);}else{labelDiv=document.createElement('div');labelDiv.innerHTML=labelValue;labelDiv.className="rotatedLabel";labelDiv.style.top=(htmlOrigin-(labelDim/2))+"px";labelDiv.style.left=margin.left+"px";labelDiv.style.width=labelDim+"px";labelDiv.style.height=labelDim+"px";labelDiv.style.textAlign="center";labelDiv.style.verticalAlign="middle";labelDiv.style.position="absolute";container.appendChild(labelDiv);}} +ctx.restore();ctx.fillStyle=ticks.color;ctx.fillRect(-(size.width/2)+margin.left+config.labelOffset+label.size,Math.round(axis),size.width-margin.right-margin.left-config.labelOffset-label.size,1);htmlOrigin+=segmentLength;axis+=segmentLength;labelValue+=labelIncrement;}},renderBackground:function(){var canvas=this.canvas,config=this.config,backgroundColor=config.backgroundColor,size=canvas.getSize(),ctx=canvas.getCtx();ctx.fillStyle=backgroundColor;ctx.fillRect(-size.width/2,-size.height/2,size.width,size.height);},loadJSON:function(json){var prefix=$.time(),ch=[],st=this.st,name=$.splat(json.label),color=$.splat(json.color||this.colors),config=this.config,ticks=config.Ticks,renderBackground=config.renderBackground,gradient=!!config.type.split(":")[1],animate=config.animate,title=config.Title,groupTotalValue=0;var valArrayAll=new Array();for(var i=0,values=json.values,l=values.length;i-1)?d:[0,0];}),'end');});this.st.fx.animate({modes:['node-property:dimArray'],duration:1500,onComplete:function(){that.busy=false;}});},restore:function(){if(this.busy)return;this.busy=true;if(this.config.Tips.enable)this.st.tips.hide();this.select(false,false,false);this.normalizeDims();var that=this;this.st.fx.animate({modes:['node-property:height:dimArray'],duration:1500,onComplete:function(){that.busy=false;}});},select:function(id,name,index){if(!this.config.selectOnHover)return;var s=this.selected;if(s.id!=id||s.name!=name||s.index!=index){s.id=id;s.name=name;s.index=index;this.st.graph.eachNode(function(n){n.setData('border',false);});if(id){var n=this.st.graph.getNode(id);n.setData('border',s);var link=index===0?'prev':'next';link=n.getData(link);if(link){n=this.st.graph.getByName(link);if(n){n.setData('border',{name:name,index:1-index});}}} +this.st.plot();}},getLegend:function(){var legend=new Array();var name=new Array();var color=new Array();var n;this.st.graph.getNode(this.st.root).eachAdjacency(function(adj){n=adj.nodeTo;});var colors=n.getData('colorArray'),len=colors.length;$.each(n.getData('stringArray'),function(s,i){color[i]=colors[i%len];name[i]=s;});legend['name']=name;legend['color']=color;return legend;},normalizeDims:function(){var root=this.st.graph.getNode(this.st.root),l=0;root.eachAdjacency(function(){l++;});var maxValue=this.maxValue||1,size=this.st.canvas.getSize(),config=this.config,margin=config.Margin,labelOffset=config.labelOffset+config.Label.size,fixedDim=(size.width-(margin.left+margin.right+labelOffset))/(l-1),animate=config.animate,ticks=config.Ticks,height=size.height-(margin.top+margin.bottom)-(config.showAggregates&&labelOffset) +-(config.showLabels&&labelOffset);var maxTickValue=Math.ceil(maxValue*.1)*10;if(maxTickValue==maxValue){var length=maxTickValue.toString().length;maxTickValue=maxTickValue+parseInt(pad(1,length));} +this.st.graph.eachNode(function(n){var acumLeft=0,acumRight=0,animateValue=[];$.each(n.getData('valueArray'),function(v){acumLeft+=+v[0];acumRight+=+v[1];animateValue.push([0,0]);});var acum=acumRight>acumLeft?acumRight:acumLeft;n.setData('width',fixedDim);if(animate){n.setData('height',acum*height/maxValue,'end');n.setData('dimArray',$.map(n.getData('valueArray'),function(n){return[n[0]*height/maxValue,n[1]*height/maxValue];}),'end');var dimArray=n.getData('dimArray');if(!dimArray){n.setData('dimArray',animateValue);}}else{if(ticks.enable){n.setData('height',acum*height/maxValue);n.setData('dimArray',$.map(n.getData('valueArray'),function(n){return[n[0]*height/maxTickValue,n[1]*height/maxTickValue];}));}else{n.setData('height',acum*height/maxValue);n.setData('dimArray',$.map(n.getData('valueArray'),function(n){return[n[0]*height/maxValue,n[1]*height/maxValue];}));}}});}});$jit.ST.Plot.NodeTypes.implement({'areachart-stacked':{'render':function(node,canvas){var pos=node.pos.getc(true),width=node.getData('width'),height=node.getData('height'),algnPos=this.getAlignedPos(pos,width,height),x=algnPos.x,y=algnPos.y,stringArray=node.getData('stringArray'),dimArray=node.getData('dimArray'),valArray=node.getData('valueArray'),valLeft=$.reduce(valArray,function(x,y){return x+y[0];},0),valRight=$.reduce(valArray,function(x,y){return x+y[1];},0),colorArray=node.getData('colorArray'),colorLength=colorArray.length,config=node.getData('config'),gradient=node.getData('gradient'),showLabels=config.showLabels,aggregates=config.showAggregates,label=config.Label,prev=node.getData('prev');var ctx=canvas.getCtx(),border=node.getData('border');if(colorArray&&dimArray&&stringArray){for(var i=0,l=dimArray.length,acumLeft=0,acumRight=0,valAcum=0;i0||dimArray[i][1]>0)){var h1=acumLeft+dimArray[i][0],h2=acumRight+dimArray[i][1],alpha=Math.atan((h2-h1)/width),delta=55;var linear=ctx.createLinearGradient(x+width/2,y-(h1+h2)/2,x+width/2+delta*Math.sin(alpha),y-(h1+h2)/2+delta*Math.cos(alpha));var color=$.rgbToHex($.map($.hexToRgb(colorArray[i%colorLength].slice(1)),function(v){return(v*0.85)>>0;}));linear.addColorStop(0,colorArray[i%colorLength]);linear.addColorStop(1,color);ctx.fillStyle=linear;} +ctx.beginPath();ctx.moveTo(x,y-acumLeft);ctx.lineTo(x+width,y-acumRight);ctx.lineTo(x+width,y-acumRight-dimArray[i][1]);ctx.lineTo(x,y-acumLeft-dimArray[i][0]);ctx.lineTo(x,y-acumLeft);ctx.fill();ctx.restore();if(border){var strong=border.name==stringArray[i];var perc=strong?0.7:0.8;var color=$.rgbToHex($.map($.hexToRgb(colorArray[i%colorLength].slice(1)),function(v){return(v*perc)>>0;}));ctx.strokeStyle=color;ctx.lineWidth=strong?4:1;ctx.save();ctx.beginPath();if(border.index===0){ctx.moveTo(x,y-acumLeft);ctx.lineTo(x,y-acumLeft-dimArray[i][0]);}else{ctx.moveTo(x+width,y-acumRight);ctx.lineTo(x+width,y-acumRight-dimArray[i][1]);} +ctx.stroke();ctx.restore();} +acumLeft+=(dimArray[i][0]||0);acumRight+=(dimArray[i][1]||0);if(dimArray[i][0]>0) +valAcum+=(valArray[i][0]||0);} +if(prev&&label.type=='Native'){ctx.save();ctx.beginPath();ctx.fillStyle=ctx.strokeStyle=label.color;ctx.font=label.style+' '+label.size+'px '+label.family;ctx.textAlign='center';ctx.textBaseline='middle';if(aggregates(node.name,valLeft,valRight,node)){ctx.fillText(valAcum,x,y-acumLeft-config.labelOffset-label.size/2,width);} +if(showLabels(node.name,valLeft,valRight,node)){ctx.fillText(node.name,x,y+label.size/2+config.labelOffset);} +ctx.restore();}}},'contains':function(node,mpos){var pos=node.pos.getc(true),width=node.getData('width'),height=node.getData('height'),algnPos=this.getAlignedPos(pos,width,height),x=algnPos.x,y=algnPos.y,dimArray=node.getData('dimArray'),rx=mpos.x-x;if(mpos.xx+width||mpos.y>y||mpos.y=intersec){var index=+(rx>width/2);return{'name':node.getData('stringArray')[i],'color':node.getData('colorArray')[i],'value':node.getData('valueArray')[i][index],'index':index};}} +return false;}}});$jit.AreaChart=new Class({st:null,colors:["#416D9C","#70A35E","#EBB056","#C74243","#83548B","#909291","#557EAA"],selected:{},busy:false,initialize:function(opt){this.controller=this.config=$.merge(Options("Canvas","Margin","Label","AreaChart"),{Label:{type:'Native'}},opt);var showLabels=this.config.showLabels,typeLabels=$.type(showLabels),showAggregates=this.config.showAggregates,typeAggregates=$.type(showAggregates);this.config.showLabels=typeLabels=='function'?showLabels:$.lambda(showLabels);this.config.showAggregates=typeAggregates=='function'?showAggregates:$.lambda(showAggregates);this.initializeViz();},initializeViz:function(){var config=this.config,that=this,nodeType=config.type.split(":")[0],nodeLabels={};var st=new $jit.ST({injectInto:config.injectInto,orientation:"bottom",levelDistance:0,siblingOffset:0,subtreeOffset:0,withLabels:config.Label.type!='Native',useCanvas:config.useCanvas,Label:{type:config.Label.type},Node:{overridable:true,type:'areachart-'+nodeType,align:'left',width:1,height:1},Edge:{type:'none'},Tips:{enable:config.Tips.enable,type:'Native',force:true,onShow:function(tip,node,contains){var elem=contains;config.Tips.onShow(tip,elem,node);}},Events:{enable:true,type:'Native',onClick:function(node,eventInfo,evt){if(!config.filterOnClick&&!config.Events.enable)return;var elem=eventInfo.getContains();if(elem)config.filterOnClick&&that.filter(elem.name);config.Events.enable&&config.Events.onClick(elem,eventInfo,evt);},onRightClick:function(node,eventInfo,evt){if(!config.restoreOnRightClick)return;that.restore();},onMouseMove:function(node,eventInfo,evt){if(!config.selectOnHover)return;if(node){var elem=eventInfo.getContains();that.select(node.id,elem.name,elem.index);}else{that.select(false,false,false);}}},onCreateLabel:function(domElement,node){var labelConf=config.Label,valueArray=node.getData('valueArray'),acumLeft=$.reduce(valueArray,function(x,y){return x+y[0];},0),acumRight=$.reduce(valueArray,function(x,y){return x+y[1];},0);if(node.getData('prev')){var nlbs={wrapper:document.createElement('div'),aggregate:document.createElement('div'),label:document.createElement('div')};var wrapper=nlbs.wrapper,label=nlbs.label,aggregate=nlbs.aggregate,wrapperStyle=wrapper.style,labelStyle=label.style,aggregateStyle=aggregate.style;nodeLabels[node.id]=nlbs;wrapper.appendChild(label);wrapper.appendChild(aggregate);if(!config.showLabels(node.name,acumLeft,acumRight,node)){label.style.display='none';} +if(!config.showAggregates(node.name,acumLeft,acumRight,node)){aggregate.style.display='none';} +wrapperStyle.position='relative';wrapperStyle.overflow='visible';wrapperStyle.fontSize=labelConf.size+'px';wrapperStyle.fontFamily=labelConf.family;wrapperStyle.color=labelConf.color;wrapperStyle.textAlign='center';aggregateStyle.position=labelStyle.position='absolute';domElement.style.width=node.getData('width')+'px';domElement.style.height=node.getData('height')+'px';label.innerHTML=node.name;domElement.appendChild(wrapper);}},onPlaceLabel:function(domElement,node){if(!node.getData('prev'))return;var labels=nodeLabels[node.id],wrapperStyle=labels.wrapper.style,labelStyle=labels.label.style,aggregateStyle=labels.aggregate.style,width=node.getData('width'),height=node.getData('height'),dimArray=node.getData('dimArray'),valArray=node.getData('valueArray'),acumLeft=$.reduce(valArray,function(x,y){return x+y[0];},0),acumRight=$.reduce(valArray,function(x,y){return x+y[1];},0),font=parseInt(wrapperStyle.fontSize,10),domStyle=domElement.style;if(dimArray&&valArray){if(config.showLabels(node.name,acumLeft,acumRight,node)){labelStyle.display='';}else{labelStyle.display='none';} +if(config.showAggregates(node.name,acumLeft,acumRight,node)){aggregateStyle.display='';}else{aggregateStyle.display='none';} +wrapperStyle.width=aggregateStyle.width=labelStyle.width=domElement.style.width=width+'px';aggregateStyle.left=labelStyle.left=-width/2+'px';for(var i=0,l=valArray.length,acum=0,leftAcum=0;i0){acum+=valArray[i][0];leftAcum+=dimArray[i][0];}} +aggregateStyle.top=(-font-config.labelOffset)+'px';labelStyle.top=(config.labelOffset+leftAcum)+'px';domElement.style.top=parseInt(domElement.style.top,10)-leftAcum+'px';domElement.style.height=wrapperStyle.height=leftAcum+'px';labels.aggregate.innerHTML=acum;}}});var size=st.canvas.getSize(),margin=config.Margin;st.config.offsetY=-size.height/2+margin.bottom ++(config.showLabels&&(config.labelOffset+config.Label.size));st.config.offsetX=(margin.right-margin.left)/2;this.st=st;this.canvas=this.st.canvas;},loadJSON:function(json){var prefix=$.time(),ch=[],st=this.st,name=$.splat(json.label),color=$.splat(json.color||this.colors),config=this.config,gradient=!!config.type.split(":")[1],animate=config.animate;for(var i=0,values=json.values,l=values.length;i-1)?d:[0,0];}),'end');});this.st.fx.animate({modes:['node-property:dimArray'],duration:1500,onComplete:function(){that.busy=false;}});},restore:function(){if(this.busy)return;this.busy=true;if(this.config.Tips.enable)this.st.tips.hide();this.select(false,false,false);this.normalizeDims();var that=this;this.st.fx.animate({modes:['node-property:height:dimArray'],duration:1500,onComplete:function(){that.busy=false;}});},select:function(id,name,index){if(!this.config.selectOnHover)return;var s=this.selected;if(s.id!=id||s.name!=name||s.index!=index){s.id=id;s.name=name;s.index=index;this.st.graph.eachNode(function(n){n.setData('border',false);});if(id){var n=this.st.graph.getNode(id);n.setData('border',s);var link=index===0?'prev':'next';link=n.getData(link);if(link){n=this.st.graph.getByName(link);if(n){n.setData('border',{name:name,index:1-index});}}} +this.st.plot();}},getLegend:function(){var legend={};var n;this.st.graph.getNode(this.st.root).eachAdjacency(function(adj){n=adj.nodeTo;});var colors=n.getData('colorArray'),len=colors.length;$.each(n.getData('stringArray'),function(s,i){legend[s]=colors[i%len];});return legend;},getMaxValue:function(){var maxValue=0;this.st.graph.eachNode(function(n){var valArray=n.getData('valueArray'),acumLeft=0,acumRight=0;$.each(valArray,function(v){acumLeft+=+v[0];acumRight+=+v[1];});var acum=acumRight>acumLeft?acumRight:acumLeft;maxValue=maxValue>acum?maxValue:acum;});return maxValue;},normalizeDims:function(){var root=this.st.graph.getNode(this.st.root),l=0;root.eachAdjacency(function(){l++;});var maxValue=this.getMaxValue()||1,size=this.st.canvas.getSize(),config=this.config,margin=config.Margin,labelOffset=config.labelOffset+config.Label.size,fixedDim=(size.width-(margin.left+margin.right))/l,animate=config.animate,height=size.height-(margin.top+margin.bottom)-(config.showAggregates&&labelOffset) +-(config.showLabels&&labelOffset);this.st.graph.eachNode(function(n){var acumLeft=0,acumRight=0,animateValue=[];$.each(n.getData('valueArray'),function(v){acumLeft+=+v[0];acumRight+=+v[1];animateValue.push([0,0]);});var acum=acumRight>acumLeft?acumRight:acumLeft;n.setData('width',fixedDim);if(animate){n.setData('height',acum*height/maxValue,'end');n.setData('dimArray',$.map(n.getData('valueArray'),function(n){return[n[0]*height/maxValue,n[1]*height/maxValue];}),'end');var dimArray=n.getData('dimArray');if(!dimArray){n.setData('dimArray',animateValue);}}else{n.setData('height',acum*height/maxValue);n.setData('dimArray',$.map(n.getData('valueArray'),function(n){return[n[0]*height/maxValue,n[1]*height/maxValue];}));}});}});Options.BarChart={$extend:true,animate:true,type:'stacked',labelOffset:3,barsOffset:0,nodeCount:0,hoveredColor:'#9fd4ff',background:false,renderBackground:false,orientation:'horizontal',showAggregates:true,showLabels:true,Ticks:{enable:false,segments:4,color:'#000000'},Tips:{enable:false,onShow:$.empty,onHide:$.empty},Events:{enable:false,onClick:$.empty}};$jit.ST.Plot.NodeTypes.implement({'barchart-stacked':{'render':function(node,canvas){var pos=node.pos.getc(true),width=node.getData('width'),height=node.getData('height'),algnPos=this.getAlignedPos(pos,width,height),x=algnPos.x,y=algnPos.y,dimArray=node.getData('dimArray'),valueArray=node.getData('valueArray'),stringArray=node.getData('stringArray'),linkArray=node.getData('linkArray'),gvl=node.getData('gvl'),colorArray=node.getData('colorArray'),colorLength=colorArray.length,nodeCount=node.getData('nodeCount');var ctx=canvas.getCtx(),canvasSize=canvas.getSize(),opt={},border=node.getData('border'),gradient=node.getData('gradient'),config=node.getData('config'),horz=config.orientation=='horizontal',aggregates=config.showAggregates,showLabels=config.showLabels,label=config.Label,margin=config.Margin;if(colorArray&&dimArray&&stringArray){for(var i=0,l=dimArray.length,acum=0,valAcum=0;i>0;}));linear.addColorStop(0,color);linear.addColorStop(0.3,colorArray[i%colorLength]);linear.addColorStop(0.7,colorArray[i%colorLength]);linear.addColorStop(1,color);ctx.fillStyle=linear;} +if(horz){ctx.fillRect(x+acum,y,dimArray[i],height);}else{ctx.fillRect(x,y-acum-dimArray[i],width,dimArray[i]);} +if(border&&border.name==stringArray[i]){opt.acum=acum;opt.dimValue=dimArray[i];} +acum+=(dimArray[i]||0);valAcum+=(valueArray[i]||0);} +if(border){ctx.save();ctx.lineWidth=2;ctx.strokeStyle=border.color;if(horz){ctx.strokeRect(x+opt.acum+1,y+1,opt.dimValue-2,height-2);}else{ctx.strokeRect(x+1,y-opt.acum-opt.dimValue+1,width-2,opt.dimValue-2);} +ctx.restore();} +if(label.type=='Native'){ctx.save();ctx.fillStyle=ctx.strokeStyle=label.color;ctx.font=label.style+' '+label.size+'px '+label.family;ctx.textBaseline='middle';if(gvl){acumValueLabel=gvl;}else{acumValueLabel=valAcum;} +if(aggregates(node.name,valAcum)){if(!horz){ctx.textAlign='center';ctx.font=label.style+' '+label.size+'px '+label.family;ctx.save();gridHeight=canvasSize.height-(margin.top+margin.bottom+(config.Title.text?config.Title.size+config.Title.offset:0)+ +(config.Subtitle.text?config.Subtitle.size+config.Subtitle.offset:0)+ +(label?label.size+config.labelOffset:0));mtxt=ctx.measureText(acumValueLabel);boxWidth=mtxt.width+10;inset=10;boxHeight=label.size+6;if(boxHeight+acum+config.labelOffset>gridHeight){bottomPadding=acum-config.labelOffset-boxHeight;}else{bottomPadding=acum+config.labelOffset+inset;} +ctx.translate(x+width/2-(mtxt.width/2),y-bottomPadding);cornerRadius=4;boxX=-inset/2;boxY=-boxHeight/2;ctx.rotate(0*Math.PI/180);ctx.fillStyle="rgba(255,255,255,.8)";if(boxHeight+acum+config.labelOffset>gridHeight){$.roundedRect(ctx,boxX,boxY,boxWidth,boxHeight,cornerRadius,"fill");} +ctx.fillStyle=ctx.strokeStyle=label.color;ctx.fillText(acumValueLabel,mtxt.width/2,0);ctx.restore();}} +if(showLabels(node.name,valAcum,node)){if(horz){ctx.font=label.style+' '+label.size+'px '+label.family;inset=10;gridWidth=canvasSize.width-(config.Margin.left+config.Margin.right);mtxt=ctx.measureText(node.name+": "+acumValueLabel);boxWidth=mtxt.width+10;inset=10;if(acum+boxWidth+config.labelOffset+inset>gridWidth){leftPadding=acum-config.labelOffset-boxWidth-inset;}else{leftPadding=acum+config.labelOffset;} +ctx.textAlign='left';ctx.translate(x+inset+leftPadding,y+height/2);boxHeight=label.size+6;boxX=-inset/2;boxY=-boxHeight/2;ctx.fillStyle="rgba(255,255,255,.8)";cornerRadius=4;if(acum+boxWidth+config.labelOffset+inset>gridWidth){$.roundedRect(ctx,boxX,boxY,boxWidth,boxHeight,cornerRadius,"fill");} +ctx.fillStyle=label.color;ctx.rotate(0*Math.PI/180);ctx.fillText(node.name+": "+acumValueLabel,0,0);}else{if(nodeCount>8){ctx.textAlign='left';ctx.translate(x+width/2,y+label.size/2+config.labelOffset);ctx.rotate(45*Math.PI/180);ctx.fillText(node.name,0,0);}else{ctx.textAlign='center';ctx.fillText(node.name,x+width/2,y+label.size/2+config.labelOffset);}}} +ctx.restore();}}},'contains':function(node,mpos){var pos=node.pos.getc(true),width=node.getData('width'),height=node.getData('height'),algnPos=this.getAlignedPos(pos,width,height),x=algnPos.x,y=algnPos.y,dimArray=node.getData('dimArray'),config=node.getData('config'),rx=mpos.x-x,horz=config.orientation=='horizontal';if(horz){if(mpos.xx+width||mpos.y>y+height||mpos.yx+width||mpos.y>y||mpos.y=intersec){return{'name':node.getData('stringArray')[i],'color':node.getData('colorArray')[i],'value':node.getData('valueArray')[i],'valuelabel':node.getData('valuelabelArray')[i],'percentage':((node.getData('valueArray')[i]/node.getData('barTotalValue'))*100).toFixed(1),'link':url,'label':node.name};}}} +return false;}},'barchart-grouped':{'render':function(node,canvas){var pos=node.pos.getc(true),width=node.getData('width'),height=node.getData('height'),algnPos=this.getAlignedPos(pos,width,height),x=algnPos.x,y=algnPos.y,dimArray=node.getData('dimArray'),valueArray=node.getData('valueArray'),valuelabelArray=node.getData('valuelabelArray'),linkArray=node.getData('linkArray'),valueLength=valueArray.length,colorArray=node.getData('colorArray'),colorLength=colorArray.length,stringArray=node.getData('stringArray');var ctx=canvas.getCtx(),canvasSize=canvas.getSize(),opt={},border=node.getData('border'),gradient=node.getData('gradient'),config=node.getData('config'),horz=config.orientation=='horizontal',aggregates=config.showAggregates,showLabels=config.showLabels,label=config.Label,shadow=config.shadow,margin=config.Margin,fixedDim=(horz?height:width)/valueLength;maxValue=Math.max.apply(null,dimArray);ctx.fillStyle="rgba(0,0,0,.2)";if(colorArray&&dimArray&&stringArray&&shadow.enable){shadowThickness=shadow.size;for(var i=0,l=valueLength,acum=0,valAcum=0;idimArray[i]){ctx.fillRect((x-shadowThickness)+fixedDim*i,y-dimArray[i]-shadowThickness,fixedDim,dimArray[i]+shadowThickness);}else if(nextBar&&nextBar0&&idimArray[i]){ctx.fillRect((x-((prevBar>0;}));linear.addColorStop(0,color);linear.addColorStop(0.3,colorArray[i%colorLength]);linear.addColorStop(0.7,colorArray[i%colorLength]);linear.addColorStop(1,color);ctx.fillStyle=linear;} +if(horz){ctx.fillRect(x,y+fixedDim*i,dimArray[i],fixedDim);}else{ctx.fillRect(x+fixedDim*i,y-dimArray[i],fixedDim,dimArray[i]);} +if(border&&border.name==stringArray[i]){opt.acum=fixedDim*i;opt.dimValue=dimArray[i];} +acum+=(dimArray[i]||0);valAcum+=(valueArray[i]||0);ctx.fillStyle=ctx.strokeStyle=label.color;ctx.font=label.style+' '+label.size+'px '+label.family;inset=10;if(aggregates(node.name,valAcum)&&label.type=='Native'){if(valuelabelArray[i]){acumValueLabel=valuelabelArray[i];}else{acumValueLabel=valueArray[i];} +if(horz){ctx.font=label.style+' '+label.size+'px '+label.family;ctx.textAlign='left';ctx.textBaseline='top';ctx.fillStyle="rgba(255,255,255,.8)";gridWidth=canvasSize.width-(margin.left+margin.right+config.labeloffset+label.size);mtxt=ctx.measureText(acumValueLabel);boxWidth=mtxt.width+10;if(boxWidth+dimArray[i]+config.labelOffset>gridWidth){leftPadding=dimArray[i]-config.labelOffset-boxWidth-inset;}else{leftPadding=dimArray[i]+config.labelOffset+inset;} +boxHeight=label.size+6;boxX=x+leftPadding;boxY=y+i*fixedDim+(fixedDim/2)-boxHeight/2;cornerRadius=4;if(boxWidth+dimArray[i]+config.labelOffset>gridWidth){$.roundedRect(ctx,boxX,boxY,boxWidth,boxHeight,cornerRadius,"fill");} +ctx.fillStyle=ctx.strokeStyle=label.color;ctx.fillText(acumValueLabel,x+inset/2+leftPadding,y+i*fixedDim+(fixedDim/2)-(label.size/2));}else{ctx.font=label.style+' '+label.size+'px '+label.family;ctx.save();ctx.textAlign='center';gridHeight=canvasSize.height-(margin.top+margin.bottom+(config.Title.text?config.Title.size+config.Title.offset:0)+ +(config.Subtitle.text?config.Subtitle.size+config.Subtitle.offset:0)+ +(label?label.size+config.labelOffset:0));mtxt=ctx.measureText(acumValueLabel);boxWidth=mtxt.width+10;boxHeight=label.size+6;if(boxHeight+dimArray[i]+config.labelOffset>gridHeight){bottomPadding=dimArray[i]-config.labelOffset-boxHeight-inset;}else{bottomPadding=dimArray[i]+config.labelOffset+inset;} +ctx.translate(x+(i*fixedDim)+(fixedDim/2),y-bottomPadding);boxX=-boxWidth/2;boxY=-boxHeight/2;ctx.fillStyle="rgba(255,255,255,.8)";cornerRadius=4;if(boxHeight+dimArray[i]+config.labelOffset>gridHeight){$.roundedRect(ctx,boxX,boxY,boxWidth,boxHeight,cornerRadius,"fill");} +ctx.fillStyle=ctx.strokeStyle=label.color;ctx.fillText(acumValueLabel,0,0);ctx.restore();}}} +if(border){ctx.save();ctx.lineWidth=2;ctx.strokeStyle=border.color;if(horz){ctx.strokeRect(x+1,y+opt.acum+1,opt.dimValue-2,fixedDim-2);}else{ctx.strokeRect(x+opt.acum+1,y-opt.dimValue+1,fixedDim-2,opt.dimValue-2);} +ctx.restore();} +if(label.type=='Native'){ctx.save();ctx.fillStyle=ctx.strokeStyle=label.color;ctx.font=label.style+' '+label.size+'px '+label.family;ctx.textBaseline='middle';if(showLabels(node.name,valAcum,node)){if(horz){ctx.textAlign='center';ctx.translate(x-config.labelOffset-label.size/2,y+height/2);ctx.rotate(Math.PI/2);ctx.fillText(node.name,0,0);}else{ctx.textAlign='center';ctx.fillText(node.name,x+width/2,y+label.size/2+config.labelOffset);}} +ctx.restore();}}},'contains':function(node,mpos){var pos=node.pos.getc(true),width=node.getData('width'),height=node.getData('height'),algnPos=this.getAlignedPos(pos,width,height),x=algnPos.x,y=algnPos.y,dimArray=node.getData('dimArray'),len=dimArray.length,config=node.getData('config'),rx=mpos.x-x,horz=config.orientation=='horizontal',fixedDim=(horz?height:width)/len;if(horz){if(mpos.xx+width||mpos.y>y+height||mpos.yx+width||mpos.y>y||mpos.y=limit&&mpos.y<=limit+fixedDim){return{'name':node.getData('stringArray')[i],'color':node.getData('colorArray')[i],'value':node.getData('valueArray')[i],'valuelabel':node.getData('valuelabelArray')[i],'title':node.getData('titleArray')[i],'percentage':((node.getData('valueArray')[i]/node.getData('barTotalValue'))*100).toFixed(1),'link':url,'label':node.name};}}else{var limit=x+fixedDim*i;if(mpos.x>=limit&&mpos.x<=limit+fixedDim&&mpos.y>=y-dimi){return{'name':node.getData('stringArray')[i],'color':node.getData('colorArray')[i],'value':node.getData('valueArray')[i],'valuelabel':node.getData('valuelabelArray')[i],'title':node.getData('titleArray')[i],'percentage':((node.getData('valueArray')[i]/node.getData('barTotalValue'))*100).toFixed(1),'link':url,'label':node.name};}}} +return false;}},'barchart-basic':{'render':function(node,canvas){var pos=node.pos.getc(true),width=node.getData('width'),height=node.getData('height'),algnPos=this.getAlignedPos(pos,width,height),x=algnPos.x,y=algnPos.y,dimArray=node.getData('dimArray'),valueArray=node.getData('valueArray'),valuelabelArray=node.getData('valuelabelArray'),linkArray=node.getData('linkArray'),valueLength=valueArray.length,colorArray=node.getData('colorMono'),colorLength=colorArray.length,stringArray=node.getData('stringArray');var ctx=canvas.getCtx(),canvasSize=canvas.getSize(),opt={},border=node.getData('border'),gradient=node.getData('gradient'),config=node.getData('config'),horz=config.orientation=='horizontal',aggregates=config.showAggregates,showLabels=config.showLabels,label=config.Label,fixedDim=(horz?height:width)/valueLength,margin=config.Margin;if(colorArray&&dimArray&&stringArray){for(var i=0,l=valueLength,acum=0,valAcum=0;i>0;}));linear.addColorStop(0,color);linear.addColorStop(0.3,colorArray[i%colorLength]);linear.addColorStop(0.7,colorArray[i%colorLength]);linear.addColorStop(1,color);ctx.fillStyle=linear;} +if(horz){ctx.fillRect(x,y+fixedDim*i,dimArray[i],fixedDim);}else{ctx.fillRect(x+fixedDim*i,y-dimArray[i],fixedDim,dimArray[i]);} +if(border&&border.name==stringArray[i]){opt.acum=fixedDim*i;opt.dimValue=dimArray[i];} +acum+=(dimArray[i]||0);valAcum+=(valueArray[i]||0);if(label.type=='Native'){ctx.fillStyle=ctx.strokeStyle=label.color;ctx.font=label.style+' '+label.size+'px '+label.family;if(aggregates(node.name,valAcum)){if(valuelabelArray[i]){acumValueLabel=valuelabelArray[i];}else{acumValueLabel=valueArray[i];} +if(!horz){ctx.textAlign='center';ctx.font=label.style+' '+label.size+'px '+label.family;ctx.save();gridHeight=canvasSize.height-(margin.top+margin.bottom+(config.Title.text?config.Title.size+config.Title.offset:0)+ +(config.Subtitle.text?config.Subtitle.size+config.Subtitle.offset:0)+ +(label?label.size+config.labelOffset:0));mtxt=ctx.measureText(acumValueLabel);boxWidth=mtxt.width+10;inset=10;boxHeight=label.size+6;if(boxHeight+dimArray[i]+config.labelOffset>gridHeight){bottomPadding=dimArray[i]-config.labelOffset-inset;}else{bottomPadding=dimArray[i]+config.labelOffset+inset;} +ctx.translate(x+width/2-(mtxt.width/2),y-bottomPadding);cornerRadius=4;boxX=-inset/2;boxY=-boxHeight/2;ctx.fillStyle="rgba(255,255,255,.6)";if(boxHeight+dimArray[i]+config.labelOffset>gridHeight){$.roundedRect(ctx,boxX,boxY,boxWidth,boxHeight,cornerRadius,"fill");} +ctx.fillStyle=ctx.strokeStyle=label.color;ctx.fillText(acumValueLabel,mtxt.width/2,0);ctx.restore();}}}} +if(border){ctx.save();ctx.lineWidth=2;ctx.strokeStyle=border.color;if(horz){ctx.strokeRect(x+1,y+opt.acum+1,opt.dimValue-2,fixedDim-2);}else{ctx.strokeRect(x+opt.acum+1,y-opt.dimValue+1,fixedDim-2,opt.dimValue-2);} +ctx.restore();} +if(label.type=='Native'){ctx.save();ctx.fillStyle=ctx.strokeStyle=label.color;ctx.font=label.style+' '+label.size+'px '+label.family;ctx.textBaseline='middle';if(showLabels(node.name,valAcum,node)){if(horz){gridWidth=canvasSize.width-(config.Margin.left+config.Margin.right);mtxt=ctx.measureText(node.name+": "+valAcum);boxWidth=mtxt.width+10;inset=10;if(acum+boxWidth+config.labelOffset+inset>gridWidth){leftPadding=acum-config.labelOffset-boxWidth-inset;}else{leftPadding=acum+config.labelOffset;} +ctx.textAlign='left';ctx.translate(x+inset+leftPadding,y+height/2);boxHeight=label.size+6;boxX=-inset/2;boxY=-boxHeight/2;ctx.fillStyle="rgba(255,255,255,.8)";cornerRadius=4;if(acum+boxWidth+config.labelOffset+inset>gridWidth){$.roundedRect(ctx,boxX,boxY,boxWidth,boxHeight,cornerRadius,"fill");} +ctx.fillStyle=label.color;ctx.fillText(node.name+": "+valAcum,0,0);}else{if(stringArray.length>8){ctx.textAlign='left';ctx.translate(x+width/2,y+label.size/2+config.labelOffset);ctx.rotate(45*Math.PI/180);ctx.fillText(node.name,0,0);}else{ctx.textAlign='center';ctx.fillText(node.name,x+width/2,y+label.size/2+config.labelOffset);}}} +ctx.restore();}}},'contains':function(node,mpos){var pos=node.pos.getc(true),width=node.getData('width'),height=node.getData('height'),config=node.getData('config'),algnPos=this.getAlignedPos(pos,width,height),x=algnPos.x,y=algnPos.y,dimArray=node.getData('dimArray'),len=dimArray.length,rx=mpos.x-x,horz=config.orientation=='horizontal',fixedDim=(horz?height:width)/len;if(horz){if(mpos.xx+width||mpos.y>y+height||mpos.yx+width||mpos.y>y||mpos.y=limit&&mpos.y<=limit+fixedDim){return{'name':node.getData('stringArray')[i],'color':node.getData('colorArray')[i],'value':node.getData('valueArray')[i],'valuelabel':node.getData('valuelabelArray')[i],'percentage':((node.getData('valueArray')[i]/node.getData('groupTotalValue'))*100).toFixed(1),'link':url,'label':node.name};}}else{var limit=x+fixedDim*i;if(mpos.x>=limit&&mpos.x<=limit+fixedDim&&mpos.y>=y-dimi){return{'name':node.getData('stringArray')[i],'color':node.getData('colorArray')[i],'value':node.getData('valueArray')[i],'valuelabel':node.getData('valuelabelArray')[i],'percentage':((node.getData('valueArray')[i]/node.getData('groupTotalValue'))*100).toFixed(1),'link':url,'label':node.name};}}} +return false;}}});$jit.BarChart=new Class({st:null,colors:["#004b9c","#9c0079","#9c0033","#28009c","#9c0000","#7d009c","#001a9c","#00809c","#009c80","#009c42","#009c07","#469c00","#799c00","#9c9600","#9c5c00"],selected:{},busy:false,initialize:function(opt){this.controller=this.config=$.merge(Options("Canvas","Margin","Label","BarChart"),{Label:{type:'Native'}},opt);var showLabels=this.config.showLabels,typeLabels=$.type(showLabels),showAggregates=this.config.showAggregates,typeAggregates=$.type(showAggregates);this.config.showLabels=typeLabels=='function'?showLabels:$.lambda(showLabels);this.config.showAggregates=typeAggregates=='function'?showAggregates:$.lambda(showAggregates);Options.Fx.clearCanvas=false;this.initializeViz();},initializeViz:function(){var config=this.config,that=this;var nodeType=config.type.split(":")[0],horz=config.orientation=='horizontal',nodeLabels={};var st=new $jit.ST({injectInto:config.injectInto,orientation:horz?'left':'bottom',background:config.background,renderBackground:config.renderBackground,backgroundColor:config.backgroundColor,colorStop1:config.colorStop1,colorStop2:config.colorStop2,levelDistance:0,nodeCount:config.nodeCount,siblingOffset:config.barsOffset,subtreeOffset:0,withLabels:config.Label.type!='Native',useCanvas:config.useCanvas,Label:{type:config.Label.type},Node:{overridable:true,type:'barchart-'+nodeType,align:'left',width:1,height:1},Edge:{type:'none'},Tips:{enable:config.Tips.enable,type:'Native',force:true,onShow:function(tip,node,contains){var elem=contains;config.Tips.onShow(tip,elem,node);if(elem.link!='undefined'&&elem.link!=''){document.body.style.cursor='pointer';}},onHide:function(call){document.body.style.cursor='default';}},Events:{enable:true,type:'Native',onClick:function(node,eventInfo,evt){if(!config.Events.enable)return;var elem=eventInfo.getContains();config.Events.onClick(elem,eventInfo,evt);},onMouseMove:function(node,eventInfo,evt){if(!config.hoveredColor)return;if(node){var elem=eventInfo.getContains();that.select(node.id,elem.name,elem.index);}else{that.select(false,false,false);}}},onCreateLabel:function(domElement,node){var labelConf=config.Label,valueArray=node.getData('valueArray'),acum=$.reduce(valueArray,function(x,y){return x+y;},0),grouped=config.type.split(':')[0]=='grouped',horz=config.orientation=='horizontal';var nlbs={wrapper:document.createElement('div'),aggregate:document.createElement('div'),label:document.createElement('div')};var wrapper=nlbs.wrapper,label=nlbs.label,aggregate=nlbs.aggregate,wrapperStyle=wrapper.style,labelStyle=label.style,aggregateStyle=aggregate.style;nodeLabels[node.id]=nlbs;wrapper.appendChild(label);wrapper.appendChild(aggregate);if(!config.showLabels(node.name,acum,node)){labelStyle.display='none';} +if(!config.showAggregates(node.name,acum,node)){aggregateStyle.display='none';} +wrapperStyle.position='relative';wrapperStyle.overflow='visible';wrapperStyle.fontSize=labelConf.size+'px';wrapperStyle.fontFamily=labelConf.family;wrapperStyle.color=labelConf.color;wrapperStyle.textAlign='center';aggregateStyle.position=labelStyle.position='absolute';domElement.style.width=node.getData('width')+'px';domElement.style.height=node.getData('height')+'px';aggregateStyle.left="0px";labelStyle.left=config.labelOffset+'px';labelStyle.whiteSpace="nowrap";label.innerHTML=node.name;domElement.appendChild(wrapper);},onPlaceLabel:function(domElement,node){if(!nodeLabels[node.id])return;var labels=nodeLabels[node.id],wrapperStyle=labels.wrapper.style,labelStyle=labels.label.style,aggregateStyle=labels.aggregate.style,grouped=config.type.split(':')[0]=='grouped',horz=config.orientation=='horizontal',dimArray=node.getData('dimArray'),valArray=node.getData('valueArray'),nodeCount=node.getData('nodeCount'),valueLength=valArray.length;valuelabelArray=node.getData('valuelabelArray'),stringArray=node.getData('stringArray'),width=(grouped&&horz)?Math.max.apply(null,dimArray):node.getData('width'),height=(grouped&&!horz)?Math.max.apply(null,dimArray):node.getData('height'),font=parseInt(wrapperStyle.fontSize,10),domStyle=domElement.style,fixedDim=(horz?height:width)/valueLength;if(dimArray&&valArray){wrapperStyle.width=aggregateStyle.width=labelStyle.width=domElement.style.width=width+'px';aggregateStyle.width=width-config.labelOffset+"px";for(var i=0,l=valArray.length,acum=0;i0){acum+=valArray[i];}} +if(config.showLabels(node.name,acum,node)){labelStyle.display='';}else{labelStyle.display='none';} +if(config.showAggregates(node.name,acum,node)){aggregateStyle.display='';}else{aggregateStyle.display='none';} +if(config.orientation=='horizontal'){aggregateStyle.textAlign='right';labelStyle.textAlign='left';labelStyle.textIndex=aggregateStyle.textIndent=config.labelOffset+'px';aggregateStyle.top=labelStyle.top=(height-font)/2+'px';domElement.style.height=wrapperStyle.height=height+'px';}else{aggregateStyle.top=(-font-config.labelOffset)+'px';labelStyle.top=(config.labelOffset+height)+'px';domElement.style.top=parseInt(domElement.style.top,10)-height+'px';domElement.style.height=wrapperStyle.height=height+'px';if(stringArray.length>8){labels.label.className="rotatedLabelReverse";labelStyle.textAlign="left";labelStyle.top=config.labelOffset+height+width/2+"px";}} +if(horz){labels.label.innerHTML=labels.label.innerHTML+": "+acum;labels.aggregate.innerHTML="";}else{if(grouped){maxValue=Math.max.apply(null,dimArray);for(var i=0,l=valArray.length,acum=0,valAcum=0;i40)?40:fixedDim;whiteSpace=size.width-(marginWidth+(fixedDim*l));if(!horz&&typeof FlashCanvas!="undefined"&&size.width<250) +location.reload();if(!grouped&&!horz){st.config.siblingOffset=whiteSpace/(l+1);} +if(horz){st.config.offsetX=size.width/2-margin.left-(grouped&&config.Label?config.labelOffset+config.Label.size:0);if(config.Ticks.enable){st.config.offsetY=((margin.bottom+config.Label.size+config.labelOffset+(subtitle.text?subtitle.size+subtitle.offset:0))-(margin.top+(title.text?title.size+title.offset:0)))/2;}else{st.config.offsetY=(margin.bottom-margin.top-(title.text?title.size+title.offset:0)-(subtitle.text?subtitle.size+subtitle.offset:0))/2;}}else{st.config.offsetY=-size.height/2+margin.bottom ++(config.showLabels&&(config.labelOffset+config.Label.size))+(subtitle.text?subtitle.size+subtitle.offset:0);if(config.Ticks.enable){st.config.offsetX=((margin.right-config.Label.size-config.labelOffset)-margin.left)/2;}else{st.config.offsetX=(margin.right-margin.left)/2;}} +this.st=st;this.canvas=this.st.canvas;},renderTitle:function(){var canvas=this.canvas,size=canvas.getSize(),config=this.config,margin=config.Margin,label=config.Label,title=config.Title;ctx=canvas.getCtx();ctx.fillStyle=title.color;ctx.textAlign='left';ctx.font=label.style+' bold '+' '+title.size+'px '+label.family;if(label.type=='Native'){ctx.fillText(title.text,-size.width/2+margin.left,-size.height/2+margin.top);}},renderSubtitle:function(){var canvas=this.canvas,size=canvas.getSize(),config=this.config,margin=config.Margin,label=config.Label,subtitle=config.Subtitle,nodeCount=config.nodeCount,horz=config.orientation=='horizontal'?true:false,ctx=canvas.getCtx();ctx.fillStyle=title.color;ctx.textAlign='left';ctx.font=label.style+' '+subtitle.size+'px '+label.family;if(label.type=='Native'){ctx.fillText(subtitle.text,-size.width/2+margin.left,size.height/2-(!horz&&nodeCount>8?20:margin.bottom)-subtitle.size);}},renderScrollNote:function(){var canvas=this.canvas,size=canvas.getSize(),config=this.config,margin=config.Margin,label=config.Label,note=config.ScrollNote;ctx=canvas.getCtx();ctx.fillStyle=title.color;title=config.Title;ctx.textAlign='center';ctx.font=label.style+' bold '+' '+note.size+'px '+label.family;if(label.type=='Native'){ctx.fillText(note.text,0,-size.height/2+margin.top+title.size);}},renderTicks:function(){var canvas=this.canvas,size=canvas.getSize(),config=this.config,margin=config.Margin,ticks=config.Ticks,title=config.Title,subtitle=config.Subtitle,label=config.Label,shadow=config.shadow;horz=config.orientation=='horizontal',maxValue=this.getMaxValue(),maxTickValue=Math.ceil(maxValue*.1)*10;if(maxTickValue==maxValue){var length=maxTickValue.toString().length;maxTickValue=maxTickValue+parseInt(pad(1,length));} +grouped=config.type.split(':')[0]=='grouped',labelValue=0,labelIncrement=maxTickValue/ticks.segments,ctx=canvas.getCtx();ctx.strokeStyle=ticks.color;ctx.font=label.style+' '+label.size+'px '+label.family;ctx.textAlign='center';ctx.textBaseline='middle';idLabel=canvas.id+"-label";labelDim=100;container=document.getElementById(idLabel);if(horz){var axis=-(size.width/2)+margin.left+(grouped&&config.Label?config.labelOffset+label.size:0),grid=size.width-(margin.left+margin.right+(grouped&&config.Label?config.labelOffset+label.size:0)),segmentLength=grid/ticks.segments;ctx.fillStyle=ticks.color;ctx.fillRect(axis,(size.height/2)-margin.bottom-config.labelOffset-label.size-(subtitle.text?subtitle.size+subtitle.offset:0)+(shadow.enable?shadow.size:0),size.width-margin.left-margin.right-(grouped&&config.Label?config.labelOffset+label.size:0),1);while(axis<=grid){ctx.fillStyle=ticks.color;lineHeight=size.height-margin.bottom-margin.top-config.labelOffset-label.size-(title.text?title.size+title.offset:0)-(subtitle.text?subtitle.size+subtitle.offset:0);ctx.fillRect(Math.round(axis),-(size.height/2)+margin.top+(title.text?title.size+title.offset:0)-(shadow.enable?shadow.size:0),1,lineHeight+(shadow.enable?shadow.size*2:0));ctx.fillStyle=label.color;if(label.type=='Native'&&config.showLabels){ctx.fillText(labelValue,Math.round(axis),-(size.height/2)+margin.top+(title.text?title.size+title.offset:0)+config.labelOffset+lineHeight+label.size);} +axis+=segmentLength;labelValue+=labelIncrement;}}else{var axis=(size.height/2)-(margin.bottom+config.labelOffset+label.size+(subtitle.text?subtitle.size+subtitle.offset:0)),htmlOrigin=size.height-(margin.bottom+config.labelOffset+label.size+(subtitle.text?subtitle.size+subtitle.offset:0)),grid=-size.height+(margin.bottom+config.labelOffset+label.size+margin.top+(title.text?title.size+title.offset:0)+(subtitle.text?subtitle.size+subtitle.offset:0)),segmentLength=grid/ticks.segments;ctx.fillStyle=ticks.color;ctx.fillRect(-(size.width/2)+margin.left+config.labelOffset+label.size-1,-(size.height/2)+margin.top+(title.text?title.size+title.offset:0),1,size.height-margin.top-margin.bottom-label.size-config.labelOffset-(title.text?title.size+title.offset:0)-(subtitle.text?subtitle.size+subtitle.offset:0));while(axis>=grid){ctx.save();ctx.translate(-(size.width/2)+margin.left,Math.round(axis));ctx.rotate(0*Math.PI/180);ctx.fillStyle=label.color;if(config.showLabels){if(label.type=='Native'){ctx.fillText(labelValue,0,0);}else{labelDiv=document.createElement('div');labelDiv.innerHTML=labelValue;labelDiv.className="rotatedLabel";labelDiv.style.top=(htmlOrigin-(labelDim/2))+"px";labelDiv.style.left=margin.left+"px";labelDiv.style.width=labelDim+"px";labelDiv.style.height=labelDim+"px";labelDiv.style.textAlign="center";labelDiv.style.verticalAlign="middle";labelDiv.style.position="absolute";container.appendChild(labelDiv);}} +ctx.restore();ctx.fillStyle=ticks.color;ctx.fillRect(-(size.width/2)+margin.left+config.labelOffset+label.size,Math.round(axis),size.width-margin.right-margin.left-config.labelOffset-label.size,1);htmlOrigin+=segmentLength;axis+=segmentLength;labelValue+=labelIncrement;}}},renderBackground:function(){var canvas=this.canvas,config=this.config,backgroundColor=config.backgroundColor,size=canvas.getSize(),ctx=canvas.getCtx();ctx.fillStyle=backgroundColor;ctx.fillRect(-size.width/2,-size.height/2,size.width,size.height);},loadJSON:function(json){if(this.busy)return;this.busy=true;var prefix=$.time(),ch=[],st=this.st,name=$.splat(json.label),color=$.splat(json.color||this.colors),config=this.config,gradient=!!config.type.split(":")[1],renderBackground=config.renderBackground,animate=config.animate,ticks=config.Ticks,title=config.Title,note=config.ScrollNote,subtitle=config.Subtitle,horz=config.orientation=='horizontal',that=this,colorLength=color.length,nameLength=name.length;groupTotalValue=0;for(var i=0,values=json.values,l=values.length;iacum?maxValue:acum;});return maxValue;},setBarType:function(type){this.config.type=type;this.st.config.Node.type='barchart-'+type.split(':')[0];},normalizeDims:function(){var root=this.st.graph.getNode(this.st.root),l=0;root.eachAdjacency(function(){l++;});var maxValue=this.getMaxValue()||1,size=this.st.canvas.getSize(),config=this.config,margin=config.Margin,ticks=config.Ticks,title=config.Title,subtitle=config.Subtitle,grouped=config.type.split(':')[0]=='grouped',marginWidth=margin.left+margin.right+(config.Label&&grouped?config.Label.size+config.labelOffset:0),marginHeight=(title.text?title.size+title.offset:0)+(subtitle.text?subtitle.size+subtitle.offset:0)+margin.top+margin.bottom,horz=config.orientation=='horizontal',fixedDim=(size[horz?'height':'width']-(horz?marginHeight:marginWidth)-(ticks.enable?config.Label.size+config.labelOffset:0)-(l-1)*config.barsOffset)/l,animate=config.animate,height=size[horz?'width':'height']-(horz?marginWidth:marginHeight) +-((config.showLabels&&!horz)?(config.Label.size+config.labelOffset):0),dim1=horz?'height':'width',dim2=horz?'width':'height',basic=config.type.split(':')[0]=='basic';var maxTickValue=Math.ceil(maxValue*.1)*10;if(maxTickValue==maxValue){var length=maxTickValue.toString().length;maxTickValue=maxTickValue+parseInt(pad(1,length));} +fixedDim=fixedDim>40?40:fixedDim;this.st.graph.eachNode(function(n){var acum=0,animateValue=[];$.each(n.getData('valueArray'),function(v){acum+=+v;animateValue.push(0);});if(grouped){fixedDim=animateValue.length*40;} +n.setData(dim1,fixedDim);if(animate){n.setData(dim2,acum*height/maxValue,'end');n.setData('dimArray',$.map(n.getData('valueArray'),function(n){return n*height/maxValue;}),'end');var dimArray=n.getData('dimArray');if(!dimArray){n.setData('dimArray',animateValue);}}else{if(ticks.enable){n.setData(dim2,acum*height/maxTickValue);n.setData('dimArray',$.map(n.getData('valueArray'),function(n){return n*height/maxTickValue;}));}else{n.setData(dim2,acum*height/maxValue);n.setData('dimArray',$.map(n.getData('valueArray'),function(n){return n*height/maxValue;}));}}});}});Options.FunnelChart={$extend:true,animate:true,type:'stacked',labelOffset:3,barsOffset:0,hoveredColor:'#9fd4ff',orientation:'vertical',showAggregates:true,showLabels:true,Tips:{enable:false,onShow:$.empty,onHide:$.empty},Events:{enable:false,onClick:$.empty}};$jit.ST.Plot.NodeTypes.implement({'funnelchart-basic':{'render':function(node,canvas){var pos=node.pos.getc(true),width=node.getData('width'),height=node.getData('height'),algnPos=this.getAlignedPos(pos,width,height),x=algnPos.x,y=algnPos.y,dimArray=node.getData('dimArray'),valueArray=node.getData('valueArray'),valuelabelArray=node.getData('valuelabelArray'),linkArray=node.getData('linkArray'),colorArray=node.getData('colorArray'),colorLength=colorArray.length,stringArray=node.getData('stringArray');var ctx=canvas.getCtx(),opt={},border=node.getData('border'),gradient=node.getData('gradient'),config=node.getData('config'),horz=config.orientation=='horizontal',aggregates=config.showAggregates,showLabels=config.showLabels,label=config.Label,size=canvas.getSize(),labelOffset=config.labelOffset+10;minWidth=width*.25;ratio=.65;if(colorArray&&dimArray&&stringArray){for(var i=0,l=dimArray.length,acum=0,valAcum=0;i0)?dimArray[i-1]:100;var labelOffsetHeight=(previousElementHeight0)?((dimArray[i]>label.size)?(dimArray[i]/2)-(label.size/2):label.size):0;var topWidth=minWidth+((acum+dimArray[i])*ratio);var bottomWidth=minWidth+((acum)*ratio);var bottomWidthLabel=minWidth+((acum+labelOffsetHeight)*ratio);var labelOffsetRight=(previousElementHeight0)?((i%2!=0&&dimArray[i]0)?((i%2!=0&&dimArray[i]0)?dimArray[i-1]:100;var labelOffsetHeight=(previousElementHeight0)?((dimArray[i]>label.size)?(dimArray[i]/2)-(label.size/2):label.size):0;var labelOffsetRight=(previousElementHeight0)?((i%2!=0&&dimArray[i]0)?((i%2!=0&&dimArray[i]>0;});linear.addColorStop(0,'rgba('+color+',1)');linear.addColorStop(0.5,'rgba('+colorRgb+',1)');linear.addColorStop(1,'rgba('+color+',1)');ctx.fillStyle=linear;} +ctx.beginPath();ctx.moveTo(-topWidth/2,y-acum-dimArray[i]);ctx.lineTo(topWidth/2,y-acum-dimArray[i]);ctx.lineTo(bottomWidth/2,y-acum);ctx.lineTo(-bottomWidth/2,y-acum);ctx.closePath();ctx.fill();if(border&&border.name==stringArray[i]){opt.acum=acum;opt.dimValue=dimArray[i];} +if(border){ctx.save();ctx.lineWidth=2;ctx.strokeStyle=border.color;ctx.restore();} +if(label.type=='Native'){ctx.save();ctx.fillStyle=ctx.strokeStyle=label.color;ctx.font=label.style+' '+label.size+'px '+label.family;ctx.textBaseline='middle';acumValueLabel=valAcum;if(showLabels(node.name,valAcum,node)){ctx.textAlign='left';ctx.fillText(stringArray[i],(bottomWidthLabel/2)+labelOffset+labelOffsetRight,y-acum-labelOffsetHeight-label.size/2);ctx.textAlign='right';ctx.fillText(valuelabelArray[i],(-bottomWidthLabel/2)-labelOffset-labelOffsetLeft,y-acum-labelOffsetHeight-label.size/2);} +ctx.restore();} +acum+=(dimArray[i]||0);valAcum+=(valueArray[i]||0);}}},'contains':function(node,mpos){var pos=node.pos.getc(true),width=node.getData('width'),height=node.getData('height'),algnPos=this.getAlignedPos(pos,width,height),x=algnPos.x,y=algnPos.y,dimArray=node.getData('dimArray'),config=node.getData('config'),st=node.getData('st'),rx=mpos.x-x,horz=config.orientation=='horizontal',minWidth=width*.25;ratio=.65,canvas=node.getData('canvas'),size=canvas.getSize(),offsetY=st.config.offsetY;if(mpos.y>y||mpos.yboundRight){return false;} +for(var i=0,l=dimArray.length,acum=(horz?x:y);i=intersec){return{'name':node.getData('stringArray')[i],'color':node.getData('colorArray')[i],'value':node.getData('valueArray')[i],'percentage':node.getData('percentageArray')[i],'valuelabel':node.getData('valuelabelArray')[i],'link':url,'label':node.name};}} +return false;}}});$jit.FunnelChart=new Class({st:null,colors:["#004b9c","#9c0079","#9c0033","#28009c","#9c0000","#7d009c","#001a9c","#00809c","#009c80","#009c42","#009c07","#469c00","#799c00","#9c9600","#9c5c00"],selected:{},busy:false,initialize:function(opt){this.controller=this.config=$.merge(Options("Canvas","Margin","Label","BarChart"),{Label:{type:'Native'}},opt);var showLabels=this.config.showLabels,typeLabels=$.type(showLabels),showAggregates=this.config.showAggregates,typeAggregates=$.type(showAggregates);this.config.showLabels=typeLabels=='function'?showLabels:$.lambda(showLabels);this.config.showAggregates=typeAggregates=='function'?showAggregates:$.lambda(showAggregates);Options.Fx.clearCanvas=false;this.initializeViz();},initializeViz:function(){var config=this.config,that=this;var nodeType=config.type.split(":")[0],horz=config.orientation=='horizontal',nodeLabels={};var st=new $jit.ST({injectInto:config.injectInto,orientation:horz?'left':'bottom',levelDistance:0,background:config.background,renderBackground:config.renderBackground,backgroundColor:config.backgroundColor,colorStop1:config.colorStop1,colorStop2:config.colorStop2,siblingOffset:config.segmentOffset,subtreeOffset:0,withLabels:config.Label.type!='Native',useCanvas:config.useCanvas,Label:{type:config.Label.type},Node:{overridable:true,type:'funnelchart-'+nodeType,align:'left',width:1,height:1},Edge:{type:'none'},Tips:{enable:config.Tips.enable,type:'Native',force:true,onShow:function(tip,node,contains){var elem=contains;config.Tips.onShow(tip,elem,node);if(elem.link!='undefined'&&elem.link!=''){document.body.style.cursor='pointer';}},onHide:function(call){document.body.style.cursor='default';}},Events:{enable:true,type:'Native',onClick:function(node,eventInfo,evt){if(!config.Events.enable)return;var elem=eventInfo.getContains();config.Events.onClick(elem,eventInfo,evt);},onMouseMove:function(node,eventInfo,evt){if(!config.hoveredColor)return;if(node){var elem=eventInfo.getContains();that.select(node.id,elem.name,elem.index);}else{that.select(false,false,false);}}},onCreateLabel:function(domElement,node){var labelConf=config.Label,valueArray=node.getData('valueArray'),idArray=node.getData('idArray'),valuelabelArray=node.getData('valuelabelArray'),stringArray=node.getData('stringArray');size=st.canvas.getSize() +prefix=$.time();for(var i=0,l=valueArray.length;iacum?maxValue:acum;});return maxValue;},setBarType:function(type){this.config.type=type;this.st.config.Node.type='funnelchart-'+type.split(':')[0];},normalizeDims:function(){var root=this.st.graph.getNode(this.st.root),l=0;root.eachAdjacency(function(){l++;});var maxValue=this.getMaxValue()||1,size=this.st.canvas.getSize(),config=this.config,margin=config.Margin,title=config.Title,subtitle=config.Subtitle,marginWidth=margin.left+margin.right,marginHeight=(title.text?title.size+title.offset:0)+(subtitle.text?subtitle.size+subtitle.offset:0)+margin.top+margin.bottom,horz=config.orientation=='horizontal',animate=config.animate,height=size[horz?'width':'height']-(horz?marginWidth:marginHeight) +-(config.showLabels&&(config.Label.size+config.labelOffset)),dim1=horz?'height':'width',dim2=horz?'width':'height';minWidth=size.width/8;this.st.graph.eachNode(function(n){var acum=0,animateValue=[];$.each(n.getData('valueArray'),function(v){acum+=+v;animateValue.push(0);});n.setData(dim1,minWidth);if(animate){n.setData(dim2,acum*height/maxValue,'end');n.setData('dimArray',$.map(n.getData('valueArray'),function(n){return n*height/maxValue;}),'end');var dimArray=n.getData('dimArray');if(!dimArray){n.setData('dimArray',animateValue);}}else{n.setData(dim2,acum*height/maxValue);n.setData('dimArray',$.map(n.getData('valueArray'),function(n){return n*height/maxValue;}));}});}});Options.PieChart={$extend:true,animate:true,offset:25,sliceOffset:0,labelOffset:3,type:'stacked',labelType:'name',hoveredColor:'#9fd4ff',Events:{enable:false,onClick:$.empty},Tips:{enable:false,onShow:$.empty,onHide:$.empty},showLabels:true,resizeLabels:false,updateHeights:false};Layouts.Radial=new Class({compute:function(property){var prop=$.splat(property||['current','start','end']);NodeDim.compute(this.graph,prop,this.config);this.graph.computeLevels(this.root,0,"ignore");var lengthFunc=this.createLevelDistanceFunc();this.computeAngularWidths(prop);this.computePositions(prop,lengthFunc);},computePositions:function(property,getLength){var propArray=property;var graph=this.graph;var root=graph.getNode(this.root);var parent=this.parent;var config=this.config;for(var i=0,l=propArray.length;imaxDim[pi]?dim:maxDim[pi]):dim;} +subnodes.push(sib);},"ignore");if(parent&&parent.id==elem.id&&subnodes.length>0&&subnodes[0].dist){subnodes.sort(function(a,b){return(a.dist>=b.dist)-(a.dist<=b.dist);});} +for(var k=0,ls=subnodes.length;kpi/2&&p.theta<3*pi/2);var thetap=cond?p.theta+pi:p.theta;if(cond){x-=Math.abs(Math.cos(p.theta)*measure.width);y+=Math.sin(p.theta)*measure.width;}else if(node.id==this.viz.root){x-=measure.width/2;}} +ctx.save();ctx.translate(x,y);ctx.rotate(thetap);ctx.fillText(node.name,0,0);ctx.restore();}});Sunburst.Label.SVG=new Class({Implements:Graph.Label.SVG,initialize:function(viz){this.viz=viz;},placeLabel:function(tag,node,controller){var pos=node.pos.getc(true),viz=this.viz,canvas=this.viz.canvas;var radius=canvas.getSize();var labelPos={x:Math.round(pos.x+radius.width/2),y:Math.round(pos.y+radius.height/2)};tag.setAttribute('x',labelPos.x);tag.setAttribute('y',labelPos.y);var bb=tag.getBBox();if(bb){var x=tag.getAttribute('x');var y=tag.getAttribute('y');var p=node.pos.getp(true);var pi=Math.PI;var cond=(p.theta>pi/2&&p.theta<3*pi/2);if(cond){tag.setAttribute('x',x-bb.width);tag.setAttribute('y',y-bb.height);}else if(node.id==viz.root){tag.setAttribute('x',x-bb.width/2);} +var thetap=cond?p.theta+pi:p.theta;if(node._depth) +tag.setAttribute('transform','rotate('+thetap*360/(2*pi)+' '+x ++' '+y+')');} +controller.onPlaceLabel(tag,node);}});Sunburst.Label.HTML=new Class({Implements:Graph.Label.HTML,initialize:function(viz){this.viz=viz;},placeLabel:function(tag,node,controller){var pos=node.pos.clone(),canvas=this.viz.canvas,height=node.getData('height'),ldist=((height||node._depth==0)?height:this.viz.config.levelDistance)/2,radius=canvas.getSize();pos.rho+=ldist;pos=pos.getc(true);var labelPos={x:Math.round(pos.x+radius.width/2),y:Math.round(pos.y+radius.height/2)};var style=tag.style;style.left=labelPos.x+'px';style.top=labelPos.y+'px';style.display=this.fitsInCanvas(labelPos,canvas)?'':'none';controller.onPlaceLabel(tag,node);}});Sunburst.Plot.NodeTypes=new Class({'none':{'render':$.empty,'contains':$.lambda(false),'anglecontains':function(node,pos){var span=node.getData('span')/2,theta=node.pos.theta;var begin=theta-span,end=theta+span;if(begin<0) +begin+=Math.PI*2;var atan=Math.atan2(pos.y,pos.x);if(atan<0) +atan+=Math.PI*2;if(begin>end){return(atan>begin&&atan<=Math.PI*2)||atanbegin&&atanend){return(atan>begin&&atan<=Math.PI*2)||atanbegin&&atan=ld*d)&&(rho<=(ld*d+ldist));} +return false;}},'gradient-multipie':{'render':function(node,canvas){var ctx=canvas.getCtx();var height=node.getData('height');var ldist=height?height:this.config.levelDistance;var radialGradient=ctx.createRadialGradient(0,0,node.getPos().rho,0,0,node.getPos().rho+ldist);var colorArray=$.hexToRgb(node.getData('color')),ans=[];$.each(colorArray,function(i){ans.push(parseInt(i*0.5,10));});var endColor=$.rgbToHex(ans);radialGradient.addColorStop(0,endColor);radialGradient.addColorStop(1,node.getData('color'));ctx.fillStyle=radialGradient;this.nodeTypes['multipie'].render.call(this,node,canvas);},'contains':function(node,pos){return this.nodeTypes['multipie'].contains.call(this,node,pos);}},'gradient-pie':{'render':function(node,canvas){var ctx=canvas.getCtx();var radialGradient=ctx.createRadialGradient(0,0,0,0,0,node.getPos().rho);var colorArray=$.hexToRgb(node.getData('color')),ans=[];$.each(colorArray,function(i){ans.push(parseInt(i*0.5,10));});var endColor=$.rgbToHex(ans);radialGradient.addColorStop(1,endColor);radialGradient.addColorStop(0,node.getData('color'));ctx.fillStyle=radialGradient;this.nodeTypes['pie'].render.call(this,node,canvas);},'contains':function(node,pos){return this.nodeTypes['pie'].contains.call(this,node,pos);}}});Sunburst.Plot.EdgeTypes=new Class({'none':$.empty,'line':{'render':function(adj,canvas){var from=adj.nodeFrom.pos.getc(true),to=adj.nodeTo.pos.getc(true);this.edgeHelper.line.render(from,to,canvas);},'contains':function(adj,pos){var from=adj.nodeFrom.pos.getc(true),to=adj.nodeTo.pos.getc(true);return this.edgeHelper.line.contains(from,to,pos,this.edge.epsilon);}},'arrow':{'render':function(adj,canvas){var from=adj.nodeFrom.pos.getc(true),to=adj.nodeTo.pos.getc(true),dim=adj.getData('dim'),direction=adj.data.$direction,inv=(direction&&direction.length>1&&direction[0]!=adj.nodeFrom.id);this.edgeHelper.arrow.render(from,to,dim,inv,canvas);},'contains':function(adj,pos){var from=adj.nodeFrom.pos.getc(true),to=adj.nodeTo.pos.getc(true);return this.edgeHelper.arrow.contains(from,to,pos,this.edge.epsilon);}},'hyperline':{'render':function(adj,canvas){var from=adj.nodeFrom.pos.getc(),to=adj.nodeTo.pos.getc(),dim=Math.max(from.norm(),to.norm());this.edgeHelper.hyperline.render(from.$scale(1/dim),to.$scale(1/dim),dim,canvas);},'contains':$.lambda(false)}});})($jit.Sunburst);$jit.Sunburst.Plot.NodeTypes.implement({'piechart-stacked':{'render':function(node,canvas){var pos=node.pos.getp(true),dimArray=node.getData('dimArray'),valueArray=node.getData('valueArray'),colorArray=node.getData('colorArray'),colorLength=colorArray.length,stringArray=node.getData('stringArray'),span=node.getData('span')/2,theta=node.pos.theta,begin=theta-span,end=theta+span,polar=new Polar;var ctx=canvas.getCtx(),opt={},gradient=node.getData('gradient'),border=node.getData('border'),config=node.getData('config'),showLabels=config.showLabels,resizeLabels=config.resizeLabels,label=config.Label;var xpos=config.sliceOffset*Math.cos((begin+end)/2);var ypos=config.sliceOffset*Math.sin((begin+end)/2);if(colorArray&&dimArray&&stringArray){for(var i=0,l=dimArray.length,acum=0,valAcum=0;i>0;}),endColor=$.rgbToHex(ans);radialGradient.addColorStop(0,colori);radialGradient.addColorStop(0.5,colori);radialGradient.addColorStop(1,endColor);ctx.fillStyle=radialGradient;} +polar.rho=acum+config.sliceOffset;polar.theta=begin;var p1coord=polar.getc(true);polar.theta=end;var p2coord=polar.getc(true);polar.rho+=dimi;var p3coord=polar.getc(true);polar.theta=begin;var p4coord=polar.getc(true);ctx.beginPath();ctx.arc(xpos,ypos,acum+.01,begin,end,false);ctx.arc(xpos,ypos,acum+dimi+.01,end,begin,true);ctx.fill();if(border&&border.name==stringArray[i]){opt.acum=acum;opt.dimValue=dimArray[i];opt.begin=begin;opt.end=end;} +acum+=(dimi||0);valAcum+=(valueArray[i]||0);} +if(border){ctx.save();ctx.globalCompositeOperation="source-over";ctx.lineWidth=2;ctx.strokeStyle=border.color;var s=begin>0;fontSize=fontSize<+resizeLabels?+resizeLabels:fontSize;ctx.font=label.style+' '+fontSize+'px '+label.family;ctx.textBaseline='middle';ctx.textAlign='center';polar.rho=acum+config.labelOffset+config.sliceOffset;polar.theta=node.pos.theta;var cart=polar.getc(true);ctx.fillText(node.name,cart.x,cart.y);ctx.restore();}}},'contains':function(node,pos){if(this.nodeTypes['none'].anglecontains.call(this,node,pos)){var rho=Math.sqrt(pos.x*pos.x+pos.y*pos.y);var ld=this.config.levelDistance,d=node._depth;var config=node.getData('config');if(rho<=ld*d+config.sliceOffset){var dimArray=node.getData('dimArray');for(var i=0,l=dimArray.length,acum=config.sliceOffset;i=acum&&rho<=acum+dimi){return{name:node.getData('stringArray')[i],color:node.getData('colorArray')[i],value:node.getData('valueArray')[i],label:node.name};} +acum+=dimi;}} +return false;} +return false;}},'piechart-basic':{'render':function(node,canvas){var pos=node.pos.getp(true),dimArray=node.getData('dimArray'),valueArray=node.getData('valueArray'),colorArray=node.getData('colorMono'),colorLength=colorArray.length,stringArray=node.getData('stringArray'),percentage=node.getData('percentage'),iteration=node.getData('iteration'),span=node.getData('span')/2,theta=node.pos.theta,begin=theta-span,end=theta+span,polar=new Polar;var ctx=canvas.getCtx(),opt={},gradient=node.getData('gradient'),border=node.getData('border'),config=node.getData('config'),renderSubtitle=node.getData('renderSubtitle'),renderBackground=config.renderBackground,showLabels=config.showLabels,resizeLabels=config.resizeLabels,label=config.Label;var xpos=config.sliceOffset*Math.cos((begin+end)/2);var ypos=config.sliceOffset*Math.sin((begin+end)/2);if(iteration==0&&typeof FlashCanvas!="undefined"&&renderBackground){backgroundColor=config.backgroundColor,size=canvas.getSize();ctx.save();ctx.fillStyle=backgroundColor;ctx.fillRect(-size.width/2,-size.height/2,size.width,size.height);var margin=config.Margin,title=config.Title,subtitle=config.Subtitle;ctx.fillStyle=title.color;ctx.textAlign='left';if(title.text!=""){ctx.font=label.style+' bold '+' '+title.size+'px '+label.family;ctx.moveTo(0,0);if(label.type=='Native'){ctx.fillText(title.text,-size.width/2+margin.left,-size.height/2+margin.top);}} +if(subtitle.text!=""){ctx.font=label.style+' '+subtitle.size+'px '+label.family;if(label.type=='Native'){ctx.fillText(subtitle.text,-size.width/2+margin.left,size.height/2-margin.bottom);}} +ctx.restore();} +if(colorArray&&dimArray&&stringArray){for(var i=0,l=dimArray.length,acum=0,valAcum=0;i>0;}),endColor2=$.map(colorRgb,function(i){return(i*0.7)>>0;});radialGradient.addColorStop(0,'rgba('+colorRgb+',1)');radialGradient.addColorStop(.7,'rgba('+colorRgb+',1)');radialGradient.addColorStop(.98,'rgba('+endColor+',1)');radialGradient.addColorStop(1,'rgba('+endColor2+',1)');ctx.fillStyle=radialGradient;}} +ctx.beginPath();ctx.arc(xpos,ypos,acum+.01,begin,end,false);ctx.arc(xpos,ypos,acum+dimi+.01,end,begin,true);ctx.fill();if(border&&border.name==stringArray[i]){opt.acum=acum;opt.dimValue=dimArray[i];opt.begin=begin;opt.end=end;opt.sliceValue=valueArray[i];} +acum+=(dimi||0);valAcum+=(valueArray[i]||0);} +if(border){ctx.save();ctx.globalCompositeOperation="source-over";ctx.lineWidth=2;ctx.strokeStyle=border.color;var s=begin>0;fontSize=fontSize<+resizeLabels?+resizeLabels:fontSize;ctx.font=label.style+' '+fontSize+'px '+label.family;ctx.textBaseline='middle';ctx.textAlign='center';pi=Math.PI;angle=theta*360/(2*pi);polar.rho=acum+config.labelOffset+config.sliceOffset;polar.theta=node.pos.theta;var cart=polar.getc(true);if(((angle>=225&&angle<=315)||(angle<=135&&angle>=45))&&percentage<=5){}else{if(config.labelType=='name'){ctx.fillText(node.name,cart.x,cart.y);}else{ctx.fillText(node.data.valuelabel,cart.x,cart.y);}} +ctx.restore();}}},'contains':function(node,pos){if(this.nodeTypes['none'].anglecontains.call(this,node,pos)){var rho=Math.sqrt(pos.x*pos.x+pos.y*pos.y);var ld=this.config.levelDistance,d=node._depth;var config=node.getData('config');if(rho<=ld*d+config.sliceOffset){var dimArray=node.getData('dimArray');for(var i=0,l=dimArray.length,acum=config.sliceOffset;i=acum&&rho<=acum+dimi){var url=Url.decode(node.getData('linkArray')[i]);return{name:node.getData('stringArray')[i],link:url,color:node.getData('colorArray')[i],value:node.getData('valueArray')[i],percentage:node.getData('percentage'),valuelabel:node.getData('valuelabelsArray')[i],label:node.name};} +acum+=dimi;}} +return false;} +return false;}}});$jit.PieChart=new Class({sb:null,colors:["#416D9C","#70A35E","#EBB056","#C74243","#83548B","#909291","#557EAA"],selected:{},busy:false,initialize:function(opt){this.controller=this.config=$.merge(Options("Canvas","PieChart","Label"),{Label:{type:'Native'}},opt);this.initializeViz();},initializeViz:function(){var config=this.config,that=this;var nodeType=config.type.split(":")[0];var sb=new $jit.Sunburst({injectInto:config.injectInto,useCanvas:config.useCanvas,withLabels:config.Label.type!='Native',background:config.background,renderBackground:config.renderBackground,backgroundColor:config.backgroundColor,colorStop1:config.colorStop1,colorStop2:config.colorStop2,Label:{type:config.Label.type},Node:{overridable:true,type:'piechart-'+nodeType,width:1,height:1},Edge:{type:'none'},Tips:{enable:config.Tips.enable,type:'Native',force:true,onShow:function(tip,node,contains){var elem=contains;config.Tips.onShow(tip,elem,node);if(elem.link!='undefined'&&elem.link!=''){document.body.style.cursor='pointer';}},onHide:function(){document.body.style.cursor='default';}},Events:{enable:true,type:'Native',onClick:function(node,eventInfo,evt){if(!config.Events.enable)return;var elem=eventInfo.getContains();config.Events.onClick(elem,eventInfo,evt);},onMouseMove:function(node,eventInfo,evt){if(!config.hoveredColor)return;if(node){var elem=eventInfo.getContains();that.select(node.id,elem.name,elem.index);}else{that.select(false,false,false);}}},onCreateLabel:function(domElement,node){var labelConf=config.Label;if(config.showLabels){var style=domElement.style;style.fontSize=labelConf.size+'px';style.fontFamily=labelConf.family;style.color=labelConf.color;style.textAlign='center';if(config.labelType=='name'){domElement.innerHTML=node.name;}else{domElement.innerHTML=(node.data.valuelabel!=undefined)?node.data.valuelabel:"";} +domElement.style.width='400px';}},onPlaceLabel:function(domElement,node){if(!config.showLabels)return;var pos=node.pos.getp(true),dimArray=node.getData('dimArray'),span=node.getData('span')/2,theta=node.pos.theta,begin=theta-span,end=theta+span,polar=new Polar;var showLabels=config.showLabels,resizeLabels=config.resizeLabels,label=config.Label;if(dimArray){for(var i=0,l=dimArray.length,acum=0;i>0;fontSize=fontSize<+resizeLabels?+resizeLabels:fontSize;domElement.style.fontSize=fontSize+'px';polar.rho=acum+config.labelOffset+config.sliceOffset;polar.theta=(begin+end)/2;var pos=polar.getc(true);var radius=that.canvas.getSize();var labelPos={x:Math.round(pos.x+radius.width/2),y:Math.round(pos.y+radius.height/2)};domElement.style.left=(labelPos.x-200)+'px';domElement.style.top=labelPos.y+'px';}}});var size=sb.canvas.getSize(),min=Math.min;sb.config.levelDistance=min(size.width,size.height)/2 +-config.offset-config.sliceOffset;this.sb=sb;this.canvas=this.sb.canvas;this.canvas.getCtx().globalCompositeOperation='lighter';},renderBackground:function(){var canvas=this.canvas,config=this.config,backgroundColor=config.backgroundColor,size=canvas.getSize(),ctx=canvas.getCtx();ctx.globalCompositeOperation="destination-over";ctx.fillStyle=backgroundColor;ctx.fillRect(-size.width/2,-size.height/2,size.width,size.height);},renderTitle:function(){var canvas=this.canvas,size=canvas.getSize(),config=this.config,margin=config.Margin,radius=this.sb.config.levelDistance,title=config.Title,label=config.Label,subtitle=config.Subtitle;ctx=canvas.getCtx();ctx.fillStyle=title.color;ctx.textAlign='left';ctx.font=label.style+' bold '+' '+title.size+'px '+label.family;ctx.moveTo(0,0);if(label.type=='Native'){ctx.fillText(title.text,-size.width/2+margin.left,-size.height/2+margin.top);}},renderSubtitle:function(){var canvas=this.canvas,size=canvas.getSize(),config=this.config,margin=config.Margin,radius=this.sb.config.levelDistance,title=config.Title,label=config.Label,subtitle=config.Subtitle;ctx=canvas.getCtx();ctx.fillStyle=title.color;ctx.textAlign='left';ctx.font=label.style+' '+subtitle.size+'px '+label.family;ctx.moveTo(0,0);if(label.type=='Native'){ctx.fillText(subtitle.text,-size.width/2+margin.left,size.height/2-margin.bottom);}},loadJSON:function(json){var prefix=$.time(),ch=[],sb=this.sb,name=$.splat(json.label),nameLength=name.length,color=$.splat(json.color||this.colors),colorLength=color.length,config=this.config,renderBackground=config.renderBackground,title=config.Title,subtitle=config.Subtitle,gradient=!!config.type.split(":")[1],animate=config.animate,mono=nameLength==1;totalValue=0;for(var i=0,values=json.values,l=values.length;iacum?maxValue:acum;});return maxValue;},normalizeDims:function(){var root=this.sb.graph.getNode(this.sb.root),l=0;root.eachAdjacency(function(){l++;});var maxValue=this.getMaxValue()||1,config=this.config,animate=config.animate,rho=this.sb.config.levelDistance;this.sb.graph.eachNode(function(n){var acum=0,animateValue=[];$.each(n.getData('valueArray'),function(v){acum+=+v;animateValue.push(1);});var stat=(animateValue.length==1)&&!config.updateHeights;if(animate){n.setData('dimArray',$.map(n.getData('valueArray'),function(n){return stat?rho:(n*rho/maxValue);}),'end');var dimArray=n.getData('dimArray');if(!dimArray){n.setData('dimArray',animateValue);}}else{n.setData('dimArray',$.map(n.getData('valueArray'),function(n){return stat?rho:(n*rho/maxValue);}));} +n.setData('normalizedDim',acum/maxValue);});}});Options.GaugeChart={$extend:true,animate:true,offset:25,sliceOffset:0,labelOffset:3,type:'stacked',labelType:'name',hoveredColor:'#9fd4ff',Events:{enable:false,onClick:$.empty},Tips:{enable:false,onShow:$.empty,onHide:$.empty},showLabels:true,resizeLabels:false,updateHeights:false};$jit.Sunburst.Plot.NodeTypes.implement({'gaugechart-basic':{'render':function(node,canvas){var pos=node.pos.getp(true),dimArray=node.getData('dimArray'),valueArray=node.getData('valueArray'),valuelabelsArray=node.getData('valuelabelsArray'),gaugeTarget=node.getData('gaugeTarget'),nodeIteration=node.getData('nodeIteration'),nodeLength=node.getData('nodeLength'),colorArray=node.getData('colorMono'),colorLength=colorArray.length,stringArray=node.getData('stringArray'),span=node.getData('span')/2,theta=node.pos.theta,begin=((theta-span)/2)+Math.PI,end=((theta+span)/2)+Math.PI,polar=new Polar;var ctx=canvas.getCtx(),opt={},gradient=node.getData('gradient'),border=node.getData('border'),config=node.getData('config'),showLabels=config.showLabels,resizeLabels=config.resizeLabels,label=config.Label;var xpos=Math.cos((begin+end)/2);var ypos=Math.sin((begin+end)/2);if(colorArray&&dimArray&&stringArray&&gaugeTarget!=0){for(var i=0,l=dimArray.length,acum=0,valAcum=0;i>0;}),endColor=$.rgbToHex(ans);radialGradient.addColorStop(0,'rgba('+colorRgb+',1)');radialGradient.addColorStop(0.1,'rgba('+colorRgb+',1)');radialGradient.addColorStop(0.85,'rgba('+colorRgb+',1)');radialGradient.addColorStop(1,'rgba('+ans+',1)');ctx.fillStyle=radialGradient;} +polar.rho=acum;polar.theta=begin;var p1coord=polar.getc(true);polar.theta=end;var p2coord=polar.getc(true);polar.rho+=dimi;var p3coord=polar.getc(true);polar.theta=begin;var p4coord=polar.getc(true);ctx.beginPath();ctx.arc(xpos,(ypos+dimi/2),(acum+dimi+.01)*.8,begin,end,false);ctx.arc(xpos,(ypos+dimi/2),(acum+dimi+.01),end,begin,true);ctx.fill();acum+=(dimi||0);valAcum+=(valueArray[i]||0);} +if(showLabels&&label.type=='Native'){ctx.save();ctx.fillStyle=ctx.strokeStyle=label.color;ctx.font=label.style+' '+label.size+'px '+label.family;ctx.textBaseline='bottom';ctx.textAlign='center';polar.rho=acum*.65;polar.theta=begin;var cart=polar.getc(true);if(nodeIteration==1){textY=cart.y-(label.size/2)+acum/2;}else{textY=cart.y+acum/2;} +if(config.labelType=='name'){ctx.fillText(node.name,cart.x,textY);}else{ctx.fillText(valuelabelsArray[0],cart.x,textY);} +if(nodeIteration==nodeLength){polar.theta=end;var cart=polar.getc(true);if(config.labelType=='name'){ctx.fillText(node.name,cart.x,cart.x,cart.y-(label.size/2)+acum/2);}else{ctx.fillText(valuelabelsArray[1],cart.x,cart.y-(label.size/2)+acum/2);}} +ctx.restore();}}},'contains':function(node,pos){if(this.nodeTypes['none'].anglecontainsgauge.call(this,node,pos)){var config=node.getData('config');var ld=this.config.levelDistance,d=node._depth;var yOffset=pos.y-(ld/2);var xOffset=pos.x;var rho=Math.sqrt(xOffset*xOffset+yOffset*yOffset);if(rho<=parseInt(ld*d)){var dimArray=node.getData('dimArray');for(var i=0,l=dimArray.length,acum=config.sliceOffset;i=ld*.8&&rho<=acum+dimi){var url=Url.decode(node.getData('linkArray')[i]);return{name:node.getData('stringArray')[i],link:url,color:node.getData('colorArray')[i],value:node.getData('valueArray')[i],valuelabel:node.getData('valuelabelsArray')[0]+" - "+node.getData('valuelabelsArray')[1],label:node.name};} +acum+=dimi;}} +return false;} +return false;}}});$jit.GaugeChart=new Class({sb:null,colors:["#416D9C","#70A35E","#EBB056","#C74243","#83548B","#909291","#557EAA"],selected:{},busy:false,initialize:function(opt){this.controller=this.config=$.merge(Options("Canvas","GaugeChart","Label"),{Label:{type:'Native'}},opt);this.initializeViz();},initializeViz:function(){var config=this.config,that=this;var nodeType=config.type.split(":")[0];var sb=new $jit.Sunburst({injectInto:config.injectInto,useCanvas:config.useCanvas,withLabels:config.Label.type!='Native',background:config.background,renderBackground:config.renderBackground,backgroundColor:config.backgroundColor,colorStop1:config.colorStop1,colorStop2:config.colorStop2,Label:{type:config.Label.type},Node:{overridable:true,type:'gaugechart-'+nodeType,width:1,height:1},Edge:{type:'none'},Tips:{enable:config.Tips.enable,type:'Native',force:true,onShow:function(tip,node,contains){var elem=contains;config.Tips.onShow(tip,elem,node);if(elem.link!='undefined'&&elem.link!=''){document.body.style.cursor='pointer';}},onHide:function(){document.body.style.cursor='default';}},Events:{enable:true,type:'Native',onClick:function(node,eventInfo,evt){if(!config.Events.enable)return;var elem=eventInfo.getContains();config.Events.onClick(elem,eventInfo,evt);}},onCreateLabel:function(domElement,node){var labelConf=config.Label;if(config.showLabels){var style=domElement.style;style.fontSize=labelConf.size+'px';style.fontFamily=labelConf.family;style.color=labelConf.color;style.textAlign='center';valuelabelsArray=node.getData('valuelabelsArray'),nodeIteration=node.getData('nodeIteration'),nodeLength=node.getData('nodeLength'),canvas=sb.canvas,prefix=$.time();if(config.labelType=='name'){domElement.innerHTML=node.name;}else{domElement.innerHTML=(valuelabelsArray[0]!=undefined)?valuelabelsArray[0]:"";} +domElement.style.width='400px';if(nodeIteration==nodeLength&&nodeLength!=0){idLabel=canvas.id+"-label";container=document.getElementById(idLabel);finalLabel=document.createElement('div');finalLabelStyle=finalLabel.style;finalLabel.id=prefix+"finalLabel";finalLabelStyle.position="absolute";finalLabelStyle.width="400px";finalLabelStyle.left="0px";container.appendChild(finalLabel);if(config.labelType=='name'){finalLabel.innerHTML=node.name;}else{finalLabel.innerHTML=(valuelabelsArray[1]!=undefined)?valuelabelsArray[1]:"";}}}},onPlaceLabel:function(domElement,node){if(!config.showLabels)return;var pos=node.pos.getp(true),dimArray=node.getData('dimArray'),nodeIteration=node.getData('nodeIteration'),nodeLength=node.getData('nodeLength'),span=node.getData('span')/2,theta=node.pos.theta,begin=((theta-span)/2)+Math.PI,end=((theta+span)/2)+Math.PI,polar=new Polar;var showLabels=config.showLabels,resizeLabels=config.resizeLabels,label=config.Label,radiusOffset=sb.config.levelDistance;if(dimArray){for(var i=0,l=dimArray.length,acum=0;i>0;fontSize=fontSize<+resizeLabels?+resizeLabels:fontSize;domElement.style.fontSize=fontSize+'px';polar.rho=acum*.65;polar.theta=begin;var pos=polar.getc(true);var radius=that.canvas.getSize();var labelPos={x:Math.round(pos.x+radius.width/2),y:Math.round(pos.y+(radius.height/2)+radiusOffset/2)};domElement.style.left=(labelPos.x-200)+'px';domElement.style.top=labelPos.y+'px';if(nodeIteration==1){domElement.style.top=labelPos.y-label.size+'px';} +if(nodeIteration==nodeLength&&nodeLength!=0){polar.theta=end;var final=polar.getc(true);var finalPos={x:Math.round(final.x+radius.width/2),y:Math.round(final.y+(radius.height/2)+radiusOffset/2)};finalLabel.style.left=(finalPos.x-200)+"px";finalLabel.style.top=finalPos.y-label.size+"px";}}}});this.sb=sb;this.canvas=this.sb.canvas;var size=sb.canvas.getSize(),min=Math.min;sb.config.levelDistance=min(size.width,size.height)/2 +-config.offset-config.sliceOffset;},renderBackground:function(){var canvas=this.sb.canvas,config=this.config,style=config.gaugeStyle,ctx=canvas.getCtx(),size=canvas.getSize(),radius=this.sb.config.levelDistance,startAngle=(Math.PI/180)*1,endAngle=(Math.PI/180)*179;ctx.fillStyle=style.borderColor;ctx.beginPath();ctx.arc(0,radius/2,radius+4,startAngle,endAngle,true);ctx.fill();var radialGradient=ctx.createRadialGradient(0,radius/2,0,0,radius/2,radius);radialGradient.addColorStop(0,'#ffffff');radialGradient.addColorStop(0.3,style.backgroundColor);radialGradient.addColorStop(0.6,style.backgroundColor);radialGradient.addColorStop(1,'#FFFFFF');ctx.fillStyle=radialGradient;startAngle=(Math.PI/180)*0;endAngle=(Math.PI/180)*180;ctx.beginPath();ctx.arc(0,radius/2,radius,startAngle,endAngle,true);ctx.fill();},renderNeedle:function(gaugePosition,target){var canvas=this.sb.canvas,config=this.config,style=config.gaugeStyle,ctx=canvas.getCtx(),size=canvas.getSize(),radius=this.sb.config.levelDistance;gaugeCenter=(radius/2);startAngle=0;endAngle=(Math.PI/180)*180;ctx.fillStyle=style.needleColor;var segments=180/target;needleAngle=gaugePosition*segments;ctx.translate(0,gaugeCenter);ctx.save();ctx.rotate(needleAngle*Math.PI/180);ctx.beginPath();ctx.moveTo(0,0);ctx.lineTo(0,-4);ctx.lineTo(-radius*.9,-1);ctx.lineTo(-radius*.9,1);ctx.lineTo(0,4);ctx.lineTo(0,0);ctx.closePath();ctx.fill();ctx.restore();ctx.lineWidth=1;ctx.strokeStyle='#aa0000';ctx.save();ctx.rotate(needleAngle*Math.PI/180);ctx.beginPath();ctx.moveTo(0,0);ctx.lineTo(0,-4);ctx.lineTo(-radius*.8,-1);ctx.lineTo(-radius*.8,1);ctx.lineTo(0,4);ctx.lineTo(0,0);ctx.closePath();ctx.stroke();ctx.restore();ctx.fillStyle="#000000";ctx.lineWidth=style.borderSize;ctx.strokeStyle=style.borderColor;var radialGradient=ctx.createRadialGradient(0,style.borderSize,0,0,style.borderSize,radius*.2);radialGradient.addColorStop(0,'#666666');radialGradient.addColorStop(0.8,'#444444');radialGradient.addColorStop(1,'rgba(0,0,0,0)');ctx.fillStyle=radialGradient;ctx.translate(0,5);ctx.save();ctx.beginPath();ctx.arc(0,0,radius*.2,startAngle,endAngle,true);ctx.fill();ctx.restore();},renderTicks:function(values){var canvas=this.sb.canvas,config=this.config,style=config.gaugeStyle,ctx=canvas.getCtx(),size=canvas.getSize(),radius=this.sb.config.levelDistance,gaugeCenter=(radius/2);ctx.strokeStyle=style.borderColor;ctx.lineWidth=5;ctx.lineCap="round";for(var i=0,total=0,l=values.length;iacum?maxValue:acum;});return maxValue;},normalizeDims:function(){var root=this.sb.graph.getNode(this.sb.root),l=0;root.eachAdjacency(function(){l++;});var maxValue=this.getMaxValue()||1,config=this.config,animate=config.animate,rho=this.sb.config.levelDistance;this.sb.graph.eachNode(function(n){var acum=0,animateValue=[];$.each(n.getData('valueArray'),function(v){acum+=+v;animateValue.push(1);});var stat=(animateValue.length==1)&&!config.updateHeights;if(animate){n.setData('dimArray',$.map(n.getData('valueArray'),function(n){return stat?rho:(n*rho/maxValue);}),'end');var dimArray=n.getData('dimArray');if(!dimArray){n.setData('dimArray',animateValue);}}else{n.setData('dimArray',$.map(n.getData('valueArray'),function(n){return stat?rho:(n*rho/maxValue);}));} +n.setData('normalizedDim',acum/maxValue);});}});Layouts.TM={};Layouts.TM.SliceAndDice=new Class({compute:function(prop){var root=this.graph.getNode(this.clickedNode&&this.clickedNode.id||this.root);this.controller.onBeforeCompute(root);var size=this.canvas.getSize(),config=this.config,width=size.width,height=size.height;this.graph.computeLevels(this.root,0,"ignore");root.getPos(prop).setc(-width/2,-height/2);root.setData('width',width,prop);root.setData('height',height+config.titleHeight,prop);this.computePositions(root,root,this.layout.orientation,prop);this.controller.onAfterCompute(root);},computePositions:function(par,ch,orn,prop){var totalArea=0;par.eachSubnode(function(n){totalArea+=n.getData('area',prop);});var config=this.config,offst=config.offset,width=par.getData('width',prop),height=par.getData('height',prop)-config.titleHeight,fact=par==ch?1:(ch.getData('area',prop)/totalArea);var otherSize,size,dim,pos,pos2,posth,pos2th;var horizontal=(orn=="h");if(horizontal){orn='v';otherSize=height;size=width*fact;dim='height';pos='y';pos2='x';posth=config.titleHeight;pos2th=0;}else{orn='h';otherSize=height*fact;size=width;dim='width';pos='x';pos2='y';posth=0;pos2th=config.titleHeight;} +var cpos=ch.getPos(prop);ch.setData('width',size,prop);ch.setData('height',otherSize,prop);var offsetSize=0,tm=this;ch.eachSubnode(function(n){var p=n.getPos(prop);p[pos]=offsetSize+cpos[pos]+posth;p[pos2]=cpos[pos2]+pos2th;tm.computePositions(ch,n,orn,prop);offsetSize+=n.getData(dim,prop);});}});Layouts.TM.Area={compute:function(prop){prop=prop||"current";var root=this.graph.getNode(this.clickedNode&&this.clickedNode.id||this.root);this.controller.onBeforeCompute(root);var config=this.config,size=this.canvas.getSize(),width=size.width,height=size.height,offst=config.offset,offwdth=width-offst,offhght=height-offst;this.graph.computeLevels(this.root,0,"ignore");root.getPos(prop).setc(-width/2,-height/2);root.setData('width',width,prop);root.setData('height',height,prop);var coord={'top':-height/2+config.titleHeight,'left':-width/2,'width':offwdth,'height':offhght-config.titleHeight};this.computePositions(root,coord,prop);this.controller.onAfterCompute(root);},computeDim:function(tail,initElem,w,coord,comp,prop){if(tail.length+initElem.length==1){var l=(tail.length==1)?tail:initElem;this.layoutLast(l,w,coord,prop);return;} +if(tail.length>=2&&initElem.length==0){initElem=[tail.shift()];} +if(tail.length==0){if(initElem.length>0)this.layoutRow(initElem,w,coord,prop);return;} +var c=tail[0];if(comp(initElem,w)>=comp([c].concat(initElem),w)){this.computeDim(tail.slice(1),initElem.concat([c]),w,coord,comp,prop);}else{var newCoords=this.layoutRow(initElem,w,coord,prop);this.computeDim(tail,[],newCoords.dim,newCoords,comp,prop);}},worstAspectRatio:function(ch,w){if(!ch||ch.length==0)return Number.MAX_VALUE;var areaSum=0,maxArea=0,minArea=Number.MAX_VALUE;for(var i=0,l=ch.length;iarea?maxArea:area;} +var sqw=w*w,sqAreaSum=areaSum*areaSum;return Math.max(sqw*maxArea/sqAreaSum,sqAreaSum/(sqw*minArea));},avgAspectRatio:function(ch,w){if(!ch||ch.length==0)return Number.MAX_VALUE;var arSum=0;for(var i=0,l=ch.length;ih?w/h:h/w;} +return arSum/l;},layoutLast:function(ch,w,coord,prop){var child=ch[0];child.getPos(prop).setc(coord.left,coord.top);child.setData('width',coord.width,prop);child.setData('height',coord.height,prop);}};Layouts.TM.Squarified=new Class({Implements:Layouts.TM.Area,computePositions:function(node,coord,prop){var config=this.config;if(coord.width>=coord.height) +this.layout.orientation='h';else +this.layout.orientation='v';var ch=node.getSubnodes([1,1],"ignore");if(ch.length>0){this.processChildrenLayout(node,ch,coord,prop);for(var i=0,l=ch.length;i0){this.processChildrenLayout(node,ch,coord,prop);for(var i=0,l=ch.length;itreeDepth)treeDepth=d;});var startNode=this.graph.getNode(this.clickedNode&&this.clickedNode.id||root.id);var maxDepth=Math.min(treeDepth,levelsToShow-1);var initialDepth=startNode._depth;if(this.layout.horizontal()){this.computeSubtree(startNode,-width/2,-height/2,width/(maxDepth+1),height,initialDepth,maxDepth,posType);}else{this.computeSubtree(startNode,-width/2,-height/2,width,height/(maxDepth+1),initialDepth,maxDepth,posType);}},computeSubtree:function(root,x,y,width,height,initialDepth,maxDepth,posType){root.getPos(posType).setc(x,y);root.setData('width',width,posType);root.setData('height',height,posType);var nodeLength,prevNodeLength=0,totalDim=0;var children=Graph.Util.getSubnodes(root,[1,1]);if(!children.length) +return;$.each(children,function(e){totalDim+=e.getData('dim');});for(var i=0,l=children.length;i>0;}));lg.addColorStop(0,color);lg.addColorStop(1,colorGrad);ctx.fillStyle=lg;} +if(border){ctx.strokeStyle=border;ctx.lineWidth=3;} +ctx.fillRect(posx,posy,Math.max(0,width-offset),Math.max(0,height-offset));border&&ctx.strokeRect(pos.x,pos.y,width,height);},'contains':function(node,pos){if(this.viz.clickedNode&&!$jit.Graph.Util.isDescendantOf(node,this.viz.clickedNode.id))return false;var npos=node.pos.getc(true),width=node.getData('width'),height=node.getData('height');return this.nodeHelper.rectangle.contains({x:npos.x+width/2,y:npos.y+height/2},pos,width,height);}}});$jit.Icicle.Plot.EdgeTypes=new Class({'none':$.empty});Layouts.ForceDirected=new Class({getOptions:function(random){var s=this.canvas.getSize();var w=s.width,h=s.height;var count=0;this.graph.eachNode(function(n){count++;});var k2=w*h/count,k=Math.sqrt(k2);var l=this.config.levelDistance;return{width:w,height:h,tstart:w*0.1,nodef:function(x){return k2/(x||1);},edgef:function(x){return k*(x-l);}};},compute:function(property,incremental){var prop=$.splat(property||['current','start','end']);var opt=this.getOptions();NodeDim.compute(this.graph,prop,this.config);this.graph.computeLevels(this.root,0,"ignore");this.graph.eachNode(function(n){$.each(prop,function(p){var pos=n.getPos(p);if(pos.equals(Complex.KER)){pos.x=opt.width/5*(Math.random()-0.5);pos.y=opt.height/5*(Math.random()-0.5);} +n.disp={};$.each(prop,function(p){n.disp[p]=$C(0,0);});});});this.computePositions(prop,opt,incremental);},computePositions:function(property,opt,incremental){var times=this.config.iterations,i=0,that=this;if(incremental){(function iter(){for(var total=incremental.iter,j=0;j=times){incremental.onComplete();return;}} +incremental.onStep(Math.round(i/(times-1)*100));setTimeout(iter,1);})();}else{for(;i1&&direction[0]!=adj.nodeFrom.id);this.edgeHelper.arrow.render(from,to,dim,inv,canvas);},'contains':function(adj,pos){var from=adj.nodeFrom.pos.getc(true),to=adj.nodeTo.pos.getc(true);return this.edgeHelper.arrow.contains(from,to,pos,this.edge.epsilon);}}});})($jit.ForceDirected);$jit.TM={};var TM=$jit.TM;$jit.TM.$extend=true;TM.Base={layout:{orientation:"h",vertical:function(){return this.orientation=="v";},horizontal:function(){return this.orientation=="h";},change:function(){this.orientation=this.vertical()?"h":"v";}},initialize:function(controller){var config={orientation:"h",titleHeight:13,offset:2,levelsToShow:0,constrained:false,animate:false,Node:{type:'rectangle',overridable:true,width:3,height:3,color:'#444'},Label:{textAlign:'center',textBaseline:'top'},Edge:{type:'none'},duration:700,fps:45};this.controller=this.config=$.merge(Options("Canvas","Node","Edge","Fx","Controller","Tips","NodeStyles","Events","Navigation","Label"),config,controller);this.layout.orientation=this.config.orientation;var canvasConfig=this.config;if(canvasConfig.useCanvas){this.canvas=canvasConfig.useCanvas;this.config.labelContainer=this.canvas.id+'-label';}else{if(canvasConfig.background){canvasConfig.background=$.merge({type:'Circles'},canvasConfig.background);} +this.canvas=new Canvas(this,canvasConfig);this.config.labelContainer=(typeof canvasConfig.injectInto=='string'?canvasConfig.injectInto:canvasConfig.injectInto.id)+'-label';} +this.graphOptions={'complex':true,'Node':{'selected':false,'exist':true,'drawn':true}};this.graph=new Graph(this.graphOptions,this.config.Node,this.config.Edge);this.labels=new TM.Label[canvasConfig.Label.type](this);this.fx=new TM.Plot(this);this.op=new TM.Op(this);this.group=new TM.Group(this);this.geom=new TM.Geom(this);this.clickedNode=null;this.busy=false;this.initializeExtras();},refresh:function(){if(this.busy)return;this.busy=true;var that=this;if(this.config.animate){this.compute('end');this.config.levelsToShow>0&&this.geom.setRightLevelToShow(this.graph.getNode(this.clickedNode&&this.clickedNode.id||this.root));this.fx.animate($.merge(this.config,{modes:['linear','node-property:width:height'],onComplete:function(){that.busy=false;}}));}else{var labelType=this.config.Label.type;if(labelType!='Native'){var that=this;this.graph.eachNode(function(n){that.labels.hideLabel(n,false);});} +this.busy=false;this.compute();this.config.levelsToShow>0&&this.geom.setRightLevelToShow(this.graph.getNode(this.clickedNode&&this.clickedNode.id||this.root));this.plot();}},plot:function(){this.fx.plot();},leaf:function(n){return n.getSubnodes([1,1],"ignore").length==0;},enter:function(n){if(this.busy)return;this.busy=true;var that=this,config=this.config,graph=this.graph,clickedNode=n,previousClickedNode=this.clickedNode;var callback={onComplete:function(){if(config.levelsToShow>0){that.geom.setRightLevelToShow(n);} +if(config.levelsToShow>0||config.request)that.compute();if(config.animate){graph.nodeList.setData('alpha',0,'end');n.eachSubgraph(function(n){n.setData('alpha',1,'end');},"ignore");that.fx.animate({duration:500,modes:['node-property:alpha'],onComplete:function(){that.clickedNode=clickedNode;that.compute('end');that.clickedNode=previousClickedNode;that.fx.animate({modes:['linear','node-property:width:height'],duration:1000,onComplete:function(){that.busy=false;that.clickedNode=clickedNode;}});}});}else{that.busy=false;that.clickedNode=n;that.refresh();}}};if(config.request){this.requestNodes(clickedNode,callback);}else{callback.onComplete();}},out:function(){if(this.busy)return;this.busy=true;this.events.hoveredNode=false;var that=this,config=this.config,graph=this.graph,parents=graph.getNode(this.clickedNode&&this.clickedNode.id||this.root).getParents(),parent=parents[0],clickedNode=parent,previousClickedNode=this.clickedNode;if(!parent){this.busy=false;return;} +callback={onComplete:function(){that.clickedNode=parent;if(config.request){that.requestNodes(parent,{onComplete:function(){that.compute();that.plot();that.busy=false;}});}else{that.compute();that.plot();that.busy=false;}}};if(config.levelsToShow>0) +this.geom.setRightLevelToShow(parent);if(config.animate){this.clickedNode=clickedNode;this.compute('end');this.clickedNode=previousClickedNode;this.fx.animate({modes:['linear','node-property:width:height'],duration:1000,onComplete:function(){that.clickedNode=clickedNode;graph.eachNode(function(n){n.setDataset(['current','end'],{'alpha':[0,1]});},"ignore");previousClickedNode.eachSubgraph(function(node){node.setData('alpha',1);},"ignore");that.fx.animate({duration:500,modes:['node-property:alpha'],onComplete:function(){callback.onComplete();}});}});}else{callback.onComplete();}},requestNodes:function(node,onComplete){var handler=$.merge(this.controller,onComplete),lev=this.config.levelsToShow;if(handler.request){var leaves=[],d=node._depth;node.eachLevel(0,lev,function(n){var nodeLevel=lev-(n._depth-d);if(n.drawn&&!n.anySubnode()&&nodeLevel>0){leaves.push(n);n._level=nodeLevel;}});this.group.requestNodes(leaves,handler);}else{handler.onComplete();}}};TM.Op=new Class({Implements:Graph.Op,initialize:function(viz){this.viz=viz;}});TM.Geom=new Class({Implements:Graph.Geom,getRightLevelToShow:function(){return this.viz.config.levelsToShow;},setRightLevelToShow:function(node){var level=this.getRightLevelToShow(),fx=this.viz.labels;node.eachLevel(0,level+1,function(n){var d=n._depth-node._depth;if(d>level){n.drawn=false;n.exist=false;n.ignore=true;fx.hideLabel(n,false);}else{n.drawn=true;n.exist=true;delete n.ignore;}});node.drawn=true;delete node.ignore;}});TM.Group=new Class({initialize:function(viz){this.viz=viz;this.canvas=viz.canvas;this.config=viz.config;},requestNodes:function(nodes,controller){var counter=0,len=nodes.length,nodeSelected={};var complete=function(){controller.onComplete();};var viz=this.viz;if(len==0) +complete();for(var i=0;i>0;}));lg.addColorStop(0,color);lg.addColorStop(1,colorGrad);ctx.fillStyle=lg;} +ctx.fillRect(posx,posy,width-offst,height-offst);if(border){ctx.save();ctx.strokeStyle=border;ctx.strokeRect(posx,posy,width-offst,height-offst);ctx.restore();}}else if(titleHeight>0){ctx.fillRect(pos.x+offst/2,pos.y+offst/2,width-offst,titleHeight-offst);if(border){ctx.save();ctx.strokeStyle=border;ctx.strokeRect(pos.x+offst/2,pos.y+offst/2,width-offst,height-offst);ctx.restore();}}},'contains':function(node,pos){if(this.viz.clickedNode&&!node.isDescendantOf(this.viz.clickedNode.id)||node.ignore)return false;var npos=node.pos.getc(true),width=node.getData('width'),leaf=this.viz.leaf(node),height=leaf?node.getData('height'):this.config.titleHeight;return this.nodeHelper.rectangle.contains({x:npos.x+width/2,y:npos.y+height/2},pos,width,height);}}});TM.Plot.EdgeTypes=new Class({'none':$.empty});TM.SliceAndDice=new Class({Implements:[Loader,Extras,TM.Base,Layouts.TM.SliceAndDice]});TM.Squarified=new Class({Implements:[Loader,Extras,TM.Base,Layouts.TM.Squarified]});TM.Strip=new Class({Implements:[Loader,Extras,TM.Base,Layouts.TM.Strip]});$jit.RGraph=new Class({Implements:[Loader,Extras,Layouts.Radial],initialize:function(controller){var $RGraph=$jit.RGraph;var config={interpolation:'linear',levelDistance:100};this.controller=this.config=$.merge(Options("Canvas","Node","Edge","Fx","Controller","Tips","NodeStyles","Events","Navigation","Label"),config,controller);var canvasConfig=this.config;if(canvasConfig.useCanvas){this.canvas=canvasConfig.useCanvas;this.config.labelContainer=this.canvas.id+'-label';}else{if(canvasConfig.background){canvasConfig.background=$.merge({type:'Circles'},canvasConfig.background);} +this.canvas=new Canvas(this,canvasConfig);this.config.labelContainer=(typeof canvasConfig.injectInto=='string'?canvasConfig.injectInto:canvasConfig.injectInto.id)+'-label';} +this.graphOptions={'complex':false,'Node':{'selected':false,'exist':true,'drawn':true}};this.graph=new Graph(this.graphOptions,this.config.Node,this.config.Edge);this.labels=new $RGraph.Label[canvasConfig.Label.type](this);this.fx=new $RGraph.Plot(this,$RGraph);this.op=new $RGraph.Op(this);this.json=null;this.root=null;this.busy=false;this.parent=false;this.initializeExtras();},createLevelDistanceFunc:function(){var ld=this.config.levelDistance;return function(elem){return(elem._depth+1)*ld;};},refresh:function(){this.compute();this.plot();},reposition:function(){this.compute('end');},plot:function(){this.fx.plot();},getNodeAndParentAngle:function(id){var theta=false;var n=this.graph.getNode(id);var ps=n.getParents();var p=(ps.length>0)?ps[0]:false;if(p){var posParent=p.pos.getc(),posChild=n.pos.getc();var newPos=posParent.add(posChild.scale(-1));theta=Math.atan2(newPos.y,newPos.x);if(theta<0) +theta+=2*Math.PI;} +return{parent:p,theta:theta};},tagChildren:function(par,id){if(par.angleSpan){var adjs=[];par.eachAdjacency(function(elem){adjs.push(elem.nodeTo);},"ignore");var len=adjs.length;for(var i=0;i1&&direction[0]!=adj.nodeFrom.id);this.edgeHelper.arrow.render(from,to,dim,inv,canvas);},'contains':function(adj,pos){var from=adj.nodeFrom.pos.getc(true),to=adj.nodeTo.pos.getc(true);return this.edgeHelper.arrow.contains(from,to,pos,this.edge.epsilon);}}});})($jit.RGraph);Complex.prototype.moebiusTransformation=function(c){var num=this.add(c);var den=c.$conjugate().$prod(this);den.x++;return num.$div(den);};Graph.Util.moebiusTransformation=function(graph,pos,prop,startPos,flags){this.eachNode(graph,function(elem){for(var i=0;i=2){return genDistFunc(i-0.01);}} +return genDistFunc(0.75);},getRadius:function(){var rad=this.config.radius;if(rad!=="auto"){return rad;} +var s=this.canvas.getSize();return Math.min(s.width,s.height)/2;},refresh:function(reposition){if(reposition){this.reposition();this.graph.eachNode(function(node){node.startPos.rho=node.pos.rho=node.endPos.rho;node.startPos.theta=node.pos.theta=node.endPos.theta;});}else{this.compute();} +this.plot();},reposition:function(){this.compute('end');var vector=this.graph.getNode(this.root).pos.getc().scale(-1);Graph.Util.moebiusTransformation(this.graph,[vector],['end'],'end',"ignore");this.graph.eachNode(function(node){if(node.ignore){node.endPos.rho=node.pos.rho;node.endPos.theta=node.pos.theta;}});},plot:function(){this.fx.plot();},onClick:function(id,opt){var pos=this.graph.getNode(id).pos.getc(true);this.move(pos,opt);},move:function(pos,opt){var versor=$C(pos.x,pos.y);if(this.busy===false&&versor.norm()<1){this.busy=true;var root=this.graph.getClosestNodeToPos(versor),that=this;this.graph.computeLevels(root.id,0);this.controller.onBeforeCompute(root);opt=$.merge({onComplete:$.empty},opt||{});this.fx.animate($.merge({modes:['moebius'],hideLabels:true},opt,{onComplete:function(){that.busy=false;opt.onComplete();}}),versor);}}});$jit.Hypertree.$extend=true;(function(Hypertree){Hypertree.Op=new Class({Implements:Graph.Op});Hypertree.Plot=new Class({Implements:Graph.Plot});Hypertree.Label={};Hypertree.Label.Native=new Class({Implements:Graph.Label.Native,initialize:function(viz){this.viz=viz;},renderLabel:function(canvas,node,controller){var ctx=canvas.getCtx();var coord=node.pos.getc(true);var s=this.viz.getRadius();ctx.fillText(node.name,coord.x*s,coord.y*s);}});Hypertree.Label.SVG=new Class({Implements:Graph.Label.SVG,initialize:function(viz){this.viz=viz;},placeLabel:function(tag,node,controller){var pos=node.pos.getc(true),canvas=this.viz.canvas,ox=canvas.translateOffsetX,oy=canvas.translateOffsetY,sx=canvas.scaleOffsetX,sy=canvas.scaleOffsetY,radius=canvas.getSize(),r=this.viz.getRadius();var labelPos={x:Math.round((pos.x*sx)*r+ox+radius.width/2),y:Math.round((pos.y*sy)*r+oy+radius.height/2)};tag.setAttribute('x',labelPos.x);tag.setAttribute('y',labelPos.y);controller.onPlaceLabel(tag,node);}});Hypertree.Label.HTML=new Class({Implements:Graph.Label.HTML,initialize:function(viz){this.viz=viz;},placeLabel:function(tag,node,controller){var pos=node.pos.getc(true),canvas=this.viz.canvas,ox=canvas.translateOffsetX,oy=canvas.translateOffsetY,sx=canvas.scaleOffsetX,sy=canvas.scaleOffsetY,radius=canvas.getSize(),r=this.viz.getRadius();var labelPos={x:Math.round((pos.x*sx)*r+ox+radius.width/2),y:Math.round((pos.y*sy)*r+oy+radius.height/2)};var style=tag.style;style.left=labelPos.x+'px';style.top=labelPos.y+'px';style.display=this.fitsInCanvas(labelPos,canvas)?'':'none';controller.onPlaceLabel(tag,node);}});Hypertree.Plot.NodeTypes=new Class({'none':{'render':$.empty,'contains':$.lambda(false)},'circle':{'render':function(node,canvas){var nconfig=this.node,dim=node.getData('dim'),p=node.pos.getc();dim=nconfig.transform?dim*(1-p.squaredNorm()):dim;p.$scale(node.scale);if(dim>0.2){this.nodeHelper.circle.render('fill',p,dim,canvas);}},'contains':function(node,pos){var dim=node.getData('dim'),npos=node.pos.getc().$scale(node.scale);return this.nodeHelper.circle.contains(npos,pos,dim);}},'ellipse':{'render':function(node,canvas){var pos=node.pos.getc().$scale(node.scale),width=node.getData('width'),height=node.getData('height');this.nodeHelper.ellipse.render('fill',pos,width,height,canvas);},'contains':function(node,pos){var width=node.getData('width'),height=node.getData('height'),npos=node.pos.getc().$scale(node.scale);return this.nodeHelper.circle.contains(npos,pos,width,height);}},'square':{'render':function(node,canvas){var nconfig=this.node,dim=node.getData('dim'),p=node.pos.getc();dim=nconfig.transform?dim*(1-p.squaredNorm()):dim;p.$scale(node.scale);if(dim>0.2){this.nodeHelper.square.render('fill',p,dim,canvas);}},'contains':function(node,pos){var dim=node.getData('dim'),npos=node.pos.getc().$scale(node.scale);return this.nodeHelper.square.contains(npos,pos,dim);}},'rectangle':{'render':function(node,canvas){var nconfig=this.node,width=node.getData('width'),height=node.getData('height'),pos=node.pos.getc();width=nconfig.transform?width*(1-pos.squaredNorm()):width;height=nconfig.transform?height*(1-pos.squaredNorm()):height;pos.$scale(node.scale);if(width>0.2&&height>0.2){this.nodeHelper.rectangle.render('fill',pos,width,height,canvas);}},'contains':function(node,pos){var width=node.getData('width'),height=node.getData('height'),npos=node.pos.getc().$scale(node.scale);return this.nodeHelper.square.contains(npos,pos,width,height);}},'triangle':{'render':function(node,canvas){var nconfig=this.node,dim=node.getData('dim'),p=node.pos.getc();dim=nconfig.transform?dim*(1-p.squaredNorm()):dim;p.$scale(node.scale);if(dim>0.2){this.nodeHelper.triangle.render('fill',p,dim,canvas);}},'contains':function(node,pos){var dim=node.getData('dim'),npos=node.pos.getc().$scale(node.scale);return this.nodeHelper.triangle.contains(npos,pos,dim);}},'star':{'render':function(node,canvas){var nconfig=this.node,dim=node.getData('dim'),p=node.pos.getc();dim=nconfig.transform?dim*(1-p.squaredNorm()):dim;p.$scale(node.scale);if(dim>0.2){this.nodeHelper.star.render('fill',p,dim,canvas);}},'contains':function(node,pos){var dim=node.getData('dim'),npos=node.pos.getc().$scale(node.scale);return this.nodeHelper.star.contains(npos,pos,dim);}}});Hypertree.Plot.EdgeTypes=new Class({'none':$.empty,'line':{'render':function(adj,canvas){var from=adj.nodeFrom.pos.getc(true),to=adj.nodeTo.pos.getc(true),r=adj.nodeFrom.scale;this.edgeHelper.line.render({x:from.x*r,y:from.y*r},{x:to.x*r,y:to.y*r},canvas);},'contains':function(adj,pos){var from=adj.nodeFrom.pos.getc(true),to=adj.nodeTo.pos.getc(true),r=adj.nodeFrom.scale;this.edgeHelper.line.contains({x:from.x*r,y:from.y*r},{x:to.x*r,y:to.y*r},pos,this.edge.epsilon);}},'arrow':{'render':function(adj,canvas){var from=adj.nodeFrom.pos.getc(true),to=adj.nodeTo.pos.getc(true),r=adj.nodeFrom.scale,dim=adj.getData('dim'),direction=adj.data.$direction,inv=(direction&&direction.length>1&&direction[0]!=adj.nodeFrom.id);this.edgeHelper.arrow.render({x:from.x*r,y:from.y*r},{x:to.x*r,y:to.y*r},dim,inv,canvas);},'contains':function(adj,pos){var from=adj.nodeFrom.pos.getc(true),to=adj.nodeTo.pos.getc(true),r=adj.nodeFrom.scale;this.edgeHelper.arrow.contains({x:from.x*r,y:from.y*r},{x:to.x*r,y:to.y*r},pos,this.edge.epsilon);}},'hyperline':{'render':function(adj,canvas){var from=adj.nodeFrom.pos.getc(),to=adj.nodeTo.pos.getc(),dim=this.viz.getRadius();this.edgeHelper.hyperline.render(from,to,dim,canvas);},'contains':$.lambda(false)}});})($jit.Hypertree);})(); \ No newline at end of file diff --git a/include/SugarCharts/Jit/js/mySugarCharts.js b/include/SugarCharts/Jit/js/mySugarCharts.js new file mode 100644 index 00000000..84543b21 --- /dev/null +++ b/include/SugarCharts/Jit/js/mySugarCharts.js @@ -0,0 +1,38 @@ +/********************************************************************************* + * SugarCRM Community Edition is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. + * + * 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. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ +SUGAR.mySugar.sugarCharts=function(){var activeTab=activePage,charts=new Object(),windowWidth=0,firstLoad=(SUGAR.isIE)?true:false;return{loadSugarCharts:function(activeTab){var chartFound=false;for(id in charts[activeTab]){if(id!='undefined'){chartFound=true;loadSugarChart(charts[activeTab][id]['chartId'],charts[activeTab][id]['jsonFilename'],charts[activeTab][id]['css'],charts[activeTab][id]['chartConfig']);}} +charts=new Object();},addToChartsArrayJson:function(json,activeTab){for(id in json){if(json[id]['supported']=="true"){SUGAR.mySugar.sugarCharts.addToChartsArray(json[id]['chartId'],json[id]['filename'],json[id]['css'],json[id]['chartConfig'],activeTab);}}},addToChartsArray:function(chartId,jsonFilename,css,chartConfig,activeTab){if(charts[activeTab]==null){charts[activeTab]=new Object();} +charts[activeTab][chartId]=new Object();charts[activeTab][chartId]['chartId']=chartId;charts[activeTab][chartId]['jsonFilename']=jsonFilename;charts[activeTab][chartId]['css']=css;charts[activeTab][chartId]['chartConfig']=chartConfig;},refreshPage:function(){var newWidth=document.body.offsetWidth;if(newWidth!=windowWidth&&!firstLoad){setTimeout(function(){location.reload();},500);SUGAR.mySugar.sugarCharts.loadSugarCharts(activePage);} +firstLoad=false;windowWidth=newWidth;},refreshGraphs:function(){setTimeout("SUGAR.mySugar.sugarCharts.refreshPage()",1000);}}}();YAHOO.util.Event.addListener(window,'resize',SUGAR.mySugar.sugarCharts.refreshGraphs); \ No newline at end of file diff --git a/include/SugarCharts/Jit/js/sugarCharts.js b/include/SugarCharts/Jit/js/sugarCharts.js new file mode 100644 index 00000000..cbf29a3b --- /dev/null +++ b/include/SugarCharts/Jit/js/sugarCharts.js @@ -0,0 +1,81 @@ +/********************************************************************************* + * SugarCRM Community Edition is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. + * + * 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. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ +function loadSugarChart(chartId,jsonFilename,css,chartConfig){var labelType,useGradients,nativeTextSupport,animate;(function(){var ua=navigator.userAgent,typeOfCanvas=typeof HTMLCanvasElement,nativeCanvasSupport=(typeOfCanvas=='object'||typeOfCanvas=='function'),textSupport=nativeCanvasSupport&&(typeof document.createElement('canvas').getContext('2d').fillText=='function');labelType='Native';nativeTextSupport=labelType=='Native';useGradients=nativeCanvasSupport;animate=false;})();switch(chartConfig["chartType"]){case"barChart":var handleFailure=function(o){alert('fail');if(o.responseText!==undefined){alert('failed');}} +var handleSuccess=function(o){if(o.responseText!==undefined&&o.responseText!="No Data"){var json=eval('('+o.responseText+')');var properties=$jit.util.splat(json.properties)[0];var marginBottom=(chartConfig["orientation"]=='vertical'&&json.values.length>8)?20*4:20;var barChart=new $jit.BarChart({injectInto:chartId,animate:false,nodeCount:json.values.length,renderBackground:chartConfig['imageExportType']=="jpg"?true:false,backgroundColor:'rgb(255,255,255)',colorStop1:'rgba(255,255,255,.8)',colorStop2:'rgba(255,255,255,0)',shadow:{enable:true,size:2},orientation:chartConfig["orientation"],hoveredColor:false,Title:{text:properties['title'],size:16,color:'#444444',offset:20},Subtitle:{text:properties['subtitle'],size:11,color:css["color"],offset:20},Ticks:{enable:true,color:css["gridLineColor"]},barsOffset:(chartConfig["orientation"]=="vertical")?30:20,Margin:{top:20,left:30,right:20,bottom:marginBottom},ScrollNote:{text:(chartConfig["scroll"]&&SUGAR.util.isTouchScreen())?"Use two fingers to scroll":"",size:12},Events:{enable:true,onClick:function(node){if(!node||SUGAR.util.isTouchScreen())return;if(node.link=='undefined'||node.link=='')return;window.location.href=node.link;}},labelOffset:5,type:useGradients?chartConfig["barType"]+':gradient':chartConfig["barType"],showAggregates:true,showLabels:true,Label:{type:labelType,size:12,family:css["font-family"],color:css["color"],colorAlt:"#ffffff"},Tips:{enable:true,onShow:function(tip,elem){if(elem.link!='undefined'&&elem.link!=''){drillDown=(SUGAR.util.isTouchScreen())?"
Click to drilldown":"
Click to drilldown";}else{drillDown="";} +if(elem.valuelabel!='undefined'&&elem.valuelabel!=undefined&&elem.valuelabel!=''){value="elem.valuelabel";}else{value="elem.value";} +eval("tip.innerHTML = '' + elem."+chartConfig["tip"]+" + ': ' + "+value+" + ' - ' + elem.percentage + '%' + drillDown");}}});barChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=barChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length/cols),table="";var j=0;for(i=0;i";for(td=0;td';if(legend["name"][j]!=undefined){table+='
 
';} +table+='';table+='
';j++;} +table+="";} +table+="
';if(legend["name"][j]!=undefined){table+=legend["name"][j];} +table+='
";list.innerHTML=table;$jit.util.saveImageTest(chartId,jsonFilename,chartConfig["imageExportType"]);}} +var callback={success:handleSuccess,failure:handleFailure,argument:{foo:'foo',bar:''}};var request=YAHOO.util.Connect.asyncRequest('GET',jsonFilename+"?r="+new Date().getTime(),callback);break;case"lineChart":var handleFailure=function(o){alert('fail');if(o.responseText!==undefined){alert('failed');}} +var handleSuccess=function(o){if(o.responseText!==undefined&&o.responseText!="No Data"){var json=eval('('+o.responseText+')');var properties=$jit.util.splat(json.properties)[0];var lineChart=new $jit.LineChart({injectInto:chartId,animate:false,renderBackground:chartConfig['imageExportType']=="jpg"?true:false,backgroundColor:'rgb(255,255,255)',colorStop1:'rgba(255,255,255,.8)',colorStop2:'rgba(255,255,255,0)',selectOnHover:false,Title:{text:properties['title'],size:16,color:'#444444',offset:20},Subtitle:{text:properties['subtitle'],size:11,color:css["color"],offset:20},Ticks:{enable:true,color:css["gridLineColor"]},Margin:{top:20,left:40,right:40,bottom:20},Events:{enable:true,onClick:function(node){if(!node||SUGAR.util.isTouchScreen())return;if(node.link=='undefined'||node.link=='')return;window.location.href=node.link;}},labelOffset:5,type:useGradients?chartConfig["lineType"]+':gradient':chartConfig["lineType"],showAggregates:true,showLabels:true,Label:{type:labelType,size:12,family:css["font-family"],color:css["color"],colorAlt:"#ffffff"},Tips:{enable:true,onShow:function(tip,elem){if(elem.link!='undefined'&&elem.link!=''){drillDown=(SUGAR.util.isTouchScreen())?"
Click to drilldown":"
Click to drilldown";}else{drillDown="";} +if(elem.valuelabel!='undefined'&&elem.valuelabel!=undefined&&elem.valuelabel!=''){var value="elem.valuelabel";}else{var value="elem.value";} +if(elem.collision){eval("var name = elem."+chartConfig["tip"]+";");var content='';for(var i=0;i';} +content+='
'+name[i]+': '+elem.value[i]+' - '+elem.percentage[i]+'%'+'
';tip.innerHTML=content;}else{eval("tip.innerHTML = '' + elem."+chartConfig["tip"]+" + ': ' + "+value+" + ' - ' + elem.percentage + '%' + drillDown");}}}});lineChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=lineChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length/cols),table="";var j=0;for(i=0;i";for(td=0;td';if(legend["name"][j]!=undefined){table+='
 
';} +table+='';table+='
';j++;} +table+="";} +table+="
';if(legend["name"][j]!=undefined){table+=legend["name"][j];} +table+='
";list.innerHTML=table;$jit.util.saveImageTest(chartId,jsonFilename,chartConfig["imageExportType"]);}} +var callback={success:handleSuccess,failure:handleFailure,argument:{foo:'foo',bar:''}};var request=YAHOO.util.Connect.asyncRequest('GET',jsonFilename+"?r="+new Date().getTime(),callback);break;case"pieChart":var handleFailure=function(o){alert('fail');if(o.responseText!==undefined){alert('failed');}} +var handleSuccess=function(o){if(o.responseText!==undefined){var json=eval('('+o.responseText+')');var properties=$jit.util.splat(json.properties)[0];var pieChart=new $jit.PieChart({injectInto:chartId,animate:false,renderBackground:chartConfig['imageExportType']=="jpg"?true:false,backgroundColor:'rgb(255,255,255)',colorStop1:'rgba(255,255,255,.8)',colorStop2:'rgba(255,255,255,0)',labelType:properties['labels'],hoveredColor:false,offset:50,sliceOffset:0,labelOffset:30,type:useGradients?chartConfig["pieType"]+':gradient':chartConfig["pieType"],showLabels:true,Title:{text:properties['title'],size:16,color:'#444444',offset:20},Subtitle:{text:properties['subtitle'],size:11,color:css["color"],offset:20},Margin:{top:20,left:20,right:20,bottom:20},Events:{enable:true,onClick:function(node){if(!node||SUGAR.util.isTouchScreen())return;if(node.link=='undefined'||node.link=='')return;window.location.href=node.link;}},Label:{type:labelType,size:12,family:css["font-family"],color:css["color"]},Tips:{enable:true,onShow:function(tip,elem){if(elem.link!='undefined'&&elem.link!=''){drillDown=(SUGAR.util.isTouchScreen())?"
Click to drilldown":"
Click to drilldown";}else{drillDown="";} +if(elem.valuelabel!='undefined'&&elem.valuelabel!=undefined&&elem.valuelabel!=''){value="elem.valuelabel";}else{value="elem.value";} +eval("tip.innerHTML = '' + elem.label + ': ' + "+value+" + ' - ' + elem.percentage + '%' + drillDown");}}});pieChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=pieChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length/cols);table="";var j=0;for(i=0;i";for(td=0;td';if(legend["name"][j]!=undefined){table+='
 
';} +table+='';table+='
';j++;} +table+="";} +table+="
';if(legend["name"][j]!=undefined){table+=legend["name"][j];} +table+='
";list.innerHTML=table;$jit.util.saveImageTest(chartId,jsonFilename,chartConfig["imageExportType"]);}} +var callback={success:handleSuccess,failure:handleFailure,argument:{foo:'foo',bar:''}};var request=YAHOO.util.Connect.asyncRequest('GET',jsonFilename+"?r="+new Date().getTime(),callback);break;case"funnelChart":var handleFailure=function(o){alert('fail');if(o.responseText!==undefined){alert('failed');}} +var handleSuccess=function(o){if(o.responseText!==undefined&&o.responseText!="No Data"){var json=eval('('+o.responseText+')');var properties=$jit.util.splat(json.properties)[0];var funnelChart=new $jit.FunnelChart({injectInto:chartId,animate:false,renderBackground:chartConfig['imageExportType']=="jpg"?true:false,backgroundColor:'rgb(255,255,255)',colorStop1:'rgba(255,255,255,.8)',colorStop2:'rgba(255,255,255,0)',orientation:"vertical",hoveredColor:false,Title:{text:properties['title'],size:16,color:'#444444',offset:20},Subtitle:{text:properties['subtitle'],size:11,color:css["color"],offset:20},segmentOffset:20,Margin:{top:20,left:20,right:20,bottom:20},Events:{enable:true,onClick:function(node){if(!node||SUGAR.util.isTouchScreen())return;if(node.link=='undefined'||node.link=='')return;window.location.href=node.link;}},labelOffset:10,type:useGradients?chartConfig["funnelType"]+':gradient':chartConfig["funnelType"],showAggregates:true,showLabels:true,Label:{type:labelType,size:12,family:css["font-family"],color:css["color"],colorAlt:"#ffffff"},Tips:{enable:true,onShow:function(tip,elem){if(elem.link!='undefined'&&elem.link!=''){drillDown=(SUGAR.util.isTouchScreen())?"
Click to drilldown":"
Click to drilldown";}else{drillDown="";} +if(elem.valuelabel!='undefined'&&elem.valuelabel!=undefined&&elem.valuelabel!=''){value="elem.valuelabel";}else{value="elem.value";} +eval("tip.innerHTML = '' + elem."+chartConfig["tip"]+" + ': ' + "+value+" + ' - ' + elem.percentage + '%' + drillDown");}}});funnelChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=funnelChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length/cols);table="";var j=0;for(i=0;i";for(td=0;td';if(legend["name"][j]!=undefined){table+='
 
';} +table+='';table+='
';j++;} +table+="";} +table+="
';if(legend["name"][j]!=undefined){table+=legend["name"][j];} +table+='
";list.innerHTML=table;$jit.util.saveImageTest(chartId,jsonFilename,chartConfig["imageExportType"]);}} +var callback={success:handleSuccess,failure:handleFailure,argument:{foo:'foo',bar:''}};var request=YAHOO.util.Connect.asyncRequest('GET',jsonFilename+"?r="+new Date().getTime(),callback);break;case"gaugeChart":var handleFailure=function(o){alert('fail');if(o.responseText!==undefined){alert('failed');}} +var handleSuccess=function(o){if(o.responseText!==undefined){var json=eval('('+o.responseText+')');var properties=$jit.util.splat(json.properties)[0];var gaugeChart=new $jit.GaugeChart({injectInto:chartId,animate:false,renderBackground:chartConfig['imageExportType']=="jpg"?true:false,backgroundColor:'rgb(255,255,255)',colorStop1:'rgba(255,255,255,.8)',colorStop2:'rgba(255,255,255,0)',labelType:properties['labels'],hoveredColor:false,Title:{text:properties['title'],size:16,color:'#444444',offset:20},Subtitle:{text:properties['subtitle'],size:11,color:css["color"],offset:5},offset:20,gaugeStyle:{backgroundColor:'#aaaaaa',borderColor:'#999999',needleColor:'rgba(255,0,0,.8)',borderSize:4,positionFontSize:24,positionOffset:2},type:useGradients?chartConfig["gaugeType"]+':gradient':chartConfig["gaugeType"],showLabels:true,Events:{enable:true,onClick:function(node){if(!node||SUGAR.util.isTouchScreen())return;if(node.link=='undefined'||node.link=='')return;window.location.href=node.link;}},Label:{type:labelType,size:12,family:css["font-family"],color:css["color"]},Tips:{enable:true,onShow:function(tip,elem){if(elem.link!='undefined'&&elem.link!=''){drillDown=(SUGAR.util.isTouchScreen())?"
Click to drilldown":"
Click to drilldown";}else{drillDown="";} +if(elem.valuelabel!='undefined'&&elem.valuelabel!=undefined&&elem.valuelabel!=''){value="elem.valuelabel";}else{value="elem.value";} +eval("tip.innerHTML = '' + elem.label + ': ' + "+value+" + drillDown");}}});gaugeChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=gaugeChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length/cols);table="";var j=1;for(i=0;i";for(td=0;td';if(legend["name"][j]!=undefined){table+='
 
';} +table+='';table+='
';j++;} +table+="";} +table+="
';if(legend["name"][j]!=undefined){table+=legend["name"][j];} +table+='
";list.innerHTML=table;$jit.util.saveImageTest(chartId,jsonFilename,chartConfig["imageExportType"]);}} +var callback={success:handleSuccess,failure:handleFailure,argument:{foo:'foo',bar:''}};var request=YAHOO.util.Connect.asyncRequest('GET',jsonFilename+"?r="+new Date().getTime(),callback);break;}} \ No newline at end of file diff --git a/include/Dashlets/DashletGenericChartScript.tpl b/include/SugarCharts/Jit/tpls/DashletGenericChartScript.tpl similarity index 80% rename from include/Dashlets/DashletGenericChartScript.tpl rename to include/SugarCharts/Jit/tpls/DashletGenericChartScript.tpl index d6f76dca..044dfa2e 100644 --- a/include/Dashlets/DashletGenericChartScript.tpl +++ b/include/SugarCharts/Jit/tpls/DashletGenericChartScript.tpl @@ -1,7 +1,6 @@ {* - /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,11 +34,18 @@ * "Powered by SugarCRM". ********************************************************************************/ - - - *} + var customChart = true; + var css = new Array(); + var chartConfig = new Array(); + {foreach from=$css key=selector item=property} + css["{$selector}"] = '{$property}'; + {/foreach} + {foreach from=$config key=name item=value} + chartConfig["{$name}"] = '{$value}'; + {/foreach} + + SUGAR.mySugar.sugarCharts.addToChartsArray('{$chartId}','{$filename}',css,chartConfig,activePage); + \ No newline at end of file diff --git a/include/SugarCharts/Jit/tpls/chart.tpl b/include/SugarCharts/Jit/tpls/chart.tpl new file mode 100644 index 00000000..a0eb48c8 --- /dev/null +++ b/include/SugarCharts/Jit/tpls/chart.tpl @@ -0,0 +1,76 @@ +{* +/********************************************************************************* + * SugarCRM Community Edition is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. + * + * 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. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ + +*} + +{if !$error} + + +
+
+
+
+
+
+
+{else} + +{$error} +{/if} \ No newline at end of file diff --git a/include/SugarCharts/JsChart.php b/include/SugarCharts/JsChart.php new file mode 100644 index 00000000..94ea348a --- /dev/null +++ b/include/SugarCharts/JsChart.php @@ -0,0 +1,678 @@ +)(.*)(<\/\w+>)/e', "'\\1'.htmlentities(from_html('\\2')).'\\3'", $str); + return str_repeat("\t", $depth) . $str . "\n"; + } + + function display($name, $xmlFile, $width='320', $height='480', $resize=false) { + + + $this->chartId = $name; + $this->height = $height; + $this->width = $width; + $this->xmlFile = $xmlFile; + $this->chartType = $this->chart_properties['type']; + + $style = array(); + $chartConfig = array(); + try { + $xmlStr = $this->processXML($this->xmlFile); + $json = $this->buildJson($xmlStr); + } + catch(Exception $e) { + $GLOBALS['log']->fatal("Unable to return chart data, invalid xml for file {$this->xmlFile}"); + return ''; + } + $this->saveJsonFile($json); + $this->ss->assign("chartId", $this->chartId); + $this->ss->assign("filename", $this->jsonFilename); + + + $dimensions = $this->getChartDimensions($xmlStr); + $this->ss->assign("width", $dimensions['width']); + $this->ss->assign("height", $dimensions['height']); + $config = $this->getConfigProperties(); + $style['gridLineColor'] = str_replace("0x","#",$config->gridLines); + $style['font-family'] = $config->labelFontFamily; + $style['color'] = str_replace("0x","#",$config->labelFontColor); + $this->ss->assign("css", $style); + foreach($this->getChartConfigParams($xmlStr) as $key => $value) { + $chartConfig[$key] = $value; + } + $chartConfig['imageExportType'] = $this->image_export_type; + $this->ss->assign("config", $chartConfig); + if($json == "No Data") { + $this->ss->assign("error", "No Data"); + } + + if(!$this->isSupported($this->chartType)) { + $this->ss->assign("error", "Unsupported Chart Type"); + } + + } + + + function getDashletScript($id,$xmlFile="") { + + global $sugar_config, $current_user, $current_language; + $this->id = $id; + $this->chartId = $id; + $this->xmlFile = (!$xmlFile) ? $sugar_config['tmp_dir']. $current_user->id . '_' . $this->id . '.xml' : $xmlFile; + + + $style = array(); + $chartConfig = array(); + $this->ss->assign("chartId", $this->chartId); + $this->ss->assign("filename", str_replace(".xml",".js",$this->xmlFile)); + $config = $this->getConfigProperties(); + $style['gridLineColor'] = str_replace("0x","#",$config->gridLines); + $style['font-family'] = $config->labelFontFamily; + $style['color'] = str_replace("0x","#",$config->labelFontColor); + $this->ss->assign("css", $style); + $xmlStr = $this->processXML($this->xmlFile); + foreach($this->getChartConfigParams($xmlStr) as $key => $value) { + $chartConfig[$key] = $value; + } + + $chartConfig['imageExportType'] = $this->image_export_type; + $this->ss->assign("config", $chartConfig); + + } + + function chartArray($chartsArray) { + + $customChartsArray = array(); + $style = array(); + $chartConfig = array(); + foreach($chartsArray as $id => $data) { + $customChartsArray[$id] = array(); + $customChartsArray[$id]['chartId'] = $id; + $customChartsArray[$id]['filename'] = str_replace(".xml",".js",$data['xmlFile']); + $customChartsArray[$id]['width'] = $data['width']; + $customChartsArray[$id]['height'] = $data['height']; + + $config = $this->getConfigProperties(); + $style['gridLineColor'] = str_replace("0x","#",$config->gridLines); + $style['font-family'] = (string)$config->labelFontFamily; + $style['color'] = str_replace("0x","#",$config->labelFontColor); + $customChartsArray[$id]['css'] = $style; + $xmlStr = $this->processXML($data['xmlFile']); + $xml = new SimpleXMLElement($xmlStr); + $params = $this->getChartConfigParams($xmlStr); + $customChartsArray[$id]['supported'] = ($this->isSupported($xml->properties->type)) ? "true" : "false"; + foreach($params as $key => $value) { + $chartConfig[$key] = $value; + } + $chartConfig['imageExportType'] = $this->image_export_type; + $customChartsArray[$id]['chartConfig'] = $chartConfig; + } + + return $customChartsArray; + } + + function getChartConfigParams($xmlStr) { + + $xml = new SimpleXMLElement($xmlStr); + + $chartType = $xml->properties->type; + if($chartType == "pie chart") { + return array ("pieType" => "basic","tip" => "name","chartType" => "pieChart"); + } elseif($chartType == "line chart") { + return array ("lineType" => "basic","tip" => "name","chartType" => "lineChart"); + } elseif($chartType == "funnel chart 3D") { + return array ("funnelType" => "basic","tip" => "name","chartType" => "funnelChart"); + } elseif($chartType == "gauge chart") { + return array ("gaugeType" => "basic","tip" => "name","chartType" => "gaugeChart"); + } elseif($chartType == "stacked group by chart") { + return array ("orientation" => "vertical","barType" => "stacked","tip" => "name","chartType" => "barChart"); + } elseif($chartType == "group by chart") { + return array("orientation" => "vertical", "barType" => "grouped", "tip" => "title","chartType" => "barChart"); + } elseif($chartType == "bar chart") { + return array("orientation" => "vertical", "barType" => "basic", "tip" => "label","chartType" => "barChart"); + } elseif ($chartType == "horizontal group by chart") { + return array("orientation" => "horizontal", "barType" => "stacked", "tip" => "name","chartType" => "barChart"); + } elseif ($chartType == "horizontal bar chart" || "horizontal") { + return array("orientation" => "horizontal","barType" => "basic","tip" => "label","chartType" => "barChart"); + } else { + return array("orientation" => "vertical","barType" => "stacked","tip" => "name","chartType" => "barChart"); + } + } + function getChartDimensions($xmlStr) { + if($this->getNumNodes($xmlStr) > 9 && $this->chartType != "pie chart") { + if($this->chartType == "horizontal group by chart" || $this->chartType == "horizontal bar chart") { + $height = ($this->getNumNodes($xmlStr) * 60) + 100; + return array("width"=>$this->width, "height"=>($height)); + } else { + return array("width"=>($this->width * 2), "height"=>$this->height); + } + } else { + return array("width"=>"100%", "height"=>$this->height); + } + } + + function checkData($xmlstr) { + $xml = new SimpleXMLElement($xmlstr); + if(sizeof($xml->data->group) > 0) { + return true; + } else { + return false; + } + } + + function getNumNodes($xmlstr) { + $xml = new SimpleXMLElement($xmlstr); + return sizeof($xml->data->group); + } + + function buildProperties($xmlstr) { + $content = $this->tab("'properties': [\n",1); + $properties = array(); + $xml = new SimpleXMLElement($xmlstr); + foreach($xml->properties->children() as $property) { + $properties[] = $this->tab("'".$property->getName()."':"."'".$this->processSpecialChars($property)."'",2); + } + $content .= $this->tab("{\n",1); + $content .= join(",\n",$properties)."\n"; + $content .= $this->tab("}\n",1); + $content .= $this->tab("],\n",1); + return $content; + } + + function buildLabelsBarChartStacked($xmlstr) { + $content = $this->tab("'label': [\n",1); + $labels = array(); + $xml = new SimpleXMLElement($xmlstr); + foreach($xml->data->group[0]->subgroups->group as $group) { + $labels[] = $this->tab("'".$this->processSpecialChars($group->title)."'",2); + } + $content .= join(",\n",$labels)."\n"; + $content .= $this->tab("],\n",1); + return $content; + } + + function buildLabelsBarChart($xmlstr) { + $content = $this->tab("'label': [\n",1); + $labels = array(); + $xml = new SimpleXMLElement($xmlstr); + foreach($xml->data->group as $group) { + $labels[] = $this->tab("'".$this->processSpecialChars($group->title)."'",2); + } + $labelStr = join(",\n",$labels)."\n"; + $content .= $labelStr; + $content .= $this->tab("],\n",1); + return $content; + } + + function buildDataBarChartStacked($xmlstr) { + $content = $this->tab("'values': [\n",1); + $data = array(); + $xml = new SimpleXMLElement($xmlstr); + foreach($xml->data->group as $group) { + $groupcontent = $this->tab("{\n",1); + $groupcontent .= $this->tab("'label': '".$this->processSpecialChars($group->title)."',\n",2); + $groupcontent .= $this->tab("'gvalue': '{$group->value}',\n",2); + $groupcontent .= $this->tab("'gvaluelabel': '{$group->label}',\n",2); + $subgroupValues = array(); + $subgroupValueLabels = array(); + $subgroupLinks = array(); + foreach($group->subgroups->group as $subgroups) { + $subgroupValues[] = $this->tab(($subgroups->value == "NULL") ? 0 : $subgroups->value,3); + $subgroupValueLabels[] = $this->tab("'".$this->processSpecialChars($subgroups->label)."'",3); + $subgroupLinks[] = $this->tab("'".$subgroups->link."'",3); + } + $subgroupValuesStr = join(",\n",$subgroupValues)."\n"; + $subgroupValueLabelsStr = join(",\n",$subgroupValueLabels)."\n"; + $subgroupLinksStr = join(",\n",$subgroupLinks)."\n"; + + $groupcontent .= $this->tab("'values': [\n".$subgroupValuesStr,2); + $groupcontent .= $this->tab("],\n",2); + $groupcontent .= $this->tab("'valuelabels': [\n".$subgroupValueLabelsStr,2); + $groupcontent .= $this->tab("],\n",2); + $groupcontent .= $this->tab("'links': [\n".$subgroupLinksStr,2); + $groupcontent .= $this->tab("]\n",2); + $groupcontent .= $this->tab("}",1); + $data[] = $groupcontent; + } + $content .= join(",\n",$data)."\n"; + $content .= $this->tab("]",1); + return $content; + } + + function buildDataBarChartGrouped($xmlstr) { + $content = $this->tab("'values': [\n",1); + $data = array(); + $xml = new SimpleXMLElement($xmlstr); + foreach($xml->data->group as $group) { + $groupcontent = $this->tab("{\n",1); + $groupcontent .= $this->tab("'label': '".$this->processSpecialChars($group->title)."',\n",2); + $groupcontent .= $this->tab("'gvalue': '{$group->value}',\n",2); + $groupcontent .= $this->tab("'gvaluelabel': '{$group->label}',\n",2); + $subgroupValues = array(); + $subgroupValueLabels = array(); + $subgroupLinks = array(); + $subgroupTitles = array(); + foreach($group->subgroups->group as $subgroups) { + $subgroupValues[] = $this->tab(($subgroups->value == "NULL") ? 0 : $subgroups->value,3); + $subgroupValueLabels[] = $this->tab("'".$subgroups->label."'",3); + $subgroupLinks[] = $this->tab("'".$subgroups->link."'",3); + $subgroupTitles[] = $this->tab("'".$this->processSpecialChars($subgroups->title)."'",3); + } + $subgroupValuesStr = join(",\n",$subgroupValues)."\n"; + $subgroupValueLabelsStr = join(",\n",$subgroupValueLabels)."\n"; + $subgroupLinksStr = join(",\n",$subgroupLinks)."\n"; + $subgroupTitlesStr = join(",\n",$subgroupTitles)."\n"; + + $groupcontent .= $this->tab("'values': [\n".$subgroupValuesStr,2); + $groupcontent .= $this->tab("],\n",2); + $groupcontent .= $this->tab("'valuelabels': [\n".$subgroupValueLabelsStr,2); + $groupcontent .= $this->tab("],\n",2); + $groupcontent .= $this->tab("'links': [\n".$subgroupLinksStr,2); + $groupcontent .= $this->tab("],\n",2); + $groupcontent .= $this->tab("'titles': [\n".$subgroupTitlesStr,2); + $groupcontent .= $this->tab("]\n",2); + $groupcontent .= $this->tab("}",1); + $data[] = $groupcontent; + } + $content .= join(",\n",$data)."\n"; + $content .= $this->tab("]",1); + return $content; + } + + function buildDataBarChart($xmlstr) { + $content = $this->tab("'values': [\n",1); + $data = array(); + $xml = new SimpleXMLElement($xmlstr); + $groupcontent = ""; + $groupcontentArr = array(); + + foreach($xml->data->group as $group) { + $groupcontent = $this->tab("{\n",1); + $groupcontent .= $this->tab("'label': [\n",2); + $groupcontent .= $this->tab("'".$this->processSpecialChars($group->title)."'\n",3); + $groupcontent .= $this->tab("],\n",2); + $groupcontent .= $this->tab("'values': [\n",2); + $groupcontent .= $this->tab(($group->value == "NULL") ? 0 : $group->value."\n",3); + $groupcontent .= $this->tab("],\n",2); + if($group->label) { + $groupcontent .= $this->tab("'valuelabels': [\n",2); + $groupcontent .= $this->tab("'{$group->label}'\n",3); + $groupcontent .= $this->tab("],\n",2); + } + $groupcontent .= $this->tab("'links': [\n",2); + $groupcontent .= $this->tab("'{$group->link}'\n",3); + $groupcontent .= $this->tab("]\n",2); + $groupcontent .= $this->tab("}",1); + $groupcontentArr[] = $groupcontent; + } + $content .= join(",\n",$groupcontentArr)."\n"; + $content .= $this->tab("]",1); + return $content; + } + + function buildLabelsPieChart($xmlstr) { + $content = $this->tab("'label': [\n",1); + $labels = array(); + $xml = new SimpleXMLElement($xmlstr); + foreach($xml->data->group as $group) { + $labels[] = $this->tab("'".$this->processSpecialChars($group->title)."'",2); + } + $labelStr = join(",\n",$labels)."\n"; + $content .= $labelStr; + $content .= $this->tab("],\n",1); + return $content; + } + + + function buildDataPieChart($xmlstr) { + $content = $this->tab("'values': [\n",1); + $data = array(); + $xml = new SimpleXMLElement($xmlstr); + $groupcontent = ""; + $groupcontentArr = array(); + + foreach($xml->data->group as $group) { + $groupcontent = $this->tab("{\n",1); + $groupcontent .= $this->tab("'label': [\n",2); + $groupcontent .= $this->tab("'".$this->processSpecialChars($group->title)."'\n",3); + $groupcontent .= $this->tab("],\n",2); + $groupcontent .= $this->tab("'values': [\n",2); + $groupcontent .= $this->tab("{$group->value}\n",3); + $groupcontent .= $this->tab("],\n",2); + $groupcontent .= $this->tab("'valuelabels': [\n",2); + $groupcontent .= $this->tab("'{$group->label}'\n",3); + $groupcontent .= $this->tab("],\n",2); + $groupcontent .= $this->tab("'links': [\n",2); + $groupcontent .= $this->tab("'{$group->link}'\n",3); + $groupcontent .= $this->tab("]\n",2); + $groupcontent .= $this->tab("}",1); + $groupcontentArr[] = $groupcontent; + } + + + $content .= join(",\n",$groupcontentArr)."\n"; + $content .= $this->tab("\n]",1); + return $content; + } + + function buildLabelsGaugeChart($xmlstr) { + $content = $this->tab("'label': [\n",1); + $labels = array(); + $xml = new SimpleXMLElement($xmlstr); + foreach($xml->data->group as $group) { + $labels[] = $this->tab("'".$this->processSpecialChars($group->title)."'",2); + } + $labelStr = join(",\n",$labels)."\n"; + $content .= $labelStr; + $content .= $this->tab("],\n",1); + return $content; + } + + function buildDataGaugeChart($xmlstr) { + $content = $this->tab("'values': [\n",1); + $data = array(); + $xml = new SimpleXMLElement($xmlstr); + foreach($xml->data->group as $group) { + $groupcontent = $this->tab("{\n",1); + $groupcontent .= $this->tab("'label': '".$this->processSpecialChars($group->title)."',\n",2); + $groupcontent .= $this->tab("'gvalue': '{$group->value}',\n",2); + $finalComma = ($group->title != "GaugePosition") ? "," : ""; + $groupcontent .= $this->tab("'gvaluelabel': '{$group->label}'{$finalComma}\n",2); + $subgroupTitles = array(); + $subgroupValues = array(); + $subgroupValueLabels = array(); + $subgroupLinks = array(); + + if(is_object($group->subgroups->group)) { + foreach($group->subgroups->group as $subgroups) { + $subgroupTitles[] = $this->tab("'".$subgroups->title."'",3); + //$subgroupValues[] = $this->tab($subgroups->value,3); + $subgroupValues[] = $subgroups->value; + $subgroupValueLabels[] = $this->tab("'".$subgroups->label."'",3); + $subgroupLinks[] = $this->tab("'".$subgroups->link."'",3); + } + $subgroupTitlesStr = join(",\n",$subgroupTitles)."\n"; + $subgroupValuesStr = join(",\n",$subgroupValues)."\n"; + $subgroupValueLabelsStr = join(",\n",$subgroupValueLabels)."\n"; + $subgroupLinksStr = join(",\n",$subgroupLinks)."\n"; + + //$groupcontent .= $this->tab("'labels': [\n".$subgroupTitlesStr,2); + //$groupcontent .= $this->tab("],\n",2); + $val = ((int)$subgroupValues[1] == (int)$subgroupValues[0]) ? $this->tab($subgroupValues[1],3)."\n" : $this->tab($subgroupValues[1] - $subgroupValues[0],3)."\n"; + + $groupcontent .= $this->tab("'values': [\n".$val,2); + $groupcontent .= $this->tab("],\n",2); + $groupcontent .= $this->tab("'valuelabels': [\n".$subgroupValueLabelsStr,2); + $groupcontent .= $this->tab("]\n",2); + //$groupcontent .= $this->tab("'links': [\n".$subgroupLinksStr,2); + //$groupcontent .= $this->tab("]\n",2); + + } + + $groupcontent .= $this->tab("}",1); + $data[] = $groupcontent; + + } + + $content .= join(",\n",$data)."\n"; + + + $content .= $this->tab("]",1); + return $content; + } + + + function getConfigProperties() { + $path = SugarThemeRegistry::current()->getImageURL('sugarColors.xml',false); + + if(!file_exists($path)) { + $GLOBALS['log']->debug("Cannot open file ($path)"); + } + $xmlstr = file_get_contents($path); + $xml = new SimpleXMLElement($xmlstr); + return $xml->charts; + } + + function buildChartColors() { + + $content = $this->tab("'color': [\n",1); + $colorArr = array(); + $xml = $this->getConfigProperties(); + $colors = ($this->chartType == "gauge chart") ? $xml->gaugeChartElementColors->color : $xml->chartElementColors->color; + foreach($colors as $color) { + $colorArr[] = $this->tab("'".str_replace("0x","#",$color)."'",2); + } + $content .= join(",\n",$colorArr)."\n"; + $content .= $this->tab("],\n",1); + + return $content; + + } + + function buildJson($xmlstr){ + if($this->checkData($xmlstr)) { + $content = "{\n"; + if ($this->chartType == "pie chart" || $this->chartType == "funnel chart 3D") { + $content .= $this->buildProperties($xmlstr); + $content .= $this->buildLabelsPieChart($xmlstr); + $content .= $this->buildChartColors(); + $content .= $this->buildDataPieChart($xmlstr); + } + elseif ($this->chartType == "gauge chart") { + $content .= $this->buildProperties($xmlstr); + $content .= $this->buildLabelsGaugeChart($xmlstr); + $content .= $this->buildChartColors(); + $content .= $this->buildDataGaugeChart($xmlstr); + } + elseif ($this->chartType == "horizontal bar chart" || $this->chartType == "bar chart") { + $content .= $this->buildProperties($xmlstr); + $content .= $this->buildLabelsBarChart($xmlstr); + $content .= $this->buildChartColors(); + $content .= $this->buildDataBarChart($xmlstr); + } + elseif ($this->chartType == "group by chart") { + $content .= $this->buildProperties($xmlstr); + $content .= $this->buildLabelsBarChartStacked($xmlstr); + $content .= $this->buildChartColors(); + $content .= $this->buildDataBarChartGrouped($xmlstr); + } else { + $content .= $this->buildProperties($xmlstr); + $content .= $this->buildLabelsBarChartStacked($xmlstr); + $content .= $this->buildChartColors(); + $content .= $this->buildDataBarChartStacked($xmlstr); + } + $content .= "\n}"; + return $content; + } else { + return "No Data"; + } + } + + function buildHTMLLegend($xmlFile) { + $xmlstr = $this->processXML($xmlFile); + $xml = new SimpleXMLElement($xmlstr); + $this->chartType = $xml->properties->type; + $html = ""; + + if ($this->chartType == "group by chart" || $this->chartType == "horizontal group by chart") { + $groups = $xml->data->group[0]->subgroups->group; + $items = (sizeof($xml->data->group[0]->subgroups->group) <= 5) ? 5 : sizeof($xml->data->group[0]->subgroups->group); + } else { + $groups = $xml->data->group; + $items = (sizeof($xml->data->group) <= 5) ? 5 : sizeof($xml->data->group); + } + + $rows = ceil($items/5); + $fullItems = $rows * 5; + $remainder = ($items < $fullItems) ? $fullItems - $items : 0; + $i = 0; + $x = 0; + + + $colorArr = array(); + $xmlColors = $this->getConfigProperties(); + $colors = ($this->chartType == "gauge chart") ? $xmlColors->gaugeChartElementColors->color : $xmlColors->chartElementColors->color; + + foreach($colors as $color) { + $colorArr[] = str_replace("0x","#",$color); + } + + + foreach($groups as $group) { + if($i == 5) {$i = 0;} + $html .= ($i == 0) ? "" : ""; + $html .= ""; + $html .= ""; + $html .= ($x+1 == $items) ? "" : ""; + $html .= ($i == 4) ? "" : ""; + $x++; + $i++; + } + + + $html .= "
"; + $html .= "
     
"; + $html .= "
"; + $html .= $group->title; + $html .= "
"; + return $html; + } + + function saveJsonFile($jsonContents) { + + $this->jsonFilename = str_replace(".xml",".js",$this->xmlFile); + //$jsonContents = mb_convert_encoding($jsonContents, 'UTF-16LE', 'UTF-8'); + + // open file + if (!$fh = sugar_fopen($this->jsonFilename, 'w')) { + $GLOBALS['log']->debug("Cannot open file ($this->jsonFilename)"); + return; + } + + // write the contents to the file + if (fwrite($fh,$jsonContents) === FALSE) { + $GLOBALS['log']->debug("Cannot write to file ($this->jsonFilename)"); + return false; + } + + $GLOBALS['log']->debug("Success, wrote ($jsonContents) to file ($this->jsonFilename)"); + + fclose($fh); + return true; + } + + function get_image_cache_file_name ($xmlFile,$ext = ".png") { + $filename = str_replace("/xml/","/images/",str_replace(".xml",$ext,$xmlFile)); + + return $filename; + } + + + function getXMLChartProperties($xmlStr) { + $props = array(); + $xml = new SimpleXMLElement($xmlstr); + foreach($xml->properties->children() as $properties) { + $props[$properties->getName()] = $properties; + } + return $props; + } + + function processSpecialChars($str) { + return addslashes(html_entity_decode($str,ENT_QUOTES)); + } + + function processXML($xmlFile) { + + if(!file_exists($xmlFile)) { + $GLOBALS['log']->debug("Cannot open file ($xmlFile)"); + } + + $pattern = array(); + $replacement = array(); + $content = file_get_contents($xmlFile); + $content = mb_convert_encoding($content, 'UTF-8','UTF-16LE' ); + $pattern[] = '/\([a-zA-Z0-9#?&%.;\[\]\/=+_-\s]+)\<\/link\>/e'; + $replacement[] = "''.urlencode(\"$1\").''"; +// $pattern[] = '/NULL/e'; +// $replacement[] = ""; + return preg_replace($pattern,$replacement, $content); + } + + +} + +?> diff --git a/include/SugarCharts/SugarChart.php b/include/SugarCharts/SugarChart.php index 348a3c24..2fec5325 100644 --- a/include/SugarCharts/SugarChart.php +++ b/include/SugarCharts/SugarChart.php @@ -1,7 +1,7 @@ db = &DBManagerFactory::getInstance(); @@ -81,6 +78,7 @@ class SugarChart { $this->div = 1; $this->is_currency = false; } + $this->image_export_type = (extension_loaded('gd') && function_exists('gd_info')) ? "png" : "jpg"; } function getData($query){ @@ -245,7 +243,7 @@ class SugarChart { $yAxis = $this->tab("" ,1); foreach ($this->chart_yAxis as $key => $value){ - $yAxis .= $this->tab("<$key>$value", 2); + $yAxis .= $this->tabValue("{$key}",$value, 2); } $yAxis .= $this->tab("" ,1); @@ -280,7 +278,21 @@ class SugarChart { function tab($str, $depth){ return str_repeat("\t", $depth) . $str . "\n"; } + /** + * returns text with tabs appended before it + * + * @param string $str xml tag + int $tagFormat 2 = open and close tag, 1 = close, 0 = open + sting $value input string + * int $depth number of times to tab + * @return string with tabs appended before it + */ + function tabValue($tag,$value,$depth) { + + return $this->tab("<{$tag}>".htmlspecialchars($value,ENT_QUOTES)."",$depth); + + } /** * returns xml data format * @@ -319,9 +331,9 @@ class SugarChart { function processDataGroup($tablevel, $title, $value, $label, $link){ $link = $this->forceHideDataGroupLink ? '' : $link; $data = $this->tab('',$tablevel); - $data .= $this->tab('' . $title . '',$tablevel+1); - $data .= $this->tab('' . $value . '',$tablevel+1); - $data .= $this->tab('',$tablevel+1); + $data .= $this->tabValue('title',$title,$tablevel+1); + $data .= $this->tabValue('value',$value,$tablevel+1); + $data .= $this->tabValue('label',$label,$tablevel+1); $data .= $this->tab('' . $link . '',$tablevel+1); $data .= $this->tab('',$tablevel); return $data; @@ -401,9 +413,9 @@ class SugarChart { $label = $this->is_currency ? ($this->currency_symbol . $this->formatNumber($amount)) : $amount; $data .= $this->tab('',2); - $data .= $this->tab('' . $key . '',3); - $data .= $this->tab('' . $amount . '',3); - $data .= $this->tab('',3); + $data .= $this->tabValue('title',$key,3); + $data .= $this->tabValue('value',$amount,3); + $data .= $this->tabValue('label',$label,3); $data .= $this->tab('',3); $data .= $this->tab('',3); @@ -412,9 +424,9 @@ class SugarChart { $label = $this->is_currency ? ($this->currency_symbol . $this->formatNumber($amount)) : $amount; $data .= $this->tab('',4); - $data .= $this->tab('' . $k . '',5); - $data .= $this->tab('' . $amount . '',5); - $data .= $this->tab('',5); + $data .= $this->tabValue('title',$k,5); + $data .= $this->tabValue('value',$amount,5); + $data .= $this->tabValue('label',$label,5); $data .= $this->tab('',5); $data .= $this->tab('',4); $this->checkYAxis($v); @@ -461,9 +473,9 @@ class SugarChart { } $data .= $this->tab('', 2); - $data .= $this->tab('' . $key . '', 3); - $data .= $this->tab('' . $value . '', 3); - $data .= $this->tab('', 3); + $data .= $this->tabValue('title',$key, 3); + $data .= $this->tabValue('value',$value, 3); + $data .= $this->tabValue('label',$label, 3); if (isset($drill_down) && $drill_down){ if ($this->group_by[0] == 'm'){ $additional_param = '&date_closed_advanced=' . urlencode($key); @@ -509,9 +521,9 @@ class SugarChart { $label = $this->is_currency ? ($this->currency_symbol . $this->formatNumber($amount) . 'K') : $amount; $data .= $this->tab('',2); - $data .= $this->tab('' . $groupByKey . '',3); - $data .= $this->tab('' . $amount . '',3); - $data .= $this->tab('',3); + $data .= $this->tabValue('title',$groupByKey,3); + $data .= $this->tabValue('value',$amount,3); + $data .= $this->tabValue('label',$label,3); $data .= $this->tab('' . $url . '',3); $data .= $this->tab('',3); @@ -534,6 +546,8 @@ class SugarChart { if($this->is_currency) { $sub_amount = $this->formatNumber($this->convertCurrency($new_data[$groupByKey][$i]['total'])); $sub_amount_formatted = $this->currency_symbol . $sub_amount . 'K'; + //bug: 38877 - do not format the amount for the value as it breaks the chart + $sub_amount = $this->convertCurrency($new_data[$groupByKey][$i]['total']); } else { $sub_amount = $new_data[$groupByKey][$i]['total']; $sub_amount_formatted = $sub_amount; @@ -691,28 +705,32 @@ class SugarChart { // generate strings for chart if it does not exist global $current_language, $theme, $sugar_config,$app_strings; - $chartStringsXML = $GLOBALS['sugar_config']['tmp_dir'].'chart_strings.' . $current_language .'.lang.xml'; - if (!file_exists($chartStringsXML)){ - $this->generateChartStrings($chartStringsXML); + $this->app_strings = $app_strings; + $this->chartStringsXML = $GLOBALS['sugar_config']['tmp_dir'].'chart_strings.' . $current_language .'.lang.xml'; + if (!file_exists($this->chartStringsXML)){ + $this->generateChartStrings($this->chartStringsXML); } - - $this->ss->assign("chartName", $name); - $this->ss->assign("chartXMLFile", $xmlFile); - $this->ss->assign("chartStringsXML", $chartStringsXML); - - // chart styles and color definitions - $this->ss->assign("chartStyleCSS", SugarThemeRegistry::current()->getCSSURL('chart.css')); - $this->ss->assign("chartColorsXML", SugarThemeRegistry::current()->getImageURL('sugarColors.xml')); - - $this->ss->assign("width", $width); - $this->ss->assign("height", $height); - - $this->ss->assign("resize", $resize); - $this->ss->assign("app_strings", $app_strings); - return $this->ss->fetch('include/SugarCharts/tpls/chart.tpl'); + + $templateFile = ""; + return $templateFile; } - + function getDashletScript($id,$xmlFile="") { + + $xmlFile = (!$xmlFile) ? $sugar_config['tmp_dir']. $current_user->id . '_' . $this->id . '.xml' : $xmlFile; + $chartStringsXML = $GLOBALS['sugar_config']['tmp_dir'].'chart_strings.' . $current_language .'.lang.xml'; + + $this->ss->assign('chartName', $id); + $this->ss->assign('chartXMLFile', $xmlFile); + $this->ss->assign('chartStyleCSS', SugarThemeRegistry::current()->getCSSURL('chart.css')); + $this->ss->assign('chartColorsXML', SugarThemeRegistry::current()->getImageURL('sugarColors.xml')); + $this->ss->assign('chartLangFile', $GLOBALS['sugar_config']['tmp_dir'].'chart_strings.' . $GLOBALS['current_language'] .'.lang.xml'); + + $templateFile = ""; + return $templateFile; + } + + /** This function is used for localize all the characters in the Chart. And it can also sort all the dom_values by the sequence defined in the dom, but this may produce a lot of extra empty data in the xml file, when the chart is sorted by two key cols. If the data quantity is large, it maybe a little slow. @@ -810,5 +828,28 @@ class SugarChart { } return $data; } + + function getChartResources() { + + $resources = ""; + return $resources; + } + + function getMySugarChartResources() { + + $mySugarRources = ""; + return $mySugarResources; + } + + /** + * wrapper function to return chart array after any additional processing + * + * @param array $chartsArray array of chart config items that need processing + * @return array $chartArray after it has been process + */ + function chartArray($chartsArray) { + + return $chartsArray; + } } // end class def diff --git a/include/SugarCharts/SugarChartFactory.php b/include/SugarCharts/SugarChartFactory.php new file mode 100644 index 00000000..c4bf5a54 --- /dev/null +++ b/include/SugarCharts/SugarChartFactory.php @@ -0,0 +1,94 @@ +debug("using default engine include/SugarCharts/".$defaultEngine."/".$defaultEngine.$module.".php"); + require_once("include/SugarCharts/".$defaultEngine."/".$defaultEngine.$module.".php"); + $chartEngine = $defaultEngine; + } + + $className = $chartEngine.$module; + return new $className(); + + } + +} + +?> diff --git a/include/SugarCharts/tpls/chart.tpl b/include/SugarCharts/tpls/chart.tpl deleted file mode 100644 index 7bc71159..00000000 --- a/include/SugarCharts/tpls/chart.tpl +++ /dev/null @@ -1,72 +0,0 @@ -{* -/********************************************************************************* - * SugarCRM is a customer relationship management program developed by - * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. - * - * 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. If the display of the logo is not reasonably feasible for - * technical reasons, the Appropriate Legal Notices must display the words - * "Powered by SugarCRM". - ********************************************************************************/ - -*} -
- - - - - - -

{$app_strings.LBL_NO_FLASH_PLAYER}

-
-
- - diff --git a/include/SugarDateTime.php b/include/SugarDateTime.php new file mode 100644 index 00000000..cd1526d9 --- /dev/null +++ b/include/SugarDateTime.php @@ -0,0 +1,598 @@ + "s", + "min" => "i", + "hour" => "G", + "zhour" => "H", + "day" => "j", + "zday" => "d", + "days_in_month" => "t", + "day_of_week" => "w", + "day_of_year" => "z", + "week" => "W", + "month" => "n", + "zmonth" => "m", + "year" => "Y", + "am_pm" => "A", + "hour_12" => "g", + ); + + protected $var_gets = array( + "24_hour" => "hour", + "day_of_week" => "day_of_week_long", + "day_of_week_short" => "day_of_week_short", + "month_name" => "month_long", + "hour" => "hour_12", + ); + + /** + * @var DateTimeZone + */ + protected static $_gmt; + + /** + * Calendar strings + * @var array + */ + protected $_strings; + + /** + * For testing - if we allowed to use PHP date parse + * @var bool + */ + public static $use_php_parser = true; + + /** + * For testing - if we allowed to use strptime() + * @var bool + */ + public static $use_strptime = true; + + /** + * Copy of DateTime::createFromFormat + * + * Needed to return right type of the object + * + * @param string $format + * @param string $time + * @param DateTimeZone $timezone + * @return SugarDateTime + * @see DateTime::createFromFormat + */ + public static function createFromFormat($format, $time, DateTimeZone $timezone = null) + { + if(empty($time) || empty($format)) { + return false; + } + if(self::$use_php_parser && is_callable(array("DateTime", "createFromFormat"))) { + // 5.3, hurray! + if(!empty($timezone)) { + $d = parent::createFromFormat($format, $time, $timezone); + } else { + $d = parent::createFromFormat($format, $time); + } + } else { + // doh, 5.2, will have to simulate + $d = self::_createFromFormat($format, $time, $timezone); + } + if(!$d) { + return false; + } + $sd = new self("@".$d->getTimestamp()); + $sd->setTimezone($d->getTimezone()); + return $sd; + } + + protected static function _createFromFormat($format, $time, DateTimeZone $timezone = null) + { + $res = new self(); + if(!empty($timezone)) { + $res->setTimezone($timezone); + } + if(self::$use_strptime && function_exists("strptime")) { + $str_format = str_replace(array_keys(TimeDate::$format_to_str), array_values(TimeDate::$format_to_str), $format); + // for a reason unknown to modern science, %P doesn't work in strptime + $str_format = str_replace("%P", "%p", $str_format); + // strip spaces before am/pm as our formats don't have them + $time = preg_replace('/\s+(AM|PM)/i', '\1', $time); + // TODO: better way to not risk locale stuff problems? + $data = strptime($time, $str_format); + if(empty($data)) { + $GLOBALS['log']->error("Cannot parse $time for format $format"); + return null; + } + if($data["tm_year"] == 0) { + unset($data["tm_year"]); + } + if($data["tm_mday"] == 0) { + unset($data["tm_mday"]); + } + if(isset($data["tm_year"])) { + $data["tm_year"] += 1900; + } + if(isset($data["tm_mon"])) { + $data["tm_mon"]++; + } + $data += self::$data_init; // fill in missing parts + } else { + // Windows, etc. might not have strptime - we'd have to work harder here + $data = $res->_strptime($time, $format); + } + if(empty($data)) { + $GLOBALS['log']->error("Cannot parse $time for format $format"); + return null; + } + if(isset($data["tm_year"])) { + $res->setDate($data["tm_year"], $data["tm_mon"], $data["tm_mday"]); + } + $res->setTime($data["tm_hour"], $data["tm_min"], $data["tm_sec"]); + return $res; + } + + /** + * Load language strings + * @param string $name string section to return + * @return array + */ + protected function _getStrings($name) + { + if(empty($this->_strings)) { + $this->_strings = return_mod_list_strings_language($GLOBALS['current_language'],"Calendar"); + } + return $this->_strings[$name]; + } + + /** + * Fetch property of the date by name + * @param string $var Property name + */ + public function __get($var) + { + // simple formats + if(isset($this->formats[$var])) { + return $this->format($this->formats[$var]); + } + // conditional, derived and translated ones + switch($var) { + case "ts": + return $this->getTimestamp(); + case "tz_offset": + return $this->getTimezone()->getOffset($this); + case "days_in_year": + return $this->format("L") == '1'?366:365; + break; + case "day_of_week_short": + $str = $this->_getStrings('dom_cal_weekdays'); + return $str[$this->day_of_week]; + case "day_of_week_long": + $str = $this->_getStrings('dom_cal_weekdays_long'); + return $str[$this->day_of_week]; + case "month_short": + $str = $this->_getStrings('dom_cal_month'); + return $str[$this->month]; + case "month_long": + $str = $this->_getStrings('dom_cal_month_long'); + return $str[$this->month]; + } + + return ''; + } + + /** + * Implement some get_ methods that fetch variables + * + * @param string $name + * @param array $args + */ + public function __call($name, $args) + { + // fill in 5.2.x gaps + if($name == "getTimestamp") { + return (int)$this->format('U'); + } + if($name == "setTimestamp") { + $sec = (int)$args[0]; + $sd = new self("@$sec"); + $sd->setTimezone($this->getTimezone()); + return $sd; + } + + // getters + if(substr($name, 0, 4) == "get_") { + $var = substr($name, 4); + + if(isset($this->var_gets[$var])) { + return $this->__get($this->var_gets[$var]); + } + + if(isset($this->formats[$var])) { + return $this->__get($var); + } + } + $GLOBALS['log']->fatal("SugarDateTime: unknowm method $name called"); + sugar_die("SugarDateTime: unknowm method $name called"); + return false; + } + + /** + * Get specific hour of today + * @param int $hour_index + * @return SugarDateTime + */ + public function get_datetime_by_index_today($hour_index) + { + if ( $hour_index < 0 || $hour_index > 23 ) + { + sugar_die("hour is outside of range"); + } + + $newdate = clone $this; + $newdate->setTime($hour_index, 0, 0); + return $newdate; + } + + function get_hour_end_time() + { + $newdate = clone $this; + $newdate->setTime($this->hour, 59, 59); + return $newdate; + } + + function get_day_end_time() + { + $newdate = clone $this; + return $newdate->setTime(23, 59, 59); + } + + function get_day_by_index_this_week($day_index) + { + $newdate = clone $this; + $newdate->setDate($this->year, $this->month, $this->day + + ($day_index - $this->day_of_week))->setTime(0,0); + return $newdate; + } + + function get_day_by_index_this_year($month_index) + { + $newdate = clone $this; + $newdate->setDate($this->year, $month_index+1, 1); + $newdate->setDate($newdate->year, $newdate->month, $newdate->days_in_month); + $newdate->setTime(0, 0); + return $newdate; + } + + function get_day_by_index_this_month($day_index) + { + $newdate = clone $this; + return $newdate->setDate($this->year, $this->month, $day_index+1)->setTime(0, 0); + } + + /** + * Get new date, modified by date expression + * + * @example $yesterday = $today->get("yesterday"); + * + * @param string $expression + * @return SugarDateTime + */ + function get($expression) + { + $newdate = clone $this; + $newdate->modify($expression); + return $newdate; + } + + /** + * Display as DB date + * @return string + */ + function get_mysql_date() + { + return $this->format(TimeDate::DB_DATE_FORMAT); + } + + /** + * Create from ISO 8601 datetime + * @param string $str + * @return SugarDateTime + */ + static public function parse_utc_date_time($str) + { + return new self($str); + } + + /** + * Create a list of time slots for calendar view + * Times must be in user TZ + * @param string $view Which view we are using - day, week, month + * @param SugarDateTime $start_time Start time + * @param SugarDateTime $end_time End time + */ + static function getHashList($view, $start_time, $end_time) + { + $hash_list = array(); + + if ( $view != 'day') + { + $end_time = $end_time->get_day_end_time(); + } + + $end = $end_time->ts; + if($end <= $start_time->ts) { + $end = $start_time->ts+1; + } + + $new_time = clone $start_time; + $new_time->setTime($new_time->hour, 0, 0); + + while ($new_time->ts < $end) { + if ($view == 'day') { + $hash_list[] = $new_time->get_mysql_date() . ":" . $new_time->hour; + $new_time->modify("next hour"); + } else { + $hash_list[] = $new_time->get_mysql_date(); + $new_time->modify("next day"); + } + } + + return $hash_list; + } + + /** + * Get the beginning of the given day + */ + function get_day_begin($day = null, $month = null, $year = null) + { + $newdate = clone $this; + $newdate->setDate( + $year?$year:$this->year, + $month?$month:$this->month, + $day?$day:$this->day); + $newdate->setTime(0, 0); + return $newdate; + } + + /** + * Get the last timestamp of the given day + */ + function get_day_end($day = null, $month = null, $year = null) + { + $newdate = clone $this; + $newdate->setDate( + $year?$year:$this->year, + $month?$month:$this->month, + $day?$day:$this->day); + $newdate->setTime(23, 59, 59); + return $newdate; + } + + function get_year_begin($year) + { + $newdate = clone $this; + $newdate->setDate($this->year, 1, 1); + $newdate->setTime(0,0); + return $newdate; + } + /* + * Print datetime in standard DB format + * + * Set $tz parameter to false if you are sure if the date is in UTC. + * + * @param bool $tz do conversion to UTC + * @return string + */ + function asDb($tz = true) + { + if($tz) { + if(empty(self::$_gmt)) { + self::$_gmt = new DateTimeZone("UTC"); + } + $this->setTimezone(self::$_gmt); + } + return $this->format(TimeDate::DB_DATETIME_FORMAT); + } + + /** + * Get query string for the date + * @return string + */ + function get_date_str() + { + return sprintf("&year=%d&month=%d&day=%d&hour=%d", $this->year, $this->month, $this->day, $this->hour); + } + + function __toString() + { + return $this->format('r'); + } + + protected static $parts_match = array( + 'Y' => 'tm_year', + 'm' => 'tm_mon', + 'n' => 'tm_mon', + 'd' => 'tm_mday', + 'H' => 'tm_hour', + 'h' => 'tm_hour', + 'i' => 'tm_min', + 's' => 'tm_sec', + ); + + protected static $data_init = array( + "tm_hour" => 0, + "tm_min" => 0, + "tm_sec" => 0, + ); + + protected static $strptime_short_mon, $strptime_long_mon; + /** + * DateTime homebrew parser + * + * Since some OSes and PHP versions (please upgrade to 5.3!) do not support built-in parsing functions, + * we have to restort to this ugliness. + * + * @param string $format + * @param string $time + * @return array Parsed parts + */ + protected function _strptime($time, $format) + { + $data = self::$data_init; + if(empty(self::$strptime_short_mon)) { + self::$strptime_short_mon = array_flip($this->_getStrings('dom_cal_month')); + unset(self::$strptime_short_mon[""]); + } + if(empty(self::$strptime_long_mon)) { + self::$strptime_long_mon = array_flip($this->_getStrings('dom_cal_month_long')); + unset(self::$strptime_long_mon[""]); + } + + $regexp = TimeDate::get_regular_expression($format); + if(!preg_match('@'.$regexp['format'].'@', $time, $dateparts)) { + return false; + } + + foreach(self::$parts_match as $part => $datapart) { + if (isset($regexp['positions'][$part]) && isset($dateparts[$regexp['positions'][$part]])) { + $data[$datapart] = (int)$dateparts[$regexp['positions'][$part]]; + } + } + // now process non-numeric ones + if ( isset($regexp['positions']['F']) && !empty($dateparts[$regexp['positions']['F']])) { + // FIXME: locale? + $mon = $dateparts[$regexp['positions']['F']]; + if(isset(self::$sugar_strptime_long_mon[$mon])) { + $data["tm_mon"] = self::$sugar_strptime_long_mon[$mon]; + } else { + return false; + } + } + if ( isset($regexp['positions']['M']) && !empty($dateparts[$regexp['positions']['M']])) { + // FIXME: locale? + $mon = $dateparts[$regexp['positions']['M']]; + if(isset(self::$sugar_strptime_short_mon[$mon])) { + $data["tm_mon"] = self::$sugar_strptime_short_mon[$mon]; + } else { + return false; + } + } + if ( isset($regexp['positions']['a']) && !empty($dateparts[$regexp['positions']['a']])) { + $ampm = trim($dateparts[$regexp['positions']['a']]); + if($ampm == 'pm') { + if($data["tm_hour"] != 12) $data["tm_hour"] += 12; + } else if($ampm == 'am') { + if($data["tm_hour"] == 12) { + // 12:00am is 00:00 + $data["tm_hour"] = 0; + } + } else { + return false; + } + } + + if ( isset($regexp['positions']['A']) && !empty($dateparts[$regexp['positions']['A']])) { + $ampm = trim($dateparts[$regexp['positions']['A']]); + if($ampm == 'PM') { + if($data["tm_hour"] != 12) $data["tm_hour"] += 12; + } else if($ampm == 'AM') { + if($data["tm_hour"] == 12) { + // 12:00am is 00:00 + $data["tm_hour"] = 0; + } + } else { + return false; + } + } + + return $data; + } + + // 5.2 compatibility - 5.2 functions don't return $this, let's help them + + /** + * (non-PHPdoc) + * @see DateTime::setDate() + * @return SugarDateTime + */ + public function setDate ($year, $month, $day) + { + parent::setDate($year, $month, $day); + return $this; + } + + /** + * (non-PHPdoc) + * @see DateTime::setTime() + * @return SugarDateTime + */ + public function setTime($hour, $minute, $sec = 0) + { + parent::setTime($hour, $minute, $sec); + return $this; + } + + /** + * (non-PHPdoc) + * @see DateTime::modify() + * @return SugarDateTime + */ + public function modify($modify) + { + if(PHP_VERSION_ID >= 50300 || $modify != 'first day of next month') { + parent::modify($modify); + } else { + /* PHP 5.2 does not understand 'first day of' and defaults need it */ + $this->setDate($this->year, $this->month+1, 1); + } + return $this; + } + + /** + * (non-PHPdoc) + * @see DateTime::setTimezone() + * @return SugarDateTime + */ + public function setTimezone (DateTimeZone $timezone) + { + parent::setTimezone($timezone); + return $this; + } + +} diff --git a/include/SugarDependentDropdown/SugarDependentDropdown.php b/include/SugarDependentDropdown/SugarDependentDropdown.php index 8a742b11..71977bab 100644 --- a/include/SugarDependentDropdown/SugarDependentDropdown.php +++ b/include/SugarDependentDropdown/SugarDependentDropdown.php @@ -1,7 +1,7 @@ get_db_date_time_format())."', '".gmdate($GLOBALS['timedate']->get_db_date_time_format())."', 0)"; + $now = TimeDate::getInstance()->nowDb(); + $upd_eabr = "INSERT INTO email_addr_bean_rel (id, email_address_id,bean_id, bean_module,primary_address,reply_to_address,date_created,date_modified,deleted) VALUES('{$guid}', '{$emailId}', '{$id}', '{$module}', {$address['primary_address']}, {$address['reply_to_address']}, '$now', '$now', 0)"; } if (!empty($upd_eabr)) { @@ -359,15 +359,15 @@ class SugarEmailAddress extends SugarBean { break; } } + $widget_id = $_REQUEST[$module .'_email_widget_id']; - $widget_id = $_REQUEST[$module .'_email_widget_id']; //Iterate over the widgets for this module, in case there are multiple email widgets for this module while(isset($_REQUEST[$module . $widget_id . "emailAddress" . $widgetCount])) { if (empty($_REQUEST[$module . $widget_id . "emailAddress" . $widgetCount])) { - $widgetCount++; - continue; + $widgetCount++; + continue; } $hasEmailValue = true; @@ -536,7 +536,7 @@ class SugarEmailAddress extends SugarBean { if(!empty($a)) { if(isset($a['invalid_email']) && isset($addressMeta['invalid_email']) && isset($addressMeta['opt_out']) && $a['invalid_email'] != $addressMeta['invalid_email'] || $a['opt_out'] != $addressMeta['opt_out']) { - $qUpdate = "UPDATE email_addresses SET invalid_email = {$addressMeta['invalid_email']}, opt_out = {$addressMeta['opt_out']}, date_modified = '".gmdate($GLOBALS['timedate']->get_db_date_time_format())."' WHERE id = '{$a['id']}'"; + $qUpdate = "UPDATE email_addresses SET invalid_email = {$addressMeta['invalid_email']}, opt_out = {$addressMeta['opt_out']}, date_modified = '".TimeDate::getInstance()->nowDb()."' WHERE id = '{$a['id']}'"; $rUpdate = $this->db->query($qUpdate); } } @@ -594,8 +594,9 @@ class SugarEmailAddress extends SugarBean { $guid = create_guid(); $address = $GLOBALS['db']->quote($address); $addressCaps = $GLOBALS['db']->quote($addressCaps); + $now = TimeDate::getInstance()->nowDb(); $qa = "INSERT INTO email_addresses (id, email_address, email_address_caps, date_created, date_modified, deleted) - VALUES('{$guid}', '{$address}', '{$addressCaps}', '".gmdate($GLOBALS['timedate']->get_db_date_time_format())."', '".gmdate($GLOBALS['timedate']->get_db_date_time_format())."', 0)"; + VALUES('{$guid}', '{$address}', '{$addressCaps}', '$now', '$now', 0)"; $ra = $this->db->query($qa); } return $guid; @@ -612,8 +613,9 @@ class SugarEmailAddress extends SugarBean { $a = $this->db->fetchByAssoc($r); if(!empty($a) && !empty($a['id'])) { //verify the opt out and invalid flags. - if ($a['invalid_email'] != $invalid or $a['opt_out'] != $opt_out) { - $upd_q="update email_addresses set invalid_email={$invalid}, opt_out={$opt_out},date_modified = '".gmdate($GLOBALS['timedate']->get_db_date_time_format())."' where id='{$a['id']}'"; + //bug# 39378- did not allow change of case of an email address + if ($a['invalid_email'] != $invalid or $a['opt_out'] != $opt_out or strcasecmp(trim($a['email_address']), trim($address))==0) { + $upd_q="update email_addresses set email_address='{$address}', invalid_email={$invalid}, opt_out={$opt_out},date_modified = '".gmdate($GLOBALS['timedate']->get_db_date_time_format())."' where id='{$a['id']}'"; $upd_r= $this->db->query($upd_q); } return $a['id']; @@ -623,8 +625,9 @@ class SugarEmailAddress extends SugarBean { $guid = create_guid(); $address = $GLOBALS['db']->quote($address); $addressCaps = $GLOBALS['db']->quote($addressCaps); + $now = TimeDate::getInstance()->nowDb(); $qa = "INSERT INTO email_addresses (id, email_address, email_address_caps, date_created, date_modified, deleted, invalid_email, opt_out) - VALUES('{$guid}', '{$address}', '{$addressCaps}', '".gmdate($GLOBALS['timedate']->get_db_date_time_format())."', '".gmdate($GLOBALS['timedate']->get_db_date_time_format())."', 0 , $invalid, $opt_out)"; + VALUES('{$guid}', '{$address}', '{$addressCaps}', '$now', '$now', 0 , $invalid, $opt_out)"; $this->db->query($qa); } return $guid; @@ -682,8 +685,9 @@ class SugarEmailAddress extends SugarBean { $return = array(); $module = $this->getCorrectedModule($module); - $q = "SELECT ea.*, ear.* FROM email_addresses ea - LEFT JOIN email_addr_bean_rel ear ON ea.id = ear.email_address_id + $q = "SELECT ea.email_address, ea.email_address_caps, ea.invalid_email, ea.opt_out, ea.date_created, ea.date_modified, + ear.id, ear.email_address_id, ear.bean_id, ear.bean_module, ear.primary_address, ear.reply_to_address, ear.deleted + FROM email_addresses ea LEFT JOIN email_addr_bean_rel ear ON ea.id = ear.email_address_id WHERE ear.bean_module = '{$module}' AND ear.bean_id = '{$id}' AND ear.deleted = 0 @@ -711,7 +715,8 @@ class SugarEmailAddress extends SugarBean { global $app_strings, $dictionary, $beanList; - $prefill = 'false'; + $prefill = 'false'; + $prefillData = 'new Object()'; $passedModule = $module; $module = $this->getCorrectedModule($module); @@ -724,10 +729,10 @@ class SugarEmailAddress extends SugarBean { if(!empty($id)) { $prefillDataArr = $this->getAddressesByGUID($id, $module); //When coming from convert leads, sometimes module is Contacts while the id is for a lead. - if (empty($prefillDataArr) && $module == "Contacts") - $prefillDataArr = $this->getAddressesByGUID($id, "Leads"); - } else if(isset($_REQUEST['full_form']) && !empty($_REQUEST['emailAddressWidget'])){ - $widget_id = isset($_REQUEST[$module . '_email_widget_id']) ? $_REQUEST[$module . '_email_widget_id'] : '0'; + if (empty($prefillDataArr) && $module == "Contacts") + $prefillDataArr = $this->getAddressesByGUID($id, "Leads"); + } else if(isset($_REQUEST['full_form']) && !empty($_REQUEST['emailAddressWidget'])){ + $widget_id = isset($_REQUEST[$module . '_email_widget_id']) ? $_REQUEST[$module . '_email_widget_id'] : '0'; $count = 0; $key = $module . $widget_id . 'emailAddress'.$count; while(isset($_REQUEST[$key])) { @@ -763,10 +768,10 @@ class SugarEmailAddress extends SugarBean { //Set addDefaultAddress flag (do not add if it's from the Email module) $this->smarty->assign('addDefaultAddress', (isset($_REQUEST['module']) && $_REQUEST['module'] == 'Emails') ? 'false' : 'true'); $form = $this->view; - if ($this->view == "QuickCreate") - $form = 'form_'.$this->view .'_'.$module; - $this->smarty->assign('emailView', $form); + if ($this->view == "QuickCreate") + $form = 'form_'.$this->view .'_'.$module; + $this->smarty->assign('emailView', $form); if($module == 'Users') { $this->smarty->assign('useReplyTo', true); @@ -813,6 +818,7 @@ class SugarEmailAddress extends SugarBean { $key = ($addressItem['reply_to_address'] == 1) ? 'reply_to' : $key; $key = ($addressItem['opt_out'] == 1) ? 'opt_out' : $key; $key = ($addressItem['invalid_email'] == 1) ? 'invalid' : $key; + $key = ($addressItem['opt_out'] == 1) && ($addressItem['invalid_email'] == 1) ? 'opt_out_invalid' : $key; $assign[] = array('key' => $key, 'address' => $current_user->getEmailLink2($addressItem['email_address'], $focus).$addressItem['email_address'].""); } diff --git a/include/SugarEmailAddress/templates/forDetailView.tpl b/include/SugarEmailAddress/templates/forDetailView.tpl index 06eefaa9..e9b685ca 100644 --- a/include/SugarEmailAddress/templates/forDetailView.tpl +++ b/include/SugarEmailAddress/templates/forDetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -40,7 +40,7 @@ {foreach from=$emailAddresses item=address}
- {if $address.key === 'opt_out'} + {if $address.key === 'opt_out' || $address.key === 'invalid' || $address.key === 'opt_out_invalid'} {elseif $address.key === 'primary'} @@ -51,13 +51,15 @@ {$address.address} {if $address.key === 'primary'} -  ({$app_strings.LBL_EMAIL_PRIMARY}) +  ({$app_strings.LBL_EMAIL_PRIMARY})‎ {elseif $address.key === 'reply_to'} -  ({$app_strings.LBL_EMAIL_REPLY_TO}) +  ({$app_strings.LBL_EMAIL_REPLY_TO})‎ {elseif $address.key === 'opt_out'} -  ({$app_strings.LBL_EMAIL_OPT_OUT}) +  ({$app_strings.LBL_EMAIL_OPT_OUT})‎ {elseif $address.key === 'invalid'} - ({$app_strings.LBL_EMAIL_INVALID}) +  ({$app_strings.LBL_EMAIL_INVALID})‎ + {elseif $address.key === 'opt_out_invalid'} +  ({$app_strings.LBL_EMAIL_OPT_OUT_AND_INVALID})‎ {/if}
{{else}} diff --git a/include/SugarFields/Fields/Address/SugarFieldAddress.js b/include/SugarFields/Fields/Address/SugarFieldAddress.js index af830cec..49bc49a6 100644 --- a/include/SugarFields/Fields/Address/SugarFieldAddress.js +++ b/include/SugarFields/Fields/Address/SugarFieldAddress.js @@ -1,5 +1,5 @@ /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -32,10 +32,12 @@ * technical reasons, the Appropriate Legal Notices must display the words * "Powered by SugarCRM". ********************************************************************************/ -var elems=new Array("address_street","address_city","address_state","address_postalcode","address_country");var tHasText=false;var originalBgColor='#FFFFFF';var Dom=YAHOO.util.Dom;function TestCheckboxReady(id){YAHOO.util.Event.onAvailable(id,this.handleOnAvailable,this);} +var elems=new Array("address_street","address_city","address_state","address_postalcode","address_country");var tHasText=false;var syncAddressCheckbox=true;var originalBgColor='#FFFFFF';var Dom=YAHOO.util.Dom;function TestCheckboxReady(id){YAHOO.util.Event.onAvailable(id,this.handleOnAvailable,this);} TestCheckboxReady.prototype.handleOnAvailable=function(me){for(x in elems){f=fromKey+"_"+elems[x];t=toKey+"_"+elems[x];e1=document.getElementById(t);e2=document.getElementById(f);if(e1!=null&&typeof e1!="undefined"&&e2!=null&&typeof e2!="undefined"){if(!tHasText&&trim(e1.value)!=""){tHasText=true;} -if(e1.value!=e2.value){document.getElementById(this.id).checked=false;break;} +if(e1.value!=e2.value) +{syncAddressCheckbox=false;break;} originalBgColor=e1.style.backgroundColor;}} -if(!tHasText){document.getElementById(this.id).checked=false;}else{syncFields(fromKey,toKey);}} +if(tHasText&&syncAddressCheckbox) +{document.getElementById(this.id).checked=true;syncFields(fromKey,toKey);}} function writeToSyncField(e){fromEl=YAHOO.util.Event.getTarget(e,true);if(typeof fromEl!="undefined"){toEl=document.getElementById(fromEl.id.replace(fromKey,toKey));toEl.value=fromEl.value;}} function syncFields(fromKey,toKey){for(x in elems){f=fromKey+"_"+elems[x];e2=document.getElementById(f);t=toKey+"_"+elems[x];e1=document.getElementById(t);if(e1!=null&&typeof e1!="undefined"&&e2!=null&&typeof e2!="undefined"){if(!document.getElementById(toKey+'_checkbox').checked){Dom.setStyle(e1,'backgroundColor',originalBgColor);e1.removeAttribute('readOnly');YAHOO.util.Event.removeListener(e2,'keyup');}else{e1.value=e2.value;Dom.setStyle(e1,'backgroundColor','#DCDCDC');e1.setAttribute('readOnly',true);YAHOO.util.Event.addListener(e2,'keyup',writeToSyncField);}}}} \ No newline at end of file diff --git a/include/SugarFields/Fields/Address/SugarFieldAddress.php b/include/SugarFields/Fields/Address/SugarFieldAddress.php index 1b756e17..c0bb608b 100644 --- a/include/SugarFields/Fields/Address/SugarFieldAddress.php +++ b/include/SugarFields/Fields/Address/SugarFieldAddress.php @@ -1,7 +1,7 @@ fetch($tplCode); } - global $current_language; - if(isset($current_language) && file_exists('include/SugarFields/Fields/Address/' . $current_language . '.DetailView.tpl')) { - return $this->fetch('include/SugarFields/Fields/Address/' . $current_language . '.DetailView.tpl'); - } else { - return $this->fetch('include/SugarFields/Fields/Address/DetailView.tpl'); - } //if-else + return $this->fetch($this->findTemplate('DetailView')); } function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { @@ -103,13 +98,7 @@ class SugarFieldAddress extends SugarFieldBase { return $this->fetch($tplCode); } - global $current_language; - if(isset($current_language) && file_exists('include/SugarFields/Fields/Address/' . $current_language . '.EditView.tpl')) { - return $this->fetch('include/SugarFields/Fields/Address/' . $current_language . '.EditView.tpl'); - } else { - return $this->fetch('include/SugarFields/Fields/Address/EditView.tpl'); - } //if-else - + return $this->fetch($this->findTemplate('EditView')); } } diff --git a/include/SugarFields/Fields/Address/en_us.DetailView.tpl b/include/SugarFields/Fields/Address/en_us.DetailView.tpl index 17eaf422..af689366 100644 --- a/include/SugarFields/Fields/Address/en_us.DetailView.tpl +++ b/include/SugarFields/Fields/Address/en_us.DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -37,10 +37,14 @@ *}
-{$fields.{{$displayParams.key}}_address_street.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
-{$fields.{{$displayParams.key}}_address_city.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br} {$fields.{{$displayParams.key}}_address_state.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}  {$fields.{{$displayParams.key}}_address_postalcode.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
-{$fields.{{$displayParams.key}}_address_country.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br} + + + + +{$fields.{{$displayParams.key}}_address_street.value|escape:'htmlentitydecode'|escape:'html'|url2html|nl2br}
+{$fields.{{$displayParams.key}}_address_city.value|escape:'htmlentitydecode'|escape:'html'|url2html|nl2br} {$fields.{{$displayParams.key}}_address_state.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}  {$fields.{{$displayParams.key}}_address_postalcode.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
+{$fields.{{$displayParams.key}}_address_country.value|escape:'htmlentitydecode'|escape:'html'|url2html|nl2br}
{{* diff --git a/include/SugarFields/Fields/Address/EditView.tpl b/include/SugarFields/Fields/Address/EditView.tpl index 9f1d2469..5db40e46 100644 --- a/include/SugarFields/Fields/Address/EditView.tpl +++ b/include/SugarFields/Fields/Address/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -120,7 +120,7 @@ {sugar_translate label='LBL_COPY_ADDRESS_FROM_LEFT' module=''}: - +
- {{if !empty($displayParams.enableConnectors)}} {{else}} diff --git a/include/SugarFields/Fields/Assigned_user_name/EditViewFunction.tpl b/include/SugarFields/Fields/Assigned_user_name/EditViewFunction.tpl new file mode 100644 index 00000000..96e5736c --- /dev/null +++ b/include/SugarFields/Fields/Assigned_user_name/EditViewFunction.tpl @@ -0,0 +1,38 @@ +{* +/********************************************************************************* + * SugarCRM Community Edition is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. + * + * 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. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ + +*} +{{include file="/include/SugarFields/Fields/Multienum/EditViewFunction.tpl"}} diff --git a/include/SugarFields/Fields/Assigned_user_name/SearchView.tpl b/include/SugarFields/Fields/Assigned_user_name/SearchView.tpl index 1b80a3bc..3df176b3 100644 --- a/include/SugarFields/Fields/Assigned_user_name/SearchView.tpl +++ b/include/SugarFields/Fields/Assigned_user_name/SearchView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Assigned_user_name/SugarFieldAssigned_user_name.php b/include/SugarFields/Fields/Assigned_user_name/SugarFieldAssigned_user_name.php index beacc878..e6e1a851 100644 --- a/include/SugarFields/Fields/Assigned_user_name/SugarFieldAssigned_user_name.php +++ b/include/SugarFields/Fields/Assigned_user_name/SugarFieldAssigned_user_name.php @@ -1,6 +1,6 @@ setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Multienum/EditViewFunction.tpl'); + return $this->fetch($this->findTemplate('EditViewFunction')); }else{ $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Assigned_user_name/SearchView.tpl'); + return $this->fetch($this->findTemplate('SearchView')); } } } diff --git a/include/SugarFields/Fields/Base/DetailView.tpl b/include/SugarFields/Fields/Base/DetailView.tpl index 1771c363..f9628e55 100644 --- a/include/SugarFields/Fields/Base/DetailView.tpl +++ b/include/SugarFields/Fields/Base/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,7 +35,14 @@ ********************************************************************************/ *} -{{sugarvar key='value'}} +{if strlen({{sugarvar key='value' string=true}}) <= 0} +{assign var="value" value={{sugarvar key='default_value' string=true}} } +{else} +{assign var="value" value={{sugarvar key='value' string=true}} } +{/if} +{{sugarvar key='value'}} {{if !empty($displayParams.enableConnectors)}} -{{sugarvar_connector view='DetailView'}} +{if !empty($value)} +{{sugarvar_connector view='DetailView'}} +{/if} {{/if}} \ No newline at end of file diff --git a/include/SugarFields/Fields/Base/DetailViewFunction.tpl b/include/SugarFields/Fields/Base/DetailViewFunction.tpl index a57857c9..af4b4e99 100644 --- a/include/SugarFields/Fields/Base/DetailViewFunction.tpl +++ b/include/SugarFields/Fields/Base/DetailViewFunction.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Base/EditView.tpl b/include/SugarFields/Fields/Base/EditView.tpl index 98e9e1e7..6fe1ddeb 100644 --- a/include/SugarFields/Fields/Base/EditView.tpl +++ b/include/SugarFields/Fields/Base/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Base/EditViewFunction.tpl b/include/SugarFields/Fields/Base/EditViewFunction.tpl index 8b0c8413..c2e92524 100644 --- a/include/SugarFields/Fields/Base/EditViewFunction.tpl +++ b/include/SugarFields/Fields/Base/EditViewFunction.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Base/ImportViewFunction.tpl b/include/SugarFields/Fields/Base/ImportViewFunction.tpl index 8b0c8413..c2e92524 100644 --- a/include/SugarFields/Fields/Base/ImportViewFunction.tpl +++ b/include/SugarFields/Fields/Base/ImportViewFunction.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Base/InlineEdit.tpl b/include/SugarFields/Fields/Base/InlineEdit.tpl index 40b7e82a..c0c60b91 100644 --- a/include/SugarFields/Fields/Base/InlineEdit.tpl +++ b/include/SugarFields/Fields/Base/InlineEdit.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Base/InlineEditView.tpl b/include/SugarFields/Fields/Base/InlineEditView.tpl index 6e8819f0..c2a57c57 100644 --- a/include/SugarFields/Fields/Base/InlineEditView.tpl +++ b/include/SugarFields/Fields/Base/InlineEditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Base/ListView.tpl b/include/SugarFields/Fields/Base/ListView.tpl index 65827dea..4567fa97 100644 --- a/include/SugarFields/Fields/Base/ListView.tpl +++ b/include/SugarFields/Fields/Base/ListView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Base/SearchForm.tpl b/include/SugarFields/Fields/Base/SearchForm.tpl index a6d10f94..6f671090 100644 --- a/include/SugarFields/Fields/Base/SearchForm.tpl +++ b/include/SugarFields/Fields/Base/SearchForm.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Base/SugarFieldBase.php b/include/SugarFields/Fields/Base/SugarFieldBase.php index 7a51f1e4..0b8f2878 100644 --- a/include/SugarFields/Fields/Base/SugarFieldBase.php +++ b/include/SugarFields/Fields/Base/SugarFieldBase.php @@ -1,6 +1,6 @@ hasButton && !empty($this->button)){ - $additional .= 'button . '>'; + $additional .= 'button . '>'; } if(!empty($this->buttons)){ foreach($this->buttons as $v){ - $additional .= ' '; + $additional .= ' '; } - + } if(!empty($this->image)){ - $additional .= ' image . '>'; + $additional .= ' image . '>'; } - return $this->ss->fetch($path) . $additional; + return $this->ss->fetch($path) . $additional; } - + function findTemplate($view){ static $tplCache = array(); @@ -76,9 +76,20 @@ class SugarFieldBase { while ( $lastClass = get_parent_class($lastClass) ) { $classList[] = str_replace('SugarField','',$lastClass); } - + $tplName = ''; foreach ( $classList as $className ) { + global $current_language; + if(isset($current_language)) { + $tplName = 'include/SugarFields/Fields/'. $className .'/'. $current_language . '.' . $view .'.tpl'; + if ( file_exists('custom/'.$tplName) ) { + $tplName = 'custom/'.$tplName; + break; + } + if ( file_exists($tplName) ) { + break; + } + } $tplName = 'include/SugarFields/Fields/'. $className .'/'. $view .'.tpl'; if ( file_exists('custom/'.$tplName) ) { $tplName = 'custom/'.$tplName; @@ -98,17 +109,17 @@ class SugarFieldBase { // The base field doesn't do any formatting, so override it in subclasses for more specific actions return $rawField; } - + public function unformatField($formattedField, $vardef){ // The base field doesn't do any formatting, so override it in subclasses for more specific actions return $formattedField; - } - + } + function getSmartyView($parentFieldArray, $vardef, $displayParams, $tabindex = -1, $view){ $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - - + + return $this->fetch($this->findTemplate($view)); } @@ -118,7 +129,7 @@ class SugarFieldBase { $tabindex = 1; $isArray = is_array($parentFieldArray); $fieldName = $vardef['name']; - + if ( $isArray ) { $fieldNameUpper = strtoupper($fieldName); if ( isset($parentFieldArray[$fieldNameUpper])) { @@ -134,7 +145,7 @@ class SugarFieldBase { } } $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex, false); - + $this->ss->left_delimiter = '{'; $this->ss->right_delimiter = '}'; $this->ss->assign('col',$vardef['name']); @@ -144,24 +155,24 @@ class SugarFieldBase { /** * Returns a smarty template for the DetailViews - * + * * @param parentFieldArray string name of the variable in the parent template for the bean's data * @param vardef vardef field defintion * @param displayParam parameters for display * available paramters are: * * labelSpan - column span for the label - * * fieldSpan - column span for the field + * * fieldSpan - column span for the field */ function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { - return"" . $this->getSmartyView($parentFieldArray, $vardef, $displayParams, $tabindex, 'DetailView') . ''; + return $this->getSmartyView($parentFieldArray, $vardef, $displayParams, $tabindex, 'DetailView'); } // 99% of all fields will just format like a listview, but just in case, it's here to override function getChangeLogSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { return $this->formatField($parentFieldArray[$vardef['name']],$vardef); } - - + + function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { if(!empty($vardef['function']['returns']) && $vardef['function']['returns'] == 'html'){ $type = $this->type; @@ -172,19 +183,19 @@ class SugarFieldBase { } return $this->getSmartyView($parentFieldArray, $vardef, $displayParams, $tabindex, 'EditView'); } - - function getImportViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) + + function getImportViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { return $this->getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); } - - - + + + function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { if(!empty($vardef['auto_increment']))$vardef['len']=255; - return $this->getSmartyView($parentFieldArray, $vardef, $displayParams, $tabindex, 'EditView'); + return $this->getSmartyView($parentFieldArray, $vardef, $displayParams, $tabindex, 'EditView'); } - + function getPopupViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex){ if (is_array($displayParams) && !isset($displayParams['formName'])) $displayParams['formName'] = 'popup_query_form'; @@ -192,8 +203,8 @@ class SugarFieldBase { $displayParams = array('formName' => 'popup_query_form'); return $this->getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); } - - public function getEmailTemplateValue($inputField, $vardef, $displayParams = array(), $tabindex = 0){ + + public function getEmailTemplateValue($inputField, $vardef, $context = null){ // This does not return a smarty section, instead it returns a direct value return $this->formatField($inputField,$vardef); } @@ -222,8 +233,8 @@ class SugarFieldBase { $returnsHtml = false; } } - - if ( $displayType == 'ListView' + + if ( $displayType == 'ListView' || $displayType == 'popupView' || $displayType == 'searchView' || $displayType == 'wirelessEditView' @@ -235,7 +246,7 @@ class SugarFieldBase { if ( !empty($includeFile) ) { require_once($includeFile); } - + return $funcName($parentFieldArray, $vardef['name'], $parentFieldArray[$vardef['name']], $displayType); } else { $displayTypeFunc = 'get'.$displayType.'Smarty'; @@ -263,16 +274,16 @@ class SugarFieldBase { function getEditView() { } - + function getSearchInput() { } - - function getQueryLike() { + + function getQueryLike() { } - + function getQueryIn() { } - + /** * Setup function to assign values to the smarty template, should be called before every display function */ @@ -287,7 +298,7 @@ class SugarFieldBase { $this->ss->assign('parentFieldArray', $parentFieldArray); $this->ss->assign('vardef', $vardef); $this->ss->assign('tabindex', $tabindex); - + //for adding attributes to the field if(!empty($displayParams['field'])){ @@ -325,16 +336,16 @@ class SugarFieldBase { $this->image = $displayParams['image']; } $this->ss->assign('displayParams', $displayParams); - - + + } - + /** * This should be called when the bean is saved. The bean itself will be passed by reference * @param SugarBean bean - the bean performing the save * @param array params - an array of paramester relevant to the save, most likely will be $_REQUEST */ - public function save(&$bean, $params, $field, $properties, $prefix = ''){ + public function save($bean, $params, $field, $properties, $prefix = ''){ if ( isset($params[$prefix.$field]) ) { if(isset($properties['len']) && isset($properties['type']) && 'varchar' == $properties['type']){ $bean->$field = trim($this->unformatField($params[$prefix.$field],$properties)); @@ -344,5 +355,39 @@ class SugarFieldBase { } } } + + /** + * Handles import field sanitizing for an field type + * + * @param $value string value to be sanitized + * @param $vardefs array + * @param $focus SugarBean object + * @param $settings ImportFieldSanitize object + * @return string sanitized value or boolean false if there's a problem with the value + */ + public function importSanitize( + $value, + $vardef, + $focus, + ImportFieldSanitize $settings + ) + { + if( isset($vardef['len']) ) { + // check for field length + $value = sugar_substr($value, $vardef['len']); + } + + return $value; + } + + /** + * isRangeSearchView + * This method helps determine whether or not to display the range search view code for the sugar field + * @param array $vardef entry representing the sugar field's definition + * @return boolean true if range search view should be displayed, false otherwise + */ + protected function isRangeSearchView($vardef) + { + return !empty($vardef['enable_range_search']) && !empty($_REQUEST['action']) && $_REQUEST['action']!='Popup'; + } } -?> diff --git a/include/SugarFields/Fields/Bool/DetailView.tpl b/include/SugarFields/Fields/Bool/DetailView.tpl index 7a5a5008..021ee437 100644 --- a/include/SugarFields/Fields/Bool/DetailView.tpl +++ b/include/SugarFields/Fields/Bool/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -40,7 +40,7 @@ {else} {assign var="checked" value=""} {/if} - + {{if !empty($displayParams.enableConnectors)}} {{sugarvar_connector view='DetailView'}} {{/if}} \ No newline at end of file diff --git a/include/SugarFields/Fields/Bool/EditView.tpl b/include/SugarFields/Fields/Bool/EditView.tpl index 8c91fa85..3e7f3a66 100644 --- a/include/SugarFields/Fields/Bool/EditView.tpl +++ b/include/SugarFields/Fields/Bool/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Bool/InlineEdit.tpl b/include/SugarFields/Fields/Bool/InlineEdit.tpl index d69773bc..79a0cbdc 100644 --- a/include/SugarFields/Fields/Bool/InlineEdit.tpl +++ b/include/SugarFields/Fields/Bool/InlineEdit.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Bool/InlineEditView.tpl b/include/SugarFields/Fields/Bool/InlineEditView.tpl index eacd7217..b6eb0a4c 100644 --- a/include/SugarFields/Fields/Bool/InlineEditView.tpl +++ b/include/SugarFields/Fields/Bool/InlineEditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Bool/ListView.tpl b/include/SugarFields/Fields/Bool/ListView.tpl index 7cb60e7d..4301208b 100644 --- a/include/SugarFields/Fields/Bool/ListView.tpl +++ b/include/SugarFields/Fields/Bool/ListView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,7 +35,8 @@ ********************************************************************************/ *} -{if strval($parentFieldArray.$col) == "1" || strval($parentFieldArray.$col) == "yes" || strval($parentFieldArray.$col) == "on"} + + {if strval($parentFieldArray.$col) == "1" || strval($parentFieldArray.$col) == "yes" || strval($parentFieldArray.$col) == "on"} {assign var="checked" value="CHECKED"} {else} {assign var="checked" value=""} diff --git a/include/SugarFields/Fields/Bool/SearchView.tpl b/include/SugarFields/Fields/Bool/SearchView.tpl index c7f40836..8f22dc75 100644 --- a/include/SugarFields/Fields/Bool/SearchView.tpl +++ b/include/SugarFields/Fields/Bool/SearchView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Bool/SugarFieldBool.php b/include/SugarFields/Fields/Bool/SugarFieldBool.php index 3376a159..5da9e955 100644 --- a/include/SugarFields/Fields/Bool/SugarFieldBool.php +++ b/include/SugarFields/Fields/Bool/SugarFieldBool.php @@ -1,7 +1,7 @@ setup($parentFieldArray, $vardef, $displayParams, $tabindex); - if( preg_match("/current_user_only.*/", $vardef['name']) || preg_match("/favorites_only.*/", $vardef['name']) ) - return $this->fetch('include/SugarFields/Fields/Bool/EditView.tpl'); - else - return $this->fetch('include/SugarFields/Fields/Bool/SearchView.tpl'); - + //If there was a type override to specifically render it as a boolean, show the EditView checkbox + if( preg_match("/(favorites|current_user|open)_only.*/", $vardef['name'])) + { + return $this->fetch($this->findTemplate('EditView')); + } else { + return $this->fetch($this->findTemplate('SearchView')); + } } - - public function getEmailTemplateValue($inputField, $vardef, $displayParams = array(), $tabindex = 0){ + + /** + * @see SugarFieldBase::importSanitize() + */ + public function importSanitize( + $value, + $vardef, + $focus, + ImportFieldSanitize $settings + ) + { + $bool_values = array(0=>'0',1=>'no',2=>'off',3=>'n',4=>'yes',5=>'y',6=>'on',7=>'1'); + $bool_search = array_search($value,$bool_values); + if ( $bool_search === false ) { + return false; + } + else { + //Convert all the values to a real bool. + $value = (int) ( $bool_search > 3 ); + } + if ( isset($vardef['dbType']) && $vardef['dbType'] == 'varchar' ) + $value = ( $value ? 'on' : 'off' ); + + return $value; + } + + public function getEmailTemplateValue($inputField, $vardef, $context = null){ global $app_list_strings; // This does not return a smarty section, instead it returns a direct value if ( $inputField == 'bool_true' || $inputField === true ) { // Note: true must be absolute true @@ -77,7 +104,7 @@ class SugarFieldBool extends SugarFieldBase { } else { $unformattedField = true; } - + return $unformattedField; } diff --git a/include/SugarFields/Fields/Collection/CollectionDetailView.tpl b/include/SugarFields/Fields/Collection/CollectionDetailView.tpl index 7d900be6..0dc8f67f 100644 --- a/include/SugarFields/Fields/Collection/CollectionDetailView.tpl +++ b/include/SugarFields/Fields/Collection/CollectionDetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Collection/CollectionEditView.tpl b/include/SugarFields/Fields/Collection/CollectionEditView.tpl index 762439a4..7fe20e18 100644 --- a/include/SugarFields/Fields/Collection/CollectionEditView.tpl +++ b/include/SugarFields/Fields/Collection/CollectionEditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Collection/CollectionEditViewRow.tpl b/include/SugarFields/Fields/Collection/CollectionEditViewRow.tpl index ed2bbd67..9d73cb1d 100644 --- a/include/SugarFields/Fields/Collection/CollectionEditViewRow.tpl +++ b/include/SugarFields/Fields/Collection/CollectionEditViewRow.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Collection/DetailView.tpl b/include/SugarFields/Fields/Collection/DetailView.tpl index 79e42197..34f43437 100644 --- a/include/SugarFields/Fields/Collection/DetailView.tpl +++ b/include/SugarFields/Fields/Collection/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Collection/EditView.tpl b/include/SugarFields/Fields/Collection/EditView.tpl index 76e1ba5d..80662d9f 100644 --- a/include/SugarFields/Fields/Collection/EditView.tpl +++ b/include/SugarFields/Fields/Collection/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Collection/SugarFieldCollection.js b/include/SugarFields/Fields/Collection/SugarFieldCollection.js index 4d20760e..f5d58b62 100644 --- a/include/SugarFields/Fields/Collection/SugarFieldCollection.js +++ b/include/SugarFields/Fields/Collection/SugarFieldCollection.js @@ -1,5 +1,5 @@ /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Collection/SugarFieldCollection.php b/include/SugarFields/Fields/Collection/SugarFieldCollection.php index bdea45a8..bf71b57b 100644 --- a/include/SugarFields/Fields/Collection/SugarFieldCollection.php +++ b/include/SugarFields/Fields/Collection/SugarFieldCollection.php @@ -1,6 +1,6 @@ ss->assign('vardefJSON', '{literal}'.$vardefJSON.'{/literal}'); $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); if(empty($this->tpl_path)){ - $this->tpl_path = 'include/SugarFields/Fields/Collection/DetailView.tpl'; + $this->tpl_path = $this->findTemplate('DetailView'); } return $this->fetch($this->tpl_path); } @@ -72,7 +72,7 @@ class SugarFieldCollection extends SugarFieldBase { $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); if(!$searchView) { if(empty($this->tpl_path)){ - $this->tpl_path = 'include/SugarFields/Fields/Collection/EditView.tpl'; + $this->tpl_path = $this->findTemplate('EditView'); } return $this->fetch($this->tpl_path); } diff --git a/include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php b/include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php index a8104931..c5d48073 100644 --- a/include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php +++ b/include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php @@ -1,6 +1,6 @@ value_name = $this->name . '_values'; $this->numFields = 1; $this->ss = new Sugar_Smarty(); - $this->edit_tpl_path = 'include/SugarFields/Fields/Collection/CollectionEditView.tpl'; - $this->detail_tpl_path = 'include/SugarFields/Fields/Collection/CollectionDetailView.tpl'; + $this->edit_tpl_path = $this->findTemplate('CollectionEditView'); + $this->detail_tpl_path = $this->findTemplate('CollectionDetailView'); $this->extra_var = array(); $this->field_to_name_array = array(); } @@ -339,7 +339,7 @@ FRA; mkdir_recursive($dir, null, true); } - $cacheRow = $this->ss->fetch('include/SugarFields/Fields/Collection/CollectionEditViewRow.tpl'); + $cacheRow = $this->ss->fetch($this->findTemplate('CollectionEditViewRow')); file_put_contents($cacheRowFile, $cacheRow); } $this->ss->assign('cacheRowFile', $cacheRowFile); @@ -495,6 +495,49 @@ FRA; $this->displayParams['popupData'] = '{literal}'. str_replace(array('{{', '}}'), array('{ {', '} }'), $this->json->encode($popup_request_data)) . '{/literal}'; } } + + + + function findTemplate($view){ + static $tplCache = array(); + + if ( isset($tplCache[$this->type][$view]) ) { + return $tplCache[$this->type][$view]; + } + + $lastClass = get_class($this); + $classList = array($this->type,str_replace('ViewSugarField','',$lastClass)); + while ( $lastClass = get_parent_class($lastClass) ) { + $classList[] = str_replace('ViewSugarField','',$lastClass); + } + + $tplName = ''; + foreach ( $classList as $className ) { + global $current_language; + if(isset($current_language)) { + $tplName = 'include/SugarFields/Fields/'. $className .'/'. $current_language . '.' . $view .'.tpl'; + if ( file_exists('custom/'.$tplName) ) { + $tplName = 'custom/'.$tplName; + break; + } + if ( file_exists($tplName) ) { + break; + } + } + $tplName = 'include/SugarFields/Fields/'. $className .'/'. $view .'.tpl'; + if ( file_exists('custom/'.$tplName) ) { + $tplName = 'custom/'.$tplName; + break; + } + if ( file_exists($tplName) ) { + break; + } + } + + $tplCache[$this->type][$view] = $tplName; + + return $tplName; + } } ?> \ No newline at end of file diff --git a/include/SugarFields/Fields/Collection/view.sugarfieldcollection.php b/include/SugarFields/Fields/Collection/view.sugarfieldcollection.php index bdfcbd67..815b914a 100644 --- a/include/SugarFields/Fields/Collection/view.sugarfieldcollection.php +++ b/include/SugarFields/Fields/Collection/view.sugarfieldcollection.php @@ -1,6 +1,6 @@ {{if !empty($displayParams.enableConnectors)}} -{{sugarvar_connector view='DetailView'}} +{{sugarvar_connector view='DetailView'}} {{/if}} \ No newline at end of file diff --git a/include/SugarFields/Fields/Currency/EditView.tpl b/include/SugarFields/Fields/Currency/EditView.tpl index 424e6031..53ddf9c5 100644 --- a/include/SugarFields/Fields/Currency/EditView.tpl +++ b/include/SugarFields/Fields/Currency/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Currency/ListView.tpl b/include/SugarFields/Fields/Currency/ListView.tpl index b86508ee..bf79a8bd 100644 --- a/include/SugarFields/Fields/Currency/ListView.tpl +++ b/include/SugarFields/Fields/Currency/ListView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Currency/SugarFieldCurrency.php b/include/SugarFields/Fields/Currency/SugarFieldCurrency.php index 033e7016..f11f482f 100644 --- a/include/SugarFields/Fields/Currency/SugarFieldCurrency.php +++ b/include/SugarFields/Fields/Currency/SugarFieldCurrency.php @@ -1,7 +1,7 @@ setup($parentFieldArray, $vardef, $displayParams, $tabindex, false); @@ -57,4 +58,19 @@ class SugarFieldCurrency extends SugarFieldFloat { } return $this->fetch($this->findTemplate('ListView')); } + + /** + * @see SugarFieldBase::importSanitize() + */ + public function importSanitize( + $value, + $vardef, + $focus, + ImportFieldSanitize $settings + ) + { + $value = str_replace($settings->currency_symbol,"",$value); + + return $settings->float($value,$vardef,$focus); + } } \ No newline at end of file diff --git a/include/SugarFields/Fields/Datetime/EditView.tpl b/include/SugarFields/Fields/Datetime/EditView.tpl index fdecb173..169dee20 100644 --- a/include/SugarFields/Fields/Datetime/EditView.tpl +++ b/include/SugarFields/Fields/Datetime/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -39,19 +39,21 @@ {{if !empty($displayParams.idName)}} {{assign var=idname value=$displayParams.idName}} {{/if}} - + {assign var=date_value value={{sugarvar key='value' string=true}} } - + {{if !$displayParams.hiddeCalendar}} {$APP.LBL_ENTER_DATE} {{/if}} {{if $displayParams.showFormats}}  ({$USER_DATEFORMAT}) {{/if}} + {{if !$displayParams.hiddeCalendar}} - - \ No newline at end of file diff --git a/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl b/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl new file mode 100644 index 00000000..04841e5f --- /dev/null +++ b/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl @@ -0,0 +1,167 @@ +{* +/********************************************************************************* + * SugarCRM Community Edition is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. + * + * 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. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ + +*} +{{if empty($displayParams.idName)}} +{assign var="id" value={{sugarvar key='name' string=true}} } +{{else}} +{assign var="id" value={{$displayParams.idName}} } +{{/if}} + +{if isset($smarty.request.{{$id_range_choice}})} +{assign var="starting_choice" value=$smarty.request.{{$id_range_choice}}} +{else} +{assign var="starting_choice" value="="} +{/if} + +
+ +
+ +
+ +{{if !$displayParams.hiddeCalendar}} +{$APP.LBL_ENTER_DATE} +{{/if}} +{{if $displayParams.showFormats}} + ({$USER_DATEFORMAT}) +{{/if}} +{{if !$displayParams.hiddeCalendar}} + +{{/if}} +
+ +
+{assign var=date_value value={{sugarvar key='value' string=true}} } + +{{if !$displayParams.hiddeCalendar}} +{$APP.LBL_ENTER_DATE} +{{/if}} +{{if $displayParams.showFormats}} + ({$USER_DATEFORMAT}) +{{/if}} +{{if !$displayParams.hiddeCalendar}} + +{{/if}} +{$APP.LBL_AND} +{assign var=date_value value={{sugarvar key='value' string=true}} } + +{{if !$displayParams.hiddeCalendar}} +{$APP.LBL_ENTER_DATE} +{{/if}} +{{if $displayParams.showFormats}} + ({$USER_DATEFORMAT}) +{{/if}} +{{if !$displayParams.hiddeCalendar}} + +{{/if}} +
+ + + \ No newline at end of file diff --git a/include/SugarFields/Fields/Datetimecombo/SearchView.tpl b/include/SugarFields/Fields/Datetimecombo/SearchView.tpl index b15552a3..d25e06f0 100644 --- a/include/SugarFields/Fields/Datetimecombo/SearchView.tpl +++ b/include/SugarFields/Fields/Datetimecombo/SearchView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -104,7 +104,7 @@ update_{{sugarvar key='name'}}_available.prototype.handleOnAvailable = function( {rdelim}); //Call update for first time to round hours and minute values - combo_{{sugarvar key='name'}}.update(); + combo_{{sugarvar key='name'}}.update(false); {rdelim} var obj_{{sugarvar key='name'}} = new update_{{sugarvar key='name'}}_available(); diff --git a/include/SugarFields/Fields/Datetimecombo/SugarFieldDatetimecombo.php b/include/SugarFields/Fields/Datetimecombo/SugarFieldDatetimecombo.php index 19dae91f..d9411852 100644 --- a/include/SugarFields/Fields/Datetimecombo/SugarFieldDatetimecombo.php +++ b/include/SugarFields/Fields/Datetimecombo/SugarFieldDatetimecombo.php @@ -1,6 +1,6 @@ get_cal_date_format(); $displayParams['timeFormat'] = $timedate->get_user_time_format(); - $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Datetimecombo/EditView.tpl'); + $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); + return $this->fetch($this->findTemplate('EditView')); } - - function getImportViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) + + function getImportViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { $displayParams['showFormats'] = true; return $this->getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); } function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { + + if($this->isRangeSearchView($vardef)) { + $displayParams['showMinutesDropdown'] = false; + $displayParams['showHoursDropdown'] = false; + $displayParams['showNoneCheckbox'] = false; + $displayParams['showFormats'] = false; + global $timedate, $current_language; + $displayParams['dateFormat'] = $timedate->get_cal_date_format(); + $displayParams['timeFormat'] = $timedate->get_user_time_format(); + + $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); + $id = isset($displayParams['idName']) ? $displayParams['idName'] : $vardef['name']; + $this->ss->assign('original_id', "{$id}"); + $this->ss->assign('id_range', "range_{$id}"); + $this->ss->assign('id_range_start', "start_range_{$id}"); + $this->ss->assign('id_range_end', "end_range_{$id}"); + $this->ss->assign('id_range_choice', "{$id}_range_choice"); + if(file_exists('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl')) + { + return $this->fetch('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl'); + } + return $this->fetch('include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl'); + } + // Create Smarty variables for the Calendar picker widget if(!isset($displayParams['showMinutesDropdown'])) { - $displayParams['showMinutesDropdown'] = false; + $displayParams['showMinutesDropdown'] = false; } - + if(!isset($displayParams['showHoursDropdown'])) { - $displayParams['showHoursDropdown'] = false; + $displayParams['showHoursDropdown'] = false; } - + if(!isset($displayParams['showNoneCheckbox'])) { - $displayParams['showNoneCheckbox'] = false; + $displayParams['showNoneCheckbox'] = false; } - + if(!isset($displayParams['showFormats'])) { - $displayParams['showFormats'] = false; + $displayParams['showFormats'] = false; } - + global $timedate; $displayParams['dateFormat'] = $timedate->get_cal_date_format(); $displayParams['timeFormat'] = $timedate->get_user_time_format(); $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Datetimecombo/SearchView.tpl'); + return $this->fetch($this->findTemplate('SearchView')); } - - - public function getEmailTemplateValue($inputField, $vardef, $displayParams = array(), $tabindex = 0){ - - return $GLOBALS['timedate']->to_display_date_time($inputField, true, false, new stdClass() ); + + + public function getEmailTemplateValue($inputField, $vardef, $context = null, $tabindex = 0){ + // This does not return a smarty section, instead it returns a direct value + if(isset($context['notify_user'])) { + $user = $context['notify_user']; + } else { + $user = $GLOBALS['current_user']; + } + return TimeDate::getInstance()->to_display_date_time($inputField, true, true, $user); } public function save(&$bean, &$inputData, &$field, &$def, $prefix = '') { @@ -108,14 +137,14 @@ class SugarFieldDatetimecombo extends SugarFieldBase { //$bean->$field = ''; return; } - + if(strpos($inputData[$prefix.$field], ' ') > 0) { $bean->$field = $timedate->to_db($inputData[$prefix.$field]); } else { $GLOBALS['log']->error('Field ' . $prefix.$field . ' expecting datetime format, but got value: ' . $inputData[$prefix.$field]); //Default to assume date format value - $bean->$field = $timedate->to_db_date($inputData[$prefix.$field]); + $bean->$field = $timedate->to_db_date($inputData[$prefix.$field]); } - } + } } ?> \ No newline at end of file diff --git a/include/SugarFields/Fields/Download/DetailView.tpl b/include/SugarFields/Fields/Download/DetailView.tpl index 5bf9b09a..efc51190 100644 --- a/include/SugarFields/Fields/Download/DetailView.tpl +++ b/include/SugarFields/Fields/Download/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,8 +35,12 @@ ********************************************************************************/ *} + {$fields.filename.value} + {{if !empty($displayParams.enableConnectors)}} -{{sugarvar_connector view='DetailView'}} +{if !empty($fields.filename.value)} +{{sugarvar_connector view='DetailView'}} +{/if} {{/if}} diff --git a/include/SugarFields/Fields/Download/SugarFieldDownload.php b/include/SugarFields/Fields/Download/SugarFieldDownload.php index 6bb3c4e3..ce6bc841 100644 --- a/include/SugarFields/Fields/Download/SugarFieldDownload.php +++ b/include/SugarFields/Fields/Download/SugarFieldDownload.php @@ -1,6 +1,6 @@ setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Download/DetailView.tpl'); + return $this->fetch($this->findTemplate('DetailView.tpl')); } } ?> \ No newline at end of file diff --git a/include/SugarFields/Fields/Enum/DetailView.tpl b/include/SugarFields/Fields/Enum/DetailView.tpl index e077b6d2..f36002f0 100644 --- a/include/SugarFields/Fields/Enum/DetailView.tpl +++ b/include/SugarFields/Fields/Enum/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -38,8 +38,10 @@ {* This is here so currency fields, who don't really have dropdown lists can work. *} {if is_string({{sugarvar key='options' string=true}})} -{ {{sugarvar key='options' string=true}}} -{else if} + +{ {{sugarvar key='options' string=true}} } +{else} + { {{sugarvar key='options' string=true}}[{{sugarvar key='value' string=true}}]} {/if} {{if !empty($displayParams.enableConnectors)}} diff --git a/include/SugarFields/Fields/Enum/DetailViewFunction.tpl b/include/SugarFields/Fields/Enum/DetailViewFunction.tpl index a57857c9..2b17c50a 100644 --- a/include/SugarFields/Fields/Enum/DetailViewFunction.tpl +++ b/include/SugarFields/Fields/Enum/DetailViewFunction.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,7 +35,7 @@ ********************************************************************************/ *} -{{sugarvar key='value'}} +{{sugarvar key='value'}} {{if !empty($displayParams.enableConnectors)}} {{sugarvar_connector view='DetailView'}} {{/if}} \ No newline at end of file diff --git a/include/SugarFields/Fields/Enum/EditView.tpl b/include/SugarFields/Fields/Enum/EditView.tpl index 5e8f55d3..58dcf3de 100644 --- a/include/SugarFields/Fields/Enum/EditView.tpl +++ b/include/SugarFields/Fields/Enum/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Enum/EditViewFunction.tpl b/include/SugarFields/Fields/Enum/EditViewFunction.tpl index eb5e1097..ff838115 100644 --- a/include/SugarFields/Fields/Enum/EditViewFunction.tpl +++ b/include/SugarFields/Fields/Enum/EditViewFunction.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Enum/SearchView.tpl b/include/SugarFields/Fields/Enum/SearchView.tpl index 783359f1..27d7d675 100644 --- a/include/SugarFields/Fields/Enum/SearchView.tpl +++ b/include/SugarFields/Fields/Enum/SearchView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Enum/SugarFieldEnum.php b/include/SugarFields/Fields/Enum/SugarFieldEnum.php index f7a2ee3c..60c6eae8 100644 --- a/include/SugarFields/Fields/Enum/SugarFieldEnum.php +++ b/include/SugarFields/Fields/Enum/SugarFieldEnum.php @@ -1,6 +1,6 @@ setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return "" . $this->fetch('include/SugarFields/Fields/Enum/DetailViewFunction.tpl') . ''; - }else{ + return "" . $this->fetch($this->findTemplate('DetailViewFunction')) . ""; + } else { return parent::getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); } } @@ -55,7 +56,7 @@ class SugarFieldEnum extends SugarFieldBase { if(isset($vardef['function']) && !empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){ $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Enum/EditViewFunction.tpl'); + return $this->fetch($this->findTemplate('EditViewFunction')); }else{ return parent::getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); } @@ -71,10 +72,10 @@ class SugarFieldEnum extends SugarFieldBase { if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){ $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Enum/EditViewFunction.tpl'); + return $this->fetch($this->findTemplate('EditViewFunction')); }else{ $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Enum/SearchView.tpl'); + return $this->fetch($this->findTemplate('SearchView')); } } @@ -88,6 +89,45 @@ class SugarFieldEnum extends SugarFieldBase { return $this->$displayTypeFunc($parentFieldArray, $vardef, $displayParams, $tabindex); } + /** + * @see SugarFieldBase::importSanitize() + */ + public function importSanitize( + $value, + $vardef, + $focus, + ImportFieldSanitize $settings + ) + { + global $app_list_strings; + + // Bug 27467 - Trim the value given + $value = trim($value); + + if ( isset($app_list_strings[$vardef['options']]) + && !isset($app_list_strings[$vardef['options']][$value]) ) { + // Bug 23485/23198 - Check to see if the value passed matches the display value + if ( in_array($value,$app_list_strings[$vardef['options']]) ) + $value = array_search($value,$app_list_strings[$vardef['options']]); + // Bug 33328 - Check for a matching key in a different case + elseif ( in_array(strtolower($value), array_keys(array_change_key_case($app_list_strings[$vardef['options']]))) ) { + foreach ( $app_list_strings[$vardef['options']] as $optionkey => $optionvalue ) + if ( strtolower($value) == strtolower($optionkey) ) + $value = $optionkey; + } + // Bug 33328 - Check for a matching value in a different case + elseif ( in_array(strtolower($value), array_map('strtolower', $app_list_strings[$vardef['options']])) ) { + foreach ( $app_list_strings[$vardef['options']] as $optionkey => $optionvalue ) + if ( strtolower($value) == strtolower($optionvalue) ) + $value = $optionkey; + } + else + return false; + } + + return $value; + } + public function formatField($rawField, $vardef){ global $app_list_strings; @@ -103,6 +143,5 @@ class SugarFieldEnum extends SugarFieldBase { return $rawField; } } - } ?> \ No newline at end of file diff --git a/include/SugarFields/Fields/File/DetailView.tpl b/include/SugarFields/Fields/File/DetailView.tpl index 3f0bfaf3..b1170d3f 100644 --- a/include/SugarFields/Fields/File/DetailView.tpl +++ b/include/SugarFields/Fields/File/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,7 +35,17 @@ ********************************************************************************/ *} -{$fields.{{$displayParams.link}}.value} + +{{sugarvar key='value'}} + +{{if isset($vardef) && isset($vardef.allowEapm) && $vardef.allowEapm}} +{if isset($fields.{{$vardef.docType}}) && !empty($fields.{{$vardef.docType}}.value) && $fields.{{$vardef.docType}}.value != 'SugarCRM' && !empty($fields.{{$vardef.docUrl}}.value) } +{capture name=imageNameCapture assign=imageName} +{$fields.{{$vardef.docType}}.value}_image_inline.png +{/capture} + +{/if} +{{/if}} {{if !empty($displayParams.enableConnectors)}} -{{sugarvar_connector view='DetailView'}} +{{sugarvar_connector view='DetailView'}} {{/if}} diff --git a/include/SugarFields/Fields/File/EditView.tpl b/include/SugarFields/Fields/File/EditView.tpl index aed852a3..09ee2e89 100644 --- a/include/SugarFields/Fields/File/EditView.tpl +++ b/include/SugarFields/Fields/File/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,8 +35,62 @@ ********************************************************************************/ *} - +{{/if}} + +{{capture name=idName assign=idName}}{{sugarvar key='name'}}{{/capture}} +{{if !empty($displayParams.idName)}} + {{assign var=idName value=$displayParams.idName}} +{{/if}} + +{{if !isset($vardef.noRemove) || !$vardef.noRemove}} +{if !empty({{sugarvar key='value' stringFormat=true}}) } + {assign var=showRemove value=true} +{else} + {assign var=showRemove value=false} +{/if} +{{else}} + {assign var=showRemove value=false} +{{/if}} + +{{if isset($vardef.noChange) && $vardef.noChange }} +{if !empty({{sugarvar key='value' stringFormat=true}}) } + {assign var=showRemove value=true} + {assign var=noChange value=true} +{else} + {assign var=noChange value=false} +{/if} +{{else}} + {assign var=noChange value=false} +{{/if}} + + + +{{if isset($vardef.allowEapm) && $vardef.allowEapm}} + + + +{{/if}} + + {{sugarvar key='value'}} + +{{if isset($vardef.allowEapm) && $vardef.allowEapm}} +{if isset($fields.{{$vardef.docType}}) && !empty($fields.{{$vardef.docType}}.value) && $fields.{{$vardef.docType}}.value != 'Sugar' && !empty($fields.{{$vardef.docUrl}}.value) } +{capture name=imageNameCapture assign=imageName} +{$fields.{{$vardef.docType}}.value}_image_inline.png +{/capture} + +{/if} +{{/if}} +{if !$noChange} + +{/if} + +{if !$noChange} + + + \ No newline at end of file +{{/if}} +{{$displayParams.field}}> + + +{{if isset($vardef.allowEapm) && $vardef.allowEapm}} + \ No newline at end of file diff --git a/include/SugarFields/Fields/File/ListView.tpl b/include/SugarFields/Fields/File/ListView.tpl new file mode 100644 index 00000000..8fb74917 --- /dev/null +++ b/include/SugarFields/Fields/File/ListView.tpl @@ -0,0 +1,48 @@ +{* +/********************************************************************************* + * SugarCRM Community Edition is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. + * + * 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. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ + +*} +{sugar_fetch object=$parentFieldArray key=$col} +{if isset($vardef.allowEapm) && $vardef.allowEapm && isset($parentFieldArray.DOC_TYPE) } +{capture name=imageNameCapture assign=imageName} +{sugar_fetch object=$parentFieldArray key=DOC_TYPE}_image_inline.png +{/capture} +{capture name=imageURLCapture assign=imageURL} +{sugar_getimagepath file=$imageName} +{/capture} +{if strlen($imageURL)>1}{/if} +{/if} + \ No newline at end of file diff --git a/include/SugarFields/Fields/File/SearchView.tpl b/include/SugarFields/Fields/File/SearchView.tpl new file mode 100644 index 00000000..046f2841 --- /dev/null +++ b/include/SugarFields/Fields/File/SearchView.tpl @@ -0,0 +1,39 @@ +{* +/********************************************************************************* + * SugarCRM Community Edition is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. + * + * 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. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ + +*} + + diff --git a/include/SugarFields/Fields/File/SugarFieldFile.js b/include/SugarFields/Fields/File/SugarFieldFile.js new file mode 100644 index 00000000..79f0b7ae --- /dev/null +++ b/include/SugarFields/Fields/File/SugarFieldFile.js @@ -0,0 +1,45 @@ +/********************************************************************************* + * SugarCRM Community Edition is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. + * + * 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. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ +if(typeof(SUGAR.field)=='undefined'){SUGAR.field=new Object();} +if(typeof(SUGAR.field.file)=='undefined'){SUGAR.field.file={deleteAttachment:function(elemBaseName,docTypeName,elem){ajaxStatus.showStatus(SUGAR.language.get("Notes","LBL_REMOVING_ATTACHMENT"));elem.form.deleteAttachment.value=1;elem.form.action.value="EditView";SUGAR.dashlets.postForm(elem.form,SUGAR.field.file.deleteAttachmentCallbackGen(elemBaseName,docTypeName));elem.form.deleteAttachment.value=0;elem.form.action.value="";},deleteAttachmentCallbackGen:function(elemBaseName,docTypeName){return function(text){if(text=='true'){document.getElementById(elemBaseName+'_new').style.display='';ajaxStatus.hideStatus();document.getElementById(elemBaseName+'_old').innerHTML='';document.getElementById(docTypeName).disabled=false;document.getElementById(elemBaseName).value='';}else{document.getElementById(elemBaseName+'_new').style.display='none';ajaxStatus.flashStatus(SUGAR.language.get('Notes','ERR_REMOVING_ATTACHMENT'),2000);}}},checkEapiLogin:function(res){var failedLogins=JSON.parse(res.responseText);if(failedLogins.length==0){return;} +for(var idx in failedLogins){if(confirm(failedLogins[idx].label)){window.open(failedLogins[idx].checkURL,'EAPM_CHECK_'+idx);}else{document.getElementById(res.argument.docTypeName).value='Sugar';document.getElementById(res.argument.docTypeName).onchange();}}},setupEapiShowHide:function(elemBaseName,docTypeName,formName){var externalSearchToggle=function(){var moreElem=document.getElementById(elemBaseName+"_more");var hideMore=(moreElem.style.display=='none');if(hideMore){moreElem.style.display='';document.getElementById(elemBaseName+'_less').style.display='none';document.getElementById(elemBaseName+'_remoteNameSpan').style.display='none';document.getElementById(elemBaseName+'_file').disabled=false;}else{moreElem.style.display='none';document.getElementById(elemBaseName+'_less').style.display='';document.getElementById(elemBaseName+'_remoteNameSpan').style.display='';document.getElementById(elemBaseName+'_file').disabled=true;}} +var showHideFunc=function(){var docShowHideElem=document.getElementById(elemBaseName+"_externalApiSelector");var dropdownValue=document.getElementById(docTypeName).value;if(typeof(SUGAR.eapm)!='undefined'&&typeof(SUGAR.eapm[dropdownValue])!='undefined'&&typeof(SUGAR.eapm[dropdownValue].docSearch)!='undefined'&&SUGAR.eapm[dropdownValue].docSearch){docShowHideElem.style.display='';YAHOO.util.Connect.asyncRequest('GET','index.php?module=EAPM&action=CheckLogins&to_pdf=1&api='+dropdownValue,{success:SUGAR.field.file.checkEapiLogin,argument:{'elemBaseName':elemBaseName,'docTypeName':docTypeName}});YAHOO.util.Connect.asyncRequest('GET','index.php?module=EAPM&action=flushFileCache&to_pdf=1&api='+dropdownValue,{});}else{docShowHideElem.style.display='none';document.getElementById(elemBaseName+'_file').disabled=false;} +sqs_objects[formName+"_"+elemBaseName+"_remoteName"].api=dropdownValue;var secLevelBoxElem=document.getElementById(elemBaseName+'_securityLevelBox');var secLevelElem=document.getElementById(elemBaseName+'_securityLevel');secLevelElem.options.length=0;if(SUGAR.eapm[dropdownValue]&&SUGAR.eapm[dropdownValue].sharingOptions){var opts=SUGAR.eapm[dropdownValue].sharingOptions;var i=0;for(idx in opts){secLevelElem.options[i]=new Option(SUGAR.language.get('app_strings',opts[idx]),idx,false,false);i++;} +secLevelBoxElem.style.display='';}else{secLevelBoxElem.style.display='none';}} +document.getElementById(docTypeName).onchange=showHideFunc;document.getElementById(elemBaseName+'_externalApiLabel').onclick=externalSearchToggle;showHideFunc();},openPopup:function(elemBaseName){window.open('index.php?module=Documents&action=extdoc&isPopup=1&elemBaseName='+elemBaseName+'&apiName='+document.getElementById('doc_type').value,'sugarPopup','width=600,height=400,menubar=no,toolbar=no,status=no,resizeable=yes,scrollbars=yes');},clearRemote:function(elemBaseName){document.getElementById('doc_id').value='';document.getElementById(elemBaseName).value='';document.getElementById(elemBaseName+'_remoteName').value='';document.getElementById('doc_url').value='';},populateFromPopup:function(elemBaseName,docId,docName,docUrl,docDirectUrl){document.getElementById('doc_id').value=docId;document.getElementById(elemBaseName).value=docId;document.getElementById(elemBaseName+'_remoteName').value=docName;document.getElementById('doc_url').value=docUrl;},getFileExtension:function(fileName){var lastindex=fileName.lastIndexOf(".");if(lastindex==-1) +return'';else +return fileName.substr(++lastindex);},isFileExtensionValid:function(fileName){var docType=document.getElementById('doc_type').value;var fileExtension=this.getFileExtension(fileName);if(typeof(SUGAR.eapm[docType])=='undefined'||!SUGAR.eapm[docType].restrictUploadsByExtension){return true;} +var whiteSuffixlist=SUGAR.eapm[docType]['restrictUploadsByExtension'];if(whiteSuffixlist.constructor==Array){var results=false;for(var i=0;ierror($error); - $this->ss->trigger_error($error); - return; + // Override the default module + if ( isset($vardef['linkModuleOverride']) ) { + $vardef['linkModule'] = $vardef['linkModuleOverride']; + } else { + $vardef['linkModule'] = '{$module}'; } - - if(!isset($displayParams['id'])) { - $error = $app_strings['ERR_SMARTY_MISSING_DISPLAY_PARAMS'] . 'id'; - $GLOBALS['log']->error($error); - $this->ss->trigger_error($error); - return; - } - $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/File/DetailView.tpl'); + // This is needed because these aren't always filled out in the edit/detailview defs + if ( !isset($vardef['fileId']) ) { + if ( isset($displayParams['id']) ) { + $vardef['fileId'] = $displayParams['id']; + } else { + $vardef['fileId'] = 'id'; + } + } + } + + + function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { + $this->fillInOptions($vardef,$displayParams); + return parent::getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); + } + + function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { + $this->fillInOptions($vardef,$displayParams); + return parent::getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); } - public function save(&$bean, $params, $field, $properties, $prefix = ''){ + public function save(&$bean, $params, $field, $vardef, $prefix = ''){ + $fakeDisplayParams = array(); + $this->fillInOptions($vardef,$fakeDisplayParams); + require_once('include/upload_file.php'); - $upload_file = new UploadFile($prefix . $field); + $upload_file = new UploadFile($prefix . $field . '_file'); //remove file - if (isset($_REQUEST['remove_file_' . $field]) && $_REQUEST['remove_file_' . $field] == 1) + if (isset($_REQUEST['remove_file_' . $field]) && $params['remove_file_' . $field] == 1) { $upload_file->unlink_file($bean->$field); $bean->$field=""; } $move=false; - if (isset($_FILES[$prefix . $field]) && $upload_file->confirm_upload()) + if (isset($_FILES[$prefix . $field . '_file']) && $upload_file->confirm_upload()) { $bean->$field = $upload_file->get_stored_file_name(); $bean->file_mime_type = $upload_file->mime_type; $bean->file_ext = $upload_file->file_ext; $move=true; } - + + if (isset($params['isDuplicate']) && $params['isDuplicate'] == true && $params['isDuplicate'] != 'false' ) { + // It's a duplicate + $old_id = $params['relate_id']; + } + + if (empty($bean->id)) { + $bean->id = create_guid(); + $bean->new_with_id = true; + } + if ($move) { - if (empty($bean->id)) { - $bean->id = create_guid(); - $bean->new_with_id = true; - } + $upload_file->final_move($bean->id); + $upload_file->upload_doc($bean, $bean->id, $params[$prefix . $vardef['docType']], $bean->$field, $upload_file->mime_type); + } else if ( ! empty($old_id) ) { + // It's a duplicate, I think + + if ( empty($params[$prefix . $vardef['docUrl'] ]) ) { + $upload_file->duplicate_file($old_id, $bean->id, $bean->$field); + } else { + $docType = $vardef['docType']; + $bean->$docType = $params[$prefix . $field . '_old_doctype']; + } + } else if ( !empty($params[$prefix . $field . '_remoteName']) ) { + // We ain't moving, we might need to do some remote linking + $displayParams = array(); + $this->fillInOptions($vardef,$displayParams); + + if ( isset($params[$prefix . $vardef['docId']]) + && ! empty($params[$prefix . $vardef['docId']]) + && isset($params[$prefix . $vardef['docType']]) + && ! empty($params[$prefix . $vardef['docType']]) + ) { + $bean->$field = $params[$prefix . $field . '_remoteName']; + + require_once('include/utils/file_utils.php'); + $extension = get_file_extension($bean->$field); + if(!empty($extension)) + { + $bean->file_ext = $extension; + $bean->file_mime_type = get_mime_content_type_from_filename($bean->$field); + } + } + } - $upload_file->final_move($bean->id); - } + if ( $vardef['allowEapm'] == true && empty($bean->$field) ) { + $GLOBALS['log']->info("The $field is empty, clearing out the lot"); + // Looks like we are emptying this out + $clearFields = array('docId', 'docType', 'docUrl', 'docDirectUrl'); + foreach ( $clearFields as $clearMe ) { + if ( ! isset($vardef[$clearMe]) ) { + continue; + } + $clearField = $vardef[$clearMe]; + $bean->$clearField = ''; + } + } } } -?> \ No newline at end of file diff --git a/include/SugarFields/Fields/Float/DetailView.tpl b/include/SugarFields/Fields/Float/DetailView.tpl index 4c264ce3..35f2b1c4 100644 --- a/include/SugarFields/Fields/Float/DetailView.tpl +++ b/include/SugarFields/Fields/Float/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,7 +35,7 @@ ********************************************************************************/ *} - + {sugar_number_format var={{sugarvar key='value' stringFormat='false'}} {{if !empty($vardef.precision)}}precision={{$vardef.precision}}{{/if}} } {{if !empty($displayParams.enableConnectors)}} diff --git a/include/SugarFields/Fields/Float/EditView.tpl b/include/SugarFields/Fields/Float/EditView.tpl index 7ec53205..e1e82a5a 100644 --- a/include/SugarFields/Fields/Float/EditView.tpl +++ b/include/SugarFields/Fields/Float/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Float/SugarFieldFloat.php b/include/SugarFields/Fields/Float/SugarFieldFloat.php index 42bd1d01..1c8ee345 100644 --- a/include/SugarFields/Fields/Float/SugarFieldFloat.php +++ b/include/SugarFields/Fields/Float/SugarFieldFloat.php @@ -1,7 +1,7 @@ num_grp_sep,"",$value); + $dec_sep = $settings->dec_sep; + if ( $dec_sep != '.' ) { + $value = str_replace($dec_sep,".",$value); + } + if ( !is_numeric($value) ) { + return false; + } + + return $value; + } } diff --git a/include/SugarFields/Fields/Fullname/DetailView.tpl b/include/SugarFields/Fields/Fullname/DetailView.tpl index db689d7e..82753903 100644 --- a/include/SugarFields/Fields/Fullname/DetailView.tpl +++ b/include/SugarFields/Fields/Fullname/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,6 +35,11 @@ ********************************************************************************/ *} +{if strlen({{sugarvar key='value' string=true}}) <= 0} +{assign var="value" value={{sugarvar key='default_value' string=true}} } +{else} +{assign var="value" value={{sugarvar key='value' string=true}} } +{/if}
{{sugarvar key='value'}}    @@ -47,5 +52,7 @@
{{if !empty($displayParams.enableConnectors)}} -{{sugarvar_connector view='DetailView'}} +{if !empty($value)} +{{sugarvar_connector view='DetailView'}} +{/if} {{/if}} \ No newline at end of file diff --git a/include/SugarFields/Fields/Fullname/SugarFieldFullname.php b/include/SugarFields/Fields/Fullname/SugarFieldFullname.php index c6298dfc..577d5ffe 100644 --- a/include/SugarFields/Fields/Fullname/SugarFieldFullname.php +++ b/include/SugarFields/Fields/Fullname/SugarFieldFullname.php @@ -1,6 +1,6 @@ setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Fullname/DetailView.tpl'); + return $this->fetch($this->findTemplate('DetailView')); } -} -?> \ No newline at end of file + + /** + * @see SugarFieldBase::importSanitize() + */ + public function importSanitize( + $value, + $vardef, + $focus, + ImportFieldSanitize $settings + ) + { + if ( property_exists($focus,'first_name') && property_exists($focus,'last_name') ) { + $name_arr = preg_split('/\s+/',$value); + + if ( count($name_arr) == 1) { + $focus->last_name = $value; + } + else { + // figure out what comes first, the last name or first name + if ( strpos($settings->default_locale_name_format,'l') > strpos($settings->default_locale_name_format,'f') ) { + $focus->first_name = array_shift($name_arr); + $focus->last_name = join(' ',$name_arr); + } + else { + $focus->last_name = array_shift($name_arr); + $focus->first_name = join(' ',$name_arr); + } + } + } + } +} \ No newline at end of file diff --git a/include/SugarFields/Fields/Html/DetailView.tpl b/include/SugarFields/Fields/Html/DetailView.tpl index bbdd3bef..e355a2d8 100644 --- a/include/SugarFields/Fields/Html/DetailView.tpl +++ b/include/SugarFields/Fields/Html/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,7 +35,7 @@ ********************************************************************************/ *} -{{$vardef.value}} +{{$vardef.value}} {{if !empty($displayParams.enableConnectors)}} -{{sugarvar_connector view='DetailView'}} +{{sugarvar_connector view='DetailView'}} {{/if}} \ No newline at end of file diff --git a/include/SugarFields/Fields/Html/SugarFieldHtml.php b/include/SugarFields/Fields/Html/SugarFieldHtml.php index cdcf6ecb..e6ab7db2 100644 --- a/include/SugarFields/Fields/Html/SugarFieldHtml.php +++ b/include/SugarFields/Fields/Html/SugarFieldHtml.php @@ -1,6 +1,6 @@ getVardefValue($vardef); $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Html/DetailView.tpl'); + return $this->fetch($this->findTemplate('DetailView')); } function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex){ $vardef['value'] = $this->getVardefValue($vardef); $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Html/DetailView.tpl'); + return $this->fetch($this->findTemplate('DetailView')); } function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { $vardef['value'] = $this->getVardefValue($vardef); $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Html/DetailView.tpl'); + return $this->fetch($this->findTemplate('DetailView')); } function getVardefValue($vardef){ diff --git a/tests/include/Expressions/Expression/Parser/Parser.php b/include/SugarFields/Fields/Id/SugarFieldId.php old mode 100755 new mode 100644 similarity index 64% rename from tests/include/Expressions/Expression/Parser/Parser.php rename to include/SugarFields/Fields/Id/SugarFieldId.php index 20bbc113..b6a42e4e --- a/tests/include/Expressions/Expression/Parser/Parser.php +++ b/include/SugarFields/Fields/Id/SugarFieldId.php @@ -1,6 +1,6 @@ addAction( - ActionFactory::getNewAction('SetValue', array('target' => 'name', 'value' => 'notAFunction(1,1)')) - ); - $focus = new Account(); - $dep->fire($focus); - $dep->setTrigger(new Trigger('falz')); - $dep->fire($focus); - $dep->setTrigger(new Trigger('isAlpha($notAField)')); - $dep->fire($focus); - //fake assert to show the test passed - $this->assertTrue(true); - } catch (Exception $e){ - $this->assertTrue(false, "Parser threw exception: {$e->getMessage()}"); + public function importSanitize( + $value, + $vardef, + $focus, + ImportFieldSanitize $settings + ) + { + if ( strlen($value) > 36 ) { + return false; } + + return $value; } -} \ No newline at end of file +} +?> \ No newline at end of file diff --git a/include/SugarFields/Fields/Iframe/DetailView.tpl b/include/SugarFields/Fields/Iframe/DetailView.tpl index 2d8eafdd..b6924a96 100644 --- a/include/SugarFields/Fields/Iframe/DetailView.tpl +++ b/include/SugarFields/Fields/Iframe/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -41,6 +41,7 @@ {{/if}} {if !empty($link) && $link != "http://"} {capture name=getStart assign=linkStart}{$link|substr:0:7}{/capture} + {/if} {{if !empty($displayParams.enableConnectors)}} diff --git a/include/SugarFields/Fields/Iframe/EditView.tpl b/include/SugarFields/Fields/Iframe/EditView.tpl index ee26db7e..90dc14b5 100644 --- a/include/SugarFields/Fields/Iframe/EditView.tpl +++ b/include/SugarFields/Fields/Iframe/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Int/DetailView.tpl b/include/SugarFields/Fields/Int/DetailView.tpl index aca47282..522ec6fc 100644 --- a/include/SugarFields/Fields/Int/DetailView.tpl +++ b/include/SugarFields/Fields/Int/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,7 +35,7 @@ ********************************************************************************/ *} - + {{if $vardef.disable_num_format}} {assign var="value" value={{sugarvar key='value' string=true}} } {$value} diff --git a/include/SugarFields/Fields/Int/EditView.tpl b/include/SugarFields/Fields/Int/EditView.tpl index f924ea71..3e364def 100644 --- a/include/SugarFields/Fields/Int/EditView.tpl +++ b/include/SugarFields/Fields/Int/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Int/RangeSearchForm.tpl b/include/SugarFields/Fields/Int/RangeSearchForm.tpl new file mode 100644 index 00000000..c0f71f0e --- /dev/null +++ b/include/SugarFields/Fields/Int/RangeSearchForm.tpl @@ -0,0 +1,107 @@ +{* +/********************************************************************************* + * SugarCRM Community Edition is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. + * + * 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. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ + +*} +{if strlen({{sugarvar key='value' string=true}}) <= 0} +{assign var="value" value={{sugarvar key='default_value' string=true}} } +{else} +{assign var="value" value={{sugarvar key='value' string=true}} } +{/if} + +{{if empty($displayParams.idName)}} +{assign var="id" value={{sugarvar key='name' string=true}} } +{{else}} +{assign var="id" value={{$displayParams.idName}} } +{{/if}} + +{if isset($smarty.request.{{$id_range_choice}})} +{assign var="starting_choice" value=$smarty.request.{{$id_range_choice}}} +{else} +{assign var="starting_choice" value="="} +{/if} + + + + + +
+ +
+
+ +{$APP.LBL_AND} + +
+
\ No newline at end of file diff --git a/include/SugarFields/Fields/Int/SearchForm.tpl b/include/SugarFields/Fields/Int/SearchForm.tpl index 26c358c1..8767a98a 100644 --- a/include/SugarFields/Fields/Int/SearchForm.tpl +++ b/include/SugarFields/Fields/Int/SearchForm.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Int/SugarFieldInt.php b/include/SugarFields/Fields/Int/SugarFieldInt.php index a9ed3331..c117de81 100644 --- a/include/SugarFields/Fields/Int/SugarFieldInt.php +++ b/include/SugarFields/Fields/Int/SugarFieldInt.php @@ -1,7 +1,7 @@ setup($parentFieldArray, $vardef, $displayParams, $tabindex); - + if($this->isRangeSearchView($vardef)) { + $id = isset($displayParams['idName']) ? $displayParams['idName'] : $vardef['name']; + $this->ss->assign('original_id', "{$id}"); + $this->ss->assign('id_range', "range_{$id}"); + $this->ss->assign('id_range_start', "start_range_{$id}"); + $this->ss->assign('id_range_end', "end_range_{$id}"); + $this->ss->assign('id_range_choice', "{$id}_range_choice"); + if(file_exists('custom/include/SugarFields/Fields/Int/RangeSearchForm.tpl')) + { + return $this->fetch('custom/include/SugarFields/Fields/Int/RangeSearchForm.tpl'); + } + return $this->fetch('include/SugarFields/Fields/Int/RangeSearchForm.tpl'); + } + + return $this->fetch($this->findTemplate('SearchForm')); + } - return $this->fetch('include/SugarFields/Fields/Int/SearchForm.tpl'); - } + /** + * @see SugarFieldBase::importSanitize() + */ + public function importSanitize( + $value, + $vardef, + $focus, + ImportFieldSanitize $settings + ) + { + $value = str_replace($settings->num_grp_sep,"",$value); + if (!is_numeric($value) || strstr($value,".")) { + return false; + } + + return $value; + } } \ No newline at end of file diff --git a/include/SugarFields/Fields/Link/DetailView.tpl b/include/SugarFields/Fields/Link/DetailView.tpl index b560fbd1..ea412b97 100644 --- a/include/SugarFields/Fields/Link/DetailView.tpl +++ b/include/SugarFields/Fields/Link/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -41,8 +41,10 @@ {{/if}} {if !empty($link)} {capture name=getStart assign=linkStart}{$link|substr:0:7}{/capture} + {{if !empty($displayParams.title)}}{sugar_translate label='{{$displayParams.title}}' module=$module}{{else}}{$link}{{/if}} -{/if} + {{if !empty($displayParams.enableConnectors)}} -{{sugarvar_connector view='DetailView'}} -{{/if}} \ No newline at end of file +{{sugarvar_connector view='DetailView'}} +{{/if}} +{/if} diff --git a/include/SugarFields/Fields/Link/EditView.tpl b/include/SugarFields/Fields/Link/EditView.tpl index 30620079..2c7d0e0e 100644 --- a/include/SugarFields/Fields/Link/EditView.tpl +++ b/include/SugarFields/Fields/Link/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Link/ListView.tpl b/include/SugarFields/Fields/Link/ListView.tpl index 86813eb4..b8594f4b 100644 --- a/include/SugarFields/Fields/Link/ListView.tpl +++ b/include/SugarFields/Fields/Link/ListView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Multienum/DetailView.tpl b/include/SugarFields/Fields/Multienum/DetailView.tpl index 55bce432..ae7bd080 100644 --- a/include/SugarFields/Fields/Multienum/DetailView.tpl +++ b/include/SugarFields/Fields/Multienum/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -36,12 +36,12 @@ *} {if !empty({{sugarvar key='value' string=true}}) && ({{sugarvar key='value' string=true}} != '^^')} + {multienum_to_array string={{sugarvar key='value' string=true}} assign="vals"} {foreach from=$vals item=item}
  • { {{sugarvar key='options' string=true}}.$item }
  • {/foreach} -{/if} {{if !empty($displayParams.enableConnectors)}} -{{sugarvar_connector view='DetailView'}} +{{sugarvar_connector view='DetailView'}} {{/if}} - +{/if} \ No newline at end of file diff --git a/include/SugarFields/Fields/Multienum/EditView.tpl b/include/SugarFields/Fields/Multienum/EditView.tpl index 14816bb5..77926bab 100644 --- a/include/SugarFields/Fields/Multienum/EditView.tpl +++ b/include/SugarFields/Fields/Multienum/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -40,6 +40,6 @@ name="{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displ {multienum_to_array string={{sugarvar key='value' string=true}} default={{sugarvar key='default' string=true}} assign="values"} diff --git a/include/SugarFields/Fields/Multienum/EditViewFunction.tpl b/include/SugarFields/Fields/Multienum/EditViewFunction.tpl index b1aab632..e8db9ec6 100644 --- a/include/SugarFields/Fields/Multienum/EditViewFunction.tpl +++ b/include/SugarFields/Fields/Multienum/EditViewFunction.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Multienum/ListView.tpl b/include/SugarFields/Fields/Multienum/ListView.tpl index d8de905e..a4ff93c5 100644 --- a/include/SugarFields/Fields/Multienum/ListView.tpl +++ b/include/SugarFields/Fields/Multienum/ListView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Multienum/SearchView.tpl b/include/SugarFields/Fields/Multienum/SearchView.tpl index 2938b01f..da926ad2 100644 --- a/include/SugarFields/Fields/Multienum/SearchView.tpl +++ b/include/SugarFields/Fields/Multienum/SearchView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Multienum/SugarFieldMultienum.php b/include/SugarFields/Fields/Multienum/SugarFieldMultienum.php index 4bb379f7..99b41fff 100644 --- a/include/SugarFields/Fields/Multienum/SugarFieldMultienum.php +++ b/include/SugarFields/Fields/Multienum/SugarFieldMultienum.php @@ -1,6 +1,6 @@ setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Multienum/EditViewFunction.tpl'); + return $this->fetch($this->findTemplate('EditViewFunction')); }else{ $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Multienum/SearchView.tpl'); + return $this->fetch($this->findTemplate('SearchView')); } } @@ -72,7 +72,7 @@ class SugarFieldMultienum extends SugarFieldBase { $bean->$field = encodeMultienumValue($params[$prefix.$field]); } - else if (isset($params[$prefix.$field.'_multiselect']) && $params[$prefix.$field.'_multiselect']==true) { + else if (isset($params[$prefix.$field.'_multiselect']) && $params[$prefix.$field.'_multiselect']==true) { // if the value in db is not empty and // if the data is not set in params (means the user has deselected everything) and // if the coorespoding multiselect flag is true @@ -81,5 +81,37 @@ class SugarFieldMultienum extends SugarFieldBase { $bean->$field = ''; } } - } -} + } + + /** + * @see SugarFieldBase::importSanitize() + */ + public function importSanitize( + $value, + $vardef, + $focus, + ImportFieldSanitize $settings + ) + { + if(!empty($value) && is_array($value)) { + $enum_list = $value; + } + else { + // If someone was using the old style multienum import technique + $value = str_replace("^","",$value); + + // We will need to break it apart to put test it. + $enum_list = explode(",",$value); + } + // parse to see if all the values given are valid + foreach ( $enum_list as $key => $enum_value ) { + $enum_list[$key] = $enum_value = trim($enum_value); + if ( parent::importSanitize($enum_value,$vardef,$focus,$settings) === false ) { + return false; + } + } + $value = encodeMultienumValue($enum_list); + + return $value; + } +} \ No newline at end of file diff --git a/include/SugarFields/Fields/Parent/DetailView.tpl b/include/SugarFields/Fields/Parent/DetailView.tpl index 0abc4f69..6dba59f0 100644 --- a/include/SugarFields/Fields/Parent/DetailView.tpl +++ b/include/SugarFields/Fields/Parent/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,7 +35,13 @@ ********************************************************************************/ *} -{{if !$nolink}}{{/if}}{{sugarvar key='value'}}{{if !$nolink}}{{/if}} +{{if !$nolink}} + + +{{/if}}{{sugarvar key='value'}}{{if !$nolink}} +{{/if}} {{if !empty($displayParams.enableConnectors)}} -{{sugarvar_connector view='DetailView'}} +{if !empty({{sugarvar key='value'}})} +{{sugarvar_connector view='DetailView'}} +{/if} {{/if}} \ No newline at end of file diff --git a/include/SugarFields/Fields/Parent/EditView.tpl b/include/SugarFields/Fields/Parent/EditView.tpl index d4fedcc6..28e52ea1 100644 --- a/include/SugarFields/Fields/Parent/EditView.tpl +++ b/include/SugarFields/Fields/Parent/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Parent/SearchView.tpl b/include/SugarFields/Fields/Parent/SearchView.tpl index 59d2d0e5..d5083b66 100644 --- a/include/SugarFields/Fields/Parent/SearchView.tpl +++ b/include/SugarFields/Fields/Parent/SearchView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Parent/SugarFieldParent.php b/include/SugarFields/Fields/Parent/SugarFieldParent.php index fa5e5bf9..ea0c13a0 100644 --- a/include/SugarFields/Fields/Parent/SugarFieldParent.php +++ b/include/SugarFields/Fields/Parent/SugarFieldParent.php @@ -1,6 +1,6 @@ ss->assign('nolink', false); } $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Parent/DetailView.tpl'); + return $this->fetch($this->findTemplate('DetailView')); } function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { @@ -80,7 +80,7 @@ class SugarFieldParent extends SugarFieldBase { $displayParams['disabled_parent_types'] = ''; $this->ss->assign('quickSearchCode', $this->createQuickSearchCode($form_name, $vardef)); $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Parent/EditView.tpl'); + return $this->fetch($this->findTemplate('EditView')); } function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { @@ -115,7 +115,33 @@ class SugarFieldParent extends SugarFieldBase { $displayParams['popupData'] = '{literal}'.$json->encode($popup_request_data).'{/literal}'; $displayParams['disabled_parent_types'] = ''; $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Parent/SearchView.tpl'); + return $this->fetch($this->findTemplate('SearchView')); + } + + /** + * @see SugarFieldBase::importSanitize() + */ + public function importSanitize( + $value, + $vardef, + $focus, + ImportFieldSanitize $settings + ) + { + global $beanList; + + if ( isset($vardef['type_name']) ) { + $moduleName = $vardef['type_name']; + if ( isset($focus->$moduleName) && isset($beanList[$focus->$moduleName]) ) { + $vardef['module'] = $focus->$moduleName; + $vardef['rname'] = 'name'; + $relatedBean = loadBean($focus->$moduleName); + $vardef['table'] = $relatedBean->table_name; + return parent::importSanitize($value,$vardef,$focus,$settings); + } + } + + return false; } function createQuickSearchCode($formName = 'EditView', $vardef){ diff --git a/include/SugarFields/Fields/Password/EditView.tpl b/include/SugarFields/Fields/Password/EditView.tpl index 23277b2e..9d42326f 100644 --- a/include/SugarFields/Fields/Password/EditView.tpl +++ b/include/SugarFields/Fields/Password/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Password/SugarFieldPassword.php b/include/SugarFields/Fields/Password/SugarFieldPassword.php new file mode 100644 index 00000000..81438245 --- /dev/null +++ b/include/SugarFields/Fields/Password/SugarFieldPassword.php @@ -0,0 +1,56 @@ + \ No newline at end of file diff --git a/include/SugarFields/Fields/Phone/DetailView.tpl b/include/SugarFields/Fields/Phone/DetailView.tpl index fd5fdabc..bfbc1721 100644 --- a/include/SugarFields/Fields/Phone/DetailView.tpl +++ b/include/SugarFields/Fields/Phone/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -37,8 +37,10 @@ *} {if !empty({{sugarvar key='value' string=true}})} {assign var="phone_value" value={{sugarvar key='value' string=true}} } -{sugar_phone value=$phone_value } -{/if} + +{sugar_phone value=$phone_value usa_format="{{if !empty($vardef.validate_usa_format)}}1{{else}}0{{/if}}"} + {{if !empty($displayParams.enableConnectors)}} -{{sugarvar_connector view='DetailView'}} -{{/if}} \ No newline at end of file +{{sugarvar_connector view='DetailView'}} +{{/if}} +{/if} \ No newline at end of file diff --git a/include/SugarFields/Fields/Phone/EditView.tpl b/include/SugarFields/Fields/Phone/EditView.tpl new file mode 100644 index 00000000..d01d3c0c --- /dev/null +++ b/include/SugarFields/Fields/Phone/EditView.tpl @@ -0,0 +1,50 @@ +{* +/********************************************************************************* + * SugarCRM Community Edition is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. + * + * 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. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ + +*} +{{capture name=idname assign=idname}}{{sugarvar key='name'}}{{/capture}} +{{if !empty($displayParams.idName)}} + {{assign var=idname value=$displayParams.idName}} +{{/if}} + +{if strlen({{sugarvar key='value' string=true}}) <= 0} +{assign var="value" value={{sugarvar key='default_value' string=true}} } +{else} +{assign var="value" value={{sugarvar key='value' string=true}} } +{/if} + + + diff --git a/include/SugarFields/Fields/Phone/ListView.tpl b/include/SugarFields/Fields/Phone/ListView.tpl index 463c9b22..20c54da1 100644 --- a/include/SugarFields/Fields/Phone/ListView.tpl +++ b/include/SugarFields/Fields/Phone/ListView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -36,4 +36,5 @@ *} {capture name=getPhone assign=phone}{sugar_fetch object=$parentFieldArray key=$col}{/capture} -{sugar_phone value=$phone } \ No newline at end of file + +{sugar_phone value=$phone usa_format=$usa_format} \ No newline at end of file diff --git a/include/SugarFields/Fields/Phone/SugarFieldPhone.php b/include/SugarFields/Fields/Phone/SugarFieldPhone.php new file mode 100644 index 00000000..2fd2c7a5 --- /dev/null +++ b/include/SugarFields/Fields/Phone/SugarFieldPhone.php @@ -0,0 +1,52 @@ + \ No newline at end of file diff --git a/include/SugarFields/Fields/Radioenum/DetailView.tpl b/include/SugarFields/Fields/Radioenum/DetailView.tpl index 46722212..4ee162cf 100644 --- a/include/SugarFields/Fields/Radioenum/DetailView.tpl +++ b/include/SugarFields/Fields/Radioenum/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,7 +35,11 @@ ********************************************************************************/ *} + { {{sugarvar key='options' string=true}}[{{sugarvar key='value' string=true}}]} + {{if !empty($displayParams.enableConnectors)}} -{{sugarvar_connector view='DetailView'}} +{if !empty({{sugarvar key='options' string=true}}[{{sugarvar key='value' string=true}}])} +{{sugarvar_connector view='DetailView'}} +{/if} {{/if}} \ No newline at end of file diff --git a/include/SugarFields/Fields/Radioenum/EditView.tpl b/include/SugarFields/Fields/Radioenum/EditView.tpl index f296dd09..fef7a30c 100644 --- a/include/SugarFields/Fields/Radioenum/EditView.tpl +++ b/include/SugarFields/Fields/Radioenum/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Readonly/SugarFieldReadonly.php b/include/SugarFields/Fields/Readonly/SugarFieldReadonly.php index da59b3ee..b1324860 100644 --- a/include/SugarFields/Fields/Readonly/SugarFieldReadonly.php +++ b/include/SugarFields/Fields/Readonly/SugarFieldReadonly.php @@ -1,6 +1,6 @@ {/if} {{/if}} -{{sugarvar key='value'}} +{{sugarvar key='value'}} {{if !$nolink && !empty($vardef.id_name)}} {if !empty({{sugarvar memberName='vardef.id_name' key='value' string='true'}})}{/if} {{/if}} diff --git a/include/SugarFields/Fields/Relate/EditView.tpl b/include/SugarFields/Fields/Relate/EditView.tpl index 446d7727..1f213bcd 100644 --- a/include/SugarFields/Fields/Relate/EditView.tpl +++ b/include/SugarFields/Fields/Relate/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Relate/SearchView.tpl b/include/SugarFields/Fields/Relate/SearchView.tpl index 02589c26..61ab2d3d 100644 --- a/include/SugarFields/Fields/Relate/SearchView.tpl +++ b/include/SugarFields/Fields/Relate/SearchView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Relate/SugarFieldRelate.php b/include/SugarFields/Fields/Relate/SugarFieldRelate.php index 3124049c..8826ec56 100644 --- a/include/SugarFields/Fields/Relate/SugarFieldRelate.php +++ b/include/SugarFields/Fields/Relate/SugarFieldRelate.php @@ -1,6 +1,6 @@ ss->assign('nolink', false); } $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Relate/DetailView.tpl'); + return $this->fetch($this->findTemplate('DetailView')); } function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { @@ -134,7 +134,7 @@ class SugarFieldRelate extends SugarFieldBase { $displayParams['readOnly'] = $displayParams['readOnly'] == false ? '' : 'READONLY'; } $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Relate/EditView.tpl'); + return $this->fetch($this->findTemplate('EditView')); } function getPopupViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex){ @@ -151,9 +151,10 @@ class SugarFieldRelate extends SugarFieldBase { if(isset($displayParams['formName'])) { $form_name = $displayParams['formName']; } - if(!empty($vardef['rname']) && $vardef['rname'] == 'user_name'){ + if(!empty($vardef['rname']) && $vardef['rname'] == 'user_name'){ $displayParams['useIdSearch'] = true; } + //Special Case for accounts; use the displayParams array and retrieve //the key and copy indexes. 'key' is the suffix of the field we are searching //the Account's address with. 'copy' is the suffix we are copying the addresses @@ -225,7 +226,7 @@ class SugarFieldRelate extends SugarFieldBase { $displayParams['readOnly'] = $displayParams['readOnly'] == false ? '' : 'READONLY'; } $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); - return $this->fetch('include/SugarFields/Fields/Relate/SearchView.tpl'); + return $this->fetch($this->findTemplate('SearchView')); } function formatField($rawField, $vardef) { @@ -251,5 +252,117 @@ class SugarFieldRelate extends SugarFieldBase { return $new_field; } + + /** + * @see SugarFieldBase::importSanitize() + */ + public function importSanitize( + $value, + $vardef, + $focus, + ImportFieldSanitize $settings + ) + { + if ( !isset($vardef['module']) ) + return false; + $newbean = loadBean($vardef['module']); + + // Bug 38885 - If we are relating to the Users table on user_name, there's a good chance + // that the related field data is the full_name, rather than the user_name. So to be sure + // let's try to lookup the field the relationship is expecting to use (user_name). + if ( $vardef['module'] == 'Users' && $vardef['rname'] == 'user_name' ) { + $userFocus = new User; + $userFocus->retrieve_by_string_fields( + array($userFocus->db->concat('users',array('first_name','last_name')) => $value )); + if ( !empty($userFocus->id) ) { + $value = $userFocus->user_name; + } + } + + // Bug 32869 - Assumed related field name is 'name' if it is not specified + if ( !isset($vardef['rname']) ) + $vardef['rname'] = 'name'; + + // Bug 27046 - Validate field against type as it is in the related field + $rvardef = $newbean->getFieldDefinition($vardef['rname']); + if ( isset($rvardef['type']) + && method_exists($this,$rvardef['type']) ) { + $fieldtype = $rvardef['type']; + $returnValue = $settings->$fieldtype($value,$rvardef); + if ( !$returnValue ) + return false; + else + $value = $returnValue; + } + + if ( isset($vardef['id_name']) ) { + $idField = $vardef['id_name']; + + // Bug 24075 - clear out id field value if it is invalid + if ( isset($focus->$idField) ) { + $checkfocus = loadBean($vardef['module']); + if ( $checkfocus && is_null($checkfocus->retrieve($focus->$idField)) ) + $focus->$idField = ''; + } + + // be sure that the id isn't already set for this row + if ( empty($focus->$idField) + && $idField != $vardef['name'] + && !empty($vardef['rname']) + && !empty($vardef['table'])) { + // Bug 27562 - Check db_concat_fields first to see if the field name is a concat + $relatedFieldDef = $newbean->getFieldDefinition($vardef['rname']); + if ( isset($relatedFieldDef['db_concat_fields']) + && is_array($relatedFieldDef['db_concat_fields']) ) + $fieldname = $focus->db->concat($vardef['table'],$relatedFieldDef['db_concat_fields']); + else + $fieldname = $vardef['rname']; + // lookup first record that matches in linked table + $query = "SELECT id + FROM {$vardef['table']} + WHERE {$fieldname} = '" . $focus->db->quote($value) . "' + AND deleted != 1"; + + $result = $focus->db->limitQuery($query,0,1,true, "Want only a single row"); + if(!empty($result)){ + if ( $relaterow = $focus->db->fetchByAssoc($result) ) + $focus->$idField = $relaterow['id']; + elseif ( !$settings->addRelatedBean + || ( $newbean->bean_implements('ACL') && !$newbean->ACLAccess('save') ) + || ( in_array($newbean->module_dir,array('Teams','Users')) ) + ) + return false; + else { + // add this as a new record in that bean, then relate + if ( isset($relatedFieldDef['db_concat_fields']) + && is_array($relatedFieldDef['db_concat_fields']) ) { + $relatedFieldParts = explode(' ',$value); + foreach ($relatedFieldDef['db_concat_fields'] as $relatedField) + $newbean->$relatedField = array_shift($relatedFieldParts); + } + else + $newbean->$vardef['rname'] = $value; + if ( !isset($focus->assigned_user_id) || $focus->assigned_user_id == '' ) + $newbean->assigned_user_id = $GLOBALS['current_user']->id; + else + $newbean->assigned_user_id = $focus->assigned_user_id; + if ( !isset($focus->modified_user_id) || $focus->modified_user_id == '' ) + $newbean->modified_user_id = $GLOBALS['current_user']->id; + else + $newbean->modified_user_id = $focus->modified_user_id; + + // populate fields from the parent bean to the child bean + $focus->populateRelatedBean($newbean); + + $newbean->save(false); + $focus->$idField = $newbean->id; + $settings->createdBeans[] = ImportFile::writeRowToLastImport( + $focus->module_dir,$newbean->object_name,$newbean->id); + } + } + } + } + + return $value; + } } -?> \ No newline at end of file diff --git a/include/SugarFields/Fields/Text/ClassicEditView.tpl b/include/SugarFields/Fields/Text/ClassicEditView.tpl index 92fac760..5b73cb2e 100644 --- a/include/SugarFields/Fields/Text/ClassicEditView.tpl +++ b/include/SugarFields/Fields/Text/ClassicEditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Text/DetailView.tpl b/include/SugarFields/Fields/Text/DetailView.tpl index a6db6434..90704bce 100644 --- a/include/SugarFields/Fields/Text/DetailView.tpl +++ b/include/SugarFields/Fields/Text/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,14 +35,15 @@ ********************************************************************************/ *} - + {{if empty($displayParams.textonly)}} {{sugarvar key='value' htmlentitydecode='true'}} {{else}} {{sugarvar key='value'}} {{/if}} - - + {{if !empty($displayParams.enableConnectors)}} -{{sugarvar_connector view='DetailView'}} +{if !empty({{sugarvar key='value'}})} +{{sugarvar_connector view='DetailView'}} +{/if} {{/if}} \ No newline at end of file diff --git a/include/SugarFields/Fields/Text/EditView.tpl b/include/SugarFields/Fields/Text/EditView.tpl index df93f8b1..82442a70 100644 --- a/include/SugarFields/Fields/Text/EditView.tpl +++ b/include/SugarFields/Fields/Text/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Text/SugarFieldText.php b/include/SugarFields/Fields/Text/SugarFieldText.php index 4573835e..9cdd56e7 100644 --- a/include/SugarFields/Fields/Text/SugarFieldText.php +++ b/include/SugarFields/Fields/Text/SugarFieldText.php @@ -1,6 +1,6 @@ ss->assign('prefix', $prefix); $this->ss->assign('field_id', $field_id); $this->ss->assign('value', $value); $this->ss->assign('tabindex', $tabindex); - + $displayParams = array(); - $displayParams['textonly'] = $rich_text ? false : true; + $displayParams['textonly'] = $rich_text ? false : true; $displayParams['maxlength'] = $maxlength; $displayParams['rows'] = $rows; $displayParams['cols'] = $cols; @@ -68,14 +68,10 @@ class SugarFieldText extends SugarFieldBase { $this->ss->assign('RICH_TEXT_EDITOR_WIDTH', $width); } else { $this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', '100px'); - $this->ss->assign('RICH_TEXT_EDITOR_WIDTH', '95%'); - } - - if(file_exists('custom/include/SugarFields/Fields/Text/ClassicEditView.tpl')) { - return $this->ss->fetch('custom/include/SugarFields/Fields/Text/ClassicEditView.tpl'); - } else { - return $this->ss->fetch('include/SugarFields/Fields/Text/ClassicEditView.tpl'); + $this->ss->assign('RICH_TEXT_EDITOR_WIDTH', '95%'); } + + return $this->ss->fetch($this->findTemplate('ClassicEditView')); } } ?> diff --git a/include/SugarFields/Fields/URL/DetailView.tpl b/include/SugarFields/Fields/URL/DetailView.tpl index 1fc5b0ed..db62d56f 100644 --- a/include/SugarFields/Fields/URL/DetailView.tpl +++ b/include/SugarFields/Fields/URL/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -41,8 +41,12 @@ {{/if}} {if !empty($link)} {capture name=getStart assign=linkStart}{$link|substr:0:7}{/capture} -{{if !empty($displayParams.title)}}{sugar_translate label='{{$displayParams.title}}' module=$module}{{else}}{$link}{{/if}} -{/if} + + +{{if !empty($displayParams.title)}}{sugar_translate label='{{$displayParams.title}}' module=$module}{{else}}{$link}{{/if}} + + {{if !empty($displayParams.enableConnectors)}} -{{sugarvar_connector view='DetailView'}} +{{sugarvar_connector view='DetailView'}} {{/if}} +{/if} diff --git a/include/SugarFields/Fields/URL/EditView.tpl b/include/SugarFields/Fields/URL/EditView.tpl index c083432d..fe75f2cf 100644 --- a/include/SugarFields/Fields/URL/EditView.tpl +++ b/include/SugarFields/Fields/URL/EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/URL/ListView.tpl b/include/SugarFields/Fields/URL/ListView.tpl index 4ef6ec66..42cb07db 100644 --- a/include/SugarFields/Fields/URL/ListView.tpl +++ b/include/SugarFields/Fields/URL/ListView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under diff --git a/include/SugarFields/Fields/Username/DetailView.tpl b/include/SugarFields/Fields/Username/DetailView.tpl index d86524a5..b36c0197 100644 --- a/include/SugarFields/Fields/Username/DetailView.tpl +++ b/include/SugarFields/Fields/Username/DetailView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -35,7 +35,9 @@ ********************************************************************************/ *} -{$fields[{{sugarvar key='salutation' stringFormat=true}}].value} {$fields[{{sugarvar key='first_name' stringFormat=true}}].value} {$fields[{{sugarvar key='last_name' stringFormat=true}}].value} + +{$fields[{{sugarvar key='salutation' stringFormat=true}}].value} {$fields[{{sugarvar key='first_name' stringFormat=true}}].value} {$fields[{{sugarvar key='last_name' stringFormat=true}}].value} + {{if !empty($displayParams.enableConnectors)}} {{sugarvar_connector view='DetailView'}} {{/if}} \ No newline at end of file diff --git a/include/SugarFields/Fields/Username/SugarFieldUsername.php b/include/SugarFields/Fields/Username/SugarFieldUsername.php index aad03671..8a2bb1eb 100644 --- a/include/SugarFields/Fields/Username/SugarFieldUsername.php +++ b/include/SugarFields/Fields/Username/SugarFieldUsername.php @@ -1,6 +1,6 @@ setup($parentFieldArray, $vardef, $displayParams, $tabindex); - global $current_language; - if(isset($current_language) && file_exists('include/SugarFields/Fields/Username/' . $current_language . '.DetailView.tpl')) { - return $this->fetch('include/SugarFields/Fields/Username/' . $current_language . '.DetailView.tpl'); - } else { - return $this->fetch('include/SugarFields/Fields/Username/DetailView.tpl'); - } //if-else + return $this->fetch($this->findTemplate('DetailView')); } } ?> diff --git a/include/SugarFields/Parsers/DetailViewMetaParser.php b/include/SugarFields/Parsers/DetailViewMetaParser.php index df6f376c..ca87a1b9 100644 --- a/include/SugarFields/Parsers/DetailViewMetaParser.php +++ b/include/SugarFields/Parsers/DetailViewMetaParser.php @@ -1,7 +1,7 @@ fatal(var_export($masterTemplateMeta['javascript'], true)); - // END SUGAR INT } return $masterTemplateMeta; diff --git a/include/SugarFields/Parsers/QuickCreateMetaParser.php b/include/SugarFields/Parsers/QuickCreateMetaParser.php index da223dd2..7956ecbe 100644 --- a/include/SugarFields/Parsers/QuickCreateMetaParser.php +++ b/include/SugarFields/Parsers/QuickCreateMetaParser.php @@ -1,7 +1,7 @@ db->query($query); - } - + } + function generateSugarsDynamicFolderQuery() { global $current_user; $type = $this->folder_type; @@ -333,7 +333,7 @@ class SugarFolder { $return = array(); $email = new Email(); //Needed for email specific functions. - + while($a = $this->db->fetchByAssoc($r)) { $temp = array(); @@ -462,8 +462,8 @@ class SugarFolder { } $rootWhere = ''; $teamSecurityClause = ''; - - + + if($sugar_config['dbconfig']['db_type'] == 'oci8') { $rootWhere .= "AND f.parent_folder IS NULL"; @@ -509,12 +509,12 @@ class SugarFolder { foreach($folders as $a) { $a['selected'] = (in_array($a['id'], $subscriptions)) ? true : false; $a['origName'] = $a['name']; - + if($a['is_group'] == 1) - if ($a['deleted'] != 1) + if ($a['deleted'] != 1) $grp[] = $a; } - + return $grp; } /** @@ -568,15 +568,19 @@ class SugarFolder { function getFoldersChildForSettings($a, $collection, $subscriptions) { $a['selected'] = (in_array($a['id'], $subscriptions)) ? true : false; $a['origName'] = $a['name']; - if( isset($a['dynamic_query']) ) - unset($a['dynamic_query']); - for($i=0; $i<$this->_depth; $i++) { + if(isset($a['dynamic_query'])) + { + unset($a['dynamic_query']); + } + + for($i=0; $i<$this->_depth; $i++) + { $a['name'] = ".".$a['name']; - } + $collection[] = $a; - + if($a['has_child'] == 1) { $this->_depth++; $qGetChildren = $this->core.$this->coreWhere."AND parent_folder = '{$a['id']}'"; @@ -585,7 +589,7 @@ class SugarFolder { $collection = $this->getFoldersChildForSettings($aGetChildren, $collection, $subscriptions); } } - + return $collection; } @@ -795,14 +799,14 @@ class SugarFolder { } // if $q = "SELECT COUNT(*) c from folders_rel where polymorphic_module = 'Emails' AND polymorphic_id = '{$id}' AND folder_id = '{$this->id}'"; - + $checkEmailQuery = "SELECT count(*) c FROM folders_rel where polymorphic_module = 'Emails' and folder_id = '{$id}' and deleted = 0"; $resultSet = $this->db->query($checkEmailQuery); $a = $this->db->fetchByAssoc($resultSet); if ($a['c'] > 0) { return false; } // if - + $q = "SELECT * FROM folders WHERE id = '{$id}'"; $r = $this->db->query($q); $a = $this->db->fetchByAssoc($r); @@ -844,22 +848,22 @@ class SugarFolder { $this->dynamic_query = $this->db->helper->escape_quote($this->dynamic_query); - if((empty($this->id) && $this->new_with_id == false) || (!empty($this->id) && $this->new_with_id == true)) + if((empty($this->id) && $this->new_with_id == false) || (!empty($this->id) && $this->new_with_id == true)) { - + if( empty($this->id) ) { $guid = create_guid(); $this->id = $guid; } - + $q = "INSERT INTO folders(id, name, folder_type, parent_folder, has_child, is_group, is_dynamic, dynamic_query, assign_to_id, ". "created_by, modified_by, deleted)". " VALUES('{$this->id}', '{$this->name}', '{$this->folder_type}', '{$this->parent_folder}', {$this->has_child}, {$this->is_group}, {$this->is_dynamic}, '{$this->dynamic_query}', '{$this->assign_to_id}', " . "'{$current_user->id}', '{$current_user->id}', 0)"; - + if($addSubscriptions) { // create default subscription @@ -869,7 +873,7 @@ class SugarFolder { // if parent_id is set, update parent's has_child flag $q3 = "UPDATE folders SET has_child = 1 WHERE id = '{$this->parent_folder}'"; $r3 = $this->db->query($q3); - } + } else { $q = "UPDATE folders SET name = '{$this->name}', parent_folder = '{$this->parent_folder}', dynamic_query = '{$this->dynamic_query}', assign_to_id = '{$this->assign_to_id}', " . "modified_by = '{$current_user->id}' WHERE id = '{$this->id}'"; @@ -887,13 +891,13 @@ class SugarFolder { function addSubscriptionsToGroupFolder() { global $current_user; - + $this->createSubscriptionForUser($current_user->id); - + } - - - + + + /** * Add subscriptions to this group folder. * @@ -904,8 +908,8 @@ class SugarFolder { $query = "INSERT INTO folders_subscriptions VALUES('{$guid2}', '{$this->id}', '{$user_id}')"; $this->db->query($query); } - - + + function updateFolder($fields) { global $current_user; diff --git a/include/SugarLogger/LoggerManager.php b/include/SugarLogger/LoggerManager.php index 0181632c..1e51a8dd 100644 --- a/include/SugarLogger/LoggerManager.php +++ b/include/SugarLogger/LoggerManager.php @@ -1,7 +1,7 @@ _oauth_config = array( + 'consumerKey' => $consumer_key, + 'consumerSecret' => $consumer_secret, + ); + if(!empty($params)) { + $this->_oauth_config = array_merge($this->_oauth_config, $params); + } + parent::__construct($this->_oauth_config); + } + + public function enableDebug() + { + return $this; + } + + public function setToken($token, $secret) + { + $this->token = array($token, $secret); + } + + public function makeRequestToken() + { + $token = new Zend_Oauth_Token_Request(); + $token->setToken($this->token[0]); + $token->setTokenSecret($this->token[1]); + return $token; + } + + public function makeAccessToken() + { + $token = new Zend_Oauth_Token_Access(); + $token->setToken($this->token[0]); + $token->setTokenSecret($this->token[1]); + return $token; + } + + public function getRequestToken($url, $callback = null, $params = array()) + { + if(!empty($callback)) { + $this->setCallbackUrl($callback); + } + list($clean_url, $query) = explode('?', $url); + if($query) { + $url = $clean_url; + parse_str($query, $query_params); + $params = array_merge($params, $query_params); + } + $this->setRequestTokenUrl($url); + try{ + $this->_last = $token = parent::getRequestToken($params); + return array('oauth_token' => $token->getToken(), 'oauth_token_secret' => $token->getTokenSecret()); + }catch(Zend_Oauth_Exception $e){ + return array('oauth_token' => '', 'oauth_token_secret' => ''); + } + } + + public function getAccessToken($url) + { + $this->setAccessTokenUrl($url); + $this->_last = $token = parent::getAccessToken($_REQUEST, $this->makeRequestToken()); + return array('oauth_token' => $token->getToken(), 'oauth_token_secret' => $token->getTokenSecret()); + } + + public function fetch($url, $params = null, $method = 'GET', $headers = null) + { + $acc = $this->makeAccessToken(); + if ( strpos($url,'?') ) { + list($clean_url, $query) = explode('?', $url); + if($query) { + $url = $clean_url; + parse_str($query, $query_params); + $params = array_merge($params?$params:array(), $query_params); + } + } + $client = $acc->getHttpClient($this->_oauth_config, $url); + $client->setMethod($method); + if(!empty($headers)) { + $client->setHeaders($headers); + } + if(!empty($params)) { + if($method == 'GET') { + $client->setParameterGet($params); + } else { + $client->setParameterPost($params); + } + } + $this->_last = $resp = $client->request(); + $this->_lastReq = $client->getLastRequest(); + return $resp->getBody(); + } + + public function getClient() + { + $acc = $this->makeAccessToken(); + return $acc->getHttpClient($this->_oauth_config); + } + + public function getLastResponse() + { + return $this->_last; + } + + public function getLastRequest() + { + return $this->_lastReq; + } + } diff --git a/include/SugarObjects/LanguageManager.php b/include/SugarObjects/LanguageManager.php index 59ca6c40..c355d5a8 100644 --- a/include/SugarObjects/LanguageManager.php +++ b/include/SugarObjects/LanguageManager.php @@ -1,6 +1,6 @@ array( array( - 'name' => 'idx_'.strtolower($table_name).'_tmst_id', + 'name' => 'idx_'.strtolower($table_name).'_tmst_id', 'type' => 'index', 'fields' => array('team_set_id') ), diff --git a/include/SugarObjects/templates/basic/Basic.php b/include/SugarObjects/templates/basic/Basic.php index dc538586..e7461601 100644 --- a/include/SugarObjects/templates/basic/Basic.php +++ b/include/SugarObjects/templates/basic/Basic.php @@ -1,6 +1,6 @@ name"; } - - function create_export_query($order_by, $where){ - return $this->create_new_list_query($order_by, $where, array(), array(), 0, '', false, $this, true); - } } \ No newline at end of file diff --git a/include/SugarObjects/templates/basic/Dashlets/Dashlet/m-n-Dashlet.meta.php b/include/SugarObjects/templates/basic/Dashlets/Dashlet/m-n-Dashlet.meta.php index 3745c449..4c06932c 100644 --- a/include/SugarObjects/templates/basic/Dashlets/Dashlet/m-n-Dashlet.meta.php +++ b/include/SugarObjects/templates/basic/Dashlets/Dashlet/m-n-Dashlet.meta.php @@ -1,7 +1,7 @@ array( 'query_type'=>'default'), 'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'), 'assigned_user_id'=> array('query_type'=>'default'), + + //Range Search Support + 'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + //Range Search Support ); ?> diff --git a/include/SugarObjects/templates/basic/metadata/dashletviewdefs.php b/include/SugarObjects/templates/basic/metadata/dashletviewdefs.php index 98ab4798..c23bff52 100644 --- a/include/SugarObjects/templates/basic/metadata/dashletviewdefs.php +++ b/include/SugarObjects/templates/basic/metadata/dashletviewdefs.php @@ -1,7 +1,7 @@ '; $searchdefs[$module_name] = array( 'templateMeta' => array( - 'maxColumns' => '3', + 'maxColumns' => '3', + 'maxColumnsBasic' => '4', 'widths' => array('label' => '10', 'field' => '30'), ), 'layout' => array( diff --git a/include/SugarObjects/templates/basic/metadata/subpanels/default.php b/include/SugarObjects/templates/basic/metadata/subpanels/default.php index 53dd7311..26deb14a 100644 --- a/include/SugarObjects/templates/basic/metadata/subpanels/default.php +++ b/include/SugarObjects/templates/basic/metadata/subpanels/default.php @@ -1,7 +1,7 @@ 'datetime', 'group'=>'created_by_name', 'comment' => 'Date record created', + 'enable_range_search' => true, + 'options' => 'date_range_search_dom', ), 'date_modified' => array ( @@ -71,6 +73,8 @@ $vardefs = array( 'type' => 'datetime', 'group'=>'modified_by_name', 'comment' => 'Date record last modified', + 'enable_range_search' => true, + 'options' => 'date_range_search_dom', ), 'modified_user_id' => array ( diff --git a/include/SugarObjects/templates/company/Company.php b/include/SugarObjects/templates/company/Company.php index 9ab87c20..b9b3e4e2 100644 --- a/include/SugarObjects/templates/company/Company.php +++ b/include/SugarObjects/templates/company/Company.php @@ -1,6 +1,6 @@ 'Any Email:', 'LBL_ANY_PHONE' => 'Any Phone:', 'LBL_ASSIGNED_TO_NAME' => 'User:', - 'LBL_RATING'=>'Rating', - 'LBL_ASSIGNED_USER'=>'Assigned to:', + 'LBL_RATING' => 'Rating', + 'LBL_ASSIGNED_TO' => 'Assigned to:', + 'LBL_ASSIGNED_USER' => 'Assigned to:', 'LBL_ASSIGNED_TO_ID' => 'Assigned to:', 'LBL_BILLING_ADDRESS_CITY' => 'Billing City:', 'LBL_BILLING_ADDRESS_COUNTRY' => 'Billing Country:', @@ -92,7 +93,8 @@ $mod_strings = array ( 'LBL_PHONE_FAX' => 'Phone Fax:', 'LBL_PHONE_OFFICE' => 'Office Phone:', 'LBL_PHONE' => 'Phone:', - 'LBL_EMAIL_ADDRESS'=>'Email Address(es)', + 'LBL_EMAIL_ADDRESS' => 'Email Address', + 'LBL_EMAIL_ADDRESSES' => 'Email Address(es)', 'LBL_POSTAL_CODE' => 'Postal Code:', 'LBL_PUSH_BILLING' => 'Push Billing', 'LBL_PUSH_SHIPPING' => 'Push Shipping', @@ -119,8 +121,8 @@ $mod_strings = array ( 'LNK_ACCOUNT_LIST' => 'Accounts', 'LNK_NEW_ACCOUNT' => 'Create Account', - 'MSG_DUPLICATE' => 'Creating this account may potentially create a duplicate account. You may either select an account from the list below or you may click on Save to continue creating a new account with the previously entered data.', - 'MSG_SHOW_DUPLICATES' => 'Creating this account may potentially create a duplicate account. You may either click on Save to continue creating this new account with the previously entered data or you may click Cancel.', + 'MSG_DUPLICATE' => 'The account record you are about to create might be a duplicate of an account record that already exists. Account records containing similar names are listed below.
    Click Create Account to continue creating this new account, or select an existing account listed below.', + 'MSG_SHOW_DUPLICATES' => 'The account record you are about to create might be a duplicate of an account record that already exists. Account records containing similar names are listed below.
    Click Save to continue creating this new account, or click Cancel to return to the module without creating the account.', 'NTC_COPY_BILLING_ADDRESS' => 'Copy billing address to shipping address', 'NTC_COPY_BILLING_ADDRESS2' => 'Copy to shipping', diff --git a/include/SugarObjects/templates/company/metadata/SearchFields.php b/include/SugarObjects/templates/company/metadata/SearchFields.php index 9bd66379..2d41a60a 100644 --- a/include/SugarObjects/templates/company/metadata/SearchFields.php +++ b/include/SugarObjects/templates/company/metadata/SearchFields.php @@ -8,7 +8,7 @@ if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -56,12 +56,29 @@ $searchFields[$module_name] = 'address_country'=> array('query_type'=>'default','db_field'=>array('billing_address_country','shipping_address_country')), 'rating'=> array('query_type'=>'default'), 'phone'=> array('query_type'=>'default','db_field'=>array('phone_office')), - 'email'=> array('query_type'=>'default','db_field'=>array('email1','email2')), + 'email'=> array( + 'query_type' => 'default', + 'operator' => 'subquery', + 'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE', + 'db_field' => array( + 'id', + ), + 'vname' =>'LBL_ANY_EMAIL', + ), 'website'=> array('query_type'=>'default'), 'ownership'=> array('query_type'=>'default'), 'employees'=> array('query_type'=>'default'), 'ticker_symbol'=> array('query_type'=>'default'), 'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'), 'assigned_user_id'=> array('query_type'=>'default'), + + //Range Search Support + 'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + //Range Search Support ); ?> diff --git a/include/SugarObjects/templates/company/metadata/dashletviewdefs.php b/include/SugarObjects/templates/company/metadata/dashletviewdefs.php index 7fa348f2..030d0730 100644 --- a/include/SugarObjects/templates/company/metadata/dashletviewdefs.php +++ b/include/SugarObjects/templates/company/metadata/dashletviewdefs.php @@ -1,7 +1,7 @@ array( 'maxColumns' => '3', + 'maxColumnsBasic' => '4', 'widths' => array('label' => '10', 'field' => '30'), ), 'layout' => array( diff --git a/include/SugarObjects/templates/company/metadata/subpanels/default.php b/include/SugarObjects/templates/company/metadata/subpanels/default.php index 57528977..755110f7 100644 --- a/include/SugarObjects/templates/company/metadata/subpanels/default.php +++ b/include/SugarObjects/templates/company/metadata/subpanels/default.php @@ -1,7 +1,7 @@ uploadfile)) + /** + * @see SugarBean::save() + */ + public function save($check_notify=false) + { + if (!empty($this->uploadfile)) { $this->filename = $this->uploadfile; - return parent::save($check_notify); + } + return parent::save($check_notify); } - - - function fill_in_additional_detail_fields(){ - - global $theme; - global $current_language; - global $timedate; + /** + * @see SugarBean::fill_in_additional_detail_fields() + */ + public function fill_in_additional_detail_fields() + { global $app_list_strings; - $this->uploadfile = $this->filename; - $mod_strings = return_module_language($current_language, $this->object_name); global $img_name; global $img_name_bare; + + $this->uploadfile = $this->filename; + + // Bug 41453 - Make sure we call the parent method as well + parent::fill_in_additional_detail_fields(); + if (!$this->file_ext) { $img_name = SugarThemeRegistry::current()->getImageURL(strtolower($this->file_ext)."_image_inline.gif"); $img_name_bare = strtolower($this->file_ext)."_image_inline"; } + //set default file name. if (!empty ($img_name) && file_exists($img_name)) { $img_name = $img_name_bare; - } else { + } + else { $img_name = "def_image_inline"; //todo change the default image. } - $this->file_url_noimage = basename(UploadFile :: get_url($this->filename, $this->id)); + $this->file_url_noimage = basename(UploadFile::get_url($this->filename, $this->id)); + if(!empty($this->status_id)) { $this->status = $app_list_strings['document_status_dom'][$this->status_id]; } - } - // need to override to have a name field created for this class - function retrieve($id = -1, $encode=true) { + /** + * @see SugarBean::retrieve() + */ + public function retrieve($id = -1, $encode=true) + { $ret_val = parent::retrieve($id, $encode); - $this->_create_proper_name_field(); - return $ret_val; - } - - function _create_proper_name_field() { - global $locale; $this->name = $this->document_name; + + return $ret_val; } } -?> diff --git a/include/SugarObjects/templates/file/controller.php b/include/SugarObjects/templates/file/controller.php index 1f721bea..6876acbe 100644 --- a/include/SugarObjects/templates/file/controller.php +++ b/include/SugarObjects/templates/file/controller.php @@ -1,7 +1,7 @@ 'Document ID', 'LBL_NAME' => 'Document Name', 'LBL_DESCRIPTION' => 'Description', + 'LBL_ASSIGNED_TO' => 'Assigned to:', 'LBL_CATEGORY' => 'Category', 'LBL_SUBCATEGORY' => 'Sub Category', 'LBL_STATUS' => 'Status', @@ -119,5 +120,4 @@ $mod_strings = array ( ); -?> - +?> \ No newline at end of file diff --git a/include/SugarObjects/templates/file/metadata/SearchFields.php b/include/SugarObjects/templates/file/metadata/SearchFields.php index 5390528c..abbc21aa 100644 --- a/include/SugarObjects/templates/file/metadata/SearchFields.php +++ b/include/SugarObjects/templates/file/metadata/SearchFields.php @@ -1,7 +1,7 @@ '] = +$module_name = ''; +$_module_name = '<_module_name>'; +$searchFields[''] = array ( 'document_name' => array( 'query_type'=>'default'), 'category_id'=> array('query_type'=>'default', 'options' => 'document_category_dom', 'template_var' => 'CATEGORY_OPTIONS'), @@ -50,7 +52,14 @@ if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 'active_date'=> array('query_type'=>'default'), 'exp_date'=> array('query_type'=>'default'), - + //Range Search Support + 'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + //Range Search Support ); ?> diff --git a/include/SugarObjects/templates/file/metadata/dashletviewdefs.php b/include/SugarObjects/templates/file/metadata/dashletviewdefs.php index 6aaad8ac..6153cbad 100644 --- a/include/SugarObjects/templates/file/metadata/dashletviewdefs.php +++ b/include/SugarObjects/templates/file/metadata/dashletviewdefs.php @@ -1,7 +1,7 @@ 'uploadfile', - 'customCode' => '{if $fields.id.value!=""} - {assign var="type" value="hidden"} - {else} - {assign var="type" value="file"} - {/if} - {$fields.filename.value}', - 'displayParams'=>array('required'=>true), - ), + array( + 'name'=>'uploadfile', + 'displayParams' => array('onchangeSetFileNameTo' => 'document_name'), + ), ), diff --git a/include/SugarObjects/templates/file/metadata/listviewdefs.php b/include/SugarObjects/templates/file/metadata/listviewdefs.php index 59f4d06f..ef43a780 100644 --- a/include/SugarObjects/templates/file/metadata/listviewdefs.php +++ b/include/SugarObjects/templates/file/metadata/listviewdefs.php @@ -1,7 +1,7 @@ 'description', 'displayParams'=>array('rows'=>10, 'cols'=>120)), diff --git a/include/SugarObjects/templates/file/metadata/searchdefs.php b/include/SugarObjects/templates/file/metadata/searchdefs.php index 3fc22725..93c82519 100644 --- a/include/SugarObjects/templates/file/metadata/searchdefs.php +++ b/include/SugarObjects/templates/file/metadata/searchdefs.php @@ -1,7 +1,7 @@ '; $searchdefs[$module_name] = array( - 'templateMeta' => array('maxColumns' => '3', + 'templateMeta' => array('maxColumns' => '3', 'maxColumnsBasic' => '4', 'widths' => array('label' => '10', 'field' => '30'), ), 'layout' => array( diff --git a/include/SugarObjects/templates/file/metadata/subpanels/default.php b/include/SugarObjects/templates/file/metadata/subpanels/default.php index 0248e4d0..6415b327 100644 --- a/include/SugarObjects/templates/file/metadata/subpanels/default.php +++ b/include/SugarObjects/templates/file/metadata/subpanels/default.php @@ -1,7 +1,7 @@ 'name', 'dbType' => 'varchar', 'len' => '255', - 'required'=>true + 'required'=>true, + 'unified_search' => true, ), 'name'=> @@ -70,6 +71,7 @@ if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 'required'=>true, 'importable' => 'required', 'len' => '255', + 'studio' => 'false', ), 'file_ext' => array ( @@ -102,6 +104,7 @@ if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 'type' => 'date', 'required'=>true, 'importable' => 'required', + 'display_default' => 'now', ), 'exp_date' => diff --git a/include/SugarObjects/templates/file/views/view.edit.php b/include/SugarObjects/templates/file/views/view.edit.php index cb44fa78..3e919fce 100644 --- a/include/SugarObjects/templates/file/views/view.edit.php +++ b/include/SugarObjects/templates/file/views/view.edit.php @@ -1,7 +1,7 @@ View extends ViewEdit{ + class ViewEdit extends ViewEdit{ function ViewEdit(){ parent::ViewEdit(); } diff --git a/include/SugarObjects/templates/issue/Issue.php b/include/SugarObjects/templates/issue/Issue.php index 15d09843..60e6a128 100644 --- a/include/SugarObjects/templates/issue/Issue.php +++ b/include/SugarObjects/templates/issue/Issue.php @@ -1,6 +1,6 @@ 'Invalid', ), ); -?> - +?> \ No newline at end of file diff --git a/include/SugarObjects/templates/issue/language/en_us.lang.php b/include/SugarObjects/templates/issue/language/en_us.lang.php index 95519361..af976e8c 100644 --- a/include/SugarObjects/templates/issue/language/en_us.lang.php +++ b/include/SugarObjects/templates/issue/language/en_us.lang.php @@ -1,7 +1,7 @@ array('query_type'=>'default','operator'=>'in'), 'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'), 'assigned_user_id'=> array('query_type'=>'default'), + 'open_only' => array( + 'query_type'=>'default', + 'db_field'=>array('status'), + 'operator'=>'not in', + 'closed_values' => array('Closed', 'Rejected', 'Duplicate'), + 'type'=>'bool', + ), + //Range Search Support + 'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + //Range Search Support ); ?> diff --git a/include/SugarObjects/templates/issue/metadata/dashletviewdefs.php b/include/SugarObjects/templates/issue/metadata/dashletviewdefs.php index 7fa348f2..030d0730 100644 --- a/include/SugarObjects/templates/issue/metadata/dashletviewdefs.php +++ b/include/SugarObjects/templates/issue/metadata/dashletviewdefs.php @@ -1,7 +1,7 @@ '; $_object_name = '<_object_name>'; $viewdefs[$module_name]['DetailView'] = array( -'templateMeta' => array('form' => array('buttons'=>array('EDIT', 'DUPLICATE', 'DELETE', - array('customCode'=>''),)), +'templateMeta' => array('form' => array('buttons'=>array('EDIT', 'DUPLICATE', 'DELETE', 'FIND_DUPLICATES',)), 'maxColumns' => '2', 'widths' => array( array('label' => '10', 'field' => '30'), diff --git a/include/SugarObjects/templates/issue/metadata/editviewdefs.php b/include/SugarObjects/templates/issue/metadata/editviewdefs.php index 61df1d9b..cf14fbaa 100644 --- a/include/SugarObjects/templates/issue/metadata/editviewdefs.php +++ b/include/SugarObjects/templates/issue/metadata/editviewdefs.php @@ -1,6 +1,6 @@ '; $searchdefs[$module_name] = array( 'templateMeta' => array( 'maxColumns' => '3', + 'maxColumnsBasic' => '4', 'widths' => array('label' => '10', 'field' => '30'), ), 'layout' => array( 'basic_search' => array( 'name', array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'), + array ('name' => 'open_only', 'label' => 'LBL_OPEN_ITEMS', 'type' => 'bool', 'default' => false, 'width' => '10%'), ), 'advanced_search' => array( $_object_name. '_number', diff --git a/include/SugarObjects/templates/issue/metadata/subpanels/default.php b/include/SugarObjects/templates/issue/metadata/subpanels/default.php index ac984442..fc500ba1 100644 --- a/include/SugarObjects/templates/issue/metadata/subpanels/default.php +++ b/include/SugarObjects/templates/issue/metadata/subpanels/default.php @@ -1,7 +1,7 @@ 'Primary State', 'LBL_PRIMARY_ADDRESS_POSTALCODE'=>'Primary Postal Code', 'LBL_PRIMARY_ADDRESS_COUNTRY' => 'Primary Address Country:', +'LBL_ALT_ADDRESS'=>'Alternate Address', 'LBL_ALT_ADDRESS_STREET'=>'Alternate Address', 'LBL_ALT_ADDRESS_STREET_2' => 'Alternate Address Street 2:', 'LBL_ALT_ADDRESS_STREET_3' => 'Alternate Address Street 3:', diff --git a/include/SugarObjects/templates/person/metadata/SearchFields.php b/include/SugarObjects/templates/person/metadata/SearchFields.php index e9c05016..be1947dd 100644 --- a/include/SugarObjects/templates/person/metadata/SearchFields.php +++ b/include/SugarObjects/templates/person/metadata/SearchFields.php @@ -1,7 +1,7 @@ array('query_type'=>'default','db_field'=>array('first_name','last_name'),'force_unifiedsearch'=>true), 'do_not_call'=> array('query_type'=>'default', 'input_type' => 'checkbox', 'operator'=>'='), 'phone'=> array('query_type'=>'default','db_field'=>array('phone_mobile','phone_work','phone_other','phone_fax','assistant_phone')), + 'email'=> array( + 'query_type' => 'default', + 'operator' => 'subquery', + 'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE', + 'db_field' => array( + 'id', + ), + 'vname' =>'LBL_ANY_EMAIL', + ), 'address_street'=> array('query_type'=>'default','db_field'=>array('primary_address_street','alt_address_street')), 'address_city'=> array('query_type'=>'default','db_field'=>array('primary_address_city','alt_address_city')), 'address_state'=> array('query_type'=>'default','db_field'=>array('primary_address_state','alt_address_state')), 'address_postalcode'=> array('query_type'=>'default','db_field'=>array('primary_address_postalcode','alt_address_postalcode')), 'address_country'=> array('query_type'=>'default','db_field'=>array('primary_address_country','alt_address_country')), 'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'), + + //Range Search Support + 'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + //Range Search Support ); ?> diff --git a/include/SugarObjects/templates/person/metadata/dashletviewdefs.php b/include/SugarObjects/templates/person/metadata/dashletviewdefs.php index 7fa348f2..030d0730 100644 --- a/include/SugarObjects/templates/person/metadata/dashletviewdefs.php +++ b/include/SugarObjects/templates/person/metadata/dashletviewdefs.php @@ -1,7 +1,7 @@ '; $searchdefs[$module_name] = array( - 'templateMeta' => array('maxColumns' => '3', + 'templateMeta' => array('maxColumns' => '3', 'maxColumnsBasic' => '4', 'widths' => array('label' => '10', 'field' => '30'), ), 'layout' => array( diff --git a/include/SugarObjects/templates/person/metadata/subpanels/default.php b/include/SugarObjects/templates/person/metadata/subpanels/default.php index 5b061ed0..cfef9f03 100644 --- a/include/SugarObjects/templates/person/metadata/subpanels/default.php +++ b/include/SugarObjects/templates/person/metadata/subpanels/default.php @@ -1,7 +1,7 @@ array('query_type'=>'default', 'operator'=>'=', 'options' => 'sales_stage_dom', 'template_var' => 'SALES_STAGE_OPTIONS', 'options_add_blank' => true), 'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'), 'assigned_user_id'=> array('query_type'=>'default'), + 'open_only' => array( + 'query_type'=>'default', + 'db_field'=>array('sales_stage'), + 'operator'=>'not in', + 'closed_values' => array('Closed Won', 'Closed Lost'), + 'type'=>'bool', + ), + //Range Search Support + 'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'range_date_closed' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'start_range_date_closed' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + 'end_range_date_closed' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), + //Range Search Support ); ?> diff --git a/include/SugarObjects/templates/sale/metadata/dashletviewdefs.php b/include/SugarObjects/templates/sale/metadata/dashletviewdefs.php index 98ab4798..c23bff52 100644 --- a/include/SugarObjects/templates/sale/metadata/dashletviewdefs.php +++ b/include/SugarObjects/templates/sale/metadata/dashletviewdefs.php @@ -1,7 +1,7 @@ '; $_object_name = '<_object_name>'; $viewdefs[$module_name]['DetailView'] = array( - 'templateMeta' => array('form' => array('buttons'=>array('EDIT', 'DUPLICATE', 'DELETE', - array('customCode'=>''),)), + 'templateMeta' => array('form' => array('buttons'=>array('EDIT', 'DUPLICATE', 'DELETE', 'FIND_DUPLICATES',)), 'maxColumns' => '2', 'widths' => array( array('label' => '10', 'field' => '30'), diff --git a/include/SugarObjects/templates/sale/metadata/editviewdefs.php b/include/SugarObjects/templates/sale/metadata/editviewdefs.php index 06d9077a..4b1857b3 100644 --- a/include/SugarObjects/templates/sale/metadata/editviewdefs.php +++ b/include/SugarObjects/templates/sale/metadata/editviewdefs.php @@ -1,7 +1,7 @@ '; $searchdefs[$module_name] = array( 'templateMeta' => array( - 'maxColumns' => '3', + 'maxColumns' => '3', 'maxColumnsBasic' => '4', 'widths' => array('label' => '10', 'field' => '30'), ), 'layout' => array( 'basic_search' => array( 'name', array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'), + array ('name' => 'open_only', 'label' => 'LBL_OPEN_ITEMS', 'type' => 'bool', 'default' => false, 'width' => '10%'), ), 'advanced_search' => array( 'name', diff --git a/include/SugarObjects/templates/sale/metadata/subpanels/default.php b/include/SugarObjects/templates/sale/metadata/subpanels/default.php index b55b57bd..5a050aba 100644 --- a/include/SugarObjects/templates/sale/metadata/subpanels/default.php +++ b/include/SugarObjects/templates/sale/metadata/subpanels/default.php @@ -1,7 +1,7 @@ 'date', 'audited'=>true, 'required' => true, - 'comment' => 'Expected or actual date the sale will close' - + 'comment' => 'Expected or actual date the sale will close', + 'enable_range_search' => true, + 'options' => 'date_range_search_dom', ), 'next_step' => array ( diff --git a/include/SugarPHPMailer.php b/include/SugarPHPMailer.php index a9fe61a3..5e028173 100644 --- a/include/SugarPHPMailer.php +++ b/include/SugarPHPMailer.php @@ -1,7 +1,7 @@ type = $type; - - } - - function setup($mainTabs, $otherTabs=array(), $subTabs=array(), $selected_group='All'){ - // TODO - prefs here - //_pp($subTabs);_pp($otherTabs); - $max_subtabs = $GLOBALS['current_user']->getPreference('max_subtabs'); - if($max_subtabs <= 0) $max_subtabs = 12; - $max_tabs = $GLOBALS['current_user']->getPreference('max_tabs'); - if($max_tabs <= 0) $max_tabs = 12; - $GLOBALS['sugar_smarty']->assign('sugartabs', array_slice($mainTabs, 0, $max_tabs)); - $GLOBALS['sugar_smarty']->assign('subtabs', array_slice($subTabs, 0, $max_subtabs)); - $GLOBALS['sugar_smarty']->assign('moreMenu', array_slice($mainTabs, $max_tabs)); - $GLOBALS['sugar_smarty']->assign('moreSubMenuName', $selected_group); - $GLOBALS['sugar_smarty']->assign('moreSubMenu', array_slice($subTabs, $max_subtabs)); - $otherMoreTabs = array(); - if(!empty($otherTabs)) - { - foreach($otherTabs as $key => $ot) - { - $otherMoreTabs[$key] = array('key' => $key, - 'tabs' => array_slice($ot['tabs'], $max_subtabs)); - $otherTabs[$key]['tabs'] = array_slice($ot['tabs'], 0, $max_subtabs); - } - } - else - { - $otherMoreTabs[$selected_group] = array('key' => $selected_group, - 'tabs' => array_slice($subTabs, $max_subtabs)); - $otherTabs[$selected_group]['tabs'] = array_slice($subTabs, 0, $max_subtabs); - } - //_pp($otherMoreTabs); - $GLOBALS['sugar_smarty']->assign('othertabs', $otherTabs); - $GLOBALS['sugar_smarty']->assign('otherMoreSubMenu', $otherMoreTabs); - $GLOBALS['sugar_smarty']->assign('startSubPanel', $selected_group); - if(!empty($mainTabs)) - { - $mtak = array_keys($mainTabs); - $GLOBALS['sugar_smarty']->assign('moreTab', $mainTabs[$mtak[min(count($mtak)-1, $max_tabs-1)]]['label']); - } - } - - function fetch(){ - return $GLOBALS['sugar_smarty']->fetch('include/SugarTabs/tpls/' . $this->type . '.tpl'); - } - function display(){ - $GLOBALS['sugar_smarty']->display('include/SugarTabs/tpls/' . $this->type . '.tpl'); - } - - -} - - - -?> diff --git a/include/SugarTabs/tpls/singletabmenu.tpl b/include/SugarTabs/tpls/singletabmenu.tpl deleted file mode 100644 index da581804..00000000 --- a/include/SugarTabs/tpls/singletabmenu.tpl +++ /dev/null @@ -1,220 +0,0 @@ -{* - -/********************************************************************************* - * SugarCRM is a customer relationship management program developed by - * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. - * - * 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. If the display of the logo is not reasonably feasible for - * technical reasons, the Appropriate Legal Notices must display the words - * "Powered by SugarCRM". - ********************************************************************************/ - - - - -*} - - - - - -
    -{$fields.{{$displayParams.key}}_address_street.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
    -{$fields.{{$displayParams.key}}_address_city.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br} {$fields.{{$displayParams.key}}_address_state.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}  {$fields.{{$displayParams.key}}_address_postalcode.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
    -{$fields.{{$displayParams.key}}_address_country.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br} +
    + + + + +{$fields.{{$displayParams.key}}_address_street.value|escape:'htmlentitydecode'|escape:'html'|url2html|nl2br}
    +{$fields.{{$displayParams.key}}_address_city.value|escape:'htmlentitydecode'|escape:'html'|url2html|nl2br} {$fields.{{$displayParams.key}}_address_state.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}  {$fields.{{$displayParams.key}}_address_postalcode.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
    +{$fields.{{$displayParams.key}}_address_country.value|escape:'htmlentitydecode'|escape:'html'|url2html|nl2br}
    diff --git a/include/SugarFields/Fields/Address/en_us.EditView.tpl b/include/SugarFields/Fields/Address/en_us.EditView.tpl index 9f1d2469..5db40e46 100644 --- a/include/SugarFields/Fields/Address/en_us.EditView.tpl +++ b/include/SugarFields/Fields/Address/en_us.EditView.tpl @@ -1,6 +1,6 @@ {* /********************************************************************************* - * SugarCRM is a customer relationship management program developed by + * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under @@ -120,7 +120,7 @@ {sugar_translate label='LBL_COPY_ADDRESS_FROM_LEFT' module=''}: - +
    - {if !empty($sugartabs)} - - {foreach from=$sugartabs item=tab} - - {/foreach} - - - - {/if} - - - -
    - - - - {capture assign="tabImage"}{$tab.type}Tab_left.gif{/capture} - - - - - - -
    {$tab.label}{$tab.label}{$tab.label}
    -
    - {if !empty($moreMenu)} - - {/if} -  
    - - - - {foreach from=$subtabs item=tab} - {if !empty($notFirst) && ($notFirst != 0) && ($notFirst != 1)} - - {else} - {assign var='notFirst' value='2'} - {/if} - - {/foreach} - {if !empty($otherMoreSubMenu[$moreSubMenuName].tabs)} - - {/if} - - - -
    | - {$tab.label} - |  >> 
    -
    - -{if !empty($moreMenu)} - -{/if} - -{foreach from=$otherMoreSubMenu item=group} -{if !empty($group.tabs)} - -{/if} -{/foreach} - - diff --git a/include/SugarTheme/SugarTheme.php b/include/SugarTheme/SugarTheme.php index d8c0aa44..32c590be 100644 --- a/include/SugarTheme/SugarTheme.php +++ b/include/SugarTheme/SugarTheme.php @@ -1,7 +1,7 @@ _jsCache = sugar_cache_retrieve('theme_'.$this->dirName.'_jsCache'); - $this->_cssCache = sugar_cache_retrieve('theme_'.$this->dirName.'_cssCache'); - $this->_imageCache = sugar_cache_retrieve('theme_'.$this->dirName.'_imageCache'); - $this->_templateCache = sugar_cache_retrieve('theme_'.$this->dirName.'_templateCache'); - } - // otherwise, see if we serialized them to a file - elseif ( sugar_is_file($GLOBALS['sugar_config']['cache_dir'].$this->getFilePath().'/pathCache.php') ) { - $caches = unserialize(file_get_contents($GLOBALS['sugar_config']['cache_dir'].$this->getFilePath().'/pathCache.php')); + if ( sugar_is_file($GLOBALS['sugar_config']['cache_dir'].$this->getFilePath().'/pathCache.php') ) { + $caches = unserialize(sugar_file_get_contents($GLOBALS['sugar_config']['cache_dir'].$this->getFilePath().'/pathCache.php')); if ( isset($caches['jsCache']) ) $this->_jsCache = $caches['jsCache']; if ( isset($caches['cssCache']) ) @@ -309,39 +313,14 @@ class SugarTheme set_include_path(realpath(dirname(__FILE__) . '/../..') . PATH_SEPARATOR . get_include_path()); chdir(realpath(dirname(__FILE__) . '/../..')); - // Bug 30807/30808 - Re-setup the external cache since the object isn't there when calling this method. - $GLOBALS['external_cache_checked'] = false; - check_cache(); - // clear out the cache on destroy if we are asked to if ( $this->_clearCacheOnDestroy ) { if (is_file($GLOBALS['sugar_config']['cache_dir'].$this->getFilePath().'/pathCache.php')) unlink($GLOBALS['sugar_config']['cache_dir'].$this->getFilePath().'/pathCache.php'); - if ( $GLOBALS['external_cache_enabled'] - && $GLOBALS['external_cache_type'] != 'base-in-memory' ) { - sugar_cache_clear('theme_'.$this->dirName.'_jsCache'); - sugar_cache_clear('theme_'.$this->dirName.'_cssCache'); - sugar_cache_clear('theme_'.$this->dirName.'_imageCache'); - sugar_cache_clear('theme_'.$this->dirName.'_templateCache'); - } } elseif ( !inDeveloperMode() ) { - // push our cache into the sugar cache - if ( $GLOBALS['external_cache_enabled'] - && $GLOBALS['external_cache_type'] != 'base-in-memory' ) { - // only update the caches if they have been changed in this request - if ( count($this->_jsCache) != $this->_initialCacheSize['jsCache'] ) - sugar_cache_put('theme_'.$this->dirName.'_jsCache',$this->_jsCache); - if ( count($this->_cssCache) != $this->_initialCacheSize['cssCache'] ) - sugar_cache_put('theme_'.$this->dirName.'_cssCache',$this->_cssCache); - if ( count($this->_imageCache) != $this->_initialCacheSize['imageCache'] ) - sugar_cache_put('theme_'.$this->dirName.'_imageCache',$this->_imageCache); - if ( count($this->_templateCache) != $this->_initialCacheSize['templateCache'] ) - sugar_cache_put('theme_'.$this->dirName.'_templateCache',$this->_templateCache); - } - // fallback in case there is no useful external caching available // only update the caches if they have been changed in this request - elseif ( count($this->_jsCache) != $this->_initialCacheSize['jsCache'] + if ( count($this->_jsCache) != $this->_initialCacheSize['jsCache'] || count($this->_cssCache) != $this->_initialCacheSize['cssCache'] || count($this->_imageCache) != $this->_initialCacheSize['imageCache'] || count($this->_templateCache) != $this->_initialCacheSize['templateCache'] @@ -360,14 +339,6 @@ class SugarTheme } } - // clear out the cache if we are in developerMode - // ( so it will be freshly rebuilt for the next load ) - elseif ( $GLOBALS['external_cache_enabled'] ) { - sugar_cache_clear('theme_'.$this->dirName.'_jsCache'); - sugar_cache_clear('theme_'.$this->dirName.'_cssCache'); - sugar_cache_clear('theme_'.$this->dirName.'_imageCache'); - sugar_cache_clear('theme_'.$this->dirName.'_templateCache'); - } } /** @@ -417,6 +388,7 @@ class SugarTheme return array( 'name', 'description', + 'directionality', 'dirName', 'parentTheme', 'version', @@ -425,6 +397,7 @@ class SugarTheme 'barChartColors', 'pieChartColors', 'group_tabs', + 'ignoreParentFiles', ); } @@ -561,7 +534,7 @@ class SugarTheme $font = $this->fonts[0]; $html .= ''; } - + return $html; } @@ -736,7 +709,7 @@ EOHTML; $addJSPath = true ) { - if ( isset($this->_cssCache[$cssFileName]) ) { + if ( isset($this->_cssCache[$cssFileName])) { if ( $addJSPath ) return getJSPath($this->_cssCache[$cssFileName]); else @@ -774,7 +747,6 @@ EOHTML; // if this is the style.css file, prepend the base.css and calendar-win2k-cold-1.css // files before the theme styles if ( $cssFileName == 'style.css' && !isset($this->parentTheme) ) { - $cssFileContents = file_get_contents('jscalendar/calendar-win2k-cold-1.css') . $cssFileContents; if ( inDeveloperMode() ) $cssFileContents = file_get_contents('include/javascript/yui/build/base/base.css') . $cssFileContents; else @@ -810,7 +782,7 @@ EOHTML; $addJSPath = true ) { - if ( isset($this->_jsCache[$jsFileName]) ) { + if ( isset($this->_jsCache[$jsFileName])) { if ( $addJSPath ) return getJSPath($this->_jsCache[$jsFileName]); else @@ -821,7 +793,7 @@ EOHTML; if (isset($this->parentTheme) && SugarThemeRegistry::get($this->parentTheme) instanceOf SugarTheme - && ($filename = SugarThemeRegistry::get($this->parentTheme)->getJSURL($jsFileName,false)) != '') + && ($filename = SugarThemeRegistry::get($this->parentTheme)->getJSURL($jsFileName,false)) != '' && !in_array($jsFileName,$this->ignoreParentFiles)) $jsFileContents .= file_get_contents($filename); else { if (sugar_is_file($this->getDefaultJSPath().'/'.$jsFileName)) @@ -842,7 +814,7 @@ EOHTML; $jsFilePath = create_cache_directory($this->getJSPath()."/$jsFileName"); // minify the js - if ( !inDeveloperMode() && !sugar_is_file(str_replace('.js','-min.js',$jsFilePath)) ) { + if ( !inDeveloperMode()&& !sugar_is_file(str_replace('.js','-min.js',$jsFilePath)) ) { $jsFileContents = JSMin::minify($jsFileContents); $jsFilePath = str_replace('.js','-min.js',$jsFilePath); } @@ -879,7 +851,7 @@ EOHTML; foreach ( $pathsToSearch as $path ) { if (!sugar_is_dir($path)) $path = "custom/$path"; - if (sugar_is_dir($path) && $dir = opendir($path)) { + if (sugar_is_dir($path) && is_readable($path) && $dir = opendir($path)) { while (($file = readdir($dir)) !== false) { if ($file == ".." || $file == "." @@ -999,6 +971,7 @@ class SugarThemeRegistry /** * Returns the current theme object * + * @return SugarTheme object */ public static function current() { @@ -1008,6 +981,23 @@ class SugarThemeRegistry return self::$_themes[self::$_currentTheme]; } + /** + * Returns the default theme object + * + * @return SugarTheme object + */ + public static function getDefault() + { + if ( !isset(self::$_currentTheme) ) + self::buildRegistry(); + + if ( isset($GLOBALS['sugar_config']['default_theme']) && self::exists($GLOBALS['sugar_config']['default_theme']) ) { + return self::get($GLOBALS['sugar_config']['default_theme']); + } + + return self::get(array_pop(array_keys(self::availableThemes()))); + } + /** * Returns true if a theme object specified by the given $themeName exists in the registry * @@ -1057,7 +1047,7 @@ class SugarThemeRegistry } foreach ($dirs as $dirPath ) { - if (sugar_is_dir('./'.$dirPath) && $dir = opendir('./'.$dirPath)) { + if (sugar_is_dir('./'.$dirPath) && is_readable('./'.$dirPath) && $dir = opendir('./'.$dirPath)) { while (($file = readdir($dir)) !== false) { if ($file == ".." || $file == "." @@ -1091,7 +1081,7 @@ class SugarThemeRegistry } // default to setting the default theme as the current theme - if ( !self::set($GLOBALS['sugar_config']['default_theme']) ) { + if ( !isset($GLOBALS['sugar_config']['default_theme']) || !self::set($GLOBALS['sugar_config']['default_theme']) ) { if ( count(self::availableThemes()) == 0 ) sugar_die('No valid themes are found on this instance'); else diff --git a/include/SugarTheme/getImage.php b/include/SugarTheme/getImage.php index 91bcbbda..a58a8868 100644 --- a/include/SugarTheme/getImage.php +++ b/include/SugarTheme/getImage.php @@ -1,7 +1,7 @@ 0){ $_REQUEST['imageName'] = str_replace('..', '.', $_REQUEST['imageName']); } $filename = SugarThemeRegistry::current()->getImageURL($_REQUEST['imageName']); -if ( empty($filename) ) { +if ( empty($filename) ) { header($_SERVER["SERVER_PROTOCOL"].' 404 Not Found'); die; } @@ -57,7 +56,7 @@ $file_ext = substr($filename,-3); $extensions = SugarThemeRegistry::current()->imageExtensions; if(!in_array($file_ext, $extensions)){ header($_SERVER["SERVER_PROTOCOL"].' 404 Not Found'); - die; + die; } @@ -73,16 +72,17 @@ header("Cache-Control: private"); header("Pragma: dummy=bogus"); header("Etag: $etag"); -$ifmod = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) - ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $last_modified_time : null; -$iftag = isset($_SERVER['HTTP_IF_NONE_MATCH']) - ? $_SERVER['HTTP_IF_NONE_MATCH'] == $etag : null; -if (($ifmod || $iftag) && ($ifmod !== false && $iftag !== false)) { - header($_SERVER["SERVER_PROTOCOL"].' 304 Not Modified'); - die; +$ifmod = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) + ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $last_modified_time : null; +$iftag = isset($_SERVER['HTTP_IF_NONE_MATCH']) + ? $_SERVER['HTTP_IF_NONE_MATCH'] == $etag : null; +if (($ifmod || $iftag) && ($ifmod !== false && $iftag !== false)) { + header($_SERVER["SERVER_PROTOCOL"].' 304 Not Modified'); + die; } -header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 86400) . 'GMT'); -header("Last-Modified: ".gmdate("D, d M Y H:i:s", $last_modified_time)." GMT"); + +header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 86400)); +header("Last-Modified: ".gmdate('D, d M Y H:i:s \G\M\T', $last_modified_time)); // now send the content if ( substr($filename,-3) == 'gif' ) diff --git a/include/SugarTinyMCE.php b/include/SugarTinyMCE.php index 05a0aef3..376e3a57 100644 --- a/include/SugarTinyMCE.php +++ b/include/SugarTinyMCE.php @@ -1,7 +1,7 @@ defaultConfig; + $config['directionality'] = SugarThemeRegistry::current()->directionality; $config['elements'] = $targets; $config['theme_advanced_buttons1'] = $this->buttonConfigs['default']['buttonConfig']; $config['theme_advanced_buttons2'] = $this->buttonConfigs['default']['buttonConfig2']; diff --git a/include/Sugar_Smarty.php b/include/Sugar_Smarty.php index 99546f2c..65d7283b 100644 --- a/include/Sugar_Smarty.php +++ b/include/Sugar_Smarty.php @@ -1,7 +1,7 @@ getQSCampaigns(); } else if($matches[0] == 'Users'){ - if($field['name'] == 'reports_to_name') + if($field['name'] == 'reports_to_name') { $sqs_objects[$name] = $qsd->getQSUser('reports_to_name','reports_to_id'); + } + // Bug 34643 - Default what the options should be for the assigned_user_name field + // and then pass thru the fields to be used in the fielddefs. + elseif($field['name'] == 'assigned_user_name') { + $sqs_objects[$name] = $qsd->getQSUser('assigned_user_name','assigned_user_id'); + } else { - if ($view == "ConvertLead") - $sqs_objects[$name] = $qsd->getQSUser($field['name'], $field['id_name']); - else - $sqs_objects[$name] = $qsd->getQSUser(); - } + $sqs_objects[$name] = $qsd->getQSUser($field['name'], $field['id_name']); + } } else if($matches[0] == 'Campaigns') { $sqs_objects[$name] = $qsd->getQSCampaigns(); } else if($matches[0] == 'Accounts') { diff --git a/include/TimeDate.php b/include/TimeDate.php index b842d78a..875d4fcc 100644 --- a/include/TimeDate.php +++ b/include/TimeDate.php @@ -1,7 +1,7 @@ '[ap]m', - 'A' => '[AP]M', - 'd' => '[0-9]{1,2}', - 'h' => '[0-9]{1,2}', - 'H' => '[0-9]{1,2}', - 'i' => '[0-9]{1,2}', - 'm' => '[0-9]{1,2}', - 'Y' => '[0-9]{4}', - 's' => '[0-9]{1,2}' - ); + * + * New Time & Date handling class + * Migration notes: + * - to_db_time() requires either full datetime or time, won't work with just date + * The reason is that it's not possible to know if short string has only date or only time, + * and it makes more sense to assume time for the time conversion function. + */ +class TimeDate +{ + const DB_DATE_FORMAT = 'Y-m-d'; + const DB_TIME_FORMAT = 'H:i:s'; + // little optimization + const DB_DATETIME_FORMAT = 'Y-m-d H:i:s'; + const RFC2616_FORMAT = 'D, d M Y H:i:s \G\M\T'; + + // Standard DB date/time formats + // they are constant, vars are for compatibility + public $dbDayFormat = self::DB_DATE_FORMAT; + public $dbTimeFormat = self::DB_TIME_FORMAT; - /** - * Map the tokens passed into this as a "format" string to - * PHP's internal date() format string values. - * - * @var array - * @access private - * @see build_format() - */ - private $time_token_map = array( - 'a' => 'a', // meridiem: am or pm - 'A' => 'A', // meridiem: AM or PM - 'd' => 'd', // days: 1 through 31 - 'h' => 'h', // hours: 01 through 12 - 'H' => 'H', // hours: 00 through 23 - 'i' => 'i', // minutes: 00 through 59 - 'm' => 'm', // month: 1 - 12 - 'Y' => 'Y', // year: four digits - 's' => 's', // seconds - ); - - /** - * The current timezone information for the current user + /** + * Regexp for matching format elements * @var array */ - private $current_user_timezone = null; + protected static $format_to_regexp = array( + 'a' => '[ ]*[ap]m', + 'A' => '[ ]*[AP]M', + 'd' => '[0-9]{1,2}', + 'j' => '[0-9]{1,2}', + 'h' => '[0-9]{1,2}', + 'H' => '[0-9]{1,2}', + 'g' => '[0-9]{1,2}', + 'G' => '[0-9]{1,2}', + 'i' => '[0-9]{1,2}', + 'm' => '[0-9]{1,2}', + 'n' => '[0-9]{1,2}', + 'Y' => '[0-9]{4}', + 's' => '[0-9]{1,2}', + 'F' => '\w+', + "M" => '[\w]{1,3}', + ); /** - * The current user timezone adjustment - * @var int + * Relation between date() and strftime() formats + * @var array */ - private $current_user_adjustment = null; + public static $format_to_str = array( + // date + 'Y' => '%Y', + + 'm' => '%m', + 'M' => '%b', + 'F' => '%B', + 'n' => '%m', + + 'd' => '%d', + //'j' => '%e', + // time + 'a' => '%P', + 'A' => '%p', + + 'h' => '%I', + 'H' => '%H', + //'g' => '%l', + //'G' => '%H', + + 'i' => '%M', + 's' => '%S', + ); + /** - * The target TZ for current user timezone adjustment - * @var array + * GMT timezone object + * + * @var DateTimeZone + */ + protected static $gmtTimezone; + + /** + * Current time + * @var SugarDateTime + */ + protected $now; + + /** + * The current user + * + * @var User + */ + protected $user; + + /** + * Current user's ID + * + * @var string + */ + protected $current_user_id; + /** + * Current user's TZ + * @var DateTimeZone */ - private $current_user_adjustment_tz = null; + protected $current_user_tz; /** - * Default midnight string in user format + * Separator for current user time format + * * @var string */ - private $default_midnight = null; + protected $time_separator; /** - * For testability - disallow using cache + * Always consider user TZ to be GMT and date format DB format - for SOAP etc. + * * @var bool */ + protected $always_db = false; + + /** + * Global instance of TimeDate + * @var TimeDate + */ + protected static $timedate; + public $allow_cache = true; + public function __construct(User $user = null) + { + if (self::$gmtTimezone == null) { + self::$gmtTimezone = new DateTimeZone("UTC"); + } + $this->now = new SugarDateTime(); + $this->tzGMT($this->now); + $this->user = $user; + } + /** - * Constructor + * Set flag specifying we should always use DB format + * @param bool $flag + * @return TimeDate */ - public function __construct() + public function setAlwaysDb($flag = true) { - // avoids a potential E_STRICT warning when using any date function - if ( function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) - date_default_timezone_set(@date_default_timezone_get()); + $this->always_db = $flag; + $this->clearCache(); + return $this; } - /** - * Returns the current users timezone info or another user; - * - * @param User $user user object for which you want to display, null for current user - * @return Array of timezone info - */ - public function getUserTimeZone($user = null){ - global $timezones, $current_user; - $usertimezone = array(); - if(empty($user) || (!empty($user->id) && $user->id == $current_user->id)) { - if(isset($this->current_user_timezone)) return $this->current_user_timezone; // current user, return saved timezone info - $user = $current_user; - } + /** + * Get "always use DB format" flag + * @return bool + */ + public function isAlwaysDb() + { + return !empty($GLOBALS['disable_date_format']) || $this->always_db; + } - if(isset($user)) - { - if($usertimezone = $user->getPreference('timezone')) { - if(empty($timezones[$usertimezone])) { - $GLOBALS['log']->fatal('TIMEZONE:NOT DEFINED-'. $usertimezone); - $usertimezone = array(); - } else { - $usertimezone = $timezones[$usertimezone]; - } - } - } + /** + * Get TimeDate instance + * @return TimeDate + */ + public static function getInstance() + { + if(empty(self::$timedate)) { + if(ini_get('date.timezone') == '') { + // Remove warning about default timezone + date_default_timezone_set(@date('e')); + try { + $tz = self::guessTimezone(); + } catch(Exception $e) { + $tz = "UTC"; // guess failed, switch to UTC + } + if(isset($GLOBALS['log'])) { + $GLOBALS['log']->fatal("Configuration variable date.timezone is not set, guessed timezone $tz. Please set date.timezone=\"$tz\" in php.ini!"); + } + date_default_timezone_set($tz); + } + self::$timedate = new self; + } + return self::$timedate; + } - if(!empty($user->id) && $user->id == $current_user->id) $this->current_user_timezone = $usertimezone; // save current_user - return $usertimezone; - } + /** + * Set current user for this object + * + * @param $user + * @return TimeDate + */ + public function setUser(User $user = null) + { + $this->user = $user; + $this->clearCache(); + return $this; + } - /** - * @deprecated for public use - * function adjustmentForUserTimeZone() - * this returns the adjustment for a user against the server time - * - * @param array $timezone_to_adjust pass in a timezone to adjust for - * @return integer number of minutes to adjust a time by to get the appropriate time for the user - */ - public function adjustmentForUserTimeZone($timezone_to_adjust = null){ - if(isset($this->current_user_adjustment) && $this->current_user_adjustment_tz == $timezone_to_adjust){ - return $this->current_user_adjustment; - } + /** + * Figure out what the required user is + * + * The order is: supplied parameter, TimeDate's user, global current user + * + * @param User $user + * @return User + */ + protected function _getUser(User $user = null) + { + if (empty($user)) { + $user = $this->user; + } + if (empty($user)) { + $user = $GLOBALS['current_user']; + } + return $user; + } - $adjustment = 0; - $this->current_user_adjustment_tz = $timezone_to_adjust; + /** + * Get timezone for the specified user + * + * @param User $user + * @return DateTimeZone + */ + protected function _getUserTZ(User $user = null) + { + $user = $this->_getUser($user); - if(empty($timezone_to_adjust)) { - $timezone = $this->getUserTimeZone(); - } else { - $timezone = $timezone_to_adjust; - } - if(empty($timezone)) { - return $adjustment; - } + if (empty($user) || $this->isAlwaysDb()) { + return self::$gmtTimezone; + } - $server_offset = date('Z')/60; - $server_in_ds = date('I'); - $user_in_ds = $this->inDST(date('Y-m-d H:i:s'), $timezone); - $user_offset = $timezone['gmtOffset'] ; + if ($this->allow_cache && $user->id == $this->current_user_id && ! empty($this->current_user_tz)) { + // current user is cached + return $this->current_user_tz; + } - //compensate for ds for user - if($user_in_ds) { - $user_offset += 60; - } + try { + $usertimezone = $user->getPreference('timezone'); + if(empty($usertimezone)) { + return self::$gmtTimezone; + } + $tz = new DateTimeZone($usertimezone); + } catch (Exception $e) { + $GLOBALS['log']->fatal('Unknown timezone: ' . $usertimezone); + return self::$gmtTimezone; + } - //either both + or - - $adjustment += $server_offset - $user_offset; - if(empty($timezone_to_adjust)) $this->current_user_adjustment = $adjustment; // save current_user adj + if (empty($this->current_user_id)) { + $this->current_user_id = $user->id; + $this->current_user_tz = $tz; + } - return $adjustment; - } + return $tz; + } - /** - * @deprecated for public use - * function getWeekDayName($indexOfDay) - * Returns a days name - * - * @param INT(WEEKDAY INDEX) $indexOfDay - * @return STRING representing the given weekday - */ - function getWeekDayName($indexOfDay){ - static $dow = array ( 'sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday' ); - return $dow[$indexOfDay]; - } - /** - * @deprecated for public use - * function getMonthName($indexMonth) - * Returns a Months Name - * - * @param INT(MONTH INDEX) $indexMonth - * @return STRING representation of the month - */ - function getMonthName($indexMonth){ - static $months = array ( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ); - return $months[$indexMonth]; - } + /** + * Clears all cached data regarding current user + */ + public function clearCache() + { + $this->current_user_id = null; + $this->current_user_tz = null; + $this->time_separator = null; + $this->now = new SugarDateTime(); + } - /** - * @deprecated for public use - * function getDateFromRules($year, $startMonth, $startDate, $weekday, $startTime ) - * Converts the rules for a timezones dst into a string representation of a date for the given year - * - * @param STRING(YEAR) $year - * @param INT(MONTH INDEX) $startMonth - * @param INT(DATE INDEX) $startDate - * @param INT(WEEKDAY INDEX) $weekday - * @param INT(START TIME IN SECONDS) $startTime - * @return unknown - */ - function getDateFromRules($year, $startMonth, $startDate, $weekday, $startTime ){ - if($weekday < 0)return date( 'Y-m-d H:i:s', strtotime("$year-$startMonth-$startDate") + $startTime); - $dayname = self::getWeekDayName($weekday); - if($startDate > 0)$startMonth--; - $month = self::getMonthName($startMonth); - $startWeek = floor($startDate/7); - //echo "$startWeek week $dayname - $month 1, $year
    "; - return date( 'Y-m-d H:i:s', strtotime( "$startWeek week $dayname", strtotime( "$month 1, $year" ) ) + $startTime ); + /** + * Get user date format. + * @todo add caching + * + * @param [User] $user user object, current user if not specified + * @return string + */ + public function get_date_format(User $user = null) + { + $user = $this->_getUser($user); - } + if (empty($user) || $this->isAlwaysDb()) { + return self::DB_DATE_FORMAT; + } - /** - * @deprecated for public use - * function getDSTRange($year, $zone) - * - * returns the start and end date for dst for a given timezone and year or false if that zone doesn't support dst - * - * @param STRING(Year e.g. 2005) $year - * @param ARRAY (TIME ZONE INFO) $zone - * @return ARRAY OF DATE REPRESENTING THE START AND END OF DST or FALSE if the zone doesn't support dst - */ - function getDSTRange($year, $zone){ - $range = array(); - if(empty($zone['dstOffset'])){ - return false; - } + $datef = $user->getPreference('datef'); + if(empty($datef) && isset($GLOBALS['current_user']) && $GLOBALS['current_user'] !== $user) { + // if we got another user and it has no date format, try current user + $datef = $GLOBALS['current_user']->getPreference('datef'); + } + if (empty($datef)) { + $datef = $GLOBALS['sugar_config']['default_date_format']; + } + if (empty($datef)) { + $datef = ''; + } - $range['start'] = $this->getDateFromRules($year, $zone['dstMonth'], $zone['dstStartday'], $zone['dstWeekday'], $zone['dstStartTimeSec']); - $range['end'] = $this->getDateFromRules($year, $zone['stdMonth'], $zone['stdStartday'], $zone['stdWeekday'], $zone['stdStartTimeSec']); - return $range; - } + return $datef; + } - /** - * @deprecated for public use - * - * Is the date in DST or not - * @param $date - * @param $zone - */ - function inDST($date, $zone){ - $datetime = explode(' ', $date); - $dateSplit = explode('-', $datetime[0]); - if(empty($dateSplit[2]))return false; - $dstRange = $this->getDSTRange($dateSplit[0], $zone); - if(!$dstRange){ - return false; - } - $datestamp = strtotime($date); - $startstamp = strtotime($dstRange['start']); - $endstamp = strtotime($dstRange['end']); - if((($datestamp >= $startstamp || $datestamp < $endstamp) && $startstamp > $endstamp) - || ($datestamp >= $startstamp && $datestamp < $endstamp) - ){ - return true; - } - return false; - } + /** + * Get user time format. + * @todo add caching + * + * @param User $user user object, current user if not specified + * @return string + */ + public function get_time_format(/*User*/ $user = null) + { + if(is_bool($user) || func_num_args() > 1) { + // BC dance - old signature was boolean, User + $GLOBALS['log']->fatal('TimeDate::get_time_format(): Deprecated API used, please update you code - get_time_format() now has one argument of type User'); + if(func_num_args() > 1) { + $user = func_get_arg(1); + } else { + $user = null; + } + } + $user = $this->_getUser($user); - /** - * Create regexp from datetime format - * @param string $format - * @return string Regular expression string - */ - function get_regular_expression($format) { - $newFormat = ''; - $regPositions = array(); - $ignoreNextChar = false; - $count = 1; - $format_characters = str_split($format, 1); - foreach ($format_characters as $char) { - if (!$ignoreNextChar && isset($this->supported_strings[$char])) { - $newFormat.= '('.$this->supported_strings[$char].')'; - $regPositions[$char] = $count; - $count++; - } else { - $ignoreNextChar = false; - - $newFormat.= $char; + if (empty($user) || $this->isAlwaysDb()) { + return self::DB_TIME_FORMAT; + } - } - if ($char == "\\") { - $ignoreNextChar = true; - } - } + $timef = $user->getPreference('timef'); + if(empty($timef) && isset($GLOBALS['current_user']) && $GLOBALS['current_user'] !== $user) { + // if we got another user and it has no time format, try current user + $timef = $GLOBALS['current_user']->getPreference('$timef'); + } + if (empty($timef)) { + $timef = $GLOBALS['sugar_config']['default_time_format']; + } + if (empty($timef)) { + $timef = ''; + } + return $timef; + } - return array('format'=>$newFormat, 'positions'=>$regPositions); + /** + * Get user datetime format. + * @todo add caching + * + * @param [User] $user user object, current user if not specified + * @return string + */ + public function get_date_time_format($user = null) + { + // BC fix - had (bool, user) signature before + if(!($user instanceof User)) { + if(func_num_args() > 1) { + $user = func_get_arg(1); + if(!($user instanceof User)) { + $user = null; + } + } else { + $user = null; + } + } + return $this->merge_date_time($this->get_date_format($user), $this->get_time_format($user)); + } - } + /** + * Make one datetime string from date string and time string + * + * @param string $date + * @param string $time + * @return string New datetime string + */ + function merge_date_time($date, $time) + { + return $date . ' ' . $time; + } - /** - * Verify if the date string conforms to a format - * - * @param string $date - * @param string $format Format to check - * @param string $toformat - * @return bool Is the date ok? - */ - public function check_matching_format($date, $format, $toformat = '') { - $regs = array(); - $startreg = $this->get_regular_expression($format); - if (!empty($toformat)) { - $otherreg = $this->get_regular_expression($toformat); - //if the other format has the same regular expression then maybe it is shifting month and day position or something similar let it go for formating - if ($startreg['format'] == $otherreg['format']) { - return false; - } - } + /** + * Split datetime string into date & time + * + * @param string $datetime + * @return array + */ + function split_date_time($datetime) + { + return explode(' ', $datetime); + } - preg_match('@'.$startreg['format'].'@', $date, $regs); - if (empty($regs)) { - return false; - } - return true; - } + function get_cal_date_format() + { + return str_replace(array_keys(self::$format_to_str), array_values(self::$format_to_str), $this->get_date_format()); + } - /** - * @deprecated for public use - * Build a true PHP format string from a user supplied format string - * - * @param string $format - * @return string - * @access private - * @see $time_token_map - */ - function build_format($format) - { - $format = str_split($format, 1); - $return = ''; - foreach ($format as $char) { - $return .= (isset($this->time_token_map[$char])) ? - $this->time_token_map[$char] : - $char; - } - return $return; - } + function get_cal_time_format() + { + return str_replace(array_keys(self::$format_to_str), array_values(self::$format_to_str), $this->get_time_format()); + } + + function get_cal_date_time_format() + { + return str_replace(array_keys(self::$format_to_str), array_values(self::$format_to_str), $this->get_date_time_format()); + } /** - * Convert date from one format to another + * Verify if the date string conforms to a format * * @param string $date - * @param string $from - * @param string $to + * @param string $format Format to check + * @param string $toformat + * @return bool Is the date ok? + */ + public function check_matching_format($date, $format) + { + try { + $dt = SugarDateTime::createFromFormat($format, $date); + if (!is_object($dt)) { + return false; + } + } catch (Exception $e) { + return false; + } + return true; + } + + /** + * Format DateTime object as DB datetime + * + * @param DateTime $date * @return string */ - function swap_formats($date, $startFormat, $endFormat) { - $startreg = $this->get_regular_expression($startFormat); - preg_match('@'.$startreg['format'].'@', $date, $regs); - $newDate = $endFormat; - //handle 12 to 24 hour conversion - if (isset($startreg['positions']['h']) && !isset($startreg['positions']['H']) && !empty($regs[$startreg['positions']['h']]) && $regs[$startreg['positions']['h']] !== '' && strpos($endFormat, 'H') > -1) { - $startreg['positions']['H'] = sizeof($startreg['positions']) + 1; - $regs[$startreg['positions']['H']] = $regs[$startreg['positions']['h']]; - if ((isset($startreg['positions']['A']) && isset($regs[$startreg['positions']['A']]) && $regs[$startreg['positions']['A']] == 'PM') || (isset($startreg['positions']['a']) && isset($regs[$startreg['positions']['a']]) && $regs[$startreg['positions']['a']] == 'pm')) { - if ($regs[$startreg['positions']['h']] != 12) { - $regs[$startreg['positions']['H']] = $regs[$startreg['positions']['h']] + 12; - } - } - if ((isset($startreg['positions']['A']) && isset($regs[$startreg['positions']['A']])&& $regs[$startreg['positions']['A']] == 'AM') || (isset($startreg['positions']['a']) && isset($regs[$startreg['positions']['a']]) && $regs[$startreg['positions']['a']] == 'am')) { - if ($regs[$startreg['positions']['h']] == 12) { - $regs[$startreg['positions']['H']] = 0; - } - } - } - if (!empty($startreg['positions']['H']) && !empty($regs[$startreg['positions']['H']]) && !isset($startreg['positions']['h']) && strpos($endFormat, 'h') > -1) { - $startreg['positions']['h'] = sizeof($startreg['positions']) + 1; - $regs[$startreg['positions']['h']] = $regs[$startreg['positions']['H']]; - if (!isset($startreg['positions']['A'])) { - $startreg['positions']['A'] = sizeof($startreg['positions']) + 1; - $regs[$startreg['positions']['A']] = 'AM'; - } - if (!isset($startreg['positions']['a'])) { - $startreg['positions']['a'] = sizeof($startreg['positions']) + 1; - $regs[$startreg['positions']['a']] = 'am'; - } - if ($regs[$startreg['positions']['H']] > 11) { - $regs[$startreg['positions']['h']] = $regs[$startreg['positions']['H']] - 12; - if ($regs[$startreg['positions']['h']] == 0) { - $regs[$startreg['positions']['h']] = 12; - } - $regs[$startreg['positions']['a']] = 'pm'; - $regs[$startreg['positions']['A']] = 'PM'; - } - if ($regs[$startreg['positions']['H']] == 0) { - $regs[$startreg['positions']['h']] = 12; - $regs[$startreg['positions']['a']] = 'am'; - $regs[$startreg['positions']['A']] = 'AM'; - } - } - if (!empty($startreg['positions']['h'])) { - if (!isset($regs[$startreg['positions']['h']])) { - $regs[$startreg['positions']['h']] = '12'; - } else if (strlen($regs[$startreg['positions']['h']]) < 2) - $regs[$startreg['positions']['h']] = '0'.$regs[$startreg['positions']['h']]; - } - if (!empty($startreg['positions']['H'])) { - // if no hour is set or it is equal to 0, set it explicitly to "00" - if (empty($regs[$startreg['positions']['H']])) { - $regs[$startreg['positions']['H']] = '00'; - } else if (strlen($regs[$startreg['positions']['H']]) < 2) - $regs[$startreg['positions']['H']] = '0'.$regs[$startreg['positions']['H']]; - } - if (!empty($startreg['positions']['d'])) { - if (!isset($regs[$startreg['positions']['d']])) { - $regs[$startreg['positions']['d']] = '01'; - } else if (strlen($regs[$startreg['positions']['d']]) < 2) - $regs[$startreg['positions']['d']] = '0'.$regs[$startreg['positions']['d']]; - } - if (!empty($startreg['positions']['i'])) { - // if no minute is set or it is equal to 0, set it explicitly to "00" - if (empty($regs[$startreg['positions']['i']])) { - $regs[$startreg['positions']['i']] = '00'; - } else if (strlen($regs[$startreg['positions']['i']]) < 2) - $regs[$startreg['positions']['i']] = '0'.$regs[$startreg['positions']['i']]; - } else { - $startreg['positions']['i'] = count($startreg['positions']) + 1; - $regs[$startreg['positions']['i']] = '00'; + public function asDb(DateTime $date) + { + $date->setTimezone(self::$gmtTimezone); + return $date->format($this->get_db_date_time_format()); + } - } - if (!empty($startreg['positions']['m'])) { - if (!isset($regs[$startreg['positions']['m']])) { - $regs[$startreg['positions']['m']] = '01'; - } elseif(strlen($regs[$startreg['positions']['m']]) < 2) - $regs[$startreg['positions']['m']] = '0'.$regs[$startreg['positions']['m']]; - } - if (!empty($startreg['positions']['Y'])) { - if (!isset($regs[$startreg['positions']['Y']])) { - $regs[$startreg['positions']['Y']] = '2000'; - } - } - if (!empty($startreg['positions']['s'])) { - if (!isset($regs[$startreg['positions']['s']])) { - $regs[$startreg['positions']['s']] = '00'; - } else if (strlen($regs[$startreg['positions']['s']]) < 2) - $regs[$startreg['positions']['s']] = '0'.$regs[$startreg['positions']['s']]; - } else { - $startreg['positions']['s'] = sizeof($startreg['positions']) + 1; - $regs[$startreg['positions']['s']] = '00'; - } - foreach($startreg['positions'] as $key=>$val) { - if (isset($regs[$val])) { - $newDate = str_replace($key, $regs[$val], $newDate); - } - } - return $newDate; + /** + * Format date as DB-formatted field type + * @param DateTime $date + * @param string $type Field type - date, time, datetime[combo] + */ + public function asDbType(DateTime $date, $type) + { + switch($type) { + case "date": + return $this->asDbDate($date); + break; + case 'time': + return $this->asDbtime($date); + break; + case 'datetime': + case 'datetimecombo': + default: + return $this->asDb($date); + } + } - } - /** - * Converts DB time string to local time string - * - * TZ conversion depends on offset parameter - * - * @param string $date Time in DB format - * @param bool $meridiem - * @param bool $offset Perform TZ conversion? - * @return string Time in user-defined format - */ - function to_display_time($date, $meridiem = true, $offset = true) { - $date = trim($date); - if (empty($date)) { - return $date; - } - if ($offset) { - $date = $this->handle_offset($date, $this->get_db_date_time_format(), true); - } - return $this->to_display($date, $this->dbTimeFormat, $this->get_time_format($meridiem)); - } + /** + * Format DateTime object as user datetime + * + * @param DateTime $date + * @return string + */ + public function asUser(DateTime $date, User $user = null) + { + $this->tzUser($date, $user); + return $date->format($this->get_date_time_format($user)); + } - /** - * Converts DB date string to local date string - * - * TZ conversion depens on offset parameter - * - * @param string $date Date in DB format - * @param bool $use_offset Perform TZ conversion? - * @return string Date in user-defined format - */ - function to_display_date($date, $use_offset = true) { - $date = trim($date); - if (empty($date)) { - return $date; - } - if ($use_offset) - $date = $this->handle_offset($date, $this->get_db_date_time_format(), true); + /** + * Format date as user-formatted field type + * @param DateTime $date + * @param string $type Field type - date, time, datetime[combo] + */ + public function asUserType(DateTime $date, $type, User $user = null) + { + switch($type) { + case "date": + return $this->asUserDate($date, true, $user); + break; + case 'time': + return $this->asUserTime($date, true, $user); + break; + case 'datetime': + case 'datetimecombo': + default: + return $this->asUser($date, $user); + } + } - return $this->to_display($date, $this->dbDayFormat, $this->get_date_format()); - } + /** + * Produce timestamp offset by user's timezone + * + * So if somebody converts it to format assuming GMT, it would actually display user's time. + * This is used by Javascript. + * + * @param DateTime $date + * @return int + */ + public function asUserTs(DateTime $date, User $user = null) + { + return $date->format('U')+$this->_getUserTZ($user)->getOffset($date); + } - /** - * Convert DB datetime to local datetime - * - * TZ conversion is controlled by $offset - * - * @param string $date Original date in DB format - * @param bool $meridiem - * @param bool $offset Perform TZ conversion? - * @param User $user User owning the conversion formats - * @return string Date in display format - */ - function to_display_date_time($date, $meridiem = true, $offset = true, $user = null) { - $date = trim($date); + /** + * Format DateTime object as DB date + * Note: by default does not convert TZ! + * @param DateTime $date + * @param boolean $tz Perform TZ conversion? + * @return string + */ + public function asDbDate(DateTime $date, $tz = false) + { + if($tz) $date->setTimezone(self::$gmtTimezone); + return $date->format($this->get_db_date_format()); + } - if (empty($date)) { - return $date; - } + /** + * Format DateTime object as user date + * Note: by default does not convert TZ! + * @param DateTime $date + * @param boolean $tz Perform TZ conversion? + * @return string + */ + public function asUserDate(DateTime $date, $tz = false, User $user = null) + { + if($tz) $this->tzUser($date, $user); + return $date->format($this->get_date_format($user)); + } - if($this->allow_cache) { - $args = array( - 'time' => $date, - 'meridiem' => $meridiem, - 'offset' => $offset, - 'user' => is_null($user)?null:$user->id, - ); - - // todo use __METHOD__ once PHP5 minimum verison is required - $cache_key = md5('TimeDate::to_display_date_time_' . serialize($args)); - $cached_value = sugar_cache_retrieve($cache_key); - if (!is_null($cached_value)) { - return $cached_value; - } - } + /** + * Format DateTime object as DB time + * + * @param DateTime $date + * @return string + */ + public function asDbTime(DateTime $date) + { + $date->setTimezone(self::$gmtTimezone); + return $date->format($this->get_db_time_format()); + } - if ($offset) { - $date = $this->handle_offset($date, $this->get_db_date_time_format(), true, $user); - } + /** + * Format DateTime object as user time + * + * @param DateTime $date + * @return string + */ + public function asUserTime(DateTime $date, User $user = null) + { + $this->tzUser($date, $user); + return $date->format($this->get_time_format($user)); + } - $return_value = $this->to_display($date, $this->get_db_date_time_format(), $this->get_date_time_format($meridiem, $user)); + /** + * Get DateTime from DB datetime string + * + * @param string $date + * @return SugarDateTime + */ + public function fromDb($date) + { + try { + return SugarDateTime::createFromFormat(self::DB_DATETIME_FORMAT, $date, self::$gmtTimezone); + } catch (Exception $e) { + $GLOBALS['log']->error("fromDb: Conversion of $date from DB format failed: {$e->getMessage()}"); + return null; + } + } - if($this->allow_cache) { - sugar_cache_put($cache_key, $return_value); - } - return $return_value; - } + /** + * Create a date from a certain type of field in DB format + * The types are: date, time, datatime[combo] + * @param string $date the datetime string + * @param string $type string type + * @return SugarDateTime + */ + public function fromDbType($date, $type) + { + switch($type) { + case "date": + return $this->fromDbDate($date); + break; + case 'time': + return $this->fromDbFormat($date, self::DB_TIME_FORMAT); + break; + case 'datetime': + case 'datetimecombo': + default: + return $this->fromDb($date); + } + } - /** - * Convert date from format to format - * - * No TZ conversion is performed! - * - * @param string $date - * @param string $fromformat Source format - * @param string $toformat Target format - * @return string Converted date - */ - function to_display($date, $fromformat, $toformat) { - $date = trim($date); - if (empty($date)) { - return $date; - } - return $this->swap_formats($date, $fromformat, $toformat); - } + /** + * Get DateTime from DB date string + * + * @param string $date + * @return SugarDateTime + */ + public function fromDbDate($date) + { + try { + return SugarDateTime::createFromFormat(self::DB_DATE_FORMAT, $date, self::$gmtTimezone); + } catch (Exception $e) { + $GLOBALS['log']->error("fromDbDate: Conversion of $date from DB format failed: {$e->getMessage()}"); + return null; + } + } - /** - * Convert date from local datetime to GMT-based DB datetime - * - * Includes TZ conversion. - * - * @param string $date - * @return string Datetime in DB format - */ - public function to_db($date) { - $date = trim($date); - if (empty($date)) { - return $date; - } - if (strlen($date) <= 10) { - $date = $this->merge_date_time($date, $this->get_default_midnight()); - } + /** + * Get DateTime from DB datetime string using non-standard format + * + * Non-standard format usually would be only date, only time, etc. + * + * @param string $date + * @param string $format format to accept + * @return SugarDateTime + */ + public function fromDbFormat($date, $format) + { + try { + return SugarDateTime::createFromFormat($format, $date, self::$gmtTimezone); + } catch (Exception $e) { + $GLOBALS['log']->error("fromDbFormat: Conversion of $date from DB format $format failed: {$e->getMessage()}"); + return null; + } + } - $date = $this->swap_formats($date, $this->get_date_time_format(), $this->get_db_date_time_format()); - return $this->handle_offset($date, $this->get_db_date_time_format(), false, $GLOBALS['current_user']); - } + /** + * Get DateTime from user datetime string + * + * @param string $date + * @return SugarDateTime + */ + public function fromUser($date, User $user = null) + { + try { + return SugarDateTime::createFromFormat($this->get_date_time_format($user), $date, $this->_getUserTZ($user)); + } catch (Exception $e) { + $uf = $this->get_date_time_format($user); + $GLOBALS['log']->error("fromUser: Conversion of $date from user format $uf failed: {$e->getMessage()}"); + return null; + } + } + + /** + * Create a date from a certain type of field in user format + * The types are: date, time, datatime[combo] + * @param string $date the datetime string + * @param string $type string type + * @param User $user + * @return SugarDateTime + */ + public function fromUserType($date, $type, $user = null) + { + switch($type) { + case "date": + return $this->fromUserDate($date, $user); + break; + case 'time': + return $this->fromUserTime($date, $user); + break; + case 'datetime': + case 'datetimecombo': + default: + return $this->fromUser($date, $user); + } + } + /** + * Get DateTime from user time string + * + * @param string $date + * @return SugarDateTime + */ + public function fromUserTime($date, User $user = null) + { + try { + return SugarDateTime::createFromFormat($this->get_time_format($user), $date, $this->_getUserTZ($user)); + } catch (Exception $e) { + $uf = $this->get_time_format($user); + $GLOBALS['log']->error("fromUserTime: Conversion of $date from user format $uf failed: {$e->getMessage()}"); + return null; + } + } - /* - * @todo This should return the raw text to be included within a "; + /** + * Convert DateTime to GMT timezone + * @param DateTime $date + * @return DateTime + */ + public function tzGMT(DateTime $date) + { + return $date->setTimezone(self::$gmtTimezone); + } - return $the_script; + /** + * Convert DateTime to user timezone + * @param DateTime $date + * @param [User] $user + * @return DateTime + */ + public function tzUser(DateTime $date, User $user = null) + { + return $date->setTimezone($this->_getUserTZ($user)); + } - } + /** + * Get string defining midnight in current user's format + * @param string $format Time format to use + * @return string + */ + protected function _get_midnight($format = null) + { + $zero = new DateTime("@0", self::$gmtTimezone); + return $zero->format($format?$format:$this->get_time_format()); + } - /** - * Convert local datetime to DB date - * - * TZ conversion depends on $use_offset. If false, only format conversion is performed. - * - * @param string $date Local date - * @param bool $use_offset Should time and TZ be taken into account? - * @return string Date in DB format - */ - public function to_db_date($date, $use_offset = true) { - $date = trim($date); - if (empty($date)) { - return $date; - } - if (!$use_offset && preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/',$date) ) { - // Already in system format + /** + * + * Basic conversion function + * + * @param string $date + * @param string $fromFormat + * @param DateTimeZone $fromTZ + * @param string $toFormat + * @param DateTimeZone $toTZ + * @param bool $expand + */ + protected function _convert($date, $fromFormat, $fromTZ, $toFormat, $toTZ, $expand = false) + { + $date = trim($date); + if (empty($date)) { return $date; } - if ($use_offset) { - $date = $this->to_db($date); - $date = $this->swap_formats($date, $this->dbDayFormat, $this->dbDayFormat); - } else { - $date = $this->swap_formats($date, $this->get_date_format(), $this->dbDayFormat); - } + try { + if ($expand && strlen($date) <= 10) { + $date = $this->expandDate($date, $fromFormat); + } + $phpdate = SugarDateTime::createFromFormat($fromFormat, $date, $fromTZ); + if ($phpdate == false) { + // var_dump($date, $phpdate, $fromFormat, DateTime::getLastErrors() ); + $GLOBALS['log']->error("convert: Conversion of $date from $fromFormat to $toFormat failed"); + return ''; + } + if ($fromTZ !== $toTZ) { + $phpdate->setTimeZone($toTZ); + } + return $phpdate->format($toFormat); + } catch (Exception $e) { + // var_dump($date, $phpdate, $fromFormat, $fromTZ, DateTime::getLastErrors() ); + $GLOBALS['log']->error("Conversion of $date from $fromFormat to $toFormat failed: {$e->getMessage()}"); + return ''; + } + } - return $date; - } + /** + * Convert DB datetime to local datetime + * + * TZ conversion is controlled by parameter + * + * @param string $date Original date in DB format + * @param bool $meridiem Ignored for BC + * @param bool $convert_tz Perform TZ conversion? + * @param User $user User owning the conversion formats + * @return string Date in display format + */ + function to_display_date_time($date, $meridiem = true, $convert_tz = true, $user = null) + { + return $this->_convert($date, + self::DB_DATETIME_FORMAT, self::$gmtTimezone, $this->get_date_time_format($user), + $convert_tz ? $this->_getUserTZ($user) : self::$gmtTimezone, true); + } - /** - * Convert local datetime to DB time - * - * TZ conversion depends on $use_offset. If false, only format conversion is performed. - * - * @param string $date Local date - * @param bool $use_offset Should time and TZ be taken into account? - * @return string Time in DB format - */ - public function to_db_time($date, $use_offset = true) { - $date = trim($date); - if (empty($date)) { - return $date; - } - if ($use_offset){ - $date =$this->to_db($date, $use_offset); - $date = $this->swap_formats($date, $this->get_db_date_time_format(), $this->dbTimeFormat); - }else{ - $date = $this->swap_formats($date, $this->get_time_format(), $this->dbTimeFormat); - } - return $date; + /** + * Converts DB time string to local time string + * + * TZ conversion depends on parameter + * + * @param string $date Time in DB format + * @param bool $meridiem + * @param bool $convert_tz Perform TZ conversion? + * @return string Time in user-defined format + */ + public function to_display_time($date, $meridiem = true, $convert_tz = true) + { + if($convert_tz && strpos($date, ' ') === false) { + // we need TZ adjustment but have no date, assume today + $date = $this->expandTime($date, self::DB_DATETIME_FORMAT, self::$gmtTimezone); + } + return $this->_convert($date, + $convert_tz ? self::DB_DATETIME_FORMAT : self::DB_TIME_FORMAT, self::$gmtTimezone, + $this->get_time_format(), $convert_tz ? $this->_getUserTZ() : self::$gmtTimezone); + } + /** + * Splits time in given format into components + * + * Components: h, m, s, a (am/pm) if format requires it + * If format has am/pm, hour is 12-based, otherwise 24-based + * + * @param string $date + * @param string $format + * @return array + */ + public function splitTime($date, $format) + { + if (! ($date instanceof DateTime)) { + $date = SugarDateTime::createFromFormat($format, $date); + } + $ampm = strpbrk($format, 'aA'); + $datearr = array( + "h" => ($ampm == false) ? $date->format("H") : $date->format("h"), + 'm' => $date->format("i"), + 's' => $date->format("s") + ); + if ($ampm) { + $datearr['a'] = ($ampm{0} == 'a') ? $date->format("a") : $date->format("A"); + } + return $datearr; + } - } + /** + * Converts DB date string to local date string + * + * TZ conversion depens on parameter + * + * @param string $date Date in DB format + * @param bool $convert_tz Perform TZ conversion? + * @return string Date in user-defined format + */ + public function to_display_date($date, $convert_tz = true) + { + return $this->_convert($date, + self::DB_DATETIME_FORMAT, self::$gmtTimezone, + $this->get_date_format(), $convert_tz ? $this->_getUserTZ() : self::$gmtTimezone, true); + } - /** - * Takes a Date & Time value in local format and converts them to DB format - * No TZ conversion! - * - * @param string $date - * @param string $time - * @return array Date & time in DB format - **/ - public function to_db_date_time($date, $time) { - global $current_user; - if(is_object($current_user)) { - $timeFormat = $current_user->getUserDateTimePreferences(); - } else { - $timeFormat['date'] = $this->dbDayFormat; - $timeFormat['time'] = $this->dbTimeFormat; - } - $dt = ''; - $newDate = ''; - $retDateTime = array(); - - // concat: ('.' breaks strtotime()) - $time = str_replace('.',':',$time); - $dt = $date.' '.$time; - if ( preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/',$dt) ) { - // Already in system time format - return array($date, $time); + /** + * Convert date from format to format + * + * No TZ conversion is performed! + * + * @param string $date + * @param string $fromformat Source format + * @param string $toformat Target format + * @return string Converted date + */ + function to_display($date, $from, $to) + { + return $this->_convert($date, $from, self::$gmtTimezone, $to, self::$gmtTimezone); + } + + /** + * Get DB datetime format + * @return string + */ + public function get_db_date_time_format() + { + return self::DB_DATETIME_FORMAT; + } + + /** + * Get DB date format + * @return string + */ + public function get_db_date_format() + { + return self::DB_DATE_FORMAT; + } + + /** + * Get DB time format + * @return string + */ + public function get_db_time_format() + { + return self::DB_TIME_FORMAT; + } + + /** + * Convert date from local datetime to GMT-based DB datetime + * + * Includes TZ conversion. + * + * @param string $date + * @return string Datetime in DB format + */ + public function to_db($date) + { + return $this->_convert($date, + $this->get_date_time_format(), $this->_getUserTZ(), + $this->get_db_date_time_format(), self::$gmtTimezone, + true); + } + + /** + * Convert local datetime to DB date + * + * TZ conversion depends on parameter. If false, only format conversion is performed. + * + * @param string $date Local date + * @param bool $convert_tz Should time and TZ be taken into account? + * @return string Date in DB format + */ + public function to_db_date($date, $convert_tz = true) + { + return $this->_convert($date, + $this->get_date_time_format(), $convert_tz ? $this->_getUserTZ() : self::$gmtTimezone, + self::DB_DATE_FORMAT, self::$gmtTimezone, true); + } + + /** + * Convert local datetime to DB time + * + * TZ conversion depends on parameter. If false, only format conversion is performed. + * + * @param string $date Local date + * @param bool $convert_tz Should time and TZ be taken into account? + * @return string Time in DB format + */ + public function to_db_time($date, $convert_tz = true) + { + $format = $this->get_date_time_format(); + $tz = $convert_tz ? $this->_getUserTZ() : self::$gmtTimezone; + if($convert_tz && strpos($date, ' ') === false) { + // we need TZ adjustment but have short string, expand it to full one + // FIXME: if the string is short, should we assume date or time? + $date = $this->expandTime($date, $format, $tz); } - $newDate = $this->swap_formats($dt, $timeFormat['date'].' '.$timeFormat['time'] , $this->dbDateTimeFormat); - return $this->split_date_time($newDate); - } + return $this->_convert($date, + $convert_tz ? $format : $this->get_time_format(), + $tz, + self::DB_TIME_FORMAT, self::$gmtTimezone); + } - /** - * @deprecated for public use - * Get DST offset between user & event - * @param $user_in_dst - * @param $event_in_dst - */ - function getUserEventOffset($user_in_dst, $event_in_dst){ - if($user_in_dst && !$event_in_dst ){ - return -3600; - } - if(!$user_in_dst && $event_in_dst ){ - return 3600; - } - return 0; - } + /** + * Takes a Date & Time value in local format and converts them to DB format + * No TZ conversion! + * + * @param string $date + * @param string $time + * @return array Date & time in DB format + **/ + public function to_db_date_time($date, $time) + { + try { + $phpdate = SugarDateTime::createFromFormat($this->get_date_time_format(), + $this->merge_date_time($date, $time), self::$gmtTimezone); + if ($phpdate == false) { + return array('', ''); + } + return array($this->asDbDate($phpdate), $this->asDbTime($phpdate)); + } catch (Exception $e) { + $GLOBALS['log']->error("Conversion of $date,$time failed"); + return array('', ''); + } + } -/************************************************************** -U S E Time GMT Delta Server Client U/E Delta Server GMT -USER IN LA and server in NY -D D D 12 19 -3 0 -4 -D D S 12 20 -3 -1 -4 -D S D 12 19 -2 0 -5 -D S S 12 20 -2 -1 -5 -S D D 12 19 -4 1 -4 -S D S 12 20 -4 0 -4 -S S D 12 19 -3 1 -5 -S S S 12 20 -3 0 -5 + /** + * Return current time in DB format + * @return string + */ + public function nowDb() + { + if(!$this->allow_cache) { + $nowGMT = $this->getNow(); + } else { + $nowGMT = $this->now; + } + return $this->asDb($nowGMT); + } + /** + * Return current date in DB format + * @return string + */ + public function nowDbDate() + { + if(!$this->allow_cache) { + $nowGMT = $this->getNow(); + } else { + $nowGMT = $this->now; + } + return $this->asDbDate($nowGMT, true); + } -User in LA and server in gmt there are no DST for server -D S D 12 19 -7 0 0 -D S S 12 20 -7 -1 0 + /** + * Get 'now' DateTime object + * @param bool $userTz return in user timezone? + * @return SugarDateTime + */ + public function getNow($userTz = false) + { + if(!$this->allow_cache) { + return new SugarDateTime("now", $userTz?$this->_getUserTz():self::$gmtTimezone); + } + // TODO: should we return clone? + $now = clone $this->now; + if($userTz) { + return $this->tzUser($now); + } + return $now; + } -S S D 12 19 -8 1 0 -S S S 12 20 -8 0 0 + /** + * Set 'now' time + * For testability - predictable time value + * @param DateTime $now + */ + public function setNow($now) + { + $this->now = $now; + return $this; + } -***************************************************************/ + /** + * Return current datetime in local format + * @return string + */ + public function now() + { + return $this->asUser($this->getNow()); + } - /** - * handles offset values for Timezones and DST - * @param $date string date/time formatted in user's selected format - * @param $format string destination format value as passed to PHP's date() funtion - * @param $to boolean - * @param $user object user object from which Timezone and DST - * @param $usetimezone string timezone name as it appears in timezones.php values will be derived - * @return string date formatted and adjusted for TZ and DST - */ - function handle_offset($date, $format, $to = true, $user = null, $usetimezone = null) { - global $sugar_config; - $date = trim($date); - // Samir Gandhi - // This has been commented out because it is going through the wrong code path - // Email module was broken and thats why its commented - //if($this->use_old_gmt()){ - //return $this->handle_offset_depricated($date, $format, $to); - //} - if (empty($date)) { - return $date; - } - if($this->allow_cache) { - $args = array( - 'date' => $date, - 'format' => $format, - 'to' => $to, - 'user' => is_null($user)?null:$user->id, - 'usetimezone' => $usetimezone, - ); - $cache_key = md5('TimeDate::handle_offset_' . serialize($args)); - $cached_result = sugar_cache_retrieve($cache_key); - if (!is_null($cached_result)) { - return $cached_result; - } - } - if (strtotime($date) == -1) { - return $date; - } - $deltaServerGMT = date('Z'); + /** + * Return current date in User format + * @return string + */ + public function nowDate() + { + return $this->asUserDate($this->getNow()); + } + + /** + * Get user format's time separator + * @return string + */ + public function timeSeparator() + { + if (empty($this->time_separator)) { + $this->time_separator = $this->timeSeparatorFormat($this->get_time_format()); + } + return $this->time_separator; + } + + /** + * Find out format's time separator + * @param string $timeformat Time format + */ + public function timeSeparatorFormat($timeformat) + { + $date = $this->_convert("00:11:22", self::DB_TIME_FORMAT, null, $timeformat, null); + if (preg_match('/\d+(.+?)11/', $date, $matches)) { + $sep = $matches[1]; + } else { + $sep = ':'; + } + return $sep; + } + + /** + * Returns start and end of a certain local date in GMT + * Example: for May 19 in PDT start would be 2010-05-19 07:00:00, end would be 2010-05-20 06:59:59 + * @param string|DateTime $date Date in any suitable format + * @return array Start & end date in start, startdate, starttime, end, enddate, endtime + */ + public function getDayStartEndGMT($date, User $user = null) + { + if ($date instanceof DateTime) { + $min = clone $date; + $min->setTimezone($this->_getUserTZ($user)); + $max = clone $date; + $max->setTimezone($this->_getUserTZ($user)); + } else { + $min = new DateTime($date, $this->_getUserTZ($user)); + $max = new DateTime($date, $this->_getUserTZ($user)); + } + $min->setTime(0, 0); + $max->setTime(23, 59, 59); + + $min->setTimezone(self::$gmtTimezone); + $max->setTimezone(self::$gmtTimezone); + + $result['start'] = $this->asDb($min); + $result['startdate'] = $this->asDbDate($min); + $result['starttime'] = $this->asDbTime($min); + $result['end'] = $this->asDb($max); + $result['enddate'] = $this->asDbDate($max); + $result['endtime'] = $this->asDbtime($max); - if ( !empty($usetimezone) ) - $timezone = $GLOBALS['timezones'][$usetimezone]; - else - $timezone = $this->getUserTimeZone($user); - $deltaServerUser = $this->get_hour_offset($to, $timezone); - $event_in_ds = $this->inDST($date,$timezone ); - $user_in_ds = $this->inDST(date('Y-m-d H:i:s'),$timezone ); - $server_in_ds = date('I'); - $ue = $this->getUserEventOffset($user_in_ds, $event_in_ds); - $zone = 1; - if (!$to) { - $zone = -1; - } - $result = date($format, strtotime($date) + $deltaServerUser * 3600 + ($ue + $deltaServerGMT) * $zone); - if($this->allow_cache) { - sugar_cache_put($cache_key, $result); - } - return $result; - } + return $result; + } - /** - * @deprecated for public use + /** + * Expand date format by adding midnight to it + * Note: date is assumed to be in target format already + * @param string $date + * @param string $format Target format + * @return string + */ + public function expandDate($date, $format) + { + $formats = $this->split_date_time($format); + if(isset($formats[1])) { + return $this->merge_date_time($date, $this->_get_midnight($formats[1])); + } + return $date; + } + + /** + * Expand time format by adding today to it + * Note: time is assumed to be in target format already + * @param string $date + * @param string $format Target format + * @param DateTimeZone $tz + */ + public function expandTime($date, $format, $tz) + { + $formats = $this->split_date_time($format); + if(isset($formats[1])) { + $now = clone $this->getNow(); + $now->setTimezone($tz); + return $this->merge_date_time($now->format($formats[0]), $date); + } + return $date; + } + + /** + * Get midnight (start of the day) in local time format + * + * @return Time string */ - function use_old_gmt() + function get_default_midnight() { - if(isset($_SESSION['GMTO'])){ - return $_SESSION['GMTO']; - } - $db = DBManagerFactory::getInstance(); - $fix_name = 'DST Fix'; - $result =$db->query("Select * from versions where name='$fix_name'"); - $valid = $db->fetchByAssoc($result); - if($valid){ - $_SESSION['GMTO'] = false; - }else{ - $_SESSION['GMTO'] = true; - } - return $_SESSION['GMTO']; + return $this->_get_midnight($this->get_time_format()); } /** - * @deprecated for public use - *This function is depricated don't use it. It is only for backwards compatibility until the admin runs the upgrade script - * - * @param unknown_type $date - * @param unknown_type $format - * @param unknown_type $to - * @return unknown + * Get the name of the timezone for the user + * @param User $user User, default - current user + * @return string */ - private function handle_offset_depricated($date, $format, $to = true) + public static function userTimezone(User $user = null) { - $date = trim($date); - if (empty($date)) { - return $date; - } - if (strtotime($date) == -1) { - return $date; - } - $zone = date('Z'); - if (!$to) { - $zone *= -1; - } - return date($format, strtotime($date) + $this->get_hour_offset($to) * 60 * 60 + $zone); + $user = self::getInstance()->_getUser($user); + if(empty($user)) { + return ''; + } + $tz = self::getInstance()->_getUserTZ($user); + if($tz) { + return $tz->getName(); + } + return ''; } /** - * this method will take an input $date variable (expecting Y-m-d format) - * and get the GMT equivalent - with an hour-level granularity : - * return the max value of a given locale's - * date+time in GMT metrics (i.e., if in PDT, "2005-01-01 23:59:59" would be - * "2005-01-02 06:59:59" in GMT metrics) + * Guess the timezone for the current user + * @return string */ - function handleOffsetMax($date, $format = '', $to = true) + public static function guessTimezone($userOffset = 0) { - global $current_user; - $gmtDateTime = array($date); // for errors - /* check for bad date formatting */ - $date = trim($date); - - if (empty($date)) { - return $gmtDateTime; - } - - if (strtotime($date) == -1) { - return $gmtDateTime; - } - - /* cn: passed $date var will be a "MAX" value, which we need to return - as a GMT date/time pair to provide for hour-level granularity */ - /* this ridiculousness b/c PHP returns current time when passing "today" - or "tomorrow" as strtotime() args */ - $dateNoTime = date('Y-m-d', strtotime($date)); - - /* handle timezone and daylight savings */ - $dateWithTimeMin = $dateNoTime.' 00:00:00'; - $dateWithTimeMax = $dateNoTime.' 23:59:59'; - - $offsetDateMin = $this->handle_offset($dateWithTimeMin, $this->dbDateTimeFormat, false); - $offsetDateMax = $this->handle_offset($dateWithTimeMax, $this->dbDateTimeFormat, false); - - - $exOffsetDateMax = $this->split_date_time($offsetDateMax); - $gmtDateTime['date'] = $exOffsetDateMax[0]; - $gmtDateTime['time'] = $exOffsetDateMax[1]; - $gmtDateTime['min'] = $offsetDateMin; - $gmtDateTime['max'] = $offsetDateMax; - - return $gmtDateTime; + if(!is_numeric($userOffset)) { + return ''; + } + $defaultZones= array( + 'America/Anchorage', 'America/Los_Angeles', 'America/Phoenix', 'America/Chicago', + 'America/New_York', 'America/Argentina/Buenos_Aires', 'America/Montevideo', + 'Europe/London', 'Europe/Amsterdam', 'Europe/Athens', 'Europe/Moscow', + 'Asia/Tbilisi', 'Asia/Omsk', 'Asia/Jakarta', 'Asia/Hong_Kong', + 'Asia/Tokyo', 'Pacific/Guam', 'Australia/Sydney', 'Australia/Perth', + ); + + $now = new DateTime(); + $tzlist = timezone_identifiers_list(); + if($userOffset == 0) { + $gmtOffset = date('Z'); + $nowtz = date('e'); + if(in_array($nowtz, $tzlist)) { + array_unshift($defaultZones, $nowtz); + } else { + $nowtz = timezone_name_from_abbr(date('T'), $gmtOffset, date('I')); + if(in_array($nowtz, $tzlist)) { + array_unshift($defaultZones, $nowtz); + } + } + } else { + $gmtOffset = $userOffset * 60; + } + foreach($defaultZones as $zoneName) { + $tz = new DateTimeZone($zoneName); + if($tz->getOffset($now) == $gmtOffset) { + return $tz->getName(); + } + } + // try all zones + foreach($tzlist as $zoneName) { + $tz = new DateTimeZone($zoneName); + if($tz->getOffset($now) == $gmtOffset) { + return $tz->getName(); + } + } + return null; } - /** - * Get current GMT datetime in DB format + * Get the description of the user timezone for specific date + * Like: PST(+08:00) + * We need the date because it can be DST or non-DST + * Note it's different from TZ name in tzName() that relates to current date + * @param User $user User, default - current user * @return string */ - function get_gmt_db_datetime() { - return gmdate($this->get_db_date_time_format()); + public static function userTimezoneSuffix(DateTime $date, User $user = null) + { + $user = self::getInstance()->_getUser($user); + if(empty($user)) { + return ''; + } + self::getInstance()->tzUser($date, $user); + return $date->format('T(P)'); } /** - * Get current GMT date in DB format + * Get display name for a certain timezone + * Note: it uses current date for GMT offset, so it may be not suitable for displaying generic dates + * @param string|DateTimeZone $name TZ name * @return string */ - function get_gmt_db_date() { - return gmdate($this->get_db_date_format()); + public static function tzName($name) + { + if(empty($name)) { + return ''; + } + if($name instanceof DateTimeZone) { + $tz = $name; + } else { + $tz = timezone_open($name); + } + if(!$tz) { + return "???"; + } + $now = new DateTime("now", $tz); + $off = $now->getOffset(); + $translated = translate('timezone_dom','',$name); + if(is_string($translated) && !empty($translated)) { + $name = $translated; + } + return sprintf("%s (GMT%+2d:%02d)%s", str_replace('_',' ', $name), $off/3600, (abs($off)/60)%60, "");//$now->format('I')==1?"(+DST)":""); } - /* - * @deprecated for public use - * Convert time in strtotime format into Y-m-d H:i:s format - */ - function convert_to_gmt_datetime($olddatetime) { - if (!empty($olddatetime)) { - return date('Y-m-d H:i:s', strtotime($olddatetime) - date('Z')); - } + + public static function _sortTz($a, $b) + { + if($a[0] == $b[0]) { + return strcmp($a[1], $b[1]); + } else { + return $a[0]<$b[0]?-1:1; + } } /** - * makes one datetime string from date string and time string - * - * @param string $date - * @param string $time - * @return string Datetime string + * Get list of all timezones in the system + * @return array */ - function merge_date_time($date, $time) { - return $date.' '.$time; + public static function getTimezoneList() + { + $now = new DateTime(); + $res_zones = $zones = array(); + foreach(timezone_identifiers_list() as $zoneName) { + $tz = new DateTimeZone($zoneName); + $zones[$zoneName] = array($tz->getOffset($now), self::tzName($zoneName)); + } + uasort($zones, array('TimeDate', '_sortTz')); + foreach($zones as $name => $zonedef) { + $res_zones[$name] = $zonedef[1]; + } + return $res_zones; } /** - * Merge time without am/pm with am/pm string - * - * @param string $date - * @param string $format User time format - * @param string $mer + * Print timestamp in RFC2616 format: * @return string */ - function merge_time_meridiem($date, $format, $mer) { - $date = trim($date); - if (empty($date)) { - return $date; - } - $fakeMerFormat = str_replace(array('a', 'A'), array('!@!', '!@!'), $format); - $noMerFormat = str_replace(array('a', 'A'), array('', ''), $format); - $newDate = $this->swap_formats($date, $noMerFormat, $fakeMerFormat); - return str_replace('!@!', $mer, $newDate); + public static function httpTime($ts = null) + { + if($ts === null) { + $ts = time(); + } + return gmdate(self::RFC2616_FORMAT, $ts); } - + /** - * Returns the time portion of a datetime string - * - * @param string $datetime - * @return string + * Create datetime object from calendar array + * @param array $time + * @return SugarDateTime */ - public function getTimePart($datetime) + public function fromTimeArray($time) { - return trim(array_pop($this->split_date_time($datetime))); + if (! isset( $time) || count($time) == 0 ) + { + return $this->nowDb(); + } + elseif ( isset( $time['ts'])) + { + return $this->fromTimestamp($time['ts']); + } + elseif ( isset( $time['date_str'])) + { + return $this->fromDb($time['date_str']); + } + else + { + $hour = 0; + $min = 0; + $sec = 0; + $now = $this->getNow(true); + $day = $now->day; + $month = $now->month; + $year = $now->year; + if (isset($time['sec'])) + { + $sec = $time['sec']; + } + if (isset($time['min'])) + { + $min = $time['min']; + } + if (isset($time['hour'])) + { + $hour = $time['hour']; + } + if (isset($time['day'])) + { + $day = $time['day']; + } + if (isset($time['month'])) + { + $month = $time['month']; + } + if (isset($time['year']) && $time['year'] >= 1970) + { + $year = $time['year']; + } + return $now->setDate($year, $month, $day)->setTime($hour, $min, $sec)->setTimeZone(self::$gmtTimezone); + } + return null; } - + /** * Returns the date portion of a datetime string * @@ -1014,266 +1432,389 @@ S S S 12 20 -8 0 0 */ public function getDatePart($datetime) { - return trim(array_shift($this->split_date_time($datetime))); + list($date, $time) = $this->split_date_time($datetime); + return $date; } /** - * @deprecated for public use - * AMPMMenu - * This method renders a "; - - if (strpos($this->get_time_format(), 'a') > -1) { - - if (substr_count($date, 'am') > 0) - $menu.= "